import { SaveUserType, UserTableAPIType } from '@/types' import http from '@/utils/http' import { AppDispatch } from '..' /** * 获取用户管理表格列表 */ export const getUserListAPI = (data: UserTableAPIType): any => { return async (dispatch: AppDispatch) => { const res = await http.post('sys/user/list', data) if (res.code === 0) { const obj = { list: res.data.records, total: res.data.total } dispatch({ type: 'Z1/getList', payload: obj }) } } } /** * 删除用户 */ export const userRemoveAPI = (id: number) => { return http.get(`sys/user/removes/${id}`) } /** * 重置密码 */ export const userPassResetAPI = (id: number) => { return http.get(`sys/user/resetPass/${id}`) } /** * 新增/修改用户信息 */ export const userSaveAPI = (data: SaveUserType) => { return http.post('sys/user/save', data) } /** * 通过id获取角色详情 */ export const getUserInfoByIdAPI = (id: number) => { return http.get(`sys/user/detail/${id}`) } /** * 角色授权-获取 */ export const Z1_APIgetAuthByUserId = (userId: number) => { return http.get(`sys/user/perm/detail/${userId}`) } /** * 角色授权-设置 */ export const Z1_APIsetAuth = (data: any) => { return http.post('sys/user/perm/auth', data) } /** * 角色授权-获取 初始页面获取 */ export const Z1_APIgetAuthBase = () => { return http.get('sys/user/perm/getTree') }