Merge branch 'hotfix/2.14.2.2406.02' into release/2.14.5.2406.03

This commit is contained in:
黎永顺 2024-07-15 11:36:41 +08:00
commit 84ed52dfde
1 changed files with 23 additions and 13 deletions

View File

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