|
|
|
@ -24,9 +24,7 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
const [pageInfo, setPageInfo] = useState<Partial<PaginationData>>({});
|
|
|
|
|
const [i18n, setI18n] = useState<any>({});
|
|
|
|
|
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,10 +38,8 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
const data: any = exceptStr(event.data);
|
|
|
|
|
if (!_.isEmpty(data)) {
|
|
|
|
|
const {
|
|
|
|
|
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {},
|
|
|
|
|
selectedKey, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission
|
|
|
|
|
columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, selectedKey, showDelSalaryFileBtn
|
|
|
|
|
} = data;
|
|
|
|
|
setShowOperateBtn(showOperateBtn);
|
|
|
|
|
setRunStatuses(selectedKey);
|
|
|
|
|
setI18n(i18nRes);
|
|
|
|
|
setPageInfo(pageInfo);
|
|
|
|
@ -51,7 +47,6 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
setSelectedRowKeys([...rowKeys, ...selectedRowKeys]);
|
|
|
|
|
setColumns(columns);
|
|
|
|
|
setShowDelSalaryFileBtn(showDelSalaryFileBtn);
|
|
|
|
|
setDCChiefPermission(DCChiefPermission);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const onChange = (current: number, pageSize: number) => {
|
|
|
|
@ -113,19 +108,30 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
!showDelSalaryFileBtn && (items = _.dropRight(items));
|
|
|
|
|
return (<Space>
|
|
|
|
|
{
|
|
|
|
|
(_.isNil(DCChiefPermission) || DCChiefPermission) ?
|
|
|
|
|
return (
|
|
|
|
|
record?.opts.includes("admin") ?
|
|
|
|
|
<Space>
|
|
|
|
|
<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">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space>);
|
|
|
|
|
onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("ADD-TO-SALARYPAYMENT", record, [record?.id])}>{i18n["设为发薪人员"]}</Button>
|
|
|
|
|
<Dropdown menu={{ items }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space> : <Space>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
<Dropdown menu={{
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
@ -142,18 +148,27 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
return (
|
|
|
|
|
<Space>
|
|
|
|
|
{
|
|
|
|
|
(((_.isNil(DCChiefPermission) || 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>
|
|
|
|
|
</Space>
|
|
|
|
|
record?.opts.includes("admin") ?
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("CHANGE-SALARY", record)}>{i18n["调薪"]}</Button>
|
|
|
|
|
<Dropdown menu={{ items }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space> :
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
<Dropdown menu={{
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -174,14 +189,30 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
return (<Space>
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("SALARY-SUSPENSION", record, [record?.id])}>{i18n["停薪"]}</Button>
|
|
|
|
|
<Dropdown menu={{ items: downsizingItems }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space>);
|
|
|
|
|
return (
|
|
|
|
|
record?.opts.includes("admin") ?
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("EDIT", record)}>{i18n["编辑"]}</Button>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("SALARY-SUSPENSION", record, [record?.id])}>{i18n["停薪"]}</Button>
|
|
|
|
|
<Dropdown menu={{ items: downsizingItems }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space> :
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
<Dropdown menu={{
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
@ -190,54 +221,56 @@ const Index: FunctionComponent<Props> = (props) => {
|
|
|
|
|
...opts,
|
|
|
|
|
render: (__: any, record: any) => {
|
|
|
|
|
let stopItems: MenuProps["items"] = [
|
|
|
|
|
{
|
|
|
|
|
key: "Log",
|
|
|
|
|
label: i18n["操作日志"],
|
|
|
|
|
onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "CancelSuspension",
|
|
|
|
|
label: i18n["删除档案"],
|
|
|
|
|
onClick: () => handleSalaryFileOperate("DEL-SALARY-FILES", record, [record?.id])
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "Log",
|
|
|
|
|
label: i18n["操作日志"],
|
|
|
|
|
onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
!showDelSalaryFileBtn && (stopItems = _.dropRight(stopItems));
|
|
|
|
|
return (<Space>
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("CANCEL-SALARY-SUSPENSION", record, [record?.id])}>{i18n["取消停薪"]}</Button>
|
|
|
|
|
{
|
|
|
|
|
!_.isEmpty(stopItems) &&
|
|
|
|
|
<Dropdown menu={{ items: stopItems }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
}
|
|
|
|
|
</Space>);
|
|
|
|
|
return (
|
|
|
|
|
record?.opts.includes("admin") ?
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link" onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("CANCEL-SALARY-SUSPENSION", record, [record?.id])}>{i18n["取消停薪"]}</Button>
|
|
|
|
|
{
|
|
|
|
|
!_.isEmpty(stopItems) &&
|
|
|
|
|
<Dropdown menu={{ items: stopItems }} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
}
|
|
|
|
|
</Space> :
|
|
|
|
|
<Space>
|
|
|
|
|
<Button type="link"
|
|
|
|
|
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
|
|
|
|
<Dropdown menu={{
|
|
|
|
|
items: [
|
|
|
|
|
{
|
|
|
|
|
key: "Log", label: i18n["操作日志"], onClick: () => handleSalaryFileOperate("log", record)
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}} placement="bottomRight">
|
|
|
|
|
<Button type="link" icon={<MoreOutlined/>}/>
|
|
|
|
|
</Dropdown>
|
|
|
|
|
</Space>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return showOperateBtn ? [..._.filter(columns, o => o.dataIndex !== "operate"), opts] :
|
|
|
|
|
[..._.filter(columns, o => o.dataIndex !== "operate"), {
|
|
|
|
|
...opts,
|
|
|
|
|
render: (__: any, record: any) => (
|
|
|
|
|
<Space>
|
|
|
|
|
{
|
|
|
|
|
(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>
|
|
|
|
|
)
|
|
|
|
|
}];
|
|
|
|
|
return [..._.filter(columns, o => o.dataIndex !== "operate"), opts];
|
|
|
|
|
} else {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
}, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission]);
|
|
|
|
|
}, [columns, runStatuses, i18n, showDelSalaryFileBtn]);
|
|
|
|
|
return (<Table
|
|
|
|
|
rowKey="id" size="small" className={styles.tableWrapper}
|
|
|
|
|
columns={cols} dataSource={dataSource} rowSelection={rowSelection}
|
|
|
|
|