业务线管理
This commit is contained in:
parent
854931db30
commit
793d7acefb
|
|
@ -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, i18n: i18nRes = {},
|
||||
selectedKey, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission
|
||||
columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, selectedKey, showDelSalaryFileBtn
|
||||
} = data;
|
||||
setShowOperateBtn(showOperateBtn);
|
||||
setRunStatuses(selectedKey);
|
||||
setI18n(i18nRes);
|
||||
setPageInfo(pageInfo);
|
||||
|
|
@ -51,7 +47,6 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
setSelectedRowKeys(selectedRowKeys);
|
||||
setColumns(columns);
|
||||
setShowDelSalaryFileBtn(showDelSalaryFileBtn);
|
||||
setDCChiefPermission(DCChiefPermission);
|
||||
}
|
||||
};
|
||||
const onChange = (current: number, pageSize: number) => {
|
||||
|
|
@ -116,19 +111,22 @@ 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>
|
||||
}
|
||||
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> : <Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Button type="link" onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -145,17 +143,19 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
}
|
||||
];
|
||||
return (
|
||||
record?.opts.includes("admin") ?
|
||||
<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>
|
||||
}
|
||||
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>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
|
@ -177,14 +177,23 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
onClick: () => handleSalaryFileOperate("log", record)
|
||||
}
|
||||
];
|
||||
return (<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> :
|
||||
<Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
|
@ -193,19 +202,21 @@ 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>
|
||||
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>
|
||||
|
|
@ -215,32 +226,25 @@ const Index: FunctionComponent<Props> = (props) => {
|
|||
<Button type="link" icon={<MoreOutlined/>}/>
|
||||
</Dropdown>
|
||||
}
|
||||
</Space>);
|
||||
</Space> :
|
||||
<Space>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("VIEW", record)}>{i18n["查看"]}</Button>
|
||||
<Button type="link"
|
||||
onClick={() => handleSalaryFileOperate("log", record)}>{i18n["操作日志"]}</Button>
|
||||
</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}
|
||||
|
|
|
|||
Loading…
Reference in New Issue