mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-09-18 12:19:58 +08:00
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { request } from '../../utils/alova'
|
|
|
|
export type SearchQuery = Partial<Pick<Entity.Dept, 'deptName' | 'status'>>
|
|
|
|
/**
|
|
* 创建部门
|
|
* POST /dept
|
|
*/
|
|
export function createDept(data: Partial<Entity.Dept>) {
|
|
return request.Post<Api.Response<Entity.Dept>>('/dept', data)
|
|
}
|
|
|
|
/**
|
|
* 分页查询部门
|
|
* GET /dept
|
|
*/
|
|
export function getDeptList(params?: SearchQuery) {
|
|
return request.Get<Api.Response<Entity.Dept[]>>('/dept', { params })
|
|
}
|
|
|
|
/**
|
|
* 获取部门下拉选项
|
|
* GET /dept/options
|
|
*/
|
|
export function getDeptOptions() {
|
|
return request.Get<Api.Response<Entity.Dept[]>>('/dept/options')
|
|
}
|
|
|
|
/**
|
|
* 查询部门详情
|
|
* GET /dept/{id}
|
|
*/
|
|
export function getDeptById(id: number) {
|
|
return request.Get<Api.Response<Entity.Dept>>(`/dept/${id}`)
|
|
}
|
|
|
|
/**
|
|
* 更新部门信息
|
|
* PUT /dept/{id}
|
|
*/
|
|
export function updateDept(id: number, data: Partial<Entity.Dept>) {
|
|
return request.Put<Api.Response<Entity.Dept>>(`/dept/${id}`, data)
|
|
}
|
|
|
|
/**
|
|
* 删除部门
|
|
* DELETE /dept/{id}
|
|
*/
|
|
export function deleteDept(id: number) {
|
|
return request.Delete<Api.Response<boolean>>(`/dept/${id}`)
|
|
}
|