cmc-web/packages/api/system/manager.ts

55 lines
1.7 KiB
TypeScript
Raw Normal View History

2024-08-20 12:11:31 +00:00
/**
* Created by HaijunZhang on 2019/7/23.
*/
import { request } from '@cmp/cmp-element'
import { wrapperParams, downloadFile } from 'utils/index'
const baseUrl = '/sms/v1/users'
export function getUser(params: Base.IListParams) {
return request.get(baseUrl, {
params
})
}
export function getUserDetail(id: number) {
return request.get(`${baseUrl}/${id}`)
}
export function createUser(params: any) {
return request.post(baseUrl, wrapperParams(params))
}
export function modifyUser(params: any) {
return request.put(`${baseUrl}/${params.id}`, wrapperParams(params))
}
export function removeUser(id: number) {
return request.delete(`${baseUrl}/${id}`)
}
export function accreditManager(id:number, roleIds:number[]) {
return request.patch(`${baseUrl}/${id}/accredit`, roleIds)
}
export function resetManager(id:number, password:string) {
return request.patch(`${baseUrl}/${id}/reset`, { password })
}
export function operateManager(id: number, action: string) {
return request.patch(`${baseUrl}/${id}`, { action })
}
export function batchOperateManager(ids: number[], action: string) {
return request.patch(`${baseUrl}`, { action, ids })
}
export function changePassword(id: number, params: {oldPassword: string, password: string}) {
return request.patch(`${baseUrl}/${id}/pwd`, params)
}
export function checkUser(id: number) {
return request.get(`${baseUrl}/${id}/status`)
}
export function getRolesByUser(id:number) {
return request.get(`${baseUrl}/${id}/roles`)
}
export function getTrack(params:Base.IListParams) {
return request.get(`${baseUrl}/track`, {
params
})
}
export function exportUser(params:Base.IListParams) {
downloadFile(`${baseUrl}/export`, params)
}