From 50c880d86890d1fd1e32adf67d0ef9a8b9c7b9b3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Wed, 30 Aug 2023 10:34:16 +0800
Subject: [PATCH] =?UTF-8?q?=E6=99=BA=E8=83=BD=E7=AE=97=E8=96=AA-=E5=85=B6?=
=?UTF-8?q?=E4=BB=96=E4=B8=89=E4=B8=AAtab=E9=A1=B5=E7=9A=84=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../intelligentCalculateSalarySettings.js | 8 +
.../components/constants.js | 39 +++++
.../components/editBeRemindObjDialog.js | 44 +++++
.../components/insufficientTrafficAlert.js | 156 +++++++++++++++---
.../components/interfaceFlowStatistics.js | 33 ++--
.../index.js | 60 ++++++-
.../index.less | 45 ++++-
pc4mobx/hrmSalary/stores/intelligent.js | 1 +
8 files changed, 343 insertions(+), 43 deletions(-)
create mode 100644 pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js
diff --git a/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js b/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js
index dd7d0a9f..0c2daeab 100644
--- a/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js
+++ b/pc4mobx/hrmSalary/apis/intelligentCalculateSalarySettings.js
@@ -33,3 +33,11 @@ export const apiflowStatisticsInfo = (params) => {
export const apiflowStatisticsList = (params) => {
return postFetch("/api/bs/hrmsalary/taxdeclaration/apiflow/statistics/list", params);
};
+//智能算薪-流量不足提醒编辑或保存
+export const apiflowWarnConfigSave = (params) => {
+ return postFetch("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/config/save", params);
+};
+//智能算薪-流量不足提醒对象列表
+export const apiflowWarnReceiverList = (params) => {
+ return WeaTools.callApi("/api/bs/hrmsalary/taxdeclaration/apiflow/warn/receiver/list", "GET", params);
+};
diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js
index fa776272..8ec20f66 100644
--- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js
+++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/constants.js
@@ -53,3 +53,42 @@ export const trafficUsageConditions = [
defaultshow: true
}
];
+export const remindObjConditions = [
+ {
+ items: [
+ {
+ browserConditionParam: {
+ completeParams: {},
+ conditionDataParams: {},
+ dataParams: {},
+ destDataParams: {},
+ hasAddBtn: false,
+ hasAdvanceSerach: true,
+ idSeparator: ",",
+ isAutoComplete: 1,
+ isDetail: 0,
+ isMultCheckbox: false,
+ isSingle: true,
+ linkUrl: "",
+ pageSize: 10,
+ quickSearchName: "",
+ replaceDatas: [],
+ title: "",
+ type: "1",
+ viewAttr: 3,
+ rules: "required"
+ },
+ colSpan: 1,
+ conditionType: "BROWSER",
+ rules: "required|string",
+ domkey: ["adminUserIds"],
+ fieldcol: 12,
+ label: "提醒对象",
+ lanId: 111,
+ labelcol: 6,
+ viewAttr: 3
+ }
+ ],
+ defaultshow: true
+ }
+];
diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js
new file mode 100644
index 00000000..79a41221
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/editBeRemindObjDialog.js
@@ -0,0 +1,44 @@
+/*
+ * Author: 黎永顺
+ * name: 智能算薪-添加提醒对象
+ * Description:
+ * Date: 2023/8/29
+ */
+import React, { Component } from "react";
+import { inject, observer } from "mobx-react";
+import { WeaDialog, WeaLocaleProvider } from "ecCom";
+import { Button } from "antd";
+import { getSearchs } from "../../../util";
+import { remindObjConditions } from "./constants";
+
+const getLabel = WeaLocaleProvider.getLabel;
+
+@inject("intelligentStore")
+@observer
+class EditBeRemindObjDialog extends Component {
+ componentWillReceiveProps(nextProps, nextContext) {
+ const { intelligentStore: { remindObjform } } = nextProps;
+ if (nextProps.visible !== this.props.visible && nextProps.visible) {
+ remindObjform.initFormFields(remindObjConditions);
+ }
+ if (nextProps.visible !== this.props.visible && !nextProps.visible) {
+ remindObjform.resetForm();
+ }
+ }
+
+ render() {
+ const { intelligentStore: { remindObjform } } = this.props;
+ return (
+ {getLabel(537558, "保存")}]}
+ >
+
+ {getSearchs(remindObjform, remindObjConditions, 1)}
+
+
+ );
+ }
+}
+
+export default EditBeRemindObjDialog;
diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js
index 5e7cb1eb..05589caf 100644
--- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js
+++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/insufficientTrafficAlert.js
@@ -5,9 +5,18 @@
* Date: 2023/7/19
*/
import React, { Component } from "react";
-import { WeaCheckbox, WeaFormItem, WeaHelpfulTip, WeaInputNumber, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
+import {
+ WeaButtonIcon,
+ WeaCheckbox,
+ WeaFormItem,
+ WeaInputNumber,
+ WeaLocaleProvider,
+ WeaSearchGroup,
+ WeaTable
+} from "ecCom";
import { Modal } from "antd";
-import { apiflowWarnConfigGetForm } from "../../../apis/intelligentCalculateSalarySettings";
+import EditBeRemindObjDialog from "./editBeRemindObjDialog";
+import { apiflowWarnConfigGetForm, apiflowWarnReceiverList } from "../../../apis/intelligentCalculateSalarySettings";
const getLabel = WeaLocaleProvider.getLabel;
@@ -16,7 +25,14 @@ class InsufficientTrafficAlert extends Component {
super(props);
this.state = {
enable: "0",
- remindEvent: { businessId: "", eventId: "", moduleId: "", id: "" }
+ remindEvent: { businessId: "", eventId: "", moduleId: "", id: "" },
+ threshold: null, channelList: [
+ { label: "EMobile", type: "IM", channel: "1", value: "1", config: {} },
+ { label: "邮件", type: "email", channel: "3", value: "1", config: {} },
+ { label: "短信", type: "message", channel: "4", value: "1", config: {} }
+ ], columns: [], dataSource: [],
+ pageInfo: { current: 1, pageSize: 10, total: 0 },
+ loading: false, remindObjDialog: { visible: false, title: "" }
};
}
@@ -28,22 +44,39 @@ class InsufficientTrafficAlert extends Component {
const { remindEvent } = this.state;
apiflowWarnConfigGetForm().then(({ status, data }) => {
if (status) {
- const { enable, businessId, eventId, moduleId, id } = data;
+ const { enable, businessId, eventId, moduleId, id, threshold } = data;
this.setState({
enable: enable ? "1" : "0",
- remindEvent: { ...remindEvent, businessId, eventId, moduleId, id }
+ remindEvent: { ...remindEvent, businessId, eventId, moduleId, id },
+ threshold
+ }, () => {
+ this.state.enable === "1" && this.apiflowWarnReceiverList();
});
}
});
};
+ apiflowWarnReceiverList = () => {
+ const { pageInfo, remindEvent } = this.state;
+ const { id } = remindEvent;
+ const payload = {
+ warnConfigId: id || this.props.warnConfigId,
+ ...pageInfo
+ };
+ apiflowWarnReceiverList(payload).then(({ status, data }) => {
+ if (status) {
+ console.log(data);
+ }
+ });
+ };
handleEnale = (enable) => {
if (enable === "1") {
- this.setState({ enable });
+ this.setState({ enable }, () => this.apiflowWarnReceiverList());
} else {
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: getLabel(111, "确认关闭提醒吗?关闭并保存后,流量不足时将无法及时提醒。"),
onOk: () => {
+ this.setState({ enable });
},
onCancel: () => {
this.setState({ enable: this.state.enable });
@@ -51,9 +84,39 @@ class InsufficientTrafficAlert extends Component {
});
}
};
+ handleChangeChannel = (o) => {
+ const { channelList } = this.state;
+ this.setState({
+ channelList: _.map(channelList, item => {
+ if (item.type === o.type) {
+ return { ...item, ...o };
+ }
+ return { ...item };
+ })
+ });
+ };
render() {
- const { enable } = this.state;
+ const { enable, channelList, threshold, pageInfo, loading, columns, dataSource, remindObjDialog } = this.state;
+ const pagination = {
+ ...pageInfo,
+ showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
+ showQuickJumper: true,
+ showSizeChanger: true,
+ pageSizeOptions: ["10", "20", "50", "100"],
+ onShowSizeChange: (current, pageSize) => {
+ this.setState({
+ pageInfo: { ...pageInfo, current, pageSize }
+ }, () => {
+ });
+ },
+ onChange: current => {
+ this.setState({
+ pageInfo: { ...pageInfo, current }
+ }, () => {
+ });
+ }
+ };
return (
@@ -66,23 +129,55 @@ class InsufficientTrafficAlert extends Component {
label={getLabel(544288, "提醒规则")}
labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}
>
-
-
-
-
-
+ this.setState({ threshold: o })}/>
+ {/**/}
+ {/* {getLabel(544287, "提醒推送方式")}:*/}
+ {/* */}
+ {/* */}
+ {/* }*/}
+ {/*>*/}
+ {/* */}
+ {/**/}
}
+ {
+ enable === "1" &&
+
+
+ {getLabel(111, "提醒对象设置")}
+ this.setState({
+ remindObjDialog: {
+ ...remindObjDialog, visible: true, title: getLabel(111, "添加提醒对象")
+ }
+ })}
+ />
+ {/* 添加提醒对象*/}
+ this.setState({
+ remindObjDialog: {
+ ...remindObjDialog, visible: false, title: ""
+ }
+ })}
+ />
+
+
+
+ }
);
}
@@ -96,7 +191,7 @@ const ReminderRules = (props) => {
return (
{getLabel(111, "流量不足")}
-
+
{getLabel(111, "时提醒")}
{getLabel(111, "为确保智能算薪正常使用,设置建议:若每个月消耗流量10,000,则不足10,000时提醒,以此预留一个月时间续流量")}
@@ -104,4 +199,21 @@ const ReminderRules = (props) => {
);
};
+const Pushmethod = (props) => {
+ const { onChange, channelList } = props;
+ return
+ {
+ _.map(channelList, item => {
+ const { label, type, value } = item;
+ return (
+
+ onChange({ ...item, value: o })}/>
+ {(type !== "email" && value === "1") && }
+
+ );
+ })
+ }
+
;
+};
+
diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/interfaceFlowStatistics.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/interfaceFlowStatistics.js
index 9c0a5edd..f96dc3ea 100644
--- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/interfaceFlowStatistics.js
+++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/components/interfaceFlowStatistics.js
@@ -5,7 +5,7 @@
* Date: 2023/8/29
*/
import React, { Component } from "react";
-import { Button, message } from "antd";
+import { Button, message, Spin } from "antd";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { apiflowStatisticsInfo, apiflowStatisticsList } from "../../../apis/intelligentCalculateSalarySettings";
@@ -91,6 +91,9 @@ class InterfaceFlowStatistics extends Component {
}
}).catch(() => this.setState({ loading: false }));
};
+ handleExport = () => {
+ window.open(`${window.ecologyContentPath || ""}/api/bs/hrmsalary/taxdeclaration/apiflow/statistics/export`, "_blank");
+ };
render() {
const { statisticsInfo, pageInfo, loading, dataSource, columns } = this.state;
@@ -133,19 +136,23 @@ class InterfaceFlowStatistics extends Component {
{getLabel(111, "使用明细")}
-
+
-
({getLabel(111, "月统计详情")})
- }
- ]}
- scroll={{ y: `calc(100vh - 190px)` }}
- />
+ {
+ loading ?
+
+
: ({getLabel(111, "月统计详情")})
+ }
+ ]}
+ scroll={{ y: `calc(100vh - 190px)` }}
+ />
+ }
);
diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.js b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.js
index 60bfb99a..6d3625a1 100644
--- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.js
+++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.js
@@ -1,11 +1,14 @@
import React, { Component } from "react";
+import { inject, observer } from "mobx-react";
import { WeaLocaleProvider, WeaReqTop } from "ecCom";
-import { Button } from "antd";
+import { Button, message, Modal } from "antd";
import EnableSettings from "./components/enableSettings";
import InsufficientTrafficAlert from "./components/insufficientTrafficAlert";
import TrafficUsageRecords from "./components/trafficUsageRecords";
import InterfaceFlowStatistics from "./components/interfaceFlowStatistics";
+import { apiflowWarnConfigSave } from "../../apis/intelligentCalculateSalarySettings";
import "./index.less";
+import { convertToUrlString } from "../../util/url";
const getLabel = WeaLocaleProvider.getLabel;
const tabs = [
@@ -15,16 +18,55 @@ const tabs = [
{ key: "TRAFFIC_USAGE_RECORD", title: getLabel(111, "流量使用记录") }
];
+@inject("intelligentStore")
+@observer
class Index extends Component {
constructor(props) {
super(props);
this.state = {
- selectedKey: "ENABLE_SETTINGS", lastUpdateTime: ""
+ selectedKey: "ENABLE_SETTINGS", lastUpdateTime: "",
+ loading: false, warnConfigId: ""
};
+ this.alertRef = null;
}
+ /*
+ * Author: 黎永顺
+ * Description:流量不足提醒 - 基础信息保存
+ * Params:
+ * Date: 2023/8/29
+ */
+ saveItaBaseInfo = () => {
+ const { channelList, enable, threshold, remindEvent } = this.alertRef.state;
+ const validateError = (enable === "1") && (_.every(channelList, o => o.channel !== "1") || _.isNil(threshold));
+ if (validateError) {
+ Modal.warning({
+ title: getLabel(131329, "信息确认"),
+ content: getLabel(518702, "必要信息不完整,红色*为必填项!")
+ });
+ return;
+ }
+ const { businessId, id } = remindEvent;
+ const config = _.map(_.filter(channelList, p => p.value === "1"), o => ({ channel: o.channel, config: o.config }));
+ const payload = {
+ id, businessId, threshold,
+ enable: enable === "1",
+ config: JSON.stringify(config)
+ };
+ this.setState({ loading: true });
+ apiflowWarnConfigSave(payload).then(({ status, data, errormsg }) => {
+ this.setState({ loading: false });
+ if (status) {
+ message.success(getLabel(22619, "保存成功!"));
+ this.setState({ warnConfigId: data });
+ payload.enable && this.alertRef.apiflowWarnReceiverList();
+ } else {
+ message.error(errormsg);
+ }
+ }).catch(() => this.setState({ loading: false }));
+ };
renderChildren = () => {
- const { selectedKey } = this.state;
+ const { selectedKey, warnConfigId } = this.state;
let CurrentDom = null;
switch (selectedKey) {
case "ENABLE_SETTINGS":
@@ -35,7 +77,7 @@ class Index extends Component {
this.setState({ lastUpdateTime: data.lastUpdateTime })}/>;
break;
case "INSUFFICIENT_TRAFFIC_ALERT":
- CurrentDom = ;
+ CurrentDom = this.alertRef = dom} warnConfigId={warnConfigId}/>;
break;
case "TRAFFIC_USAGE_RECORD":
CurrentDom = ;
@@ -46,13 +88,17 @@ class Index extends Component {
}
return CurrentDom;
};
+ handleExport = () => {
+ const { intelligentStore: { form } } = this.props;
+ window.open(`${window.ecologyContentPath || ""}/api/bs/hrmsalary/taxdeclaration/apiflow/record/export?${convertToUrlString(form.getFormParams())}`, "_blank");
+ };
render() {
- const { selectedKey, lastUpdateTime } = this.state;
+ const { selectedKey, lastUpdateTime, loading } = this.state;
const buttons = selectedKey === "INSUFFICIENT_TRAFFIC_ALERT" ?
- [] :
+ [] :
selectedKey === "TRAFFIC_USAGE_RECORD" ?
- [] :
+ [] :
selectedKey === "INTERFACE_FLOW_STATISTICS" ? [
{getLabel(111, "最后统计时间:")}
diff --git a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less
index 6fff3639..e8cc4773 100644
--- a/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less
+++ b/pc4mobx/hrmSalary/pages/intelligentCalculateSalarySettings/index.less
@@ -60,6 +60,14 @@
border: 1px solid #f2f2f2;
border-bottom: none;
+ .flex {
+ display: flex;
+ }
+
+ .items-center {
+ align-items: center;
+ }
+
.wea-content {
padding: 0;
@@ -78,7 +86,7 @@
}
.after {
- margin-left: 6px;
+ margin-left: 16px;
margin-right: 16px;
}
@@ -88,6 +96,41 @@
padding: 6px 0;
}
}
+
+ .channel-list {
+ display: flex;
+ align-items: center;
+
+ & > .channel-item:not(:first-child) {
+ margin-left: 16px;
+ }
+
+ .channel-item {
+ display: inline-flex;
+ align-items: center;
+ min-height: 30px;
+ }
+
+ .icon-coms-Flow-setting {
+ font-size: 16px;
+ cursor: pointer;
+ margin-top: 5px;
+ }
+ }
+
+ .table {
+ .title {
+ height: 40px;
+ justify-content: space-between;
+ background: #f6f6f6;
+
+ .titleLeft {
+ font-size: 14px;
+ color: #111;
+ padding: 0;
+ }
+ }
+ }
}
.trafficUsageRecords-layout {
diff --git a/pc4mobx/hrmSalary/stores/intelligent.js b/pc4mobx/hrmSalary/stores/intelligent.js
index 4181fcf8..7d0caf9b 100644
--- a/pc4mobx/hrmSalary/stores/intelligent.js
+++ b/pc4mobx/hrmSalary/stores/intelligent.js
@@ -5,6 +5,7 @@ const { TableStore } = WeaTableNew;
export class IntelligentStore {
@observable form = new WeaForm(); //流量使用记录查询form实例
+ @observable remindObjform = new WeaForm(); //流量使用记录查询form实例
@observable tableStore = new TableStore();
@action("...")