From 7cc9e422b1c08700ec735b98fbc38c6ab94e9db9 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 13:44:53 +0800 Subject: [PATCH] =?UTF-8?q?1feature/2.9.9.2312.01-=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E4=BB=A5=E5=8F=8A=E8=96=AA=E8=B5=84=E8=B4=A6?= =?UTF-8?q?=E5=A5=97=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../calcOc/components/salaryCalcOcList.js | 137 +++++++++--------- .../pages/calculate/calcOc/index.less | 21 +-- .../ledgerPage/components/ledgerSearchComp.js | 37 ++++- .../ledgerPage/components/ledgerTable.js | 7 +- pc4mobx/hrmSalary/pages/ledgerPage/index.js | 11 +- pc4mobx/hrmSalary/pages/ledgerPage/index.less | 4 + .../pages/reportView/components/condition.js | 26 ++-- .../statisticalMicroSettingsSlide.js | 4 +- 8 files changed, 126 insertions(+), 121 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/calculate/calcOc/components/salaryCalcOcList.js b/pc4mobx/hrmSalary/pages/calculate/calcOc/components/salaryCalcOcList.js index e3dda5fb..aefd3e5b 100644 --- a/pc4mobx/hrmSalary/pages/calculate/calcOc/components/salaryCalcOcList.js +++ b/pc4mobx/hrmSalary/pages/calculate/calcOc/components/salaryCalcOcList.js @@ -5,8 +5,8 @@ * Date: 2023/9/26 */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaTable } from "ecCom"; -import { Alert } from "antd"; +import { WeaLocaleProvider } from "ecCom"; +import { Alert, Spin } from "antd"; import { comparisonResultList } from "../../../../apis/calculate"; const getLabel = WeaLocaleProvider.getLabel; @@ -21,9 +21,35 @@ class SalaryCalcOcList extends Component { } componentDidMount() { - this.comparisonResultList(this.props); + window.addEventListener("message", this.handleReceive, false); } + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + } + + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.comparisonResultList(this.props); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + const { size: pageSize, pageNum: current } = params; + this.setState({ + pageInfo: { ...this.state.pageInfo, current, pageSize } + }, () => this.comparisonResultList(this.props)); + break; + case "FORMULA": + const { formulaDesc } = params; + this.setState({ formulaDesc }); + break; + default: + break; + } + } + }; + componentWillReceiveProps(nextProps, nextContext) { if ( (nextProps.form.onlyDiffEmployee !== this.props.form.onlyDiffEmployee) || @@ -34,6 +60,15 @@ class SalaryCalcOcList extends Component { } } + postMessageToChild = (payload = {}) => { + const i18n = { + "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), + "总计": getLabel(523, "总计"), "系统值": getLabel(543280, "系统值"), + "线下值": getLabel(543281, "线下值"), "差值": getLabel(543282, "差值") + }; + const childFrameObj = document.getElementById("atdTable"); + childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; comparisonResultList = (props) => { const { form, routeParams: { salaryAcctRecordId } } = props; const { pageInfo } = this.state; @@ -42,85 +77,47 @@ class SalaryCalcOcList extends Component { comparisonResultList(payload).then(({ status, data }) => { this.setState({ loading: false }); if (status) { - const { list: dataSource, columns, pageNum: current, pageSize, total } = data; + const { columns, pageInfo: { pageNum: current, pageSize, total, list: dataSource } } = data; this.setState({ - dataSource, columns, + dataSource, columns: this.convertColumns(columns), pageInfo: { ...pageInfo, current, pageSize, total } + }, () => { + const { pageInfo, dataSource, columns } = this.state; + this.postMessageToChild({ dataSource, pageInfo, columns }); }); } }).catch(() => this.setState({ loading: false })); }; - render() { - const { dataSource, loading, columns, pageInfo, formulaDesc } = this.state; - const pagination = { - ...pageInfo, - showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`, - showQuickJumper: true, - showSizeChanger: true, - pageSizeOptions: ["10", "20", "50", "100"], - onShowSizeChange: (current, pageSize) => { - this.setState({ - pageInfo: { ...pageInfo, current, pageSize } - }, () => this.comparisonResultList(this.props)); - }, - onChange: current => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => this.comparisonResultList(this.props)); + convertColumns = (cols) => { + return _.map(cols, (item, index) => { + const col = { title: item.text, dataIndex: item.column }; + if (_.isNaN(parseInt(item.column))) { + return item.fixed ? { ...col, width: 150, fixed: item.fixed } : index < 2 ? { + ...col, width: 150, fixed: "left" + } : { ...col, width: 150 }; + } else { + return { ...col, width: 180, children: this.convertColumns(item.children) }; } - }; + }); + }; + + render() { + const { loading, formulaDesc } = this.state; return ( - +
- { - if (i > 1) { - if (i > 2) { - return { - ...o, width: 180, - render: (__, record) => { - const formulaDesc = record["customParameters"][`${o["dataIndex"]}`]; - const showDifference = record[`${o["dataIndex"]}_type`] === "number"; - const { acctResultValue, excelResultValue } = record[o["dataIndex"]]; - return
this.setState({ formulaDesc })}> -
- {getLabel(543280, "系统值")}: - {acctResultValue} -
-
- {getLabel(543281, "线下值")}: - {excelResultValue} -
- { - showDifference && -
- {getLabel(543282, "差值")}: - {calculateDifference(acctResultValue, excelResultValue)} -
- } -
; - } - }; - } - return { ...o, width: 180 }; - } - return { ...o, width: 150, fixed: "left" }; - })} - /> - + +