2023-04-17 17:32:16 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
|
* name: 统计表
|
|
|
|
|
|
* Description:
|
|
|
|
|
|
* Date: 2023/4/17
|
|
|
|
|
|
*/
|
|
|
|
|
|
import React, { Component } from "react";
|
|
|
|
|
|
import { WeaLocaleProvider } from "ecCom";
|
2023-04-19 09:29:38 +08:00
|
|
|
|
import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd";
|
|
|
|
|
|
import { reportStatisticsReportDelete, reportStatisticsReportList } from "../../../apis/statistics";
|
2023-04-17 17:32:16 +08:00
|
|
|
|
import "../index.less";
|
|
|
|
|
|
|
2023-04-19 09:29:38 +08:00
|
|
|
|
const SubMenu = Menu.SubMenu;
|
2023-04-17 17:32:16 +08:00
|
|
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
|
|
|
|
|
|
|
|
class ReportList extends Component {
|
2023-04-19 09:29:38 +08:00
|
|
|
|
constructor(props) {
|
|
|
|
|
|
super(props);
|
|
|
|
|
|
this.state = {
|
|
|
|
|
|
dataSource: []
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
|
this.reportStatisticsReportList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleOptsClick = ({ key }, id, dimensionId) => {
|
|
|
|
|
|
if (key === "delete") {
|
2023-04-20 15:36:51 +08:00
|
|
|
|
this.reportStatisticsReportDelete(id.split(","));
|
2023-04-19 09:29:38 +08:00
|
|
|
|
} else if (key === "edit") {
|
|
|
|
|
|
this.props.onEdit("addReport", id);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
reportStatisticsReportDelete = (payload) => {
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: getLabel(111, "信息确认"),
|
|
|
|
|
|
content: getLabel(111, "确认删除本条数据吗?"),
|
|
|
|
|
|
onOk: () => {
|
|
|
|
|
|
const { reportName = "" } = this.props;
|
|
|
|
|
|
reportStatisticsReportDelete(payload).then(({ status, errormsg }) => {
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
message.success(getLabel(111, "删除成功"));
|
|
|
|
|
|
this.reportStatisticsReportList({ reportName });
|
|
|
|
|
|
} else {
|
|
|
|
|
|
message.error(errormsg || getLabel(111, "删除失败"));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
reportStatisticsReportList = (payload = {}) => {
|
|
|
|
|
|
reportStatisticsReportList(payload).then(({ status, data: dataSource }) => {
|
|
|
|
|
|
if (status) {
|
|
|
|
|
|
this.setState({ dataSource });
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
2023-04-20 15:36:51 +08:00
|
|
|
|
/*
|
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
|
* Description: 报表查看
|
|
|
|
|
|
* Params:
|
|
|
|
|
|
* Date: 2023/4/20
|
|
|
|
|
|
*/
|
|
|
|
|
|
handleGoReportView = (id) => {
|
|
|
|
|
|
window.open(`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/reportView?id=${id}`);
|
|
|
|
|
|
};
|
2023-04-19 09:29:38 +08:00
|
|
|
|
|
2023-04-17 17:32:16 +08:00
|
|
|
|
render() {
|
2023-04-19 09:29:38 +08:00
|
|
|
|
const { dataSource } = this.state;
|
2023-04-17 17:32:16 +08:00
|
|
|
|
return (
|
|
|
|
|
|
<Row gutter={16} className="reportRow">
|
|
|
|
|
|
{
|
|
|
|
|
|
_.isEmpty(dataSource) ? <div className="empty">{getLabel(111, "暂无数据")}</div> :
|
|
|
|
|
|
_.map(dataSource, it => {
|
2023-04-19 09:29:38 +08:00
|
|
|
|
const { reportName, dimension, id, dimensionId } = it;
|
2023-04-20 15:36:51 +08:00
|
|
|
|
return <Col className="gutter-row" span={6} onClick={() => this.handleGoReportView(id)}>
|
2023-04-17 17:32:16 +08:00
|
|
|
|
<div className="card-item">
|
2023-04-19 09:29:38 +08:00
|
|
|
|
<div className="cardLeft"><i className="icon-coms-fa"/></div>
|
|
|
|
|
|
<div className="cardCenter">
|
|
|
|
|
|
<span className="reportName">{reportName}</span>
|
2023-04-17 17:32:16 +08:00
|
|
|
|
<div className="dimension">
|
|
|
|
|
|
<div className="label">{getLabel(111, "统计维度")}:</div>
|
2023-04-19 09:29:38 +08:00
|
|
|
|
<div className="value">{dimension}</div>
|
2023-04-17 17:32:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2023-04-19 09:29:38 +08:00
|
|
|
|
<div className="cardRight">
|
|
|
|
|
|
<Dropdown overlay={
|
|
|
|
|
|
<Menu onClick={e => this.handleOptsClick(e, id, dimensionId)}>
|
|
|
|
|
|
<Menu.Item key="edit">{getLabel(111, "编辑")}</Menu.Item>
|
|
|
|
|
|
<Menu.Item key="delete">{getLabel(111, "删除")}</Menu.Item>
|
|
|
|
|
|
</Menu>
|
|
|
|
|
|
}>
|
|
|
|
|
|
<Button type="ghost"><i className="icon-coms-more"/></Button>
|
|
|
|
|
|
</Dropdown>
|
|
|
|
|
|
</div>
|
2023-04-17 17:32:16 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</Col>;
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
</Row>
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export default ReportList;
|