import http from "@/utils/http"; import { AppDispatch } from ".."; import { A5TableType } from "@/types"; /** * 获取部门管理树型数据 */ export const A5_APIgetList = () => { return async (dispatch: AppDispatch) => { const res = await http.get("sys/dept/getTree"); if (res.code === 0) { const arr: A5TableType[] = res.data; arr.forEach((v) => { v.level = 1; if (v.children && v.children.length) { v.children.forEach((v2) => { v2.level = 2; if (v2.children && v2.children.length) { v2.children.forEach((v3) => { v3.level = 3; if (v3.children && v3.children.length) { v3.children.forEach((v4) => { v4.level = 4; }); } }); } }); } }); dispatch({ type: "Section/getList", payload: arr }); } }; }; /** * 获取部门管理树型数据 */ export const A5_APIsort = (id1: string, id2: string) => { return http.get(`sys/dept/sort/${id1}/${id2}`); }; /** * 新增和编辑 */ export const A5_APIadd = (data: any) => { return http.post("sys/dept/save", data); }; /** * 删除 */ export const A5_APIdel = (id:string) => { return http.get(`sys/dept/remove/${id}`); };