2023-04-11 13:41:56 +08:00
|
|
|
/*
|
|
|
|
|
* Author: 黎永顺
|
|
|
|
|
* name: 统计弹框
|
|
|
|
|
* Description:
|
|
|
|
|
* Date: 2023/4/10
|
|
|
|
|
*/
|
|
|
|
|
import React, { Component } from "react";
|
2023-04-19 09:29:38 +08:00
|
|
|
import { Button, message, Modal } from "antd";
|
2023-11-07 16:21:17 +08:00
|
|
|
import { WeaDialog, WeaLocaleProvider, WeaSlideModal } from "ecCom";
|
2023-04-19 09:29:38 +08:00
|
|
|
import { reportStatisticsReportSave } from "../../../apis/ruleconfig";
|
2023-04-11 13:41:56 +08:00
|
|
|
import "../index.less";
|
|
|
|
|
|
2023-04-17 17:32:16 +08:00
|
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
|
|
2023-04-11 13:41:56 +08:00
|
|
|
class StatisticsModal extends Component {
|
2023-04-19 09:29:38 +08:00
|
|
|
constructor(props) {
|
|
|
|
|
super(props);
|
|
|
|
|
this.state = {
|
|
|
|
|
loading: false
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-31 10:24:15 +08:00
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
|
|
|
if (nextProps.visible !== this.props.visible && nextProps.visible) {
|
|
|
|
|
document.querySelector(".xc_tj_fx_wrapper").classList.add("zIndex0-statistics");
|
|
|
|
|
} else if (nextProps.visible !== this.props.visible && !nextProps.visible) {
|
|
|
|
|
document.querySelector(".xc_tj_fx_wrapper").classList.remove("zIndex0-statistics");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-19 09:29:38 +08:00
|
|
|
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, "必要信息不完整,红色*为必填项!")
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2023-11-07 16:21:17 +08:00
|
|
|
renderTitle = () => {
|
|
|
|
|
return <div className="titleDialog">
|
|
|
|
|
<div className="titleCol titleLeftBox">
|
|
|
|
|
<div className="titleIcon"><i className="icon-coms-fa"/></div>
|
|
|
|
|
<div className="title">{getLabel(543313, "统计维度管理")}</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="titleCol titleRightBox">
|
|
|
|
|
<Button type="primary" onClick={() => this.props.onAddDimension()}>{getLabel(543314, "新建统计维度")}</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>;
|
|
|
|
|
};
|
2023-04-19 09:29:38 +08:00
|
|
|
|
2023-04-11 13:41:56 +08:00
|
|
|
render() {
|
2023-04-19 09:29:38 +08:00
|
|
|
const { loading } = this.state;
|
2023-04-11 13:41:56 +08:00
|
|
|
const { typeKey, onCancel } = this.props;
|
|
|
|
|
const buttons = typeKey === "addReport" ? [
|
2023-04-19 09:29:38 +08:00
|
|
|
<Button type="primary" onClick={this.handleSaveReportList} loading={loading}>{getLabel(111, "保存")}</Button>
|
2023-04-11 13:41:56 +08:00
|
|
|
] : [];
|
|
|
|
|
return (
|
2023-11-07 16:21:17 +08:00
|
|
|
<React.Fragment>
|
|
|
|
|
{
|
|
|
|
|
typeKey === "addReport" ? <WeaDialog
|
|
|
|
|
{...this.props} hasScroll
|
|
|
|
|
style={typeKey === "addReport" ? { width: 600 } : { width: 640, height: 540 }}
|
|
|
|
|
buttons={buttons}
|
|
|
|
|
onCancel={onCancel}
|
|
|
|
|
initLoadCss
|
|
|
|
|
className="dimensionModalWrapper"
|
|
|
|
|
>
|
|
|
|
|
{this.props.children}
|
|
|
|
|
</WeaDialog> :
|
|
|
|
|
<WeaSlideModal
|
|
|
|
|
className="dimensionModalWrapper" {...this.props}
|
|
|
|
|
top={0} width={760} height={100} measureT={"%"} measureY={"%"} measureX={"px"}
|
|
|
|
|
direction={"right"} content={this.props.children} title={this.renderTitle()}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
</React.Fragment>
|
2023-04-11 13:41:56 +08:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default StatisticsModal;
|