custom/汇通建设

This commit is contained in:
lys 2024-11-22 18:03:53 +08:00
parent c3f54312d7
commit 5c8fa0cf73
1 changed files with 14 additions and 10 deletions

View File

@ -25,7 +25,7 @@ class Index extends Component {
super(props);
this.state = {
pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false, showSearchAd: false,
dataSource: [], columns: [], conditions: [], sumDataSource: {}, payload: {},
dataSource: [], columns: [], conditions: [], payload: {}, sumDataSource: {},
query: { billMonth: moment(new Date()).format("YYYY-MM") }
};
}
@ -71,28 +71,32 @@ class Index extends Component {
const payload = { ...pageInfo, ...query, ...advanceSearch };
this.setState({ loading: true });
API.getHTCommonListReport(payload).then(({ status, data }) => {
if (updateSum) this.getHTCommonListReportSum(payload);
this.setState({ loading: false });
if (status) {
const { columns, pageInfo: result } = data;
const { list: dataSource, pageNum: current, pageSize, total } = result;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, payload,
sumDataSource: updateSum ? sumRow : this.state.sumDataSource,
columns: _.map(columns, o => ({
title: o.text, dataIndex: o.column, width: o.width, ellipsis: true, fixed: o.fixed || false
}))
}, () => this.postMessageToChild({
scrollHeight: 152, dataSource: this.state.dataSource, columns: this.state.columns,
pageInfo: this.state.pageInfo, unitTableType: "999", showRowSelection: false,
showTotalCell: true, sumDataSource: this.state.sumDataSource
}));
}, () => {
const result = {
scrollHeight: 152, dataSource: this.state.dataSource, columns: this.state.columns,
pageInfo: this.state.pageInfo, unitTableType: "999", showRowSelection: false,
showTotalCell: true, sumDataSource: this.state.sumDataSource
};
this.postMessageToChild(result);
if (updateSum) this.getHTCommonListReportSum(payload, result);
});
}
}).catch(() => this.setState({ loading: false }));
};
getHTCommonListReportSum = (payload) => {
getHTCommonListReportSum = (payload, result) => {
API.getHTCommonListReportSum(payload).then(({ status, data }) => {
if (status) this.setState({ sumRow: data.sumRow });
if (status) this.setState({ sumDataSource: data.sumRow }, () => this.postMessageToChild({
...result, sumDataSource: data.sumRow
}));
});
};
handleExport = () => {