dept.ts
1.06 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
import { defHttp } from '/@/utils/http/axios';
import { DeptListGetResultModel, DeptListItem } from '/@/api/system/model/deptModel';
import { DeptOperationApiResult, DeptOperationParams } from '/@/api/system/model/deptModel';
import { ErrorMessageMode } from '/#/axios';
enum Api {
  DeptList = '/dept/all',
  basicUrl = '/dept',
}
export const getDeptList = (params?: DeptListItem) =>
  defHttp.get<DeptListGetResultModel>({ url: Api.DeptList, params });
/**
 * @description: save or edit dept api
 */
export function saveOrEditDeptApi(
  params: DeptOperationParams,
  update = false,
  mode: ErrorMessageMode = 'modal'
) {
  if (!update) {
    return defHttp.post<DeptOperationApiResult>(
      {
        url: Api.basicUrl,
        params,
      },
      {
        errorMessageMode: mode,
      }
    );
  } else {
    return defHttp.put<DeptOperationApiResult>(
      { url: Api.basicUrl, params },
      { errorMessageMode: mode }
    );
  }
}
export const delDept = (menuIds: string[]) => {
  const url = Api.basicUrl;
  return defHttp.delete({ url: url, data: menuIds });
};