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

View File

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