/* * Author: 黎永顺 * name: 统计弹框 * Description: * Date: 2023/4/10 */ import React, { Component } from "react"; import { Button, message, Modal } from "antd"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; import { reportStatisticsReportSave } from "../../../apis/ruleconfig"; import "../index.less"; const { getLabel } = WeaLocaleProvider; class StatisticsModal extends Component { constructor(props) { super(props); this.state = { loading: false }; } handleSaveReportList = () => { const { form, id, onCancel } = this.props; form.validateForm().then(f => { if (f.isValid) { const { dimensionIds, reportName } = form.getFormParams(); const payload = { id, reportName, dimensionIds: dimensionIds.split(",") }; this.setState({ loading: true }); reportStatisticsReportSave(payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { onCancel(true); message.success(getLabel(111, "保存成功")); form.resetForm(); } else { message.error(errormsg || getLabel(111, "保存失败")); } }).catch(() => this.setState({ loading: false })); } else { Modal.warning({ title: getLabel(111, "信息确认"), content: getLabel(111, "必要信息不完整,红色*为必填项!") }); } }); }; render() { const { loading } = this.state; const { typeKey, onCancel } = this.props; const buttons = typeKey === "addReport" ? [ ] : []; return ( {this.props.children} ); } } export default StatisticsModal;