salary-management-front/pc4mobx/hrmSalary/pages/custom-pages/Omron/statisticalReport/index.js

65 lines
2.1 KiB
JavaScript

/*
* 欧姆龙二开
* 月度薪资环比统计报表(本月、上月维度比较)
* @Author: 黎永顺
* @Date: 2024/12/17
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDatePicker, WeaLocaleProvider, WeaTable, WeaTop } from "ecCom";
import * as API from "../../../../apis/custom-apis/omron";
import { Button } from "antd";
import moment from "moment";
import "./index.css";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
year: moment().format("YYYY"), dataSource: [], columns: [], loading: false
};
}
componentDidMount() {
this.getYdxzhbReportList();
}
getYdxzhbReportList = () => {
const { year } = this.state;
this.setState({ loading: true });
API.getYdxzhbReportList({ year }).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, data: dataSource } = data;
this.setState({
columns: _.map(columns, o => ({ dataIndex: o.column, title: o.text })), dataSource
});
}
});
};
render() {
const { year, dataSource, columns, loading } = this.state;
const buttons = [
<WeaDatePicker value={year} format="YYYY"
onChange={year => this.setState({ year }, () => this.getYdxzhbReportList())}/>,
<Button type="primary"
onClick={() => window.open(`/api/bs/hrmsalary/salaryacct/oml/exportYdxzhbReport?year=${year}`, "_blank")}>{getLabel(111, "导出")}</Button>
];
return (
<WeaTop title={getLabel(111, "月度薪资环比统计报表")} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
buttons={buttons} showDropIcon={false}>
<div className="omron_report">
<WeaTable pagination={false} columns={columns} dataSource={dataSource} loading={loading} bordered
scroll={{ y: "calc(100vh - 106px)" }}/>
</div>
</WeaTop>);
}
}
export default Index;