From 793d7acefb8b690a05a753e43fe9e6a4736f4a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Wed, 11 Sep 2024 10:10:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E7=BA=BF=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/salaryFileTable/index.tsx | 144 ++++++++++++++-------------- 1 file changed, 74 insertions(+), 70 deletions(-) diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx index 6185926..bf2f81e 100644 --- a/src/pages/salaryFileTable/index.tsx +++ b/src/pages/salaryFileTable/index.tsx @@ -24,9 +24,7 @@ const Index: FunctionComponent = (props) => { const [pageInfo, setPageInfo] = useState>({}); const [i18n, setI18n] = useState({}); const [runStatuses, setRunStatuses] = useState(""); - const [showOperateBtn, setShowOperateBtn] = useState(false); const [showDelSalaryFileBtn, setShowDelSalaryFileBtn] = useState(false);//待定薪、停薪员工 是否允许删除薪资档案 - const [DCChiefPermission, setDCChiefPermission] = useState(undefined);//二开权限(大成) useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -40,10 +38,8 @@ const Index: FunctionComponent = (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) => { setSelectedRowKeys(selectedRowKeys); setColumns(columns); setShowDelSalaryFileBtn(showDelSalaryFileBtn); - setDCChiefPermission(DCChiefPermission); } }; const onChange = (current: number, pageSize: number) => { @@ -116,19 +111,22 @@ const Index: FunctionComponent = (props) => { } ]; !showDelSalaryFileBtn && (items = _.dropRight(items)); - return ( - { - (_.isNil(DCChiefPermission) || DCChiefPermission) ? + return ( + record?.opts.includes("admin") ? + : - - } - - - + + + + + + ); } }; break; @@ -145,18 +143,20 @@ const Index: FunctionComponent = (props) => { } ]; return ( - - { - (((_.isNil(DCChiefPermission) || DCChiefPermission) && runStatuses === "fixed") || runStatuses === "ext") ? - : - - } - - + + + + ); } }; @@ -177,14 +177,23 @@ const Index: FunctionComponent = (props) => { onClick: () => handleSalaryFileOperate("log", record) } ]; - return ( - - - - + + + + + + ); } }; break; @@ -193,54 +202,49 @@ const Index: FunctionComponent = (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 ( - - - { - !_.isEmpty(stopItems) && - - + + { + !_.isEmpty(stopItems) && + + + + + ); } }; break; default: break; } - return showOperateBtn ? [..._.filter(columns, o => o.dataIndex !== "operate"), opts] : - [..._.filter(columns, o => o.dataIndex !== "operate"), { - ...opts, - render: (__: any, record: any) => ( - - { - (DCChiefPermission && (runStatuses === "pending" || runStatuses === "fixed")) ? - : - - } - - - ) - }]; + return [..._.filter(columns, o => o.dataIndex !== "operate"), opts]; } else { return []; } - }, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission]); + }, [columns, runStatuses, i18n, showDelSalaryFileBtn]); return (