12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import {
- addTreeitem,
- axios,
- delTreeitem,
- editTreeitem,
- getTreeselect,
- } from "@/request";
- const request = axios.create({
- baseURL: 'https://xj-mix3d.4dkankan.com/fusion-xj',
- timeout: 1000,
- headers: {
- share: 1,
- 'Content-Type': 'application/json'
- },
- });
- export enum DeptType {
- corps = 1,
- detachment = 2,
- brigade = 3,
- }
- export type Organization = {
- ancestors: string;
- children?: Organization[];
- deptType: DeptType;
- id: string;
- leader: string;
- level: number;
- name: string;
- parentId: string;
- parentName: string;
- phone: string;
- remark: string;
- };
- export const getOrganizationTree = async (type?: string) =>
- (await request.get<Organization[]>('/web/department/treeselect', { headers: { share: 1 }, params: { type, ingoreRes: true, share: 1, } })).data;
- export const addOrganization = async (
- dept: Omit<Organization, "id">,
- deptIds: string[]
- ) => {
- await axios.post(addTreeitem, {
- superior: "sheq",
- ...dept,
- deptIdList: deptIds.join(","),
- });
- };
- export const setOrganization = async (
- dept: Organization,
- deptIds: string[]
- ) => {
- await axios.post(editTreeitem, {
- superior: "sheq",
- ...dept,
- deptIdList: deptIds.join(","),
- });
- };
- export const delOrganization = async (deptId: string) =>
- axios.post(delTreeitem + deptId);
|