diff --git a/src/pages/calcTable/customTableTitle.tsx b/src/pages/calcTable/customTableTitle.tsx index 1985999..81f6d9a 100644 --- a/src/pages/calcTable/customTableTitle.tsx +++ b/src/pages/calcTable/customTableTitle.tsx @@ -17,13 +17,14 @@ interface OwnProps { i18n?: any; pattern?: number; calcDetail?: boolean; //查看详情页面 + mzgOptPermission?: boolean; //二开美之高操作权限 children?: any; } type Props = OwnProps; const customTableTitle: FunctionComponent = (props) => { - const { dataIndex, title, onHandleFormulatd, i18n = {}, pattern, dataType, calcDetail, children } = props; + const { dataIndex, title, onHandleFormulatd, i18n = {}, pattern, dataType, calcDetail, children, mzgOptPermission } = props; const handleToggleSalaryItemVal = (salaryItemId: string, type: string, updateParams: any = {}) => { window.parent.postMessage({ type: "turn", payload: { id: "LOCKING", params: { lockType: type, salaryItemId, ...updateParams } } }, "*"); }; @@ -37,7 +38,9 @@ const customTableTitle: FunctionComponent = (props) => {
handleToggleSalaryItemVal(dataIndex as string, "LOCK")} /> handleToggleSalaryItemVal(dataIndex as string, "UNLOCK")} /> - handleToggleSalaryItemVal(dataIndex as string, "BATCHUPDATE", { pattern, salaryItemName: title, dataType })} /> + {!mzgOptPermission && ( + handleToggleSalaryItemVal(dataIndex as string, "BATCHUPDATE", { pattern, salaryItemName: title, dataType })} /> + )}
)} diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index ac6961e..b0cd6aa 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -5,7 +5,7 @@ * Date: 2023/9/14 */ import React, { FunctionComponent, useContext, useEffect, useMemo, useRef, useState } from "react"; -import { Button, Dropdown, Form, Input, InputNumber, MenuProps, Space, Table, Tooltip, Typography } from "antd"; +import { Button, Checkbox, Dropdown, Form, Input, InputNumber, MenuProps, Space, Table, Tooltip, Typography } from "antd"; import { DeleteOutlined, LockOutlined, QuestionCircleOutlined, SettingOutlined, UnlockOutlined } from "@ant-design/icons"; import type { FormInstance } from "antd/es/form"; import CustomTableTitle from "@/pages/calcTable/customTableTitle"; @@ -15,6 +15,7 @@ import type { ColumnType } from "antd/lib/table"; import type { PaginationData } from "rc-pagination"; import { exceptStr, paginationFun, toDecimal_n } from "@/utils/common"; import { IPage } from "@/common/types"; +import Icon from "../../lib/CustomIcon"; import styles from "@/pages/atdTable/components/index.less"; interface OwnProps {} @@ -51,6 +52,7 @@ const Index: FunctionComponent = (props) => { const [fixed, setFixed] = useState(true); const [optWidth, setOptWidth] = useState(120); //操作列宽度 const [sumRow, setSumRow] = useState>({}); //总计行数据 + const [mzgOptPermission, setMzgOptPermission] = useState(false); //美之高操作权限 false 默认可以编辑,true不可编辑 const [editCell, setEditCell] = useState({}); //编辑行key const [form] = Form.useForm(); @@ -78,7 +80,8 @@ const Index: FunctionComponent = (props) => { fixed = true, tableScrollHeight, sumRow, - optWidth + optWidth, + mzgOptPermission = false } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); @@ -93,14 +96,66 @@ const Index: FunctionComponent = (props) => { setOptWidth(optWidth); setSelectedRowKeys([...selectedRowKeys, ...rowKeys]); setTableScrollHeight(tableScrollHeight); - setColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes }))); - setEditCell({}); + setMzgOptPermission(mzgOptPermission); + setColumns([ + ...convertColumns(_.map(columns, (o) => ({ ...o, i18n: i18nRes }))), + { + title: i18nRes["操作"], + dataIndex: "operate", + fixed: "right", + width: optWidth || 120, + render: (__, record) => ( + + + {optWidth && ( + <> + + + + )} + {record?.lockTime && {record?.lockTime}} + + ) + } + ]); } }; const convertColumns: any = (cols: any[]) => { return _.map(cols, (item) => { if (_.isNaN(parseInt(item.dataIndex))) { - return { ...item }; + // 医博肛肠二开 + if (item.dataIndex === "ybgc-custom") { + return { + ...item, + render: (text: string, record: any) => { + return handlePassed(record, e.target.checked)} />; + } + }; + } else { + return { ...item }; + } } else { return { ...item, @@ -181,6 +236,38 @@ const Index: FunctionComponent = (props) => { }) } ]); + item.rightClickType && + item.rightClickType.includes("MARK") && + (items = [ + ...items, + { + label: item.i18n["标记"], + key: "MARK", + icon: , + onClick: () => + handleSetMark({ + lockStatus: "LOCK", + acctEmpId: record?.id, + salaryItemId: item?.dataIndex + }) + } + ]); + item.rightClickType && + item.rightClickType.includes("UNMARK") && + (items = [ + ...items, + { + label: item.i18n["取消标记"], + key: "UNMARK", + icon: , + onClick: () => + handleSetUnMark({ + lockStatus: "UNLOCK", + acctEmpId: record?.id, + salaryItemId: item?.dataIndex + }) + } + ]); return ( @@ -188,6 +275,7 @@ const Index: FunctionComponent = (props) => { {text} {record.lockItems && record.lockItems.includes(item.dataIndex) ? : null} + {record.markItems && record.markItems.includes(item.dataIndex) ? : null} {!_.isEmpty(record[`${item.dataIndex}_feedback`]) ? ( @@ -221,6 +309,26 @@ const Index: FunctionComponent = (props) => { const handleSetFeedback = (params: any) => { window.parent.postMessage({ type: "turn", payload: { id: "SETFEEDBACK", params } }, "*"); }; + // 安徽国元信托有限责任公司薪酬二开-薪资核算项添加右击添加标记和取消标记的操作 + const handleSetMark = (params: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "MARK", params } }, "*"); + }; + const handleSetUnMark = (params: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "UNMARK", params } }, "*"); + }; + // 医博二开 + const handlePassed = (params: any, calculateStatus: boolean) => { + setDataSource((pre) => { + pre = _.map(pre, (o) => { + if (o.id === params.id) { + return { ...o, calculateStatus: calculateStatus ? "1" : "0" }; + } + return o; + }); + return pre; + }); + window.parent.postMessage({ type: "turn", payload: { id: "CUSTPASSED", params: { ...params, calculateStatus: calculateStatus ? "1" : "0" } } }, "*"); + }; const sizeChange = (pageobj: IPage) => {}; const onChange = (pageobj: IPage) => { setPageInfo(() => { @@ -230,8 +338,8 @@ const Index: FunctionComponent = (props) => { }; const rowSelection = { columnWidth: 50, - columnTitle: isDetailTable && _.isNil(showSee) ? "序号" : "", - renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable && _.isNil(showSee) ? {index + 1} : originNode), + columnTitle: isDetailTable && !showSee ? "序号" : "", + renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable && !showSee ? {index + 1} : originNode), selectedRowKeys, preserveSelectedRowKeys: true, onChange: (rowKeys: React.Key[]) => { @@ -245,51 +353,6 @@ const Index: FunctionComponent = (props) => { ); } }; - const cols = useMemo(() => { - return [ - ...convertColumns(columns), - { - title: i18n["操作"], - dataIndex: "operate", - fixed: "right", - width: optWidth || 120, - render: (__: any, record: any) => ( - - - {optWidth && ( - <> - - - - )} - {record?.lockTime && {record?.lockTime}} - - ) - } - ]; - }, [columns, editCell, i18n]); const components = { body: { row: EditableRow, @@ -310,7 +373,7 @@ const Index: FunctionComponent = (props) => { x: 1200, y: `calc(100vh - ${tableScrollHeight || (!showTotalCell ? 165 : 200)}px)` }} - columns={!isDetailTable || showSee ? cols : _.filter(cols, (o) => o.dataIndex !== "operate")} + columns={(!isDetailTable || showSee) && !mzgOptPermission ? columns : _.filter(columns, (o) => o.dataIndex !== "operate")} footer={() => (!isDetailTable ? : null)} pagination={ !_.isNil(pageInfo) @@ -329,7 +392,7 @@ const Index: FunctionComponent = (props) => { {i18n["总计"]} - + ) @@ -390,4 +453,4 @@ const EditableCell: React.FC = (props) => { <>{children} ); return {childNode}; -}; +}; \ No newline at end of file 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 ( { @@ -12,7 +11,6 @@ const StandingbookTable: FC = (props) => { const [dataSource, setDataSource] = useState>([]); const [pageInfo, setPageInfo] = useState(defaultPage); const [sumRow, setSumRow] = useState>({}); - const [showSumrow, setShowSumrow] = useState(false); useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -24,134 +22,108 @@ const StandingbookTable: FC = (props) => { const receiveMessageFromIndex = async (event: any) => { const data: any = exceptStr(event.data); if (!_.isEmpty(data)) { - const { - columns, dataSource, pageInfo, showOperates, selectedRowKeys, - sumpayload, selectedKey - } = data; + const { columns, dataSource, pageInfo, showOperates, selectedRowKeys, sumRow } = data; const { current: pageNum, pageSize: size, total } = pageInfo; - const conventColumns = _.map(_.filter(columns, it => it.dataIndex !== "id"), item => { - const { dataIndex } = item; - if (dataIndex === "employeeId") { + const conventColumns = _.map( + _.filter(columns, (it) => it.dataIndex !== "id"), + (item) => { + const { dataIndex } = item; + if (dataIndex === "employeeId") { + return { + title: "姓名", + dataIndex, + fixed: "left", + width: 150, + render: (_: any, record: Partial) => {record?.userName} + }; + } return { - title: "姓名", dataIndex, fixed: "left", width: 150, - render: (_: any, record: Partial) => ( - {record?.userName} - ) + dataIndex, + width: 150, + title: }; } - return { - dataIndex, width: 150, - title: - }; - }); + ); setDataSource(dataSource); setColumns( - !showOperates ? conventColumns : - [ - ...conventColumns, - { - title: "操作", - dataIndex: "operate", - fixed: "right", - width: 120, - render: (_: any, record: any) => { - return ( - - ); + !showOperates + ? conventColumns + : [ + ...conventColumns, + { + title: "操作", + dataIndex: "operate", + fixed: "right", + width: 120, + render: (_: any, record: any) => { + return ( + + ); + } } - } - ] + ] ); setPageInfo({ pageNum, size, total }); setSelected(selectedRowKeys); - const confCode: any = await API.CalculateService.getSysconfcode({ code: "OPEN_ACCT_RESULT_SUM" }); - setShowSumrow(confCode.data.status && confCode.data.data === "1"); - if (confCode.data.status && confCode.data.data === "1") { - const sumRowlist: any = selectedKey === "1" ? await API.CalculateService.siaccountDetailCommonListSum(sumpayload) : - selectedKey === "3" ? await API.CalculateService.siaccountDetailSupplementaryListSum(sumpayload) : - selectedKey === "regression" ? await API.CalculateService.siaccountDetailRecessionListSum(sumpayload) : - selectedKey === "difference" ? await API.CalculateService.siaccountDetailBalanceListSum(sumpayload) : { - data: { - status: false, - data: { sumRow: {} } - } - }; - if (sumRowlist.data.status) { - if (!_.isEmpty(sumRowlist.data.data.sumRow)) { - setSumRow(sumRowlist.data.data.sumRow); - } else { - setSumRow({ [new Date().getTime()]: new Date().getTime() }); - } - } - if (sumRowlist.data.status && _.isNil(sumRowlist.data.data.sumRow)) { - setSumRow({ [new Date().getTime()]: new Date().getTime() }); - } - } + setSumRow(sumRow); } }; const handleEdit = (record: any) => { window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); }; - const sizeChange = (pageobj: IPage) => { - }; + const sizeChange = (pageobj: IPage) => {}; const onChange = (pageobj: IPage) => { setPageInfo({ ...pageInfo, ...pageobj }); - window.parent.postMessage( - { - type: "turn", - payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } - }, - "*" - ); + window.parent.postMessage({ type: "turn", payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } }, "*"); }; const rowSelection = { selectedRowKeys: selected, - columnWidth: 80, + columnWidth: 60, onChange: (selectedRowKeys: Array) => { setSelected(selectedRowKeys); - window.parent.postMessage( - { - type: "turn", - payload: { id: "ROWSELECT", params: { selectedRowKeys } } - }, - "*" - ); + window.parent.postMessage({ type: "turn", payload: { id: "ROWSELECT", params: { selectedRowKeys } } }, "*"); } }; - return
{ - if (_.isEmpty(columns) || !showSumrow) return; - return ( - - - { - _.isEmpty(sumRow) ? : - _.map([{}, ...columns], (item, index) => { - if (index === 0) { - return 总计; - } - return + return ( +
{ + if (_.isEmpty(sumRow)) return; + return ( + + + {_.map([{}, ...columns], (item, index) => { + if (index === 0) { + return ( + + 总计 + + ); + } + return ( + {!_.isNil(sumRow[item.dataIndex]) ? sumRow[item.dataIndex] : "-"} - ; - }) - } - - - ); - }} - />; + + ); + })} + + + ); + }} + /> + ); }; export default StandingbookTable; diff --git a/src/pages/unitTable/renderColsOpts.tsx b/src/pages/unitTable/renderColsOpts.tsx index fe3adc2..1ab54e5 100644 --- a/src/pages/unitTable/renderColsOpts.tsx +++ b/src/pages/unitTable/renderColsOpts.tsx @@ -27,7 +27,7 @@ export function renderCols(initialState: any[], type: string, i18n?: AnyObject, render: (text: string, record: any) => { 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 (
); };