DepartmentSelectTree增加新接口
parent
c3bf282fbb
commit
bd64a7ec35
|
|
@ -1,7 +1,18 @@
|
|||
import type { FC } from "react";
|
||||
import type { Params } from "../../../LeftTree/Department/Gwj";
|
||||
import type { BasicSelectTreeProps } from "../../Basic";
|
||||
|
||||
/**
|
||||
* 请求参数
|
||||
*/
|
||||
export interface Params {
|
||||
/** 企业id */
|
||||
eqCorpinfoId?: string;
|
||||
/** 父级部门id */
|
||||
eqParentId?: string;
|
||||
/** 企业类型 */
|
||||
corpinfoTypeList?: number[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 组件属性
|
||||
*/
|
||||
|
|
@ -14,8 +25,8 @@ export interface DepartmentSelectTreeProps extends Omit<BasicSelectTreeProps, "t
|
|||
isNeedCorpInfoId?: boolean;
|
||||
/** 是否需要父级部门id,默认 false */
|
||||
isNeedParentId?: boolean;
|
||||
/** 查询当前登陆人部门还是所有企业部门,all 的话 isNeedCorpInfoId、isNeedParentId、params 不生效 */
|
||||
searchType?: "current" | "all";
|
||||
/** 查询当前登陆人部门还是所有企业部门 */
|
||||
searchType?: "current" | "all" | "company";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,7 +28,15 @@ function DepartmentSelectTree(props) {
|
|||
return;
|
||||
}
|
||||
|
||||
const { data } = await request(searchType === "current" ? "/basicInfo/department/listTree" : "/basicInfo/department/listAllTree", "post", params);
|
||||
let requestUrl = "";
|
||||
if (searchType === "current")
|
||||
requestUrl = "/basicInfo/department/listTree";
|
||||
if (searchType === "all")
|
||||
requestUrl = "/basicInfo/department/listAllTree";
|
||||
if (searchType === "company")
|
||||
requestUrl = "/basicInfo/department/listAllTreeByCorpType";
|
||||
|
||||
const { data } = await request(requestUrl, "post", params);
|
||||
setTreeData(data);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue