优化PersonnelSelect

master
LiuJiaNan 2025-12-18 16:30:10 +08:00
parent 7ca0eebaf1
commit cb104a3b7e
2 changed files with 18 additions and 5 deletions

View File

@ -13,6 +13,16 @@ export interface Params {
departmentId?: string;
}
/**
*
*/
export interface ExtraParams {
/** 返回值是否存在主账号 */
noMain: 1 | "";
/** 入职状态 */
eqEmploymentFlag: number;
}
/**
*
*/
@ -27,8 +37,8 @@ export interface PersonnelSelectProps extends Omit<BasicSelectProps, "data" | "p
isNeedPostId?: boolean;
/** 是否需要部门id默认 true */
isNeedDepartmentId?: boolean;
/** 返回值是否存在主账号 */
noMain?: 1 | "";
/** 额外请求参数 */
extraParams?: ExtraParams;
}
/**

View File

@ -12,7 +12,10 @@ function PersonnelSelect(props) {
isNeedCorpInfoId = false,
isNeedDepartmentId = true,
isNeedPostId = false,
noMain = "",
extraParams= {
noMain: "",
eqEmploymentFlag: 1,
},
...restProps
} = props;
@ -28,13 +31,13 @@ function PersonnelSelect(props) {
if (isNeedPostId && !params.postId)
return;
const { data } = await request("/basicInfo/user/listAll", "get", { ...params, noMain });
const { data } = await request("/basicInfo/user/listAll", "get", { ...params, ...extraParams });
setData(data);
};
useEffect(() => {
getData();
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId, noMain]);
}, [JSON.stringify(params), isNeedCorpInfoId, isNeedDepartmentId, isNeedPostId, JSON.stringify(extraParams)]);
return (
<BasicSelect data={data} placeholder={placeholder} {...restProps} />