优化PersonnelSelect
parent
7ca0eebaf1
commit
cb104a3b7e
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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} />
|
||||
|
|
|
|||
Loading…
Reference in New Issue