Blame view

Yi.Vben5.Vue3/playground/src/api/system/dept.ts 1.02 KB
515fceeb   “wangming”   框架初始化
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
  import { requestClient } from '#/api/request';
  
  export namespace SystemDeptApi {
    export interface SystemDept {
      [key: string]: any;
      children?: SystemDept[];
      id: string;
      name: string;
      remark?: string;
      status: 0 | 1;
    }
  }
  
  /**
   * 获取部门列表数据
   */
  async function getDeptList() {
    return requestClient.get<Array<SystemDeptApi.SystemDept>>(
      '/system/dept/list',
    );
  }
  
  /**
   * 创建部门
   * @param data 部门数据
   */
  async function createDept(
    data: Omit<SystemDeptApi.SystemDept, 'children' | 'id'>,
  ) {
    return requestClient.post('/system/dept', data);
  }
  
  /**
   * 更新部门
   *
   * @param id 部门 ID
   * @param data 部门数据
   */
  async function updateDept(
    id: string,
    data: Omit<SystemDeptApi.SystemDept, 'children' | 'id'>,
  ) {
    return requestClient.put(`/system/dept/${id}`, data);
  }
  
  /**
   * 删除部门
   * @param id 部门 ID
   */
  async function deleteDept(id: string) {
    return requestClient.delete(`/system/dept/${id}`);
  }
  
  export { createDept, deleteDept, getDeptList, updateDept };