1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- import {
- addTreeitem,
- axios,
- delTreeitem,
- editTreeitem,
- getTreeselect,
- } from "@/request";
- 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 axios.get<Organization[]>(getTreeselect, { 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);
|