diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx index 1a5830d..0c2ec5c 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: 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) => { setSelectedRowKeys([...rowKeys, ...selectedRowKeys]); setColumns(columns); setShowDelSalaryFileBtn(showDelSalaryFileBtn); - setDCChiefPermission(DCChiefPermission); } }; const onChange = (current: number, pageSize: number) => { @@ -113,19 +108,30 @@ const Index: FunctionComponent = (props) => { } ]; !showDelSalaryFileBtn && (items = _.dropRight(items)); - return ( - { - (_.isNil(DCChiefPermission) || DCChiefPermission) ? + return ( + record?.opts.includes("admin") ? + : - - } - - - + + + + handleSalaryFileOperate("log", record) + } + ] + }} placement="bottomRight"> + : - - } - - + + + handleSalaryFileOperate("log", record) + } + ] + }} placement="bottomRight"> + - - - + + + + handleSalaryFileOperate("log", record) + } + ] + }} placement="bottomRight"> + - - { - !_.isEmpty(stopItems) && - - + + { + !_.isEmpty(stopItems) && + + + handleSalaryFileOperate("log", record) + } + ] + }} placement="bottomRight"> + : - - } - - - ) - }]; + return [..._.filter(columns, o => o.dataIndex !== "operate"), opts]; } else { return []; } - }, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn, DCChiefPermission]); + }, [columns, runStatuses, i18n, showDelSalaryFileBtn]); return ( { const { billStatus } = record; return ( - ); @@ -84,7 +84,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, ]; return ( - {!extraParams?.permission ? ( + {!record?.opts.includes("admin") ? ( - + {record?.opts.includes("admin") ? ( + + + + + ) : ( + + )} ); } @@ -404,13 +412,15 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, onClick: () => postMessageToParent("log", record) } ]; - isSpecial && items.shift(); + (isSpecial || !record?.opts.includes("admin")) && items.shift(); return ( - - {isSpecial ? ( + {record?.opts.includes("admin") && ( + + )} + {isSpecial && record?.opts.includes("admin") ? ( diff --git a/src/pages/welfareArchiveTable/index.tsx b/src/pages/welfareArchiveTable/index.tsx index 7fb50e1..bc64799 100644 --- a/src/pages/welfareArchiveTable/index.tsx +++ b/src/pages/welfareArchiveTable/index.tsx @@ -25,7 +25,6 @@ const Index: FunctionComponent = (props) => { const [pageInfo, setPageInfo] = useState>({}); const [i18n, setI18n] = useState({}); const [runStatuses, setRunStatuses] = useState(""); - const [showOperateBtn, setShowOperateBtn] = useState(false); useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -38,11 +37,7 @@ const Index: FunctionComponent = (props) => { const receiveMessageFromIndex = (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { - columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, - runStatuses, showOperateBtn - } = data; - setShowOperateBtn(showOperateBtn); + const { columns, dataSource, pageInfo, selectedRowKeys: rowKeys = [], i18n: i18nRes = {}, runStatuses } = data; setRunStatuses(runStatuses); setI18n(i18nRes); setPageInfo(pageInfo); @@ -87,6 +82,14 @@ const Index: FunctionComponent = (props) => { }; const cols: any = useMemo(() => { let opts: any = { title: i18n["操作"], dataIndex: "operate", fixed: "right", width: 185 }; + const UnAuthOpts = (record: any) => ( + + handleWelfareOperate("log", record) }] + }} placement="bottomRight"> + - - + + - - - ) - }]; - }, [columns, runStatuses, i18n, showOperateBtn]); + return [...columns, opts]; + }, [columns, runStatuses, i18n]); return (
); };