salary-management-front/pc4mobx/hrmSalary/pages/intelligentCalculateSalaryS.../components/monthStaticsDetailDialog/index.js

98 lines
3.1 KiB
JavaScript

/*
* 月度统计详情
*
* @Author: 黎永顺
* @Date: 2026/2/10
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDialog, WeaLocaleProvider, WeaTable } from "ecCom";
import { getStatisticsDetailList } from "../../../../apis/intelligentCalculateSalarySettings";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
class MonthStaticsDetailDialog extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: [], columns: [], pageInfo: { current: 0, pageSize: 10, total: 0 },
loading: false
};
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.visible !== this.props.visible && nextProps.visible) this.getStatisticsDetailList();
if (nextProps.visible !== this.props.visible && !nextProps.visible) {
this.setState({
dataSource: [], columns: [], pageInfo: { current: 0, pageSize: 10, total: 0 },
loading: false
});
}
}
getStatisticsDetailList = () => {
const { pageInfo } = this.state;
const payload = { ...pageInfo };
this.setState({ loading: true });
getStatisticsDetailList(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, pageInfo: { list: dataSource, pageNum: current, pageSize, total } } = data;
this.setState({
pageInfo: { current, pageSize, total }, dataSource, columns
});
}
}).catch(() => this.setState({ loading: false }));
};
render() {
const { loading, dataSource, columns, pageInfo } = this.state;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
showQuickJumper: true,
showSizeChanger: true,
pageSizeOptions: ["10", "20", "50", "100"],
onShowSizeChange: (current, pageSize) => {
this.setState({
pageInfo: { ...pageInfo, current, pageSize }
}, () => this.getStatisticsDetailList());
},
onChange: current => {
this.setState({
pageInfo: { ...pageInfo, current }
}, () => this.getStatisticsDetailList());
}
};
const scrollHeight = this.logRef ? this.logRef.state.height - 144 : 606.6;
return (
<WeaDialog
{...this.props} title={getLabel(111, "月度统计详情")}
ref={dom => this.logRef = dom} className="statiscalDialog" initLoadCss
style={{
width: 1150,
height: 606.6,
minHeight: 200,
minWidth: 380,
maxHeight: "90%",
maxWidth: "90%",
overflow: "hidden",
transform: "translate(0px, 0px)"
}}
>
<div className="statiscalDialogContent">
<WeaTable
columns={columns} dataSource={dataSource}
loading={loading} className="statiscalTable"
pagination={pagination} scroll={{ y: `${scrollHeight}px` }}
/>
</div>
</WeaDialog>
);
}
}
export default MonthStaticsDetailDialog;