import request from "@/utils/request";
import { AxiosPromise } from "axios";


/**
 * 部门树形列表
 * @param queryParams
 */
export function treeList(): AxiosPromise<any[]> {
  return request({
    url: "/api/v1/sys/dept/orgTree",
    method: "get"
  });
}

/**
 * 部门树形表格
 *
 * @param queryParams
 */
export function queryTreeList(queryParams?: any): AxiosPromise<any> {
  return request({
    url: "/api/v1/sys/dept/queryOrgTree",
    method: "post",
    data: queryParams,
  });
}


/**
 * 新增部门
 *
 * @param data
 */
export function addDept(data: any) {
  return request({
    url: "/api/v1/sys/dept/add",
    method: "post",
    data: data,
  });
}

/**
 *  修改部门
 *
 * @param id
 * @param data
 */
export function updateDept(data: any) {
  return request({
    url: "/api/v1/sys/dept/update",
    method: "post",
    data: data,
  });
}

/**
 * 删除部门
 *
 * @param ids
 */
export function deleteDept(ids: any) {
  return request({
    url: "/api/v1/sys/dept/batch-del",
    method: "post",
    data: ids
  });
}
