|  | @ -1,6 +1,6 @@ | 
			
		
	
		
		
			
				
					|  |  | import React, { useState, useRef, useEffect } from "react"; |  |  | import React, { useState, useRef, useEffect } from "react"; | 
			
		
	
		
		
			
				
					|  |  | import { connect } from "react-redux"; |  |  | import { connect } from "react-redux"; | 
			
		
	
		
		
			
				
					
					|  |  | import { Modal, Form, Notification } from "@douyinfe/semi-ui"; |  |  | import { Modal, Form, Notification, Tooltip } from "@douyinfe/semi-ui"; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | import { IconAlertCircle } from '@douyinfe/semi-icons'; |  |  | import { IconAlertCircle } from '@douyinfe/semi-icons'; | 
			
		
	
		
		
			
				
					|  |  | import './pushModal.less' |  |  | import './pushModal.less' | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -34,7 +34,7 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |    const [interval3, setInterval3] = useState(undefined); // |  |  |    const [interval3, setInterval3] = useState(undefined); // | 
			
		
	
		
		
			
				
					|  |  |    const [deviceProportion, setDeviceProportion] = useState(undefined); // |  |  |    const [deviceProportion, setDeviceProportion] = useState(undefined); // | 
			
		
	
		
		
			
				
					|  |  |    const [subType, setSubType] = useState([]); //监听模块中的子类 |  |  |    const [subType, setSubType] = useState([]); //监听模块中的子类 | 
			
		
	
		
		
			
				
					
					|  |  |    const [factor, setFactor] = useState([]); //结构物对应监测项 |  |  |    const [factorShow, setFactorShow] = useState([]); //结构物对应监测项 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |    //初始化 |  |  |    //初始化 | 
			
		
	
	
		
		
			
				
					|  | @ -43,7 +43,7 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |       getOrganizationUsersList()//获取全部未删除用户 |  |  |       getOrganizationUsersList()//获取全部未删除用户 | 
			
		
	
		
		
			
				
					|  |  |       getProjectPomsList()//获取已绑定项目 |  |  |       getProjectPomsList()//获取已绑定项目 | 
			
		
	
		
		
			
				
					|  |  |       if (editObj.id) { |  |  |       if (editObj.id) { | 
			
		
	
		
		
			
				
					
					|  |  |          getProjectStructureList(editObj.pomsProjectId) |  |  |          getProjectStructureList(editObj.pomsProjectId, editObj) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |          let division = editObj?.pomsProject?.map(v => (v.pepProject?.id || 'POMS')) |  |  |          let division = editObj?.pomsProject?.map(v => (v.pepProject?.id || 'POMS')) | 
			
		
	
		
		
			
				
					|  |  |          if (division.length == 1 && division?.includes('POMS')) { |  |  |          if (division.length == 1 && division?.includes('POMS')) { | 
			
		
	
		
		
			
				
					|  |  |             setProjectStatus([{ construction_status: 'POMS', id: 'POMS' }]) |  |  |             setProjectStatus([{ construction_status: 'POMS', id: 'POMS' }]) | 
			
		
	
	
		
		
			
				
					|  | @ -75,11 +75,12 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |          } |  |  |          } | 
			
		
	
		
		
			
				
					|  |  |       }) |  |  |       }) | 
			
		
	
		
		
			
				
					|  |  |    } |  |  |    } | 
			
		
	
		
		
			
				
					
					|  |  |    function getProjectStructureList (value) {//获取绑定项目下结构物 |  |  |    function getProjectStructureList (value, alter) {//获取绑定项目下结构物 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |       dispatch(service.getProjectStructure({ pomsProjectId: value.join(',') })).then((res) => { |  |  |       dispatch(service.getProjectStructure({ pomsProjectId: value.join(',') })).then((res) => { | 
			
		
	
		
		
			
				
					|  |  |          if (res.success) { |  |  |          if (res.success) { | 
			
		
	
		
		
			
				
					|  |  |             let data = [] |  |  |             let data = [] | 
			
		
	
		
		
			
				
					|  |  |             let ProjectId = [] |  |  |             let ProjectId = [] | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             let factorId = [] | 
			
		
	
		
		
			
				
					|  |  |             res.payload?.data.map(v => { |  |  |             res.payload?.data.map(v => { | 
			
		
	
		
		
			
				
					|  |  |                if (ProjectId.includes(v.id)) { |  |  |                if (ProjectId.includes(v.id)) { | 
			
		
	
		
		
			
				
					|  |  |                } else { |  |  |                } else { | 
			
		
	
	
		
		
			
				
					|  | @ -87,14 +88,15 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                   data.push(v) |  |  |                   data.push(v) | 
			
		
	
		
		
			
				
					|  |  |                } |  |  |                } | 
			
		
	
		
		
			
				
					|  |  |             }) |  |  |             }) | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             let mylist = [] |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             for (let i = 0; i < data.length; i++) { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                mylist.push(data[i].id) |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             setProjectStructure(data) |  |  |             setProjectStructure(data) | 
			
		
	
		
		
			
				
					
					|  |  |             // setFactor() |  |  |             let FactorId = [] | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             form.current.setValue('strucId', mylist) |  |  |             for (let key in alter?.pomsStrucFactorId) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                FactorId.push(key) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             setFactorShow(FactorId?.map(Number)) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             if (!editObj.id) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                form.current.setValue('strucId', ProjectId) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					|  |  |             form.current.validate(['strucId', 'timeType']) |  |  |             form.current.validate(['strucId', 'timeType']) | 
			
		
	
		
		
			
				
					|  |  |             setStructure(false) |  |  |             setStructure(false) | 
			
		
	
		
		
			
				
					|  |  |             setTimeTypeDis(false) |  |  |             setTimeTypeDis(false) | 
			
		
	
	
		
		
			
				
					|  | @ -122,7 +124,6 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |       let regu = /^[0-9]*[1-9][0-9]*$/; |  |  |       let regu = /^[0-9]*[1-9][0-9]*$/; | 
			
		
	
		
		
			
				
					|  |  |       let title = tactics == 'immediately' ? '即时' : tactics == 'continue' ? '持续时长' : '异常率' |  |  |       let title = tactics == 'immediately' ? '即时' : tactics == 'continue' ? '持续时长' : '异常率' | 
			
		
	
		
		
			
				
					|  |  |       if (!regu.test(interval) || (tactics == 'abnormal_rate' && interval > 720) || interval > 1440) { |  |  |       if (!regu.test(interval) || (tactics == 'abnormal_rate' && interval > 720) || interval > 1440) { | 
			
		
	
		
		
			
				
					|  |  |          console.log(interval); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |          Notification.error({ |  |  |          Notification.error({ | 
			
		
	
		
		
			
				
					|  |  |             content: title + (interval ? `推送时间不能大于${tactics == 'abnormal_rate' ? 720 : 1440}分钟` : '推送时间应为正整数'), |  |  |             content: title + (interval ? `推送时间不能大于${tactics == 'abnormal_rate' ? 720 : 1440}分钟` : '推送时间应为正整数'), | 
			
		
	
		
		
			
				
					|  |  |             duration: 2, |  |  |             duration: 2, | 
			
		
	
	
		
		
			
				
					|  | @ -157,11 +158,14 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                timeType: v.timeType[0] == 'POMS' ? [] : v.timeType, |  |  |                timeType: v.timeType[0] == 'POMS' ? [] : v.timeType, | 
			
		
	
		
		
			
				
					|  |  |                receiverPepUserId: v.receiverPepUserId || [], |  |  |                receiverPepUserId: v.receiverPepUserId || [], | 
			
		
	
		
		
			
				
					|  |  |                disable: v.disable, |  |  |                disable: v.disable, | 
			
		
	
		
		
			
				
					
					|  |  |                alarmSubType: {} |  |  |                alarmSubType: {}, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                pomsStrucFactorId: {} | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					|  |  |             for (let key in v) { |  |  |             for (let key in v) { | 
			
		
	
		
		
			
				
					|  |  |                if (['app_exception', 'data_exception', 'data_outages', 'device_exception', 'video_exception', 'strategy_hit'].includes(key)) { |  |  |                if (['app_exception', 'data_exception', 'data_outages', 'device_exception', 'video_exception', 'strategy_hit'].includes(key)) { | 
			
		
	
		
		
			
				
					|  |  |                   data.alarmSubType = { ...data.alarmSubType, [key]: v[key] } |  |  |                   data.alarmSubType = { ...data.alarmSubType, [key]: v[key] } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                } else if (key.indexOf('factor') == 0) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                   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)) { | 
			
		
	
	
		
		
			
				
					|  | @ -190,10 +194,9 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |          > |  |  |          > | 
			
		
	
		
		
			
				
					|  |  |             <div> |  |  |             <div> | 
			
		
	
		
		
			
				
					|  |  |                <Form |  |  |                <Form | 
			
		
	
		
		
			
				
					|  |  |                   allowEmpty |  |  |  | 
			
		
	
		
		
			
				
					|  |  |                   labelPosition="left" |  |  |                   labelPosition="left" | 
			
		
	
		
		
			
				
					|  |  |                   labelAlign="right" |  |  |                   labelAlign="right" | 
			
		
	
		
		
			
				
					
					|  |  |                   labelWidth="120px" |  |  |                   labelWidth="130px" | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                   onValueChange={(values, field) => { |  |  |                   onValueChange={(values, field) => { | 
			
		
	
		
		
			
				
					|  |  |                      for (var key in field) { |  |  |                      for (var key in field) { | 
			
		
	
		
		
			
				
					|  |  |                         if (key == 'tactics') { |  |  |                         if (key == 'tactics') { | 
			
		
	
	
		
		
			
				
					|  | @ -203,8 +206,7 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                            } else { |  |  |                            } else { | 
			
		
	
		
		
			
				
					|  |  |                               setAbnormal(false) |  |  |                               setAbnormal(false) | 
			
		
	
		
		
			
				
					|  |  |                            } |  |  |                            } | 
			
		
	
		
		
			
				
					
					|  |  |                         } |  |  |                         } else if (key == 'pomsProjectId') { | 
			
				
				
			
		
	
		
		
			
				
					|  |  |                         if (key == 'pomsProjectId') { |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					|  |  |                            if (values.pomsProjectId.length > 0) { |  |  |                            if (values.pomsProjectId.length > 0) { | 
			
		
	
		
		
			
				
					|  |  |                               getProjectStructureList(values.pomsProjectId)//获取绑定项目下结构物 |  |  |                               getProjectStructureList(values.pomsProjectId)//获取绑定项目下结构物 | 
			
		
	
		
		
			
				
					|  |  |                               let pepProjectId = [] |  |  |                               let pepProjectId = [] | 
			
		
	
	
		
		
			
				
					|  | @ -228,8 +230,9 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                               form.current.setValue('timeType', []) |  |  |                               form.current.setValue('timeType', []) | 
			
		
	
		
		
			
				
					|  |  |                            } |  |  |                            } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |                         } |  |  |                         } else if (key == 'strucId') { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |                         if (key == 'alarmType') { |  |  |                            setFactorShow(values.strucId) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                         } else if (key == 'alarmType') { | 
			
		
	
		
		
			
				
					|  |  |                            setSubType(field['alarmType']) |  |  |                            setSubType(field['alarmType']) | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                      } |  |  |                      } | 
			
		
	
	
		
		
			
				
					|  | @ -245,7 +248,7 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                         label='策略名称:' |  |  |                         label='策略名称:' | 
			
		
	
		
		
			
				
					|  |  |                         maxLength={15} |  |  |                         maxLength={15} | 
			
		
	
		
		
			
				
					|  |  |                         disabled={pushEdit} |  |  |                         disabled={pushEdit} | 
			
		
	
		
		
			
				
					
					|  |  |                         style={{ width: 695 }} |  |  |                         style={{ width: 678 }} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         initValue={editObj?.name || ""} |  |  |                         initValue={editObj?.name || ""} | 
			
		
	
		
		
			
				
					|  |  |                         placeholder="请输入策略名称" |  |  |                         placeholder="请输入策略名称" | 
			
		
	
		
		
			
				
					|  |  |                         showClear |  |  |                         showClear | 
			
		
	
	
		
		
			
				
					|  | @ -256,7 +259,7 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                         label="请选择项目:" |  |  |                         label="请选择项目:" | 
			
		
	
		
		
			
				
					|  |  |                         field="pomsProjectId" |  |  |                         field="pomsProjectId" | 
			
		
	
		
		
			
				
					|  |  |                         placeholder="请选择项目" |  |  |                         placeholder="请选择项目" | 
			
		
	
		
		
			
				
					
					|  |  |                         style={{ width: 695 }} |  |  |                         style={{ width: 678 }} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         rules={[{ required: true, message: "请选择项目" }]} |  |  |                         rules={[{ required: true, message: "请选择项目" }]} | 
			
		
	
		
		
			
				
					|  |  |                         initValue={editObj?.pomsProjectId || ""} |  |  |                         initValue={editObj?.pomsProjectId || ""} | 
			
		
	
		
		
			
				
					|  |  |                         multiple |  |  |                         multiple | 
			
		
	
	
		
		
			
				
					|  | @ -275,10 +278,13 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                   </div> |  |  |                   </div> | 
			
		
	
		
		
			
				
					|  |  |                   <div> |  |  |                   <div> | 
			
		
	
		
		
			
				
					|  |  |                      <Form.Select |  |  |                      <Form.Select | 
			
		
	
		
		
			
				
					
					|  |  |                         label="请选择结构物:" |  |  |                         label={<>请选择结构物 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |                            <Tooltip content={'选择结构物,若该结构物下没有监测项则下方不展示,反之展示结构物对应的监测项'} style={{ lineHeight: 2 }}> | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                               <img src="/assets/images/install/table_question.png" alt="" style={{ height: 14, width: 14 }} /> | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            </Tooltip>:</>} | 
			
		
	
		
		
			
				
					|  |  |                         field="strucId" |  |  |                         field="strucId" | 
			
		
	
		
		
			
				
					|  |  |                         placeholder="请选择结构物" |  |  |                         placeholder="请选择结构物" | 
			
		
	
		
		
			
				
					
					|  |  |                         style={{ width: 695 }} |  |  |                         style={{ width: 678 }} | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |                         rules={[{ required: true, message: "请选择结构物" }]} |  |  |                         rules={[{ required: true, message: "请选择结构物" }]} | 
			
		
	
		
		
			
				
					|  |  |                         initValue={editObj?.strucId || []} |  |  |                         initValue={editObj?.strucId || []} | 
			
		
	
		
		
			
				
					|  |  |                         disabled={structure} |  |  |                         disabled={structure} | 
			
		
	
	
		
		
			
				
					|  | @ -297,6 +303,23 @@ function pushModal (props) { | 
			
		
	
		
		
			
				
					|  |  |                            }) |  |  |                            }) | 
			
		
	
		
		
			
				
					|  |  |                         } |  |  |                         } | 
			
		
	
		
		
			
				
					|  |  |                      </Form.Select> |  |  |                      </Form.Select> | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                      {projectStructure?.filter(v => (factorShow?.includes(v.id) && v.factor?.length > 0))?.map((u, index) => { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         return <Form.CheckboxGroup | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            label={u.name + ':'} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            key={u.name + index} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            field={'factor' + u.id} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            style={{ width: 695 }} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            initValue={editObj?.id ? editObj?.pomsStrucFactorId[u.id] : []} | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            direction='horizontal' | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            showClear | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         > | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                               u.factor?.map((v, index) => | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                                  <Form.Checkbox value={v.id} key={v.id} style={{ width: 150 }}>{v.name}</Form.Checkbox>) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                            } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                         </Form.CheckboxGroup> | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                      }) | 
			
		
	
		
		
			
				
					|  |  |  |  |  |                      } | 
			
		
	
		
		
			
				
					|  |  |                   </div> |  |  |                   </div> | 
			
		
	
		
		
			
				
					|  |  |                   <div className='pushInput'> |  |  |                   <div className='pushInput'> | 
			
		
	
		
		
			
				
					|  |  |                      <Form.RadioGroup |  |  |                      <Form.RadioGroup | 
			
		
	
	
		
		
			
				
					|  | 
 |