-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathdept.ts
More file actions
71 lines (62 loc) · 1.36 KB
/
dept.ts
File metadata and controls
71 lines (62 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import { requestClient } from './request';
export interface SysDeptResult {
id: number;
name: string;
parent_id: number;
sort: number;
leader?: string;
phone?: string;
email?: string;
status: number;
created_time: string;
}
export interface SysDeptTreeResult extends SysDeptResult {
children?: SysDeptTreeResult[];
}
export interface SysDeptParams {
name: string;
parent_id?: number;
sort?: number;
leader?: string;
phone?: string;
email?: string;
status: number;
}
export interface SysDeptTreeParams {
name?: string;
leader?: string;
phone?: string;
status?: number;
}
/**
* 获取部门树
*/
export async function getSysDeptTree(params: SysDeptTreeParams) {
return requestClient.get<SysDeptTreeResult[]>('/api/v1/sys/depts', {
params,
});
}
/**
* 获取部门详情
*/
export async function getSysDeptDetail(pk: number) {
return requestClient.get<SysDeptTreeResult>(`/api/v1/sys/depts/${pk}`);
}
/**
* 创建部门
*/
export async function createSysDept(data: SysDeptParams) {
return requestClient.post('/api/v1/sys/depts', data);
}
/**
* 更新部门
*/
export async function updateSysDept(pk: number, data: SysDeptParams) {
return requestClient.put(`/api/v1/sys/depts/${pk}`, data);
}
/**
* 删除部门
*/
export async function deleteSysDept(pk: number) {
return requestClient.delete(`/api/v1/sys/depts/${pk}`);
}