From 8bd1cd51af2b5fea55d0529cf43d7dfcaf0b41e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Mon, 6 Nov 2023 17:05:26 +0800 Subject: [PATCH] =?UTF-8?q?feature/2.9.42310.02-=E8=96=AA=E9=85=AC?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8=E7=BB=9F=E8=AE=A1=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statisticalMicroSettingsSlide.js | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js index aae94c87..cdbe05c9 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js @@ -47,6 +47,7 @@ class StatisticalMicroSettingsSlide extends Component { dataSource: [], unitTypeList: [], salaryMonth: [], + salaryMonthDefault: "", showMonthRange: true, statisticalItemPayload: { visible: false, id: "", dimension: "", @@ -99,7 +100,8 @@ class StatisticalMicroSettingsSlide extends Component { if (status && !_.isEmpty(data)) { const { salaryEndMonth, salaryStartMonth, ...formData } = data.data; this.setState({ - salaryMonth: [salaryStartMonth || moment().startOf("year").format("YYYY-MM"), salaryEndMonth || moment().format("YYYY-MM")] + salaryMonth: [salaryStartMonth || moment().startOf("year").format("YYYY-MM"), salaryEndMonth || moment().format("YYYY-MM")], + salaryMonthDefault: salaryStartMonth || moment().startOf("year").format("YYYY-MM") }); const fields = _.map(conditions[0].items, it => it.domkey[0]); fields.map(item => { @@ -119,12 +121,12 @@ class StatisticalMicroSettingsSlide extends Component { }); }; reportStatisticsSaveSearchCondition = () => { - const { salaryMonth, dataSource } = this.state; + const { salaryMonth, salaryMonthDefault, dataSource } = this.state; const { form, id, dimension, onClose } = this.props; const [salaryStartMonth, salaryEndMonth] = salaryMonth; const { department, employee, position, subCompany, taxAgent, ...extra } = form.getFormDatas(); const { value, valueSpan } = taxAgent; - if (!salaryEndMonth || !salaryStartMonth) { + if ((!salaryEndMonth || !salaryStartMonth) && !salaryMonthDefault) { this.refs.weaError.showError(); return; } @@ -137,13 +139,14 @@ class StatisticalMicroSettingsSlide extends Component { subCompany: _.map(subCompany.valueObj, it => ({ id: it.id, name: it.name })), taxAgent: value ? _.map(value.split(","), (it, idx) => ({ id: it, name: valueSpan.split(",")[idx] })) : [], items: dataSource, - salaryEndMonth: salaryEndMonth + "-01", - salaryStartMonth: salaryStartMonth + "-01" + salaryEndMonth: (salaryEndMonth || salaryMonthDefault) + "-01", + salaryStartMonth: (salaryStartMonth || salaryMonthDefault) + "-01" }; this.setState({ loading: true }); reportStatisticsSaveSearchCondition(payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { + this.setState({ showMonthRange: true }); onClose(true); message.success(getLabel(111, "保存成功")); } else { @@ -233,7 +236,7 @@ class StatisticalMicroSettingsSlide extends Component { render() { const { - salaryMonth, showMonthRange, conditions, selectedRowKeys, loading, + salaryMonth, salaryMonthDefault, showMonthRange, conditions, selectedRowKeys, loading, statisticalItemPayload, dataSource, unitTypeList } = this.state; const { id, dimension, isShare } = this.props; @@ -275,7 +278,9 @@ class StatisticalMicroSettingsSlide extends Component { this.props.onClose()} + onClose={() => { + this.setState({ showMonthRange: true }, () => this.props.onClose()); + }} top={0} measureT="%" width={800} @@ -291,13 +296,21 @@ class StatisticalMicroSettingsSlide extends Component {
- this.setState({ salaryMonth: [v, v], showMonthRange: false })}/> + this.setState({ + salaryMonth: [v, v], + salaryMonthDefault: v, + showMonthRange: !v + })}/>
this.setState({ showMonthRange: true })}>{getLabel(111, "指定日期范围")} + onClick={() => this.setState({ + showMonthRange: true, + salaryMonth: [] + })}>{getLabel(111, "指定日期范围")} { showMonthRange &&