From c048565890c95d39838f9c6bf23fffdf86d92c24 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, 24 Apr 2023 16:25:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=88=86=E6=9E=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/statistics.js | 8 +-- .../pages/reportView/components/condition.js | 2 +- .../reportView/components/reportContent.js | 11 +++- .../statisticalMicroSettingsSlide.js | 55 ++++++++++++------- pc4mobx/hrmSalary/pages/reportView/index.js | 4 +- 5 files changed, 53 insertions(+), 27 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index 03138258..767d8c7e 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -43,14 +43,14 @@ export const reportStatisticsItemSave = (params) => { return postFetch("/api/bs/hrmsalary/report/statistics/item/save", params); }; //保存数据范围及负责设置 -export const reportStatisticsItemSaveSearchCondition = (params) => { - return postFetch("/api/bs/hrmsalary/report/statistics/item/saveSearchCondition", params); +export const reportStatisticsSaveSearchCondition = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/report/saveSearchCondition", params); }; //删除自定义统计项目 export const reportStatisticsItemDelete = (params) => { return postFetch("/api/bs/hrmsalary/report/statistics/item/delete", params); }; //获取薪酬统计报表查询条件 -export const reportStatisticsItemGetSearchCondition = (params) => { - return postFetch("/api/bs/hrmsalary/report/statistics/item/getSearchCondition", params); +export const reportStatisticsGetSearchCondition = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/report/getSearchCondition", "GET", params); }; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js index a971b2b3..2f88f912 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js @@ -140,7 +140,7 @@ export const condition = [ { colSpan: 2, conditionType: "RANGEPICKER", - domkey: ["hiredate"], + domkey: ["hiredate1", "hiredate2"], fieldcol: 18, label: getLabel(111, "入职日期"), labelcol: 6, diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js index 9c84d067..3b72e070 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -63,7 +63,16 @@ class ReportContent extends Component { const { countResult, columns, pageInfo: { list } } = data; this.setState({ countResult, - columns: _.map(columns, it => ({ ...it, dataIndex: it.column, title: it.text, align: "center" })), + columns: _.map(columns, it => ({ + ...it, + dataIndex: it.column, width: 150, + title: it.text, align: "center", + children: !_.isNil(it.children) ? _.map(it.children, child => ({ + ...child, + dataIndex: child.column, width: 150, + title: child.text, align: "center" + })) : [] + })), dataSource: list || [] }, () => { this.postMessageToChild({ diff --git a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js index 9048d4c6..471a9a16 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js @@ -24,9 +24,9 @@ import { Button, message, Modal } from "antd"; import { condition } from "./condition"; import { getSearchs } from "../../../util"; import { + reportStatisticsGetSearchCondition, reportStatisticsItemDelete, - reportStatisticsItemGetSearchCondition, - reportStatisticsItemSaveSearchCondition, + reportStatisticsSaveSearchCondition, statisticsItemList } from "../../../apis/statistics"; import { commonEnumList } from "../../../apis/ruleconfig"; @@ -72,12 +72,9 @@ class StatisticalMicroSettingsSlide extends Component { nextProps.form.initFormFields(condition); } if (nextProps.id !== this.props.id && !_.isEmpty(nextProps.id)) { - this.reportStatisticsItemGetSearchCondition(nextProps.id); + this.reportStatisticsGetSearchCondition(nextProps.id); this.statisticsItemList(nextProps.id).then(r => { }); - this.setState({ - salaryMonth: [moment().startOf("year").format("YYYY-MM"), moment().format("YYYY-MM")] - }); } if (nextProps.visible !== this.props.visible && !nextProps.visible) { nextProps.form.resetForm(); @@ -85,18 +82,37 @@ class StatisticalMicroSettingsSlide extends Component { } } - reportStatisticsItemGetSearchCondition = (id) => { - reportStatisticsItemGetSearchCondition({ id }).then(({ status, data }) => { - if (status) { - console.log(data); + reportStatisticsGetSearchCondition = (id) => { + const { conditions } = this.state; + const { form } = this.props; + reportStatisticsGetSearchCondition({ id }).then(({ status, data }) => { + 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")] + }); + const fields = _.map(conditions[0].items, it => it.domkey[0]); + fields.map(item => { + const value = item.indexOf("hiredate") !== -1 ? { + value: formData["hiredate"] || [] + } : { + value: !_.isNil(formData[item]) ? _.map(formData[item], val => val.id).join(",") : "", + valueSpan: !_.isNil(formData[item]) ? _.map(formData[item], val => val.name).join(",") : "", + valueObj: !_.isNil(formData[item]) ? formData[item] : [] + }; + const key = item.indexOf("hiredate") !== -1 ? "hiredate1__hiredate2" : item; + form.updateFields({ + [key]: value + }); + }); } }); }; - reportStatisticsItemSaveSearchCondition = () => { + reportStatisticsSaveSearchCondition = () => { const { salaryMonth, dataSource } = this.state; - const { form, id, dimension } = this.props; + const { form, id, dimension, onClose } = this.props; const [salaryStartMonth, salaryEndMonth] = salaryMonth; - const { hiredate, department, employee, position, subCompany, taxAgent } = form.getFormDatas(); + const { department, employee, position, subCompany, taxAgent, ...extra } = form.getFormDatas(); const { value, valueSpan } = taxAgent; if (!salaryEndMonth && !salaryStartMonth) { this.refs.weaError.showError(); @@ -104,21 +120,21 @@ class StatisticalMicroSettingsSlide extends Component { } const payload = { dimension, id, - hiredate: hiredate.value, + hiredate: extra["hiredate1__hiredate2"].value || [], department: _.map(department.valueObj, it => ({ id: it.id, name: it.name })), employee: _.map(employee.valueObj, it => ({ id: it.id, name: it.name })), position: _.map(position.valueObj, it => ({ id: it.id, name: it.name })), 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, - salaryStartMonth + salaryEndMonth: salaryEndMonth + "-01", + salaryStartMonth: salaryStartMonth + "-01" }; this.setState({ loading: true }); - reportStatisticsItemSaveSearchCondition(payload).then(({ status, errormsg }) => { + reportStatisticsSaveSearchCondition(payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { - + onClose(true); message.success(getLabel(111, "保存成功")); } else { message.error(errormsg); @@ -237,6 +253,7 @@ class StatisticalMicroSettingsSlide extends Component { this.props.onClose()} top={0} measureT="%" width={800} @@ -244,7 +261,7 @@ class StatisticalMicroSettingsSlide extends Component { height={100} measureY="%" direction={"right"} - title={} + title={} content={ diff --git a/pc4mobx/hrmSalary/pages/reportView/index.js b/pc4mobx/hrmSalary/pages/reportView/index.js index 61f169d2..de4f9f6d 100644 --- a/pc4mobx/hrmSalary/pages/reportView/index.js +++ b/pc4mobx/hrmSalary/pages/reportView/index.js @@ -132,9 +132,9 @@ class Index extends Component { this.setState({ + onClose={(isRefresh) => this.setState({ statisticalPayload: { visible: false, id: "", dimension: "" } - })} + }, () => isRefresh && this.reportRef.reportStatisticsReportGetData(report.id, report.dimensionId))} />