/* * Author: 黎永顺 * name: 统计表 * Description: * Date: 2023/4/17 */ import React, { Component } from "react"; import { WeaLocaleProvider } from "ecCom"; import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd"; import { reportStatisticsReportDelete, reportStatisticsReportList } from "../../../apis/statistics"; import "../index.less"; const SubMenu = Menu.SubMenu; const { getLabel } = WeaLocaleProvider; class ReportList extends Component { constructor(props) { super(props); this.state = { dataSource: [] }; } componentDidMount() { this.reportStatisticsReportList(); } handleOptsClick = ({ key }, id, dimensionId) => { if (key === "delete") { this.reportStatisticsReportDelete(id.split(",")); } 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 }); } }); }; /* * Author: 黎永顺 * Description: 报表查看 * Params: * Date: 2023/4/20 */ handleGoReportView = (id) => { window.open(`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/reportView?id=${id}`); }; render() { const { dataSource } = this.state; return ( { _.isEmpty(dataSource) ?
{getLabel(111, "暂无数据")}
: _.map(dataSource, it => { const { reportName, dimension, id, dimensionId } = it; return this.handleGoReportView(id)}>
{reportName}
{getLabel(111, "统计维度")}:
{dimension}
this.handleOptsClick(e, id, dimensionId)}> {getLabel(111, "编辑")} {getLabel(111, "删除")} }>
; }) }
); } } export default ReportList;