import request from "@/utils/request";
const api = "/mosty-api/mosty-base";
/*
 * 登录
 *  return promise 实例对象
 */
export const login = (data) => {
  return request({
    url: api + "/sys/login",
    method: "POST",
    data
  });
};

/*
 * 获取所有角色
 *
 */
export const getRoleList = (params) => {
  return request({
    url: api + "/sysRole/selectPage",
    method: "GET",
    params
  });
};

/*
 * 新增角色
 */
export const addSysRole = (data) => {
  return request({
    url: api + "/sysRole/addSysRole",
    method: "POST",
    data
  });
};

/*
 * 修改角色信息
 */
export const updateSysRole = (data) => {
  return request({
    url: api + "/sysRole/updateSysRole",
    method: "POST",
    data
  });
};

/*
 *
删除角色信息
 */
export const deleteSysRole = (data) => {
  return request({
    url: api + "/sysRole/deleteSysRole",
    method: "POST",
    data
  });
};

/*
 *
删除用户
 */
export const deleteSysUser = (data) => {
  return request({
    url: api + "/sysUser/deleteSysUser",
    method: "POST",
    data
  });
};

/*
 *
分页查询岗位信息
 *
 */
export const selectJobPage = (params) => {
  return request({
    url: api + "/sysPosition/selectPage",
    method: "GET",
    params
  });
};

/*
 * 修改岗位
 */
export const updateSysPosition = (data) => {
  return request({
    url: api + "/sysPosition/updateSysPosition",
    method: "POST",
    data
  });
};

/*
 * 修改岗位
 */
export const addSysPosition = (data) => {
  return request({
    url: api + "/sysPosition/addSysPosition",
    method: "POST",
    data
  });
};

/*
 *
删除角色信息
 */
export const deleteSysPosition = (data) => {
  return request({
    url: api + "/sysPosition/deleteSysPosition",
    method: "POST",
    data
  });
};

/*
 *分页查询菜单信息
 *
 */
export const getSystemMeny = (params) => {
  return request({
    url: api + "/sysMenu/selectPage",
    method: "GET",
    params
  });
};

/*
 *添加菜单
 *
 */
export const addSysMenu = (data) => {
  return request({
    url: api + "/sysMenu/addSysMenu",
    method: "POST",
    data
  });
};
/*
 *编辑菜单
 *
 */
export const updateSysMenu = (data) => {
  return request({
    url: api + "/sysMenu/updateSysMenu",
    method: "POST",
    data
  });
};
/*
 *删除菜单
 *
 */
export const deleteSysMenu = (data) => {
  return request({
    url: api + "/sysMenu/deleteSysMenu",
    method: "POST",
    data
  });
};

/*
 *分页查询菜单信息
 *
 */
export const getSysConfigList = (params) => {
  return request({
    url: api + "/sys-config/selectPage",
    method: "GET",
    params
  });
};

/*
 *
添加系统配置
 *
 */
export const addSysConfig = (data) => {
  return request({
    url: api + "/sys-config/addSysConfig",
    method: "POST",
    data
  });
};
/*
 *
删除系统配置信息
 *
 */
export const deleteSysConfig = (data) => {
  return request({
    url: api + "/sys-config/deleteSysConfig",
    method: "POST",
    data
  });
};
/*
 *
修改系统配置信息
 *
 */
export const updateSysConfig = (data) => {
  return request({
    url: api + "/sys-config/updateSysConfig",
    method: "POST",
    data
  });
};

/* 部门 */

/*
 *
  添加部门
 *
 */
export const addSysDept = (data) => {
  return request({
    url: api + "/sysDept/addSysDept",
    method: "POST",
    data
  });
};
/*
 *
  删除部门
 *
 */
export const deleteSysDept = (data) => {
  return request({
    url: api + "/sysDept/deleteSysDept",
    method: "POST",
    data
  });
};

/*
 *
  修改部门
 *
 */
export const updateSysDept = (data) => {
  return request({
    url: api + "/sysDept/updateSysDept",
    method: "POST",
    data
  });
};

/*
 *
  分页查询部门信息
 *
 */
export const selectDeptPage = (params) => {
  return request({
    // url: api + "/sysDept/selectPage",
    url: api + "/sysDept/selectDept",
    method: "GET",
    params
  });
};

export const selectDeptPageKh = (params) => {
  return request({
    url: api + "/sysDept/selectPage",
    method: "GET",
    params
  });
};
/* 部门 end*/

/* 部门 */

/*
 *
添加系统版本管理
 *
 */
export const addVersionManage = (data) => {
  return request({
    url: api + "/sys-version-manage/addVersionManage",
    method: "POST",
    data
  });
};
/*
   *
    删除系统版本管理信息
   *
   */
export const deleteVersionManage = (params) => {
  return request({
    url: api + "/sys-version-manage/deleteVersionManage",
    method: "GET",
    params
  });
};

/*
   *

修改系统版本管理
   *
   */
export const updateVersionManage = (data) => {
  return request({
    url: api + "/sys-version-manage/updateVersionManage",
    method: "POST",
    data
  });
};

/*  系统版本管理*/
export const getSysVersionList = (params) => {
  return request({
    url: api + "/sys-version-manage/selectPage",
    method: "GET",
    params
  });
};

/* 部门 end*/

/*操作日志 */
export const getOperlogList = (data) => {
  return request({
    url: api + "/monitor/operlog/list",
    method: "POST",
    data
  });
};

/*删除日志 */
export const operlogRemove = (data) => {
  return request({
    url: api + "/monitor/operlog/remove",
    method: "POST",
    data
  });
};
/*clean日志 */
export const operlogClean = (data) => {
  return request({
    url: api + "/monitor/operlog/clean",
    method: "POST",
    data
  });
};

//详情
export const operlogDetail = (id) => {
  return request({
    url: api + `/monitor/operlog/detail/${id}`,
    method: "GET"
  });
};

/*日志 end*/

/*登录日志 */
export const getSysLoginLogList = (data) => {
  return request({
    url: api + "/sysLoginLog/list",
    method: "POST",
    data
  });
};

/*删除日志 */
export const sysLogRemove = (data) => {
  return request({
    url: api + "/sysLoginLog/remove",
    method: "POST",
    data
  });
};
/*clean日志 */
export const LoginlogClean = (data) => {
  return request({
    url: api + "/sysLoginLog/clean",
    method: "POST",
    data
  });
};

//详情
export const sysLoginogDetail = (id) => {
  return request({
    url: api + `/sysLoginLog/detail/${id}`,
    method: "POST"
  });
};

/*登录日志 end*/

/*用户模块*/
/*分页查询用户信息 */
export const getSysUserList = (params) => {
  return request({
    url: api + "/sysUser/selectPage",
    method: "GET",
    params
  });
};

/*编辑用户信息 */
export const editSysUser = (data) => {
  return request({
    url: api + "/sysUser/editSysUser",
    method: "POST",
    data
  });
};

/*添加用户信息 */
export const addUser = (data) => {
  return request({
    url: api + "/sysUser/addUser",
    method: "POST",
    data
  });
};

/*编辑密码 */
export const editPassword = (data) => {
  return request({
    url: api + "/sysUser/editPassword",
    method: "POST",
    data
  });
};

/*根据id查询用户信息 */
export const getUserInfoToId = (id) => {
  return request({
    url: api + `/sysUser/getUserInfo/${id}`,
    method: "GET"
  });
};
// 新增用户信息用于民辅警
export const getUserOrFjInfo = (params) => {
  return request({
    url: api + `/sysUser/getUserOrFjInfo`,
    method: "GET",
    params
  });
};
/*用户模块end*/

// 查询所有子部门树

export const getAllChildDeptList = (data) => {
  return request({
    url: api + `/sysDept/getAllChildDeptList`,
    method: "POST",
    data
  });
};

/*
 * //通过 userId获取 角色列表
 *
 */
export const getUserRoleList = (params) => {
  return request({
    url: api + `/sysRole/getUserRoleList/${params}`,
    method: "GET"
  });
};

/*
 * //通过 部门id 获取 角色列表
 *
 */
export const selectRolePageByDept = (params) => {
  return request({
    url: api + `/sysDept/selectRolePageByDept`,
    method: "GET",
    params
  });
};

//为用户 授予角色
export const grantRoleToUser = (data) => {
  return request({
    url: api + `/sysRole/grantRoleToUser`,
    method: "POST",
    data
  });
};
//为部门 授予角色
export const saveRoleDeptInfo = (data) => {
  return request({
    url: api + `/sysDept/saveRoleDeptInfo`,
    method: "POST",
    data
  });
};

// 添加数据权限
export const saveDataPermission = (data) => {
  return request({
    url: api + `/sysRole/saveDataPermission`,
    method: "POST",
    data
  });
};

/*分页查询 所有用户
未绑定当前角色的用户 传当前角色id
 */
export const selectUnAccreditPage = (params) => {
  return request({
    url: api + "/sysUser/selectUnAccreditPage",
    method: "GET",
    params
  });
};

// 查询当前角色下 的所有用户
export const getRoleUserList = (params) => {
  return request({
    url: api + `/sysRole/getRoleUserList`,
    method: "GET",
    params
  });
};

// 查询当前部门 的所有用户
export const selectUserPageByDept = (params) => {
  return request({
    url: api + `/sysDept/selectUserPageByDept`,
    method: "GET",
    params
  });
};

// 批量解绑用户角色
export const batchUnboundUserRole = (data) => {
  return request({
    url: api + `/sysRole/batchUnboundUserRole`,
    method: "POST",
    data
  });
};

// 重置密码
export const resetPassword = (params) => {
  return request({
    url: api + `/sysUser/resetPassword`,
    method: "GET",
    params
  });
};

// 为角色授予用户
export const grantUserToRole = (data) => {
  return request({
    url: api + `/sysRole/grantUserToRole`,
    method: "POST",
    data
  });
};

// 获取角色对应权限
export const getRoleMenuIds = (roleId) => {
  return request({
    url: api + `/sysRole/getRoleMenuIds/${roleId}`,
    method: "GET"
  });
};

// 获取所有菜单权限
export const getMenuTree = (params) => {
  return request({
    url: api + `/sysMenu/selectList`,
    method: "GET",
    params
  });
};

// 为角色修改权限
export const saveRoleMenuInfo = (data) => {
  return request({
    url: api + `/sysRole/saveRoleMenuInfo`,
    method: "POST",
    data
  });
};

// 获取用户列表
export const getPasswordLevel = (params) => {
  return request({
    url: api + `/sysUser/getPasswordLevel`,
    method: "GET",
    params
  });
};

// 获取带部门的用户列表
export const selectUserDeptPage = (data = {}) => {
  return request({
    url: api + `/sysUser/selectUserDeptPage`,
    method: "POST",
    data
  });
};
///unifiedLogin
export const unifiedLogin = (data) => {
  return request({
    url: api + `/unifiedLogin`,
    method: "POST",
    data
  });
};