Browse Source

监测项展示修改

dev
wenlele 2 years ago
parent
commit
034f06438f
  1. 29
      web/client/src/sections/service/components/pushModal.jsx

29
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) {
}
</Form.Select>
{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 <Form.CheckboxGroup
label={u.name + ':'}
key={u.name + index}
@ -321,8 +341,8 @@ function pushModal (props) {
showClear
>
{
u.factor?.map((v, index) =>
<Form.Checkbox value={v.id} key={v.id} style={{ width: 150 }}>{v.name}</Form.Checkbox>)
[...new Set(factorItem)].map((v, index) =>
<Form.Checkbox value={v} key={v} style={{ width: 150 }}>{v}</Form.Checkbox>)
}
</Form.CheckboxGroup>
})
@ -339,7 +359,6 @@ function pushModal (props) {
<div style={{ display: 'flex', alignItems: 'flex-start' }}>
<Form.Radio
value='immediately'
extra={
<span style={{ fontSize: 13 }}>
中台每分钟查询若有告警源新增则每

Loading…
Cancel
Save