diff --git a/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js b/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js index 30e8cbc5..bd77c193 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/xbxt/personalSalaryReport.js @@ -34,6 +34,10 @@ class PersonalSalaryReport extends Component { window.addEventListener("message", this.handleReceive, false); } + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.dateRange !== this.props.dateRange) this.getSalaryReport(nextProps); + } + componentWillUnmount() { window.removeEventListener("message", this.handleReceive, false); } @@ -60,8 +64,9 @@ class PersonalSalaryReport extends Component { const childFrameObj = document.getElementById("atdTable"); childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; - getSalaryReport = () => { - const { pageInfo, dateRange } = this.state, [startDateStr, endDateStr] = dateRange; + getSalaryReport = (props) => { + const { pageInfo, dateRange: pageDateRange } = this.state, { dateRange } = props || this.props; + const [startDateStr, endDateStr] = dateRange || pageDateRange; const payload = { startDateStr, endDateStr, ...pageInfo }; this.setState({ loading: true }); postFetch("/api/bs/hrmsalary/report/statistics/employee/salaryReport", payload).then(({ status, data }) => { @@ -89,13 +94,25 @@ class PersonalSalaryReport extends Component { render() { - const { dataSource, loading, dateRange } = this.state; - const dom = document.querySelector(".wea-new-top-content"); + const { dataSource, loading, dateRange } = this.state, { isCom = false } = this.props; + const dom = document.querySelector(".wea-new-top-content") || document.querySelector(".wea-new-top-req-content"); let height = 280; if (dataSource.length > 0 && dom) { const tableHeight = dataSource.length * 39 + 127; height = dom.offsetHeight > tableHeight ? tableHeight : dom.offsetHeight; } + if (isCom) return ( +
+ +