/*
 * @Author: Gui
 * @Date: 2023-03-01 19:20:44
 * @LastEditors: guicheng 1625811865@qq.com
 * @LastEditTime: 2024-04-18 17:59:27
 * @Description: kxs files
 * @filePath:
 */
import { http } from "@/utils/http";
import { dataResult } from "./apiResult";
import { getGroupUrl } from "@/utils/getUrl/getUrl.js";
const UrlList = await getGroupUrl();

// <*------用户板块--------*>
/** 获取用户管理列表 */
export const getUserList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.userpage.url,
    method: UrlList.kxsSys.userpage.method,
    params
  });
};
/** 修改用户密码 */
export const changeUserPassword = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.userpassword.url,
    method: UrlList.kxsSys.userpassword.method,
    params
  });
};
/** 锁定用户 */
export const lockUserList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.userlock.url,
    method: UrlList.kxsSys.userlock.method,
    params
  });
};
/** 删除用户 */
export const deleteUserList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.userremoveById.url,
    method: UrlList.kxsSys.userremoveById.method,
    params
  });
};
/** 新增用户 */
export const AddUserList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.useradd.url,
    method: UrlList.kxsSys.useradd.method,
    params
  });
};
/** 编辑用户 */
export const editUserList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.userupdate.url,
    method: UrlList.kxsSys.userupdate.method,
    params
  });
};

// <*------角色板块--------*>

/** 获取全部角色管理列表 */
export const getAllRoleList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.rolelist.url,
    method: UrlList.kxsSys.rolelist.method,
    params
  });
};
/** 获取角色管理列表 */
export const getRoleList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.rolepage.url,
    method: UrlList.kxsSys.rolepage.method,
    params
  });
};
/** 获取当前角色权限列表 */
export const getRoleRightList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.menugetRoleTree.url,
    method: UrlList.kxsSys.menugetRoleTree.method,
    params
  });
};
/** 添加系统角色 */
export const postRoleList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.roleadd.url,
    method: UrlList.kxsSys.roleadd.method,
    params
  });
};
/** 编辑系统角色 */
export const putRoleList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.roleupdate.url,
    method: UrlList.kxsSys.roleupdate.method,
    params
  });
};
/** 删除系统角色 */
export const deleteRoleList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.roleremoveById.url,
    method: UrlList.kxsSys.roleremoveById.method,
    params
  });
};
/** 获取所有角色权限列表 */
export const getRoleTreeList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.menugetRoleTree.url,
    method: UrlList.kxsSys.menugetRoleTree.method,
    params
  });
};

// <*------菜单板块--------*>

/** 获取菜单列表 */
export const getMenuList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.menutree.url,
    method: UrlList.kxsSys.menutree.method,
    params
  });
};
/** 获取菜单列表 */
export const putRoleMenuList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.rolemenu.url,
    method: UrlList.kxsSys.rolemenu.method,
    params
  });
};
/** 添加菜单 */
export const postMenuList = (params?: object): dataResult => {
  console.log(params);
  return http.Request({
    url: UrlList.kxsSys.menuadd.url,
    method: UrlList.kxsSys.menuadd.method,
    params
  });
};
/** 编辑菜单 */
export const putMenuList = (params?: object): dataResult => {
  console.log(params);
  return http.Request({
    url: UrlList.kxsSys.menuupdate.url,
    method: UrlList.kxsSys.menuupdate.method,
    params
  });
};
/** 删除菜单 */
export const deleteMenuList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.menuremoveById.url,
    method: UrlList.kxsSys.menuremoveById.method,
    params
  });
};

// <*------部门板块--------*>

/** 获取全部部门列表 */
export const getAllDeptList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.deptlist.url,
    method: UrlList.kxsSys.deptlist.method,
    params
  });
};
/** 获取部门列表 */
export const getDeptList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.depttree.url,
    method: UrlList.kxsSys.depttree.method,
    params
  });
};
/** 删除部门列表 */
export const deleteDeptList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.deptremoveById.url,
    method: UrlList.kxsSys.deptremoveById.method,
    params
  });
};
/** 编辑部门 */
export const putDeptList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.deptupdate.url,
    method: UrlList.kxsSys.deptupdate.method,
    params
  });
};
/** 添加部门 */
export const postDeptList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.deptadd.url,
    method: UrlList.kxsSys.deptadd.method,
    params
  });
};
// <*------岗位板块--------*>

/** 获取全部列表 */
export const getAllPostList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.postlist.url,
    method: UrlList.kxsSys.postlist.method,
    params
  });
};
/** 获取分页岗位列表 */
export const getPostList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.postpage.url,
    method: UrlList.kxsSys.postpage.method,
    params
  });
};
/** 删除岗位列表 */
export const deletePostList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.postremoveById.url,
    method: UrlList.kxsSys.postremoveById.method,
    params
  });
};
/** 编辑岗位 */
export const putPostList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.postupdate.url,
    method: UrlList.kxsSys.postupdate.method,
    params
  });
};
/** 添加岗位 */
export const postPostList = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.postadd.url,
    method: UrlList.kxsSys.postadd.method,
    params
  });
};
// <*------公共参数--------*>

/** 修改公共参数 */
export const paramUpdate = (params?: object): dataResult => {
  return http.Request({
    url: UrlList.kxsSys.paramupdate.url,
    method: UrlList.kxsSys.paramupdate.method,
    params
  });
};
