From 121d82d379bfc94dbe830c3f1540d6e7fe293105 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, 1 Nov 2023 16:18:51 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.9.42310.02-=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=E9=A1=B5=E9=9D=A2=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/welfareTableList/index.js | 98 +++++++++++-------- .../components/welfareTip/index.js | 10 +- .../welfareArchive/config.js | 78 +++++++++++++++ .../welfareArchive/index.js | 6 +- .../welfareArchive/index.less | 41 ++++++-- 5 files changed, 180 insertions(+), 53 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js index aa7993ad..60cb2d50 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/welfareArchive/components/welfareTableList/index.js @@ -5,8 +5,8 @@ * Date: 2023/10/31 */ import React, { Component } from "react"; -import { WeaLocaleProvider, WeaTable } from "ecCom"; -import {Table} from "antd" +import { WeaLocaleProvider } from "ecCom"; +import { Spin } from "antd"; import { inject, observer } from "mobx-react"; import { getExtTable, queryList } from "../../../../../apis/welfareArchive"; @@ -22,19 +22,43 @@ class Index extends Component { constructor(props) { super(props); this.state = { - dataSource: [], columns: [], loading: false, pageInfo: { current: 0, pageSize: 10, total: 0 }, + dataSource: [], columns: [], loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 }, selectedRowKeys: [] }; } componentDidMount() { - this.getWelfareList(this.props); + window.addEventListener("message", this.handleReceive, false); + } + + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); } componentWillReceiveProps(nextProps, nextContext) { - if ((nextProps.runStatuses !== this.props.runStatuses) || (nextProps.isQuery !== this.props.isQuery)) this.getWelfareList(nextProps); + if ((nextProps.runStatuses !== this.props.runStatuses) || (nextProps.isQuery !== this.props.isQuery)) { + this.setState({ + pageInfo: { ...this.state.pageInfo, current: 1, pageSize: 10, total: 0 } + }, () => this.getWelfareList(nextProps)); + } } + handleReceive = async ({ data }) => { + const { type, payload: { id, params } = {} } = data; + if (type === "init") { + this.getWelfareList(this.props); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + this.setState({ + pageInfo: { ...this.state.pageInfo, ...params } + }, () => this.getWelfareList(this.props)); + break; + default: + break; + } + } + }; getWelfareList = (props) => { const { pageInfo } = this.state; const { archivesStore: { welfareForm }, runStatuses, onChangeTopTabCount } = props; @@ -54,52 +78,46 @@ class Index extends Component { const { column: dataIndex, text: title, width } = o; if (dataIndex === "employeeName") { return { - dataIndex, title, width, fixed: "left", - render: (txt) => ({txt}) + dataIndex, title, width, fixed: "left", ellipsis: true }; } return { - dataIndex, title, width, - render: (txt) => ({txt}) + dataIndex, title, width, ellipsis: true }; }) - }, () => onChangeTopTabCount(runStatuses, total)); + }, () => { + const { pageInfo, selectedRowKeys, columns, dataSource } = this.state; + onChangeTopTabCount(runStatuses, total); + this.postMessageToChild({ + dataSource, pageInfo, selectedRowKeys, runStatuses, + columns + }); + }); } }).catch(() => this.setState({ loading: false })); }; + postMessageToChild = (payload = {}) => { + const i18n = { + "操作": getLabel(30585, "操作"), + "共": getLabel(18609, "共"), "条": getLabel(18256, "条") + }; + const childFrameObj = document.getElementById("atdTable"); + childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; render() { - const { dataSource, columns, loading, pageInfo, selectedRowKeys } = 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.getWelfareList(this.props)); - }, - onChange: current => { - this.setState({ - pageInfo: { ...pageInfo, current } - }, () => this.getWelfareList(this.props)); - } - }; - const rowSelection = { - selectedRowKeys, - onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }) - }; + const { loading, dataSource } = this.state; return ( - (123) - }]} - /> +
+ +