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