From 1afaa041294e64e1d5ea9c587d122caa4b17bb05 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, 9 Nov 2023 15:36:13 +0800 Subject: [PATCH] 1release/2.9.42311.01 --- .../reportView/components/reportContent.js | 19 ++++++++++++------- .../statisticalMicroSettingsSlide.js | 2 +- pc4mobx/hrmSalary/pages/reportView/index.js | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js index 70980238..37700a22 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -12,6 +12,7 @@ import ChartsRangeSettingsModal from "./chartsRangeSettingsModal"; import { mapBarOptions, mapLineOptions, mapPieOptions } from "./condition"; import { queryRangeSetting, reportStatisticsReportGetData } from "../../../apis/statistics"; import PovitpivotChartModal from "./povitpivotChartModal"; +import { getSalaryMonthValue } from "./statisticalMicroSettingsSlide"; import "../index.less"; class ReportContent extends Component { @@ -43,7 +44,7 @@ class ReportContent extends Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.report !== this.props.report && nextProps.report.dimensionId) { - this.reportStatisticsReportGetData(nextProps.report.id, nextProps.report.dimensionId, nextProps.report.isShare); + this.reportStatisticsReportGetData(nextProps.report); this.setState({ viewType: "dataView", chartsInfo: {} }); } } @@ -81,8 +82,13 @@ class ReportContent extends Component { dataSource, columns, showSum, countResult }), "*"); }; - reportStatisticsReportGetData = (id, dimensionId, isShare) => { - const payload = { id, dimensionId, isShare }; + reportStatisticsReportGetData = (params) => { + const { id, dimensionId, isShare, timeType, salaryEndMonth: end, salaryStartMonth: start } = params; + const [salaryStartMonth, salaryEndMonth] = getSalaryMonthValue(timeType); + const payload = { + id, dimensionId, isShare, + salaryStartMonth: (salaryStartMonth || start) + "-01", salaryEndMonth: (salaryEndMonth || end) + "-01" + }; this.setState({ loading: true }); reportStatisticsReportGetData(payload).then(({ status, data }) => { this.setState({ loading: false }); @@ -191,13 +197,13 @@ class ReportContent extends Component { handleChangeChartOpts = (chartsType, viewType) => { this.setState({ chartsInfo: {} }); if (this.refs.chart && viewType !== "setting" && viewType !== "dataView" && !this.state.rangSet.visible) this.refs.chart.clear(); - const { report: { id: reportId, dimensionId, isShare } } = this.props; + const { report: { id: reportId } } = this.props; const { rangSet } = this.state; viewType !== "setting" && this.setState({ chartsType, viewType }, () => { const { viewType, chartsType } = this.state; viewType !== "dataView" ? this.queryRangeSetting({ reportId, chartsType }, true) : - this.reportStatisticsReportGetData(reportId, dimensionId, isShare); + this.reportStatisticsReportGetData(this.props.report); }); viewType === "setting" && this.setState({ rangSet: { ...rangSet, visible: true, reportId } }, () => { this.queryRangeSetting({ reportId, chartsType }); @@ -213,8 +219,7 @@ class ReportContent extends Component { }; handleGetData = () => { const { report } = this.props; - const { id, dimensionId, isShare } = report; - this.setState({ viewType: "dataView" }, () => this.reportStatisticsReportGetData(id, dimensionId, isShare)); + this.setState({ viewType: "dataView" }, () => this.reportStatisticsReportGetData(report)); }; renderCharts = () => { const { chartsInfo, viewType } = this.state; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js index 261330e2..35b36fa5 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js @@ -436,7 +436,7 @@ export const MonthRangePicker = (props) => { ; }; // 获取所属月份值 -const getSalaryMonthValue = (dateType) => { +export const getSalaryMonthValue = (dateType) => { let start = "", end = ""; switch (dateType) { case 1: diff --git a/pc4mobx/hrmSalary/pages/reportView/index.js b/pc4mobx/hrmSalary/pages/reportView/index.js index ffe5a3db..14be4f97 100644 --- a/pc4mobx/hrmSalary/pages/reportView/index.js +++ b/pc4mobx/hrmSalary/pages/reportView/index.js @@ -113,7 +113,7 @@ class Index extends Component { ref={dom => this.leftTabRef = dom} onChangeTab={report => this.setState({ - report, + report: !_.isNil(report) ? report : this.state.report, statisticalPayload: { visible: false, id: "", dimension: "" } })} /> @@ -152,7 +152,7 @@ class Index extends Component { taxAgentAdminOption={taxAgentOption} isShare={isShare} onClose={(isRefresh) => this.setState({ statisticalPayload: { visible: false, id: "", dimension: "" } - }, () => isRefresh && this.reportRef.reportStatisticsReportGetData(report.id, report.dimensionId, report.isShare))} + }, () => isRefresh && this.leftTabRef.reportStatisticsReportList())} />