custom/领悦

This commit is contained in:
黎永顺 2024-08-22 17:53:18 +08:00
parent 772ef95416
commit 8f6f762a44
2 changed files with 13 additions and 16 deletions

View File

@ -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) {

View File

@ -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 = [
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={value => this.setState({ query: { ...query, salaryMonth: value } })}/>,
<WeaInputSearch value={ffgsqc} onChange={value => this.setState({ query: { ...query, ffgsqc: value } })}/>
onChange={value => this.setState({
query: { ...query, salaryMonth: value }
}, () => this.setState({ isQuery: !isQuery }))}/>,
<WeaInputSearch value={ffgsqc} onChange={value => this.setState({ query: { ...query, ffgsqc: value } })}
onSearch={() => this.setState({ isQuery: !isQuery })}/>
];
return (
<WeaTop
title={getLabel(111, "薪资汇总表")} icon={<i className="icon-coms-fa"/>} buttons={buttons}
iconBgcolor="#F14A2D" showDropIcon={false} className="custom_salary_lingyue">
<div className="lingyue-body"><List query={query}/></div>
<div className="lingyue-body"><List query={query} isQuery={isQuery}/></div>
</WeaTop>);
}
}