From 034f06438ff06bb360e3a0939032c51040e0257f Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 30 Nov 2022 08:56:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=B5=8B=E9=A1=B9=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sections/service/components/pushModal.jsx | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/web/client/src/sections/service/components/pushModal.jsx b/web/client/src/sections/service/components/pushModal.jsx index b237879..c492244 100644 --- a/web/client/src/sections/service/components/pushModal.jsx +++ b/web/client/src/sections/service/components/pushModal.jsx @@ -127,7 +127,7 @@ function pushModal (props) { } }) } - function caution (tactics, interval, deviceProportion) { + function caution (tactics, interval, deviceProportion, data) { let regu = /^[0-9]*[1-9][0-9]*$/; let title = tactics == 'immediately' ? '即时' : tactics == 'continue' ? '持续时长' : '异常率' if (!regu.test(interval) || (tactics == 'abnormal_rate' && interval > 720) || interval > 1440) { @@ -144,6 +144,22 @@ function pushModal (props) { }) return false } + if (data.alarmType?.includes('strategy_hit')) { + let factorItem = [] + for (let key in data.pomsStrucFactorId) { + factorItem = [...factorItem, ...data.pomsStrucFactorId[key]] + + } + if (factorItem.length > 0 && data.alarmSubType['strategy_hit']?.length > 0) { + return true + } else { + Notification.error({ + content: '勾选策略命中监听模块后,策略命中细项与监测项都必须勾选一项', + duration: 3, + }) + } + return false + } return true } @@ -175,7 +191,7 @@ function pushModal (props) { data.pomsStrucFactorId = { ...data.pomsStrucFactorId, [key.slice(6)]: v[key] } } } - if (caution(data.tactics, data.tacticsParams.interval, data.tacticsParams.deviceProportion)) { + if (caution(data.tactics, data.tacticsParams.interval, data.tacticsParams.deviceProportion, data)) { dispatch(service.postPush({ pushId: editObj.id, ...data, msg: pushEdit ? '编辑推送配置' : "新增推送策略" })).then((res) => {//获取项企(PEP)全部部门及其下用户 if (res.success) { close(); @@ -311,6 +327,10 @@ function pushModal (props) { } {projectStructure?.filter(v => (factorShow?.includes(v.id) && v.factor?.length > 0))?.map((u, index) => { + let factorItem = [] + u.factor?.map(v => { + v.item.map(vv => factorItem.push(vv.name)) + }) return { - u.factor?.map((v, index) => - {v.name}) + [...new Set(factorItem)].map((v, index) => + {v}) } }) @@ -339,7 +359,6 @@ function pushModal (props) {
中台每分钟查询,若有告警源新增,则每