From 5dfcbe1af96e0dbe0bb342f43e3f3365aa6098c8 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, 19 Oct 2023 13:50:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=B3=9B=E5=BE=AE=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97iframe=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/calculate.service.ts | 4 + src/layouts/config.js | 1 + src/pages/welfareLedgerTable/index.tsx | 95 +++++++++++++++++++ .../welfareLedgerTable/welfareFixedTotal.tsx | 55 +++++++++++ 4 files changed, 155 insertions(+) create mode 100644 src/pages/welfareLedgerTable/index.tsx create mode 100644 src/pages/welfareLedgerTable/welfareFixedTotal.tsx diff --git a/src/api/calculate.service.ts b/src/api/calculate.service.ts index e3cf9dd..27ec01a 100644 --- a/src/api/calculate.service.ts +++ b/src/api/calculate.service.ts @@ -76,6 +76,10 @@ class CalculateService extends BasicService { getAcctResultsum = async (params: any) => { return this.post(`/api/bs/hrmsalary/salaryacct/acctresult/sum`, params); }; + //社保合计行 + getSyMixSum = async (params: any) => { + return this.post(`/api/bs/hrmsalary/siaccount/detail/list/syMixSum`, params); + }; } const calculateService = new CalculateService(); diff --git a/src/layouts/config.js b/src/layouts/config.js index 1f2bb09..ed0463e 100644 --- a/src/layouts/config.js +++ b/src/layouts/config.js @@ -13,6 +13,7 @@ module.exports = { "/reportTable.*": "blank", "/commonTable.*": "blank", "/calcTable.*": "blank", + "/welfareLedgerTable.*": "blank", "/payrollFilesTable.*": "blank", "/employeeDeclareTable.*": "blank", "/manage.*": "manage", diff --git a/src/pages/welfareLedgerTable/index.tsx b/src/pages/welfareLedgerTable/index.tsx new file mode 100644 index 0000000..8c6dec9 --- /dev/null +++ b/src/pages/welfareLedgerTable/index.tsx @@ -0,0 +1,95 @@ +/* + * Author: 黎永顺 + * name: 社保福利台账总览-穿透列表 + * Description: + * Date: 2023/10/17 + */ +import React, { FunctionComponent, useEffect, useState } from "react"; +import { Table, Typography } from "antd"; +import styles from "@/pages/atdTable/components/index.less"; +import { exceptStr, paginationFun } from "@/utils/common"; +import { IPage } from "@/common/types"; +import { ColumnType } from "antd/lib/table"; +import type { PaginationData } from "rc-pagination"; +import WelfareFixedTotal from "@/pages/welfareLedgerTable/welfareFixedTotal"; + +interface OwnProps { +} + +type Props = OwnProps; +const { Text } = Typography; + +const Index: FunctionComponent = (props) => { + const [columns, setColumns] = useState[]>([]); + const [dataSource, setDataSource] = useState([]); + const [pageInfo, setPageInfo] = useState>({}); + const [sumRowlistUrl, setSumRowlistUrl] = useState(""); + const [payload, setPayload] = 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, sumRowlistUrl = "", payload = {} + } = data; + setSumRowlistUrl(sumRowlistUrl); + setPayload(payload); + setPageInfo(pageInfo); + setDataSource(dataSource); + setColumns(_.map(columns, it => { + if (it.dataIndex === "userName") { + return { + ...it, width: 200, title: ( + + ), fixed: "left" + }; + } + return { + ...it, width: 200, title: ( + + ) + }; + })); + } + }; + const sizeChange = (pageobj: IPage) => { + }; + const onChange = (pageobj: IPage) => { + setPageInfo(() => { + window.parent.postMessage( + { + type: "turn", + payload: { id: "PAGEINFO", params: { ...pageInfo, ...pageobj } } + }, + "*" + ); + return { ...pageInfo, ...pageobj }; + }); + }; + return ( ( + + + 总计 + + + + )} + />); +}; + +export default Index; diff --git a/src/pages/welfareLedgerTable/welfareFixedTotal.tsx b/src/pages/welfareLedgerTable/welfareFixedTotal.tsx new file mode 100644 index 0000000..6d5678b --- /dev/null +++ b/src/pages/welfareLedgerTable/welfareFixedTotal.tsx @@ -0,0 +1,55 @@ +/* + * Author: 黎永顺 + * name:社保福利台账总览-总计行 + * Description: + * Date: 2023/10/17 + */ +import React, { FunctionComponent, useCallback, useEffect, useMemo, useState } from "react"; +import { ColumnType } from "antd/lib/table"; +import { Spin, Table, Typography } from "antd"; +import API from "@/api"; + +const { Text } = Typography; + +interface OwnProps { + columns: ColumnType[]; + dataSourceUrl: string; + payload: any; +} + +type Props = OwnProps; + +const welfareFixedTotal: FunctionComponent = (props) => { + const [sumRow, setSumRow] = useState>({});//薪资核算总计行数据 + const [loading, setLoading] = useState(false); + const columns = useMemo(() => { + return !_.isEmpty(props.columns) ? props.columns : []; + }, [props.columns]); + const dataSourceUrl = useCallback((payload) => { + return API.CalculateService.getSyMixSum(payload); + }, [props.dataSourceUrl]); + useEffect(() => { + if (!_.isEmpty(props.payload)) { + setLoading(true); + dataSourceUrl(props.payload).then(({ data }) => { + setLoading(false); + const { data: result, status } = data; + if (status) setSumRow(result.sumRow || {}); + }); + } + }, [props.payload]); + return (<> + { + _.map(columns.slice(1), (item: any, index) => { + return + { + loading ? : + {sumRow[item.dataIndex] || "-"} + } + ; + }) + } + ); +}; + +export default welfareFixedTotal; From 670d3da752f13dd8fd37e3feb88bdfdf83a14721 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, 27 Oct 2023 17:53:57 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B3=9B=E5=BE=AE=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97iframe=E8=A1=A8=E6=A0=BC-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/CustomIcon/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/CustomIcon/index.tsx b/src/lib/CustomIcon/index.tsx index b7d4212..cbb4149 100644 --- a/src/lib/CustomIcon/index.tsx +++ b/src/lib/CustomIcon/index.tsx @@ -13,7 +13,7 @@ const hrmSalaryUrl = "/spa/hrmSalary/hrmSalaryCalculateDetail/"; const Icon = createFromIconfontCN({ scriptUrl: [ // @ts-ignore - `${process.env.NODE_ENV === "dev" ? Util.getPublicPath() : hrmSalaryUrl}css/iconfont/iconfont.js` + `${process.env.NODE_ENV === "development" ? Util.getPublicPath() : hrmSalaryUrl}css/iconfont/iconfont.js` ] }); From e6e93f8fc490cc3c421fbd77a528783b5ab4a9b3 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, 7 Nov 2023 11:06:15 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=B3=9B=E5=BE=AE=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E6=A0=B8=E7=AE=97iframe=E8=A1=A8=E6=A0=BC-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/iconfont/demo_index.html | 213 ++++++++++++++++++++++- public/css/iconfont/iconfont.css | 42 ++++- public/css/iconfont/iconfont.js | 2 +- public/css/iconfont/iconfont.json | 67 ++++++- public/css/iconfont/iconfont.ttf | Bin 2248 -> 5272 bytes public/css/iconfont/iconfont.woff | Bin 167836 -> 3240 bytes public/css/iconfont/iconfont.woff2 | Bin 129256 -> 2580 bytes src/layouts/BlankLayout/index.tsx | 5 +- src/layouts/config.js | 1 + src/pages/atdTable/components/index.less | 15 ++ src/pages/calcTable/index.tsx | 2 +- src/pages/reportTable/index.tsx | 8 +- src/pages/welfareArchiveTable/index.tsx | 191 ++++++++++++++++++++ src/utils/common.js | 26 ++- 14 files changed, 554 insertions(+), 18 deletions(-) create mode 100644 src/pages/welfareArchiveTable/index.tsx diff --git a/public/css/iconfont/demo_index.html b/public/css/iconfont/demo_index.html index 7a1168c..83eb5ca 100644 --- a/public/css/iconfont/demo_index.html +++ b/public/css/iconfont/demo_index.html @@ -47,11 +47,67 @@
  • Symbol
  • + 查看项目 +
    ); +}; + +export default Index; diff --git a/src/utils/common.js b/src/utils/common.js index 891bb42..5fcaa49 100644 --- a/src/utils/common.js +++ b/src/utils/common.js @@ -72,14 +72,21 @@ export const exceptStr = (str) => { export const paginationFun = (tableListPageObj, sizeChange, onChange, i18n = {}) => { return { - current: tableListPageObj.pageNum, - pageSize: tableListPageObj.size, + current: tableListPageObj.pageNum || tableListPageObj.current, + pageSize: tableListPageObj.size || tableListPageObj.pageSize, total: tableListPageObj.total, showTotal: total => `${i18n["共"] ? i18n["共"] : "共"} ${total} ${i18n["条"] ? i18n["条"] : "条"}`, showQuickJumper: true, showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange: () => sizeChange(), + onShowSizeChange: (page, size) => { + const { total } = tableListPageObj; + sizeChange({ + pageNum: page, + size, + total + }); + }, onChange: (page, size) => { const { total } = tableListPageObj; onChange({ @@ -90,3 +97,16 @@ export const paginationFun = (tableListPageObj, sizeChange, onChange, i18n = {}) } }; }; + +export const paginationAction = (pageInfo = {}, i18n = {}, onChange, onShowSizeChange) => { + return { + pageSize: pageInfo.pageSize || 10, + current: pageInfo.current || 1, + total: pageInfo.total || 0, + pageSizeOptions: ["10", "20", "50", "100"], + showTotal: total => `${i18n["共"] ? i18n["共"] : "共"} ${total} ${i18n["条"] ? i18n["条"] : "条"}`, + onChange, onShowSizeChange, + showQuickJumper: true, + showSizeChanger: true + }; +}; 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 4/5] =?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 5/5] =?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