diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js index a7808410..2fc4c28b 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -6,7 +6,7 @@ */ import React, { Component } from "react"; import { Spin } from "antd"; -import { WeaEchart } from "ecCom"; +import { WeaEchart, WeaLocaleProvider } from "ecCom"; import RightOptions from "./rightOptions"; import ChartsRangeSettingsModal from "./chartsRangeSettingsModal"; import { mapBarOptions, mapLineOptions, mapPieOptions } from "./condition"; @@ -15,6 +15,8 @@ import PovitpivotChartModal from "./povitpivotChartModal"; import { getSalaryMonthValue } from "./statisticalMicroSettingsSlide"; import "../index.less"; +const getLabel = WeaLocaleProvider.getLabel; + class ReportContent extends Component { constructor(props) { super(props); @@ -33,7 +35,8 @@ class ReportContent extends Component { rangSet: { visible: false, reportId: "", rangeVal: {} - } + }, + pageInfo: { current: 1, pageSize: 10, total: 0 } }; } @@ -56,9 +59,9 @@ class ReportContent extends Component { handleReceive = ({ data }) => { const { type, payload: { id, params } = {} } = data; if (type === "init") { - const { columns, countResult, dataSource } = this.state; + const { columns, countResult, dataSource, pageInfo } = this.state; this.postMessageToChild({ - columns, countResult, dataSource, + columns, countResult, dataSource, pageInfo, showSum: !_.isEmpty(countResult) }); } else if (type === "turn") { @@ -72,30 +75,38 @@ class ReportContent extends Component { visible: true, id: pivotId, dimensionId, dimensionValue, isShare } }); + } else if (id === "PAGEINFO") { + this.setState({ pageInfo: { ...this.state.pageInfo, ...params } }, () => this.reportStatisticsReportGetData(this.props.report)); } } }; postMessageToChild = (payload) => { + const i18n = { + "共": getLabel(18609, "共"), "条": getLabel(18256, "条"), + "总计": getLabel(523, "总计") + }; const childFrameObj = document.getElementById("atdTable"); - const { dataSource, columns, showSum, countResult } = payload; + const { dataSource, columns, showSum, countResult, pageInfo } = payload; childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ - dataSource, columns, showSum, countResult + dataSource, columns, showSum, countResult, i18n, pageInfo }), "*"); }; reportStatisticsReportGetData = (params) => { - const { id, dimensionId, isShare, timeType, salaryEndMonth: end, salaryStartMonth: start } = params; + const { pageInfo } = this.state; + const { id, dimension, dimensionId, isShare, timeType, salaryEndMonth: end, salaryStartMonth: start } = params; const [salaryStartMonth, salaryEndMonth] = getSalaryMonthValue(timeType); const payload = { - id, dimensionId, isShare, + id, dimensionId, isShare, ...pageInfo, salaryStartMonth: (salaryStartMonth || start) + "-01", salaryEndMonth: (salaryEndMonth || end) + "-01" }; this.setState({ loading: true }); reportStatisticsReportGetData(payload).then(({ status, data }) => { this.setState({ loading: false }); if (status && id.toString() === data.reportId.toString()) { - const { countResult, columns, pageInfo: { list } } = data; + const { countResult, columns, pageInfo: { list, pageNum, pageSize, total } } = data; this.setState({ - countResult, + countResult, dataSource: list || [], + pageInfo: dimension === getLabel(111, "人员") ? { ...pageInfo, current: pageNum, pageSize, total } : null, columns: _.map(columns, it => ({ ...it, dataIndex: it.column, width: it.width ? it.width + "px" : 150, @@ -105,12 +116,11 @@ class ReportContent extends Component { dataIndex: child.column, width: child.width ? child.width + "px" : 150, title: child.text, align: "center" })) : [] - })), - dataSource: list || [] + })) }, () => { this.postMessageToChild({ columns: this.state.columns, countResult: this.state.countResult, - dataSource: this.state.dataSource, + dataSource: this.state.dataSource, pageInfo: this.state.pageInfo, showSum: !_.isEmpty(this.state.countResult) }); });