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

55 lines
1.7 KiB
TypeScript
Raw Permalink 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}`)
}
2024-08-21 01:17:14 +00:00
export function accreditManager(id: number, roleIds: number[]) {
2024-08-20 12:11:31 +00:00
return request.patch(`${baseUrl}/${id}/accredit`, roleIds)
}
2024-08-21 01:17:14 +00:00
export function resetManager(id: number, password: string) {
2024-08-20 12:11:31 +00:00
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 })
}
2024-08-21 01:17:14 +00:00
export function changePassword(id: number, params: { oldPassword: string; password: string }) {
2024-08-20 12:11:31 +00:00
return request.patch(`${baseUrl}/${id}/pwd`, params)
}
export function checkUser(id: number) {
return request.get(`${baseUrl}/${id}/status`)
}
2024-08-21 01:17:14 +00:00
export function getRolesByUser(id: number) {
2024-08-20 12:11:31 +00:00
return request.get(`${baseUrl}/${id}/roles`)
}
2024-08-21 01:17:14 +00:00
export function getTrack(params: Base.IListParams) {
2024-08-20 12:11:31 +00:00
return request.get(`${baseUrl}/track`, {
params
})
}
2024-08-21 01:17:14 +00:00
export function exportUser(params: Base.IListParams) {
2024-08-20 12:11:31 +00:00
downloadFile(`${baseUrl}/export`, params)
}