diff --git a/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js b/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js index 49471b95..d5ef992c 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js @@ -22,7 +22,7 @@ class PersonalSalaryReport extends Component { constructor(props) { super(props); this.state = { - loading: false, dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, + loading: false, dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, sumRow: {}, dateRange: [ moment(new Date()).subtract(12, "months").format("YYYY-MM"), moment(new Date()).format("YYYY-MM") @@ -65,7 +65,7 @@ class PersonalSalaryReport extends Component { childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; getSalaryReport = (props) => { - const { pageInfo, dateRange: pageDateRange } = this.state, { dateRange } = props || this.props; + const { pageInfo, dateRange: pageDateRange } = this.state, { dateRange, isCom } = props || this.props; const [startDateStr, endDateStr] = dateRange || pageDateRange; if (!startDateStr || !endDateStr) { message.warning(getLabel(111, "请选择薪资所属月!")); @@ -81,9 +81,9 @@ class PersonalSalaryReport extends Component { this.setState({ columns, dataSource, pageInfo: { ...pageInfo, current, total, pageSize } }, () => { - const { columns, dataSource, pageInfo } = this.state; + const { columns, dataSource, pageInfo, sumRow } = this.state; this.postMessageToChild({ - dataSource, pageInfo, showTotalCell: false, calcDetail: true, tableScrollHeight: 107, + dataSource, pageInfo, showTotalCell: isCom, calcDetail: true, tableScrollHeight: 107, sumRow, columns: _.map(columns, (it, idx) => ({ dataIndex: it.column, title: it.text, calcDetail: true, showSee: false, width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.width, @@ -92,9 +92,27 @@ class PersonalSalaryReport extends Component { })) }); }); + isCom && this.getSalaryReportSum(payload, { + dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, + showTotalCell: true, calcDetail: true, tableScrollHeight: 107, + columns: _.map(columns, (it, idx) => ({ + dataIndex: it.column, title: it.text, calcDetail: true, showSee: false, + width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.width, + fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "", + ellipsis: true + })) + }); } }).catch(() => this.setState({ loading: false })); }; + getSalaryReportSum = (payload, tableData) => { + postFetch("/api/bs/hrmsalary/report/statistics/employee/salaryReportSum", payload).then(({ status, data }) => { + if (status) this.setState({ sumRow: data.sumRow }, () => { + const { sumRow } = this.state; + this.postMessageToChild({ ...tableData, sumRow }); + }); + }); + }; render() { @@ -106,7 +124,7 @@ class PersonalSalaryReport extends Component { height = dom.offsetHeight > tableHeight ? tableHeight : dom.offsetHeight; } if (isCom) return ( -
+