From 28a7bb7f646862babce45b9838bbb7ddefb8ecf5 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, 25 May 2023 14:39:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=BB=9F=E8=AE=A1=E5=88=86?= =?UTF-8?q?=E6=9E=90-=E5=91=98=E5=B7=A5=E6=98=8E=E7=BB=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/employeeDetails.js | 21 ++++---- pc4mobx/hrmSalary/pages/employeeView/index.js | 48 ++++++++++++------- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js index 6d9d0274..1360fb57 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js @@ -6,7 +6,7 @@ */ import React, { Component } from "react"; import { WeaLocaleProvider, WeaTable } from "ecCom"; -import { Menu, Popover } from "antd"; +import { Dropdown, Menu } from "antd"; import { statisticsEmployeeList } from "../../../apis/statistics"; import "../index.less"; @@ -56,19 +56,14 @@ class EmployeeDetails extends Component { width: 80, render: (_, record) => { return
- { - window.open(`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/analysisOfSalaryStatistics/${record.id}?name=${record.name}&dept=${record.department || ""}`); - }}> - {getLabel(111, "查看")} - - } - > + + {getLabel(111, "查看")} + + } overlayStyle={{ width: "auto", height: "auto" }}> - +
; } }] diff --git a/pc4mobx/hrmSalary/pages/employeeView/index.js b/pc4mobx/hrmSalary/pages/employeeView/index.js index 86a3353f..1d220a8c 100644 --- a/pc4mobx/hrmSalary/pages/employeeView/index.js +++ b/pc4mobx/hrmSalary/pages/employeeView/index.js @@ -26,7 +26,12 @@ class Index extends Component { taxAgentId: "", salaryMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")], dataSource: [], - columns: [] + columns: [], + pageInfo: { + current: 1, + pageSize: 10, + total: 0 + } }; } @@ -41,45 +46,56 @@ class Index extends Component { } handleReceive = ({ data }) => { - const { type } = data; + const { type, payload: { id, params } = {} } = data; + const { columns, dataSource, pageInfo } = this.state; if (type === "init") { - const { columns, dataSource } = this.state; this.postMessageToChild({ columns, dataSource, - showSum: false + showSum: false, pageInfo }); } else if (type === "turn") { + if (id === "PAGEINFO") { + const { pageNum: current, size: pageSize } = params; + this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () => this.statisticsEmployeeDetailList()); + } } }; postMessageToChild = (payload) => { const childFrameObj = document.getElementById("atdTable"); - const { dataSource, columns, showSum } = payload; + const { dataSource, columns, showSum, pageInfo } = payload; childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ - dataSource, columns, showSum + dataSource, columns, showSum, pageInfo }), "*"); }; statisticsEmployeeDetailList = () => { const { params: { employeeId } } = this.props; - const { taxAgentId, salaryMonth } = this.state; - const payload = { employeeId, taxAgentId, salaryMonth }; + const { taxAgentId, salaryMonth, pageInfo } = this.state; + const payload = { + employeeId, taxAgentId, + salaryMonth: salaryMonth.map(item => moment(item).format("YYYY-MM-DD")), + ...pageInfo + }; this.setState({ loading: true }); statisticsEmployeeDetailList(payload).then(({ status, data }) => { this.setState({ loading: false }); if (status) { - const { columns, pageInfo: { list } } = data; + const { columns, pageInfo: { list, pageNum: current, pageSize, total } } = data; this.setState({ - columns: _.map(columns, it => ({ + columns: _.map(columns, (it, idx) => ({ ...it, - dataIndex: it.column, width: 150, - title: it.text, align: "left" + dataIndex: it.text, width: 150, + title: it.width, align: "left", + fixed: (idx === 1 || idx === 0) ? "left" : "", + ellipsis: true })), - dataSource: list || [] + dataSource: list || [], + pageInfo: { ...pageInfo, current, pageSize, total } }, () => { this.postMessageToChild({ columns: this.state.columns, dataSource: this.state.dataSource, - showSum: false + showSum: false, pageInfo: this.state.pageInfo }); }); } @@ -106,8 +122,8 @@ class Index extends Component {