|
|
|
@ -26,6 +26,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
const [runStatuses, setRunStatuses] = useState<string>("");
|
|
|
|
|
const [showOperateBtn, setShowOperateBtn] = useState<boolean>(false);
|
|
|
|
|
const [showDelSalaryFileBtn, setShowDelSalaryFileBtn] = useState<boolean>(false);//待定薪、停薪员工 是否允许删除薪资档案
|
|
|
|
|
const [DCChiefPermission, setDCChiefPermission] = useState<undefined>(undefined);//二开权限(大成)
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
window.parent.postMessage({ type: "init" }, "*");
|
|
|
|
@ -40,7 +41,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
if (!_.isEmpty(data)) {
|
|
|
|
|
const {
|
|
|
|
|
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {},
|
|
|
|
|
selectedKey, showOperateBtn, showDelSalaryFileBtn
|
|
|
|
|
selectedKey, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission
|
|
|
|
|
} = data;
|
|
|
|
|
setShowOperateBtn(showOperateBtn);
|
|
|
|
|
setRunStatuses(selectedKey);
|
|
|
|
@ -50,6 +51,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
setSelectedRowKeys(selectedRowKeys);
|
|
|
|
|
setColumns(columns);
|
|
|
|
|
setShowDelSalaryFileBtn(showDelSalaryFileBtn);
|
|
|
|
|
setDCChiefPermission(DCChiefPermission);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const onChange = (current: number, pageSize: number) => {
|
|
|
|
@ -115,7 +117,12 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
];
|
|
|
|
|
!showDelSalaryFileBtn && (items = _.dropRight(items));
|
|
|
|
|
return (<Space>
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
|
|
|
|
|
{
|
|
|
|
|
_.isNil(DCChiefPermission) ?
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button> :
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
}
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("ADD-TO-SALARYPAYMENT", record, [record?.id])}>{i18n["设为发薪人员"]}</Button>
|
|
|
|
|
<Dropdown menu={{ items }} placement="bottomRight">
|
|
|
|
@ -139,8 +146,13 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
];
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button>
|
|
|
|
|
{
|
|
|
|
|
((_.isNil(DCChiefPermission) && runStatuses === "fixed") || runStatuses === "ext") ?
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button> :
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
}
|
|
|
|
|
<Dropdown menu={{ items }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
@ -215,7 +227,12 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
...opts,
|
|
|
|
|
render: (__: any, record: any) => (
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
{
|
|
|
|
|
(DCChiefPermission && (runStatuses === "pending" || runStatuses === "fixed")) ?
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate(runStatuses === "fixed" ? "CHANGE-SALARY" : "EDIT", record)}>{runStatuses === "fixed" ? i18n["调薪"] : i18n["编辑"]}</Button> :
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
}
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
|
|
|
|
|
</Space>
|
|
|
|
|
)
|
|
|
|
@ -223,7 +240,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
} else {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
}, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn]);
|
|
|
|
|
}, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission]);
|
|
|
|
|
return (<Table
|
|
|
|
|
rowKey="id" size="small" className={styles.tableWrapper}
|
|
|
|
|
columns={cols} dataSource={dataSource} rowSelection={rowSelection}
|
|
|
|
|