diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js index c83fcf3b..32dd213a 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js @@ -33,23 +33,18 @@ class List extends Component { } componentWillReceiveProps(nextProps, nextContext) { - if (!this.handleDebounce) { - this.handleDebounce = _.debounce(() => { - this.getLYSalaryReportList(nextProps); - }, 500); - } - this.handleDebounce(); + if (nextProps.isQuery !== this.props.isQuery) this.getLYSalaryReportList(); } handleReceive = ({ data }) => { const { pageInfo } = this.state; const { type, payload: { id, params } = {} } = data; if (type === "init") { - this.getLYSalaryReportList(this.props); + this.getLYSalaryReportList(); } else if (type === "turn") { switch (id) { case "PAGEINFO": - this.setState({ pageInfo: { ...pageInfo, ...params } }, () => this.getLYSalaryReportList(this.props)); + this.setState({ pageInfo: { ...pageInfo, ...params } }, () => this.getLYSalaryReportList()); break; default: break; @@ -65,9 +60,8 @@ class List extends Component { childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*"); }; - getLYSalaryReportList = (props) => { - const { query } = props; - const { pageInfo } = this.state; + getLYSalaryReportList = () => { + const { query } = this.props, { pageInfo } = this.state; const payload = { ...pageInfo, ...query }; API.getLYSalaryReportList(payload).then(({ status, data }) => { if (status) { diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.js index 47fef9ad..8a3dff50 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.js @@ -19,23 +19,26 @@ class Index extends Component { constructor(props) { super(props); this.state = { - query: { salaryMonth: moment().format("YYYY-MM"), ffgsqc: "" } + query: { salaryMonth: moment().format("YYYY-MM"), ffgsqc: "" }, isQuery: false }; } render() { - const { query } = this.state; + const { query, isQuery } = this.state; const { salaryMonth, ffgsqc } = query; const buttons = [ this.setState({ query: { ...query, salaryMonth: value } })}/>, - this.setState({ query: { ...query, ffgsqc: value } })}/> + onChange={value => this.setState({ + query: { ...query, salaryMonth: value } + }, () => this.setState({ isQuery: !isQuery }))}/>, + this.setState({ query: { ...query, ffgsqc: value } })} + onSearch={() => this.setState({ isQuery: !isQuery })}/> ]; return ( } buttons={buttons} iconBgcolor="#F14A2D" showDropIcon={false} className="custom_salary_lingyue"> -
+
); } }