From e4a7b9d7d5783a65866bd526d3a9c8efd55d7d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Tue, 28 Nov 2023 11:56:51 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/config.js | 1 + src/pages/OCTable/index.tsx | 103 +++++++++++++++++++++++ src/pages/atdTable/components/index.less | 12 +++ 3 files changed, 116 insertions(+) create mode 100644 src/pages/OCTable/index.tsx diff --git a/src/layouts/config.js b/src/layouts/config.js index 2761b0d..37ef1b4 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -17,6 +17,7 @@ module.exports = { "/payrollFilesTable.*": "blank", "/employeeDeclareTable.*": "blank", "/welfareArchiveTable.*": "blank", + "/OCTable.*": "blank", "/manage.*": "manage", "/portal.*": "template", "/passport/oauth-in": "blank", diff --git a/src/pages/OCTable/index.tsx b/src/pages/OCTable/index.tsx new file mode 100644 index 0000000..ab8d780 --- /dev/null +++ b/src/pages/OCTable/index.tsx @@ -0,0 +1,103 @@ +/* + * Author: 黎永顺 + * name: 薪酬系统-线下对比 + * Description: + * Date: 2023/11/28 + */ +import React, { FC, useEffect, useState } from "react"; +import { Table } from "antd"; +import { exceptStr, paginationFun } from "@/utils/common"; +import styles from "@/pages/atdTable/components/index.less"; +import { defaultPage, IPage } from "@/common/types"; +import cs from "classnames"; + +const OCTable: FC = (props) => { + const [columns, setColumns] = useState>([]); + const [pageInfo, setPageInfo] = useState(defaultPage); + const [dataSource, setDataSource] = useState>([]); + const [i18n, setI18n] = useState({}); + + useEffect(() => { + window.parent.postMessage({ type: "init" }, "*"); + window.addEventListener("message", receiveMessageFromIndex, false); + return () => { + window.removeEventListener("message", receiveMessageFromIndex, false); + }; + }, []); + const receiveMessageFromIndex = (event: any) => { + const data: any = exceptStr(event.data); + if (!_.isEmpty(data)) { + const { columns, dataSource, pageInfo, i18n: i18nRes = {} } = data; + const { current: pageNum, pageSize: size, total } = pageInfo; + setDataSource(dataSource); + setI18n(i18nRes); + setPageInfo({ pageNum, size, total }); + setColumns(convertColumns(columns, i18nRes)); + } + }; + const convertColumns: any = (cols: any[], lanObj: any) => { + return _.map(cols, item => { + if (_.isNaN(parseInt(item.dataIndex))) { + return { ...item }; + } else { + return { + ...item, children: convertColumns(item.children, lanObj), + render: (__: any, record: any) => { + const formulaDesc = record["customParameters"][`${item["dataIndex"]}`]; + const showDifference = record[`${item["dataIndex"]}_type`] === "number"; + const { acctResultValue, excelResultValue } = record[item["dataIndex"]] || {}; + return
console.log(formulaDesc)}> +
+ {lanObj["系统值"]}: + {acctResultValue} +
+
+ {lanObj["线下值"]}: + {excelResultValue} +
+ { + showDifference && +
+ {lanObj["差值"]}: + {calculateDifference(acctResultValue, excelResultValue)} +
+ } +
; + } + }; + } + }); + }; + // 计算差值 + const calculateDifference = (systemValue: string, excelValue: string) => { + if (_.isNil(systemValue) || _.isNil(excelValue)) return ""; + const systemNum = Number(systemValue); + const excelNum = Number(excelValue); + return (systemNum - excelNum).toFixed(2); + }; + + const sizeChange = (pageobj: IPage) => { + }; + const onChange = (pageobj: IPage) => { + setPageInfo({ ...pageInfo, ...pageobj }); + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } + }, + "*" + ); + }; + return ; +}; + +export default OCTable; diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 9b3859f..7577694 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -153,6 +153,18 @@ } } + .comparison-column-item-container { + cursor: pointer; + + .comparison-single-row { + margin: 4px 0; + } + + .danger { + color: #ff4d4f; + } + } + :global { .ant-btn-link { height: inherit !important; From e794d1021f82ce45d4af798bc59d6fd4ae9daa98 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, 29 Nov 2023 17:20:44 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/OCTable/index.tsx | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/pages/OCTable/index.tsx b/src/pages/OCTable/index.tsx index ab8d780..87ca8bf 100644 --- a/src/pages/OCTable/index.tsx +++ b/src/pages/OCTable/index.tsx @@ -47,7 +47,15 @@ const OCTable: FC = (props) => { const showDifference = record[`${item["dataIndex"]}_type`] === "number"; const { acctResultValue, excelResultValue } = record[item["dataIndex"]] || {}; return
console.log(formulaDesc)}> + onClick={() => { + window.parent.postMessage( + { + type: "turn", + payload: { id: "FORMULA", params: { formulaDesc } } + }, + "*" + ); + }}>
{lanObj["系统值"]}: {acctResultValue} @@ -80,14 +88,18 @@ const OCTable: FC = (props) => { const sizeChange = (pageobj: IPage) => { }; const onChange = (pageobj: IPage) => { - setPageInfo({ ...pageInfo, ...pageobj }); - window.parent.postMessage( - { - type: "turn", - payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } - }, - "*" - ); + const { pageNum, size: pageSize } = pageobj; + setPageInfo((prevState) => { + const { size } = prevState; + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, pageNum: size === pageSize ? pageNum : 1, size: pageSize } } + }, + "*" + ); + return { ...pageInfo, current: size === pageSize ? pageNum : 1, size: pageSize }; + }); }; return
Date: Wed, 6 Dec 2023 11:16:44 +0800 Subject: [PATCH 03/15] master --- src/pages/atdTable/components/index.less | 16 +++++++++++++++- src/utils/common.js | 13 +++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 7577694..8aa9522 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -165,6 +165,12 @@ } } + tr:hover .editable-cell { + padding: 4px 11px; + border: 1px solid #d9d9d9; + border-radius: 2px; + } + :global { .ant-btn-link { height: inherit !important; @@ -260,7 +266,15 @@ } th, td { - font-size: 12px + font-size: 12px; + + .ant-form-item { + margin-bottom: 0; + + .ant-input-number { + width: 100%; + } + } } } } diff --git a/src/utils/common.js b/src/utils/common.js index 5fcaa49..5096b1a 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -110,3 +110,16 @@ export const paginationAction = (pageInfo = {}, i18n = {}, onChange, onShowSizeC showSizeChanger: true }; }; +/* + * Author: 黎永顺 + * Description: + * Params: 格式化钱 + * Date: 2023/12/6 + */ +export const toDecimal_n = (num, decimalPlaces) => { + if (num === null || !isFinite(num)) return null + if (decimalPlaces < 0) return null; + const multiplier = Math.pow(10, decimalPlaces); + const roundedNum = Math.round(num * multiplier) / multiplier; + return roundedNum.toFixed(decimalPlaces); +}; From 0c00895f180eff282443e915e6e531b8f6e88503 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, 6 Dec 2023 11:42:12 +0800 Subject: [PATCH 04/15] =?UTF-8?q?custom/=E9=B2=81=E6=8E=A7=E6=95=B0?= =?UTF-8?q?=E5=AD=97-=E8=96=AA=E8=B5=84=E6=A0=B8=E7=AE=97=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=89=B9=E9=87=8F=E7=BC=96=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/iconfont/demo_index.html | 29 +++++++++++++++++++++++++--- public/css/iconfont/iconfont.css | 10 +++++++--- public/css/iconfont/iconfont.js | 2 +- public/css/iconfont/iconfont.json | 7 +++++++ public/css/iconfont/iconfont.ttf | Bin 5272 -> 5580 bytes public/css/iconfont/iconfont.woff | Bin 3240 -> 3428 bytes public/css/iconfont/iconfont.woff2 | Bin 2580 -> 2800 bytes 7 files changed, 41 insertions(+), 7 deletions(-) diff --git a/public/css/iconfont/demo_index.html b/public/css/iconfont/demo_index.html index 83eb5ca..aa55039 100644 --- a/public/css/iconfont/demo_index.html +++ b/public/css/iconfont/demo_index.html @@ -54,6 +54,12 @@
    +
  • + +
    批量更新
    +
    &#xe696;
    +
  • +
  • 全部
    @@ -138,9 +144,9 @@
    @font-face {
       font-family: 'iconfont';
    -  src: url('iconfont.woff2?t=1698914262517') format('woff2'),
    -       url('iconfont.woff?t=1698914262517') format('woff'),
    -       url('iconfont.ttf?t=1698914262517') format('truetype');
    +  src: url('iconfont.woff2?t=1701833672416') format('woff2'),
    +       url('iconfont.woff?t=1701833672416') format('woff'),
    +       url('iconfont.ttf?t=1701833672416') format('truetype');
     }
     

    第二步:定义使用 iconfont 的样式

    @@ -166,6 +172,15 @@
      +
    • + +
      + 批量更新 +
      +
      .icon-pilianggengxin +
      +
    • +
    • @@ -292,6 +307,14 @@
        +
      • + +
        批量更新
        +
        #icon-pilianggengxin
        +
      • +
      • ;u;70Wg#|+eCQcypa#DY)N5O`@`J0Cf*Pb0Npi38y1uBP zB0>5nZ0MH#k>}jrm!N}TNu|woP?677{6l8c)2xlNS0t$^V*(3WlTBf2b8->&qG)ZZ z_0Z^F@97=I{+0qsbjl-?=eZ1iIVfv?w3q^aAPo4ZB2)P;Qa%}%b zf#)N87q#_v<946*b`?~zo37c% z@k%{*DUeLh%8?2+dhts&X$twNWBH~_p@$V4TEqKJ_sah9V<9*P=zV`gya7R>wH-79 z)}I%VN$YY_YSxBKXv!Kxxy_1_M9Q@gns2xWaF4+NJR)FZV6Xtoi9BNSWBI8_h@sS4 z#yydwHc!Hod~a;dL#9GGh&uGR9JoqcSJ+XIbkjXNAc19LSc}EBlnGK^vS!| z^xdiTweo3jPbx<;gT3or=3l_GcKu9TOH!y0Zf6i|?bh)=yXm8oJS?*kZze*@Ihw zj@{c2pVt=ejN(9K!`H$}_50iJkM!-BZ@Dx(cD5N#GoCGS5$j73dJIod*N3!&0LbZJ?Nc#ZzxWMM`uFjO@4AXhB^}YKx z^?uWSwe9}>4ATKI(=ZC%yFLwbM6*)?1 zbGmn{VHu!}Xj-NMN8D_G;bO*dM-9jPWK*GLb!QD{cE*;S(#_=aaf-f*&AK`c%Y30D z;^D(baK!7~kLWlYv3WqqcjWH8zLGN!j`t<_69&vW*k4gOTqJ+d`QvA*WXTF1va2*c zX)N!r#s_02g_ZUZuUdN_cpu7VN9ilK{|e04or7St6)#~bNk9pIji%t@DP@G5a6&k5 z;xySsky!o2(p(^x$i1?9ln6k;8h}Vd5D*gqC(Svbv1wQlaLS_X_YWt7XtUM_5g_;} zu@q51hK1wg=2L(mnh?qW){-9~u$u@3&IC~l5E$2%M4OJIHsXgLg$U4z z2C@R0goQ#%j;$pCqQ*qgDg;W=`=%2Nn#cq(dj$*gZ6!)O|M*{A8zA)`pnhbzps{aN zcpx2REf`-qb2!(`mtuD+DDP?AldoH^cnL?SNm0INLK|{_j;SA-9;#2U3r8<5tuu-r zmEcd|LpF+kC?ed72}j%uh06ynp(8@1f#t(!ez@eZCa+Rp=`4< zW9$N0<3)qp9SpcU#SMclSJ2%dO>c{{ooZ}MNs=o*#^2jmYU909HbC5Bt=wr^qhu^* z>x^kZGy`#euD%(f_eXC(obUERet#BnX*sD+xNUOVfKC+dlay>K*RpKcmgUzRTT|X) ze&PZTyAC?^69DoYc7V0_5B7%5W)c7}H+=@kFW54c5KED=kI+%=A>0EC$&<_JSp`7e z&knLmMgL*8yiB3{KZqh>WyR%xn;I*8S83mzrk=Kc7cv=1NBlwnRG<+31o+tDjW|t( z<=d?%03G-2yNjA6Z7DY;7wSk~2zClUBM$;TX@*UB)P){JZvKqZqmIQCO2h+;rPzQ& zO1@$qS`-5XQYsc}kRPeH)*=esz(6=P02fA}m_Wd~VhRKH0z=Aa;E-~=n1_U1P$1>M zVhtvLesy?s>(Cr4Ez&t=HBR zsKNnW#*c>HGo->6WgAUv={!v;W->|+!=nNT&6Yoa-Cs>2u}JN{mH)msNb5YI5YZPe zDyQti!D2KM(5o6r+h!tH-?UX@TmcP*xdZTVGQ|KtaWatNb_>Z>|HvfRle0v>Fk|tye5^;=l8$y7j_* og)t%B#mx)-8`{ Date: Thu, 7 Dec 2023 09:22:54 +0800 Subject: [PATCH 05/15] =?UTF-8?q?master-=E8=96=AA=E8=B5=84=E6=A0=B8?= =?UTF-8?q?=E7=AE=97=E6=B7=BB=E5=8A=A0=E6=89=B9=E9=87=8F=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/atdTable/components/index.less | 4 ++-- src/pages/calcTable/calcExplainFooter.tsx | 4 ++++ src/pages/calcTable/customTableTitle.tsx | 12 +++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 8aa9522..12cae05 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -86,7 +86,7 @@ .expand-th:hover { .toogle-lock-tool { - width: 30%; + width: 37%; } } @@ -118,7 +118,7 @@ justify-content: center; align-items: center; - & > :first-child { + & > :not(:last-child) { margin-right: 4px; } diff --git a/src/pages/calcTable/calcExplainFooter.tsx b/src/pages/calcTable/calcExplainFooter.tsx index 5799820..6b6fa3e 100644 --- a/src/pages/calcTable/calcExplainFooter.tsx +++ b/src/pages/calcTable/calcExplainFooter.tsx @@ -29,6 +29,10 @@ const CalcExplainFooter: FunctionComponent = (props) => { {i18n["当前状态未锁定,点击锁定"]}

      +
      + + {i18n["批量更新"]} +
      ); }; diff --git a/src/pages/calcTable/customTableTitle.tsx b/src/pages/calcTable/customTableTitle.tsx index 3931d39..cdcad41 100644 --- a/src/pages/calcTable/customTableTitle.tsx +++ b/src/pages/calcTable/customTableTitle.tsx @@ -13,20 +13,22 @@ interface OwnProps { dataIndex?: string; title?: string; lockStatus?: string; + dataType?: string; onHandleFormulatd?: any; i18n?: any; + pattern?: number; } type Props = OwnProps; const customTableTitle: FunctionComponent = (props) => { - const { dataIndex, title, lockStatus, onHandleFormulatd, i18n = {} } = props; + const { dataIndex, title, lockStatus, onHandleFormulatd, i18n = {}, pattern, dataType } = props; - const handleToggleSalaryItemVal = (salaryItemId: string, type: string) => { + const handleToggleSalaryItemVal = (salaryItemId: string, type: string, updateParams: any = {}) => { window.parent.postMessage( { type: "turn", - payload: { id: "LOCKING", params: { lockType: type, salaryItemId } } + payload: { id: "LOCKING", params: { lockType: type, salaryItemId, ...updateParams } } }, "*" ); @@ -42,6 +44,10 @@ const customTableTitle: FunctionComponent = (props) => { onClick={() => handleToggleSalaryItemVal(dataIndex as string, "LOCK")}/> handleToggleSalaryItemVal(dataIndex as string, "UNLOCK")}/> + handleToggleSalaryItemVal(dataIndex as string, "BATCHUPDATE", { + pattern, salaryItemName: title, dataType + })}/>
    }
From 6c79742e755d9d164f0b74dfc7a38ce69856a299 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 7 Dec 2023 18:50:47 +0800 Subject: [PATCH 06/15] =?UTF-8?q?master-=E8=96=AA=E8=B5=84=E6=A0=B8?= =?UTF-8?q?=E7=AE=97=E8=A1=A8=E6=A0=BC=E9=80=82=E9=85=8D=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/calcTable/customTableTitle.tsx | 5 +++-- src/pages/calcTable/index.tsx | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/calcTable/customTableTitle.tsx b/src/pages/calcTable/customTableTitle.tsx index cdcad41..c88df83 100644 --- a/src/pages/calcTable/customTableTitle.tsx +++ b/src/pages/calcTable/customTableTitle.tsx @@ -17,12 +17,13 @@ interface OwnProps { onHandleFormulatd?: any; i18n?: any; pattern?: number; + calcDetail?: boolean; //查看详情页面 } type Props = OwnProps; const customTableTitle: FunctionComponent = (props) => { - const { dataIndex, title, lockStatus, onHandleFormulatd, i18n = {}, pattern, dataType } = props; + const { dataIndex, title, lockStatus, onHandleFormulatd, i18n = {}, pattern, dataType, calcDetail } = props; const handleToggleSalaryItemVal = (salaryItemId: string, type: string, updateParams: any = {}) => { window.parent.postMessage( @@ -38,7 +39,7 @@ const customTableTitle: FunctionComponent = (props) => {
onHandleFormulatd(dataIndex)}>{title}
{ - !!lockStatus && + !!lockStatus && !calcDetail &&
handleToggleSalaryItemVal(dataIndex as string, "LOCK")}/> diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 8af2648..5a78abe 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -29,6 +29,7 @@ const index: FunctionComponent = (props) => { const [pageInfo, setPageInfo] = useState>({}); const [i18n, setI18n] = useState({}); const [showTotalCell, setShowTotalCell] = useState(false); + const [isDetailTable, setIsDetailTable] = useState(false); const [sumRowlistUrl, setSumRowlistUrl] = useState(""); const [payload, setPayload] = useState(""); @@ -44,10 +45,11 @@ const index: FunctionComponent = (props) => { if (!_.isEmpty(data)) { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, - showTotalCell = false, sumRowlistUrl = "", payload = {} + showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); + setIsDetailTable(calcDetail); setI18n(i18nRes); setPayload(payload); setPageInfo(pageInfo); @@ -128,9 +130,10 @@ const index: FunctionComponent = (props) => { }; return (
} + columns={!isDetailTable ? columns : _.filter(columns, o => o.dataIndex !== "operate")} + footer={() => !isDetailTable ? : null} pagination={{ ...paginationFun(pageInfo, sizeChange, onChange, i18n), size: "default" From 104b36786c612a29b0eee9c63f82c7f89d40e262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 11 Dec 2023 14:45:15 +0800 Subject: [PATCH 07/15] master --- src/pages/reportTable/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/reportTable/index.tsx b/src/pages/reportTable/index.tsx index 61c14c0..61f1fef 100644 --- a/src/pages/reportTable/index.tsx +++ b/src/pages/reportTable/index.tsx @@ -26,15 +26,15 @@ const ReportTable: FC = (props) => { setSumRow(countResult); setColumns(_.map(columns, (item, index: number) => { if (index === 0) { - return { ...item, fixed: "left" }; + return { ...item, fixed: "left", ellipsis: true }; } return { ...item, children: _.map(item.children, child => { return { - ...child, + ...child, ellipsis: true, render: (text: string, record: any) => { - return + + ) + } + ] : columns); + } + }; + const handleEdit = (record: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); + }; + const onChange = (current: number, pageSize: number) => { + setPageInfo((prevState) => { + const { pageSize: size } = prevState; + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, current: size === pageSize ? current : 1, pageSize } } + }, + "*" + ); + return { ...pageInfo, current: size === pageSize ? current : 1, pageSize }; + }); + }; + return
; +}; + +export default TaxDeclareTable; From b992c06a21b578f2795541b6fd35f229d6f4bdac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 29 Dec 2023 10:17:56 +0800 Subject: [PATCH 09/15] master --- src/pages/atdTable/components/index.less | 8 +++----- src/pages/calcTable/calcFixedTotal.tsx | 2 +- src/pages/taxDeclareTable/index.tsx | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/atdTable/components/index.less b/src/pages/atdTable/components/index.less index 12cae05..7cded41 100644 --- a/src/pages/atdTable/components/index.less +++ b/src/pages/atdTable/components/index.less @@ -86,7 +86,7 @@ .expand-th:hover { .toogle-lock-tool { - width: 37%; + display: flex; } } @@ -102,17 +102,15 @@ height: 100%; .title-text { - width: 90%; + flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - flex: 1 1; cursor: pointer; } .toogle-lock-tool { - display: flex; - width: 0; + display: none; overflow: hidden; height: 100%; justify-content: center; diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index f6c50a1..b23504b 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -49,7 +49,7 @@ const calcFixedTotal: FunctionComponent = (props) => { return (<> { _.map(columns, (item: any, index) => { - return + return { loading ? : {sumRow[item.dataIndex] || "-"} diff --git a/src/pages/taxDeclareTable/index.tsx b/src/pages/taxDeclareTable/index.tsx index 2223e9e..1e4cef7 100644 --- a/src/pages/taxDeclareTable/index.tsx +++ b/src/pages/taxDeclareTable/index.tsx @@ -40,6 +40,7 @@ const TaxDeclareTable: FC = (props) => { render: (_: any, record: any) => ( + {/**/} ) } @@ -49,6 +50,9 @@ const TaxDeclareTable: FC = (props) => { const handleEdit = (record: any) => { window.parent.postMessage({ type: "turn", payload: { id: "EDIT", params: { ...record } } }, "*"); }; + const handleDelete = (record: any) => { + window.parent.postMessage({ type: "turn", payload: { id: "DELETE", params: { ...record } } }, "*"); + }; const onChange = (current: number, pageSize: number) => { setPageInfo((prevState) => { const { pageSize: size } = prevState; From 2f50be171ae2b188860cc24c0aedbc0a2dfaf262 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, 3 Jan 2024 14:31:31 +0800 Subject: [PATCH 10/15] master --- src/pages/calcTable/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 5a78abe..4343872 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -20,6 +20,7 @@ interface OwnProps { } type Props = OwnProps; +type fixedProps = boolean | "top" | "bottom"; const { Text } = Typography; const index: FunctionComponent = (props) => { @@ -32,6 +33,7 @@ const index: FunctionComponent = (props) => { const [isDetailTable, setIsDetailTable] = useState(false); const [sumRowlistUrl, setSumRowlistUrl] = useState(""); const [payload, setPayload] = useState(""); + const [fixed, setFixed] = useState(true); useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -45,13 +47,15 @@ const index: FunctionComponent = (props) => { if (!_.isEmpty(data)) { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, - showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail + showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, + fixed = true } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); setIsDetailTable(calcDetail); setI18n(i18nRes); setPayload(payload); + setFixed(fixed); setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); @@ -140,7 +144,7 @@ const index: FunctionComponent = (props) => { }} summary={() => ( !showTotalCell ? <> : - + {i18n["总计"]} From 156b3288b05ca5fdcc1dfe4ce7ca4188d2fb817c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 5 Jan 2024 10:32:13 +0800 Subject: [PATCH 11/15] master --- src/api/calculate.service.ts | 4 +--- src/pages/calcTable/calcFixedTotal.tsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/api/calculate.service.ts b/src/api/calculate.service.ts index 27ec01a..d7d843b 100644 --- a/src/api/calculate.service.ts +++ b/src/api/calculate.service.ts @@ -73,9 +73,7 @@ class CalculateService extends BasicService { return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, queryParams); }; //合计行 - getAcctResultsum = async (params: any) => { - return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params); - }; + getAcctResultsum = async (url: string, params: any) => (this.post(url, params)); //社保合计行 getSyMixSum = async (params: any) => { return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, params); diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index b23504b..cf35fa6 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -34,7 +34,7 @@ const calcFixedTotal: FunctionComponent = (props) => { return !_.isEmpty(props.columns) ? flattenFn(props.columns) : []; }, [props.columns]); const dataSourceUrl = useCallback((payload) => { - return API.CalculateService.getAcctResultsum(payload); + return API.CalculateService.getAcctResultsum(props.dataSourceUrl, payload); }, [props.dataSourceUrl]); useEffect(() => { if (!_.isEmpty(props.payload)) { From b9846d5abd40769f69cc061801cd1dabed3c4150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 8 Jan 2024 18:04:32 +0800 Subject: [PATCH 12/15] master --- src/layouts/config.js | 1 + src/pages/salaryFileTable/index.tsx | 102 ++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/pages/salaryFileTable/index.tsx diff --git a/src/layouts/config.js b/src/layouts/config.js index 873e8fe..4b582b2 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -18,6 +18,7 @@ module.exports = { "/employeeDeclareTable.*": "blank", "/taxDeclareTable.*": "blank", "/welfareArchiveTable.*": "blank", + "/salaryFileTable.*": "blank", "/OCTable.*": "blank", "/manage.*": "manage", "/portal.*": "template", diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx new file mode 100644 index 0000000..4611757 --- /dev/null +++ b/src/pages/salaryFileTable/index.tsx @@ -0,0 +1,102 @@ +/* + * Author: 黎永顺 + * name: 薪资档案重构-档案列表 + * Description: + * Date: 2024/1/8 + */ +import React, { FunctionComponent, useEffect, useMemo, useState } from "react"; +import { ColumnType } from "antd/lib/table"; +import { PaginationData } from "rc-pagination"; +import styles from "@/pages/atdTable/components/index.less"; +import { exceptStr, paginationAction } from "@/utils/common"; +import { Table } from "antd"; + +interface OwnProps { +} + +type Props = OwnProps; + +const Index: FunctionComponent = (props) => { + const [columns, setColumns] = useState[]>([]); + const [dataSource, setDataSource] = useState([]); + const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [pageInfo, setPageInfo] = useState>({}); + const [i18n, setI18n] = useState({}); + const [runStatuses, setRunStatuses] = useState(""); + const [showOperateBtn, setShowOperateBtn] = useState(false); + + useEffect(() => { + window.parent.postMessage({ type: "init" }, "*"); + window.addEventListener("message", receiveMessageFromIndex, false); + return () => { + window.removeEventListener("message", receiveMessageFromIndex, false); + }; + }, []); + + const receiveMessageFromIndex = (event: any) => { + const data: any = exceptStr(event.data); + if (!_.isEmpty(data)) { + const { + columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, + runStatuses, showOperateBtn + } = data; + setShowOperateBtn(showOperateBtn); + setRunStatuses(runStatuses); + setI18n(i18nRes); + setPageInfo(pageInfo); + setDataSource(dataSource); + setSelectedRowKeys(selectedRowKeys); + setColumns(columns); + } + }; + const onChange = (current: number, pageSize: number) => { + setPageInfo((prevState) => { + const { pageSize: size } = prevState; + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, current: size === pageSize ? current : 1, pageSize } } + }, + "*" + ); + return { ...pageInfo, current: size === pageSize ? current : 1, pageSize }; + }); + }; + const rowSelection = { + columnWidth: 60, + selectedRowKeys: selectedRowKeys, + onChange: (selectedRowKeys: React.Key[]) => { + setSelectedRowKeys(selectedRowKeys); + window.parent.postMessage( + { + type: "turn", + payload: { id: "CHECKBOX", params: { selectedRowKeys } } + }, + "*" + ); + } + }; + const handleWelfareOperate = (type: string, record: any, interfaceParams?: any) => { + window.parent.postMessage( + { + type: "turn", + payload: { id: type, params: { record, interfaceParams } } + }, + "*" + ); + }; + const cols: any = useMemo(() => { + return showOperateBtn ? [...columns] : [...columns]; + }, [columns, runStatuses, i18n, showOperateBtn]); + return (
); +}; + +export default Index; From 58152f05288ef40bdd76142ab66b5085eebe284c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 11 Jan 2024 14:52:52 +0800 Subject: [PATCH 13/15] master --- src/pages/calcTable/index.tsx | 6 +- src/pages/salaryFileTable/index.tsx | 118 ++++++++++++++++++++++++++-- 2 files changed, 114 insertions(+), 10 deletions(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 4343872..4a9b626 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -32,6 +32,7 @@ const index: FunctionComponent = (props) => { const [showTotalCell, setShowTotalCell] = useState(false); const [isDetailTable, setIsDetailTable] = useState(false); const [sumRowlistUrl, setSumRowlistUrl] = useState(""); + const [tableScrollHeight, setTableScrollHeight] = useState(0); const [payload, setPayload] = useState(""); const [fixed, setFixed] = useState(true); @@ -48,7 +49,7 @@ const index: FunctionComponent = (props) => { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, - fixed = true + fixed = true, tableScrollHeight } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); @@ -59,6 +60,7 @@ const index: FunctionComponent = (props) => { setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); + setTableScrollHeight(tableScrollHeight); setColumns([...convertColumns(_.map(columns, o => ({ ...o, i18n: i18nRes }))), { title: i18nRes["操作"], dataIndex: "operate", fixed: "right", width: 120, render: (__, record) => () @@ -135,7 +137,7 @@ const index: FunctionComponent = (props) => { return (
o.dataIndex !== "operate")} footer={() => !isDetailTable ? : null} pagination={{ diff --git a/src/pages/salaryFileTable/index.tsx b/src/pages/salaryFileTable/index.tsx index 4611757..52f96f8 100644 --- a/src/pages/salaryFileTable/index.tsx +++ b/src/pages/salaryFileTable/index.tsx @@ -9,7 +9,8 @@ import { ColumnType } from "antd/lib/table"; import { PaginationData } from "rc-pagination"; import styles from "@/pages/atdTable/components/index.less"; import { exceptStr, paginationAction } from "@/utils/common"; -import { Table } from "antd"; +import { Button, Dropdown, MenuProps, Space, Table } from "antd"; +import { MoreOutlined } from "@ant-design/icons"; interface OwnProps { } @@ -24,6 +25,7 @@ const Index: FunctionComponent = (props) => { const [i18n, setI18n] = useState({}); const [runStatuses, setRunStatuses] = useState(""); const [showOperateBtn, setShowOperateBtn] = useState(false); + const [showDelSalaryFileBtn, setShowDelSalaryFileBtn] = useState(false);//待定薪、停薪员工 是否允许删除薪资档案 useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -38,15 +40,16 @@ const Index: FunctionComponent = (props) => { if (!_.isEmpty(data)) { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, - runStatuses, showOperateBtn + selectedKey, showOperateBtn, showDelSalaryFileBtn } = data; setShowOperateBtn(showOperateBtn); - setRunStatuses(runStatuses); + setRunStatuses(selectedKey); setI18n(i18nRes); setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); setColumns(columns); + setShowDelSalaryFileBtn(showDelSalaryFileBtn); } }; const onChange = (current: number, pageSize: number) => { @@ -70,13 +73,13 @@ const Index: FunctionComponent = (props) => { window.parent.postMessage( { type: "turn", - payload: { id: "CHECKBOX", params: { selectedRowKeys } } + payload: { id: "ROWSELECTION", params: { selectedRowKeys } } }, "*" ); } }; - const handleWelfareOperate = (type: string, record: any, interfaceParams?: any) => { + const handleSalaryFileOperate = (type: string, record: any, interfaceParams?: any) => { window.parent.postMessage( { type: "turn", @@ -86,10 +89,109 @@ const Index: FunctionComponent = (props) => { ); }; const cols: any = useMemo(() => { - return showOperateBtn ? [...columns] : [...columns]; - }, [columns, runStatuses, i18n, showOperateBtn]); + if (!_.isEmpty(columns)) { + let opts: any = _.find(columns, o => o.dataIndex === "operate"); + switch (runStatuses) { + case "pending": + opts = { + ...opts, + render: (__: any, record: any) => { + let items: MenuProps["items"] = [ + { + key: "DeleteTodoList", + label: i18n["删除待办"], + onClick: () => handleSalaryFileOperate("DEL-PENDITNG-TO-DO", record, [record?.id]) + }, + { + key: "DeleteFiles", + label: i18n["删除档案"], + onClick: () => handleSalaryFileOperate("DEL-SALARY-FILES", record, [record?.id]) + } + ]; + !showDelSalaryFileBtn && (items = _.dropRight(items)); + return ( + + + + ) + }; + break; + case "suspend": + opts = { + ...opts, + render: (__: any, record: any) => { + const downsizingItems: MenuProps["items"] = [ + { + key: "DeleteTodoList", + label: i18n["删除待办"], + onClick: () => handleSalaryFileOperate("DEL-SUSPEND-TO-DO", record, [record?.id]) + } + ]; + return ( + + + + + + { + !_.isEmpty(stopItems) && + + ) + }]; + } else { + return []; + } + }, [columns, runStatuses, i18n, showOperateBtn, showDelSalaryFileBtn]); return (
Date: Wed, 17 Jan 2024 14:32:26 +0800 Subject: [PATCH 14/15] master --- src/pages/calcTable/calcFixedTotal.tsx | 7 +++++-- src/pages/calcTable/index.tsx | 12 +++++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/pages/calcTable/calcFixedTotal.tsx b/src/pages/calcTable/calcFixedTotal.tsx index cf35fa6..769cdb8 100644 --- a/src/pages/calcTable/calcFixedTotal.tsx +++ b/src/pages/calcTable/calcFixedTotal.tsx @@ -15,6 +15,7 @@ interface OwnProps { columns: ColumnType[]; dataSourceUrl: string; payload: any; + sumRow: Partial<{}>; } type Props = OwnProps; @@ -37,15 +38,17 @@ const calcFixedTotal: FunctionComponent = (props) => { return API.CalculateService.getAcctResultsum(props.dataSourceUrl, payload); }, [props.dataSourceUrl]); useEffect(() => { - if (!_.isEmpty(props.payload)) { + if (!_.isEmpty(props.payload) && !props.sumRow) { setLoading(true); dataSourceUrl(props.payload).then(({ data }) => { setLoading(false); const { data: result, status } = data; if (status) setSumRow(result.sumRow || {}); }); + } else { + setSumRow(props.sumRow); } - }, [props.payload]); + }, [props.payload, props.sumRow]); return (<> { _.map(columns, (item: any, index) => { diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 4a9b626..761078a 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -35,6 +35,7 @@ const index: FunctionComponent = (props) => { const [tableScrollHeight, setTableScrollHeight] = useState(0); const [payload, setPayload] = useState(""); const [fixed, setFixed] = useState(true); + const [sumRow, setSumRow] = useState>({});//总计行数据 useEffect(() => { window.parent.postMessage({ type: "init" }, "*"); @@ -49,7 +50,7 @@ const index: FunctionComponent = (props) => { const { columns, dataSource, pageInfo, selectedRowKeys, i18n: i18nRes = {}, showTotalCell = false, sumRowlistUrl = "", payload = {}, calcDetail, - fixed = true, tableScrollHeight + fixed = true, tableScrollHeight, sumRow } = data; setSumRowlistUrl(sumRowlistUrl); setShowTotalCell(showTotalCell); @@ -57,6 +58,7 @@ const index: FunctionComponent = (props) => { setI18n(i18nRes); setPayload(payload); setFixed(fixed); + setSumRow(sumRow); setPageInfo(pageInfo); setDataSource(dataSource); setSelectedRowKeys(selectedRowKeys); @@ -137,19 +139,19 @@ const index: FunctionComponent = (props) => { return (
o.dataIndex !== "operate")} footer={() => !isDetailTable ? : null} - pagination={{ + pagination={!_.isNil(pageInfo) ? { ...paginationFun(pageInfo, sizeChange, onChange, i18n), size: "default" - }} + } : false} summary={() => ( !showTotalCell ? <> : {i18n["总计"]} - + )} From 0c43d4789561810ccd8d126c4ef83c0ed95b3481 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, 17 Jan 2024 17:24:12 +0800 Subject: [PATCH 15/15] master --- src/pages/calcTable/index.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pages/calcTable/index.tsx b/src/pages/calcTable/index.tsx index 761078a..6e949fe 100644 --- a/src/pages/calcTable/index.tsx +++ b/src/pages/calcTable/index.tsx @@ -123,7 +123,9 @@ const index: FunctionComponent = (props) => { }); }; const rowSelection = { - columnWidth: 60, + columnWidth: 60, hideSelectAll: isDetailTable, + renderCell: (value: boolean, record: any, index: number, originNode: React.ReactNode) => (isDetailTable ? + {index + 1} : originNode), selectedRowKeys: selectedRowKeys, onChange: (selectedRowKeys: React.Key[]) => { setSelectedRowKeys(selectedRowKeys);