From c5a62b3c26a2af0d71cfeae7827c04f3197560a8 Mon Sep 17 00:00:00 2001 From: lys <971387674@qq.com> Date: Wed, 30 Oct 2024 10:20:43 +0800 Subject: [PATCH 1/4] =?UTF-8?q?custom/=E4=BA=AC=E8=B4=B5=E6=8A=95=E8=B5=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/addItems.js | 4 +- .../dataAcquisition/cumDeduct/columns.js | 6 +- .../pages/dataAcquisition/cumDeduct/index.js | 10 +- .../pages/dataAcquisition/dataTables.js | 94 ++++++++++++++----- .../pages/dataAcquisition/index.less | 15 ++- .../hrmSalary/pages/dataAcquisition/layout.js | 7 +- 6 files changed, 97 insertions(+), 39 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js index 5b05c2d6..a3a98e5e 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/addItems.js @@ -61,8 +61,8 @@ class AddItems extends Component { render() { const { form, condition = [] } = this.props; return ( -
- {getSearchs(form, condition)} +
+ {getSearchs(form, condition, 2, false)} 若此员工数据已存在在同期列表中,则当前数据保存后会覆盖列表数据
); diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js index 742d1573..8945d37b 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/columns.js @@ -404,7 +404,7 @@ export const dataCollectCondition = [ fieldcol: 12, label: "税款所属期", lanId: 542240, - labelcol: 4, + labelcol: 8, value: "", rules: "required|string", viewAttr: 3 @@ -414,7 +414,7 @@ export const dataCollectCondition = [ domkey: ["taxAgentId"], fieldcol: 12, label: "个税扣缴义务人", - labelcol: 4, + labelcol: 8, lanId: 537996, value: "", options: [], @@ -448,7 +448,7 @@ export const dataCollectCondition = [ isQuickSearch: false, label: "人员", lanId: 30042, - labelcol: 4, + labelcol: 8, rules: "required", viewAttr: 3 } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 9f1e481f..2d7d12f6 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -244,10 +244,12 @@ class Index extends Component { }; this.handleSaveDeduction(payload); } else { - Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" - }); + f.showErrors(); + this.forceUpdate(); + // Modal.warning({ + // title: "信息确认", + // content: "必要信息不完整,红色*为必填项!" + // }); } }); }; diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index e677d531..58acfc56 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -5,9 +5,9 @@ * Date: 2023/2/17 */ import React, { Component } from "react"; -import UnifiedTable from "../../components/UnifiedTable"; +// import UnifiedTable from "../../components/UnifiedTable"; import { getTableDate } from "../../apis/cumDeduct"; -import { Menu, Popover } from "antd"; +import { Menu, Popover, Spin } from "antd"; import { WeaLocaleProvider } from "ecCom"; const getLabel = WeaLocaleProvider.getLabel; @@ -16,24 +16,44 @@ class DataTables extends Component { constructor(props) { super(props); this.state = { - loading: { - query: false - }, - dataSource: [], - columns: [], - selectedRowKeys: [], - pageInfo: { - current: 1, pageSize: 10, total: 0 - } + loading: { query: false }, dataSource: [], columns: [], selectedRowKeys: [], + pageInfo: { current: 1, pageSize: 10, total: 0 } }; } componentDidMount() { - this.getTableDate(); + 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.getTableDate(); + } else if (type === "turn") { + switch (id) { + case "PAGEINFO": + this.setState({ pageInfo: { ...this.state.pageInfo, ...params } }, () => this.getTableDate()); + break; + case "CHECKBOX": + const { selectedRowKeys } = params; + this.setState({ selectedRowKeys }); + break; + case "DEL": + break; + case "EDIT": + break; + default: + break; + } + } + }; + getTableDate = (extraPayload = {}) => { - const { loading, pageInfo } = this.state; + const { loading, pageInfo, selectedRowKeys } = this.state; const { url, payload } = this.props; const module = { ...pageInfo, url, ...payload, ...extraPayload, @@ -45,10 +65,12 @@ class DataTables extends Component { if (status) { const { columns, list: dataSource, pageNum: current, pageSize, total } = data; this.setState({ - pageInfo: { ...pageInfo, current, pageSize, total }, - dataSource, - columns - }); + pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, columns + }, () => this.postMessageToChild({ + dataSource: this.state.dataSource, scrollHeight: 95, selectedRowKeys, + pageInfo: this.state.pageInfo, unitTableType: "dataAcquisition", + columns: this.state.columns + })); } }).catch(() => this.setState({ loading: { ...loading, query: false } })); }; @@ -59,6 +81,14 @@ class DataTables extends Component { * Date: 2023/2/20 */ handleClearRows = () => this.setState({ selectedRowKeys: [] }); + postMessageToChild = (payload = {}) => { + const i18n = { + "操作": getLabel(30585, "操作"), "编辑": getLabel(111, "编辑"), "共": getLabel(18609, "共"), + "条": getLabel(18256, "条"), "删除": getLabel(111, "删除") + }; + const childFrameObj = document.getElementById("unitTable"); + childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); + }; render() { const { columns, dataSource, loading, selectedRowKeys, pageInfo } = this.state; @@ -168,15 +198,27 @@ class DataTables extends Component { }; } }); - return ; + let height = 280; + if (dataSource.length > 0) height = dataSource.length <= 10 ? dataSource.length * 46 + 108 : 500; + return (
+ +