import {getToken} from "../util/token"; const token = getToken(); export const defaultDataSource = [ { key: "getGroupUserTree", name: "部门人员", url: "/api/main/group/getGroupUserTree", method: "GET", auto: true, params: {}, headers: token, responseFunc: "return res.data;", requestFunc: "return config;", errorFunc: "", args: [] }, { key: "getUserPage", name: "人员", url: "/api/main/user/getUserPage", method: "GET", auto: true, params: { pageNum: "1", size: "-1" }, headers: token, responseFunc: "return res.data.list.map((item) => {\r\n return {\r\n value: item.id,\r\n label: item.name\r\n };\r\n });", requestFunc: "return config;", errorFunc: "", args: [] }, { key: "getDeptTree", name: "部门", url: "/api/main/group/getGroupList", method: "GET", auto: true, params: {}, headers: token, responseFunc: "const data = [...res.data];\n return data.reduce((acc, item) => {\n const parent = data.find(i => i.id == item.parentId);\n if (parent) {\n if (!parent.children) {\n parent.children = [];\n }\n parent.children.push(item);\n } else {\n acc.push(item);\n }\n return acc;\n }, []);\n\n", requestFunc: "return config;", errorFunc: "", args: [] } ]