Commit 6df3097914263a34447b9f1bab111cf8b39177fc

Authored by 黄 x
1 parent 2b3c6c86

fix(front): 修改设备配置BUG【待完善-1】

@@ -310,11 +310,10 @@ @@ -310,11 +310,10 @@
310 isGetStepThreeData, 310 isGetStepThreeData,
311 alarmProfileData.alarmProfile.alarmContactId == '' ? null : alarmProfileData 311 alarmProfileData.alarmProfile.alarmContactId == '' ? null : alarmProfileData
312 ); 312 );
313 - console.log('总对象', postDeviceConfogData.value);  
314 - // await deviceConfigAddOrEdit(postDeviceConfogData.value);  
315 - // createMessage.success('新增成功');  
316 - // closeModal();  
317 - // emit('success'); 313 + await deviceConfigAddOrEdit(postDeviceConfogData.value);
  314 + createMessage.success('新增成功');
  315 + closeModal();
  316 + emit('success');
318 } else if (isUpdate.value == 2) { 317 } else if (isUpdate.value == 2) {
319 const id = { 318 const id = {
320 id: postEditId, 319 id: postEditId,
@@ -327,10 +326,11 @@ @@ -327,10 +326,11 @@
327 id, 326 id,
328 alarmProfileData.alarmProfile.alarmContactId == '' ? null : alarmProfileData 327 alarmProfileData.alarmProfile.alarmContactId == '' ? null : alarmProfileData
329 ); 328 );
330 - await deviceConfigAddOrEdit(postDeviceConfogData.value);  
331 - createMessage.success('编辑成功');  
332 - closeModal();  
333 - emit('success'); 329 + console.log('==========', postDeviceConfogData.value);
  330 + // await deviceConfigAddOrEdit(postDeviceConfogData.value);
  331 + // createMessage.success('编辑成功');
  332 + // closeModal();
  333 + // emit('success');
334 } 334 }
335 } catch {} 335 } catch {}
336 }; 336 };
@@ -91,7 +91,6 @@ @@ -91,7 +91,6 @@
91 const [registerModalDetail] = useModal(); 91 const [registerModalDetail] = useModal();
92 const [registerTable, { reload, getSelectRowKeys }] = useTable({ 92 const [registerTable, { reload, getSelectRowKeys }] = useTable({
93 title: '设备配置列表', 93 title: '设备配置列表',
94 - pagination: true,  
95 clickToRowSelect: false, 94 clickToRowSelect: false,
96 api: deviceConfigGetQuery, 95 api: deviceConfigGetQuery,
97 columns, 96 columns,
@@ -31,7 +31,7 @@ @@ -31,7 +31,7 @@
31 " 31 "
32 > 32 >
33 <CommonCpns 33 <CommonCpns
34 - :ref="`commonCpnsRef${index}`" 34 + :ref="ruleRef.createRuleRefs"
35 :step3FatherEmitCpnData="!getIsEchoEditStatus ? 1 : item" 35 :step3FatherEmitCpnData="!getIsEchoEditStatus ? 1 : item"
36 :step3FatherEmitCpnStatus=" 36 :step3FatherEmitCpnStatus="
37 !getIsEchoEditStatus ? !getIsEchoEditStatus : getIsEchoEditStatus 37 !getIsEchoEditStatus ? !getIsEchoEditStatus : getIsEchoEditStatus
@@ -58,7 +58,7 @@ @@ -58,7 +58,7 @@
58 </template> 58 </template>
59 59
60 <script lang="ts"> 60 <script lang="ts">
61 - import { defineComponent, ref, getCurrentInstance, reactive, watch } from 'vue'; 61 + import { defineComponent, ref, getCurrentInstance, reactive, watch, nextTick } from 'vue';
62 import CommonCpns from './common/index.vue'; 62 import CommonCpns from './common/index.vue';
63 import { deteleObject } from '/@/hooks/web/useFilter'; 63 import { deteleObject } from '/@/hooks/web/useFilter';
64 64
@@ -75,9 +75,10 @@ @@ -75,9 +75,10 @@
75 const echoEditData: any = ref([]); 75 const echoEditData: any = ref([]);
76 const getIsEchoEditStatus = ref(false); 76 const getIsEchoEditStatus = ref(false);
77 const btnClose = ref(true); 77 const btnClose = ref(true);
78 - let editObj = reactive({});  
79 let addObj = reactive({}); 78 let addObj = reactive({});
80 - 79 + const ruleRef = {
  80 + createRuleRefs: ref([]),
  81 + };
81 const prevStepFunc = () => { 82 const prevStepFunc = () => {
82 emit('prev'); 83 emit('prev');
83 }; 84 };
@@ -87,44 +88,41 @@ @@ -87,44 +88,41 @@
87 }); 88 });
88 }; 89 };
89 const getStep3AllDataFunc = async (e) => { 90 const getStep3AllDataFunc = async (e) => {
90 - try {  
91 - if (e == 1) {  
92 - for (let i = 0; i < alarmsData.value.length; i++) {  
93 - const ii = i;  
94 - addObj = await proxy.$refs['commonCpnsRef' + ii].getStep3AllDataFunc(1);  
95 - alarmsData.value.push(addObj);  
96 - alarmsData.value.shift();  
97 - }  
98 - } else {  
99 - if (getIsEchoEditStatus.value) {  
100 - /**  
101 - * 编辑  
102 - */  
103 - for (let i = 0; i < echoEditData.value.length; i++) {  
104 - const ii = i;  
105 - editObj = await proxy.$refs['commonCpnsRef' + ii].getStep3AllDataFunc(2);  
106 - alarmsData.value.push(editObj);  
107 - }  
108 - } 91 + let temp = [];
  92 + if (e == 1) {
  93 + temp = alarmsData.value;
  94 + } else {
  95 + temp = echoEditData.value;
  96 + }
  97 + for (let i = 0; i < temp.length; i++) {
  98 + for (const item of ruleRef.createRuleRefs.value) {
  99 + addObj = await item.getStep3AllDataFunc();
  100 + alarmsData.value.push(addObj);
109 } 101 }
110 - /**  
111 - * 过滤null和重复对象和1  
112 - */  
113 - alarmsData.value = alarmsData.value.filter((i) => i);  
114 - alarmsData.value = deteleObject(alarmsData.value);  
115 - alarmsData.value = alarmsData.value.filter((f) => f !== 1);  
116 - return alarmsData.value;  
117 - } catch {} 102 + }
  103 + /**
  104 + * 过滤null和重复对象和1
  105 + */
  106 + alarmsData.value = alarmsData.value.filter((i) => i);
  107 + alarmsData.value = deteleObject(alarmsData.value);
  108 + alarmsData.value = alarmsData.value.filter((f) => f !== 1);
  109 + return alarmsData.value;
118 }; 110 };
119 const clickAddAlaramRuleFunc = async () => { 111 const clickAddAlaramRuleFunc = async () => {
120 - try {  
121 - alarmsData.value.push(1);  
122 - // proxy.$refs['commonCpnsRef' + 0].updateCpnSchemaSelectEnableFunc();  
123 - // proxy.$refs['commonCpnsRef' + 1].updateCpnSchemaSelectEnableFunc();  
124 - if (getIsEchoEditStatus.value) {  
125 - echoEditData.value.push(1);  
126 - }  
127 - } catch {} 112 + alarmsData.value.push(1);
  113 + nextTick(() => {
  114 + ruleRef.createRuleRefs.value[alarmsData.value.length - 1].updateCpnSchemaSelectEnableFunc(
  115 + alarmsData.value.length - 1
  116 + );
  117 + });
  118 +
  119 + // try {
  120 + // // proxy.$refs['commonCpnsRef' + 0].updateCpnSchemaSelectEnableFunc();
  121 + // // proxy.$refs['commonCpnsRef' + 1].updateCpnSchemaSelectEnableFunc();
  122 + // if (getIsEchoEditStatus.value) {
  123 + // echoEditData.value.push(1);
  124 + // }
  125 + // } catch {}
128 }; 126 };
129 const removeAlarmRule = (e, i) => { 127 const removeAlarmRule = (e, i) => {
130 const key = alarmsData.value.indexOf(e); 128 const key = alarmsData.value.indexOf(e);
@@ -140,26 +138,22 @@ @@ -140,26 +138,22 @@
140 * 清空数据 138 * 清空数据
141 */ 139 */
142 const clearStep3DataFunc = () => { 140 const clearStep3DataFunc = () => {
143 - try {  
144 - alarmsData.value.length = 0;  
145 - echoEditData.value.length = 0;  
146 - proxy.$refs.commonCpnsRef?.clearStep3CpnDataFunc();  
147 - getIsEchoEditStatus.value = false;  
148 - } catch {} 141 + alarmsData.value.length = 0;
  142 + echoEditData.value.length = 0;
  143 + proxy.$refs.commonCpnsRef?.clearStep3CpnDataFunc();
  144 + getIsEchoEditStatus.value = false;
149 }; 145 };
150 /** 146 /**
151 * 回显数据 147 * 回显数据
152 */ 148 */
153 const echoStep3DataFunc = (e, s) => { 149 const echoStep3DataFunc = (e, s) => {
154 - try {  
155 - getIsEchoEditStatus.value = s;  
156 - if (getIsEchoEditStatus.value === true) {  
157 - echoEditData.value = e;  
158 - if (echoEditData.value == null) {  
159 - echoEditData.value = [];  
160 - } 150 + getIsEchoEditStatus.value = s;
  151 + if (getIsEchoEditStatus.value === true) {
  152 + echoEditData.value = e;
  153 + if (echoEditData.value == null) {
  154 + echoEditData.value = [];
161 } 155 }
162 - } catch {} 156 + }
163 }; 157 };
164 watch( 158 watch(
165 () => props.isShowAddRule, 159 () => props.isShowAddRule,
@@ -180,6 +174,7 @@ @@ -180,6 +174,7 @@
180 getIsEchoEditStatus, 174 getIsEchoEditStatus,
181 getStep3AllDataFunc, 175 getStep3AllDataFunc,
182 btnClose, 176 btnClose,
  177 + ruleRef,
183 }; 178 };
184 }, 179 },
185 }); 180 });
1 -export const formatAlarmRuleConditionsData = (f) => {  
2 - return f?.predicate.operation == 'EQUAL'  
3 - ? f?.key.key + '等于' + f?.predicate.value.defaultValue  
4 - : f?.predicate.operation == 'STARTS_WITH'  
5 - ? f?.key.key + '开始于' + f?.predicate.value.defaultValue  
6 - : f?.predicate.operation == 'ENDS_WITH'  
7 - ? f?.key.key + '结束于' + f?.predicate.value.defaultValue  
8 - : f?.predicate.operation == 'NOT_CONTAINS'  
9 - ? f?.key.key + '不包含' + f?.predicate.value.defaultValue  
10 - : f?.predicate.operation == 'NOT_EQUAL'  
11 - ? f?.key.key + '不等于' + f?.predicate.value.defaultValue  
12 - : f?.predicate.operation == 'GREATER'  
13 - ? f?.key.key + '大于' + f?.predicate.value.defaultValue  
14 - : f?.predicate.operation == 'LESS'  
15 - ? f?.key.key + '小于' + f?.predicate.value.defaultValue  
16 - : f?.predicate.operation == 'GREATER_OR_EQUAL'  
17 - ? f?.key.key + '大于或等于' + f?.predicate.value.defaultValue  
18 - : f?.key.key + '小于或等于' + f?.predicate.value.defaultValue; 1 +export const formatAlarmRuleConditionsData = (item) => {
  2 + console.log('==', item);
  3 + let item1 = [];
  4 + item1 = item.map((f) => {
  5 + return f?.predicate.operation == 'EQUAL'
  6 + ? f?.key.key + '等于' + f?.predicate.value.defaultValue
  7 + : f?.predicate.operation == 'STARTS_WITH'
  8 + ? f?.key.key + '开始于' + f?.predicate.value.defaultValue
  9 + : f?.predicate.operation == 'ENDS_WITH'
  10 + ? f?.key.key + '结束于' + f?.predicate.value.defaultValue
  11 + : f?.predicate.operation == 'NOT_CONTAINS'
  12 + ? f?.key.key + '不包含' + f?.predicate.value.defaultValue
  13 + : f?.predicate.operation == 'NOT_EQUAL'
  14 + ? f?.key.key + '不等于' + f?.predicate.value.defaultValue
  15 + : f?.predicate.operation == 'GREATER'
  16 + ? f?.key.key + '大于' + f?.predicate.value.defaultValue
  17 + : f?.predicate.operation == 'LESS'
  18 + ? f?.key.key + '小于' + f?.predicate.value.defaultValue
  19 + : f?.predicate.operation == 'GREATER_OR_EQUAL'
  20 + ? f?.key.key + '大于或等于' + f?.predicate.value.defaultValue
  21 + : f?.key.key + '小于或等于' + f?.predicate.value.defaultValue;
  22 + });
  23 + return item1;
19 }; 24 };
20 25
21 export const formatEnableRuleData = (f) => { 26 export const formatEnableRuleData = (f) => {
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 <!-- 报警类型和传递报警--> 3 <!-- 报警类型和传递报警-->
4 <div> 4 <div>
5 <div class="alert-type" style="margin-left: -2.1vw; margin-top: 1vh"> 5 <div class="alert-type" style="margin-left: -2.1vw; margin-top: 1vh">
6 - <BasicForm @register="registerForm"  
7 - /></div> 6 + <BasicForm @register="registerForm" />
  7 + </div>
8 <div style="margin-top: -15px"> 8 <div style="margin-top: -15px">
9 <div style="margin-left: -8px; margin-top: -10px"> 9 <div style="margin-left: -8px; margin-top: -10px">
10 <BasicForm 10 <BasicForm
@@ -45,11 +45,11 @@ @@ -45,11 +45,11 @@
45 <div style="width: 38vw; height: 30vh; border: 1px solid grey; border-radius: 4px"> 45 <div style="width: 38vw; height: 30vh; border: 1px solid grey; border-radius: 4px">
46 <div style="margin-top: 1vh"> 46 <div style="margin-top: 1vh">
47 <AlarmSeverityCpn 47 <AlarmSeverityCpn
48 - :ref="`AlarmSeverityRef${index}`" 48 + :ref="conditionRefs.AlarmSeverityRef"
49 :AlarmSeverityCpnData="!isStep3FatherAddOrEditStatus ? 1 : item" 49 :AlarmSeverityCpnData="!isStep3FatherAddOrEditStatus ? 1 : item"
50 /> 50 />
51 <DetailTemplateCpn 51 <DetailTemplateCpn
52 - :ref="`DetailTemplateRef${index}`" 52 + :ref="conditionRefs.DetailTemplateRef"
53 :DetailTemplateCpnData="!isStep3FatherAddOrEditStatus ? 1 : item" 53 :DetailTemplateCpnData="!isStep3FatherAddOrEditStatus ? 1 : item"
54 /> 54 />
55 <AlarmRuleConditionsCpn 55 <AlarmRuleConditionsCpn
@@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
57 @getAllFieldsRule="getAlarmRuleConditionsValFunc" 57 @getAllFieldsRule="getAlarmRuleConditionsValFunc"
58 /> 58 />
59 <EnableRuleCpn 59 <EnableRuleCpn
60 - :ref="`EnableRuleRef${index}`" 60 + :ref="conditionRefs.EnableRuleRef"
61 @register="registerEnableRuleModal" 61 @register="registerEnableRuleModal"
62 @getAllFieldsEnab="getEnableRuleFunc" 62 @getAllFieldsEnab="getEnableRuleFunc"
63 /> 63 />
@@ -67,47 +67,22 @@ @@ -67,47 +67,22 @@
67 style="border-radius: 10px" 67 style="border-radius: 10px"
68 class="mt-5" 68 class="mt-5"
69 @click="clickAddAlarmRuleConditionsFunc(item, index)" 69 @click="clickAddAlarmRuleConditionsFunc(item, index)"
70 - ><PlusCircleOutlined  
71 - /></a-button> 70 + >
  71 + <PlusCircleOutlined />
  72 + </a-button>
72 <div> 73 <div>
73 - <div>  
74 - <template  
75 - v-for="(item1, index1) in !isStep3FatherAddOrEditStatus  
76 - ? formatAlarmRuleConditions  
77 - : []"  
78 - :key="index1"  
79 - >  
80 - <p v-if="index1 == index && !isStep3FatherAddOrEditStatus">  
81 - 报警规则条件:{{ formatAlarmRuleConditionsData(item1.data[0]) }}  
82 - </p>  
83 - </template>  
84 - </div>  
85 - <div v-if="isStep3FatherAddOrEditStatus && formatEditRuleData.length == 0">  
86 - <p> 报警规则条件:{{ formatAlarmRuleConditionsDataFunc(item) }} </p> 74 + <div v-for="(item1, index1) in formatAlarmRuleConditions" :key="index1">
  75 + <p v-if="item1.key === index && item1.data.length > 0">
  76 + 报警规则条件:{{ formatAlarmRuleConditionsData(item1.data) }}
  77 + </p>
87 </div> 78 </div>
88 - <template  
89 - v-for="(item11, index11) in !isStep3FatherAddOrEditStatus  
90 - ? []  
91 - : formatEditRuleData"  
92 - :key="index11"  
93 - >  
94 - <div  
95 - v-if="  
96 - index11 == index &&  
97 - isStep3FatherAddOrEditStatus &&  
98 - formatEditRuleData.length > 0  
99 - "  
100 - >  
101 - <p> 报警规则条件:{{ formatEditRuleDataFunc(item11, index11) }} </p>  
102 - </div>  
103 - </template>  
104 </div> 79 </div>
105 </div> 80 </div>
106 <div style="margin-left: 0.5vw"> 81 <div style="margin-left: 0.5vw">
107 <span style="color: red">启用规则:</span> 82 <span style="color: red">启用规则:</span>
108 - <a-button style="border-radius: 10px" class="mt-5" @click="clickAddEnableRuleFunc"  
109 - ><PlusCircleOutlined  
110 - /></a-button> 83 + <a-button style="border-radius: 10px" class="mt-5" @click="clickAddEnableRuleFunc">
  84 + <PlusCircleOutlined />
  85 + </a-button>
111 <div> 86 <div>
112 <p v-if="formatEnableRule.length == 0 && !isStep3FatherAddOrEditStatus" 87 <p v-if="formatEnableRule.length == 0 && !isStep3FatherAddOrEditStatus"
113 >启用规则:始终启用</p 88 >启用规则:始终启用</p
@@ -150,9 +125,10 @@ @@ -150,9 +125,10 @@
150 </template> 125 </template>
151 </div> 126 </div>
152 <div> 127 <div>
153 - <a-button style="border-radius: 10px" class="mt-5" @click="clickAddCreateRuleFunc"  
154 - ><PlusCircleOutlined />添加创建条件</a-button  
155 - > 128 + <a-button style="border-radius: 10px" class="mt-5" @click="clickAddCreateRuleFunc">
  129 + <PlusCircleOutlined />
  130 + 添加创建条件
  131 + </a-button>
156 </div> 132 </div>
157 <!-- 清除报警规则 --> 133 <!-- 清除报警规则 -->
158 <div style="margin-top: 2vh"> 134 <div style="margin-top: 2vh">
@@ -193,8 +169,9 @@ @@ -193,8 +169,9 @@
193 style="border-radius: 10px" 169 style="border-radius: 10px"
194 class="mt-5" 170 class="mt-5"
195 @click="clickClearAlarmRuleConditionsFunc" 171 @click="clickClearAlarmRuleConditionsFunc"
196 - ><PlusCircleOutlined  
197 - /></a-button> 172 + >
  173 + <PlusCircleOutlined />
  174 + </a-button>
198 <div> 175 <div>
199 <div> 176 <div>
200 <template v-for="(item3, index3) in formatClearAlarmRuleConditions" :key="index3"> 177 <template v-for="(item3, index3) in formatClearAlarmRuleConditions" :key="index3">
@@ -202,22 +179,13 @@ @@ -202,22 +179,13 @@
202 <p> 报警规则条件:{{ formatClearAlarmRuleConditionsFunc(item3) }} </p> 179 <p> 报警规则条件:{{ formatClearAlarmRuleConditionsFunc(item3) }} </p>
203 </template> 180 </template>
204 </div> 181 </div>
205 - <div>  
206 - <template  
207 - v-for="(item33, index33) in formatEditClearAlarmRuleConditions"  
208 - :key="index33"  
209 - >  
210 - <span style="display: none">{{ index33 }}</span>  
211 - <p> 报警规则条件:{{ formatAlarmRuleConditionsData(item33) }} </p>  
212 - </template>  
213 - </div>  
214 </div> 182 </div>
215 </div> 183 </div>
216 <div style="margin-left: 0.5vw"> 184 <div style="margin-left: 0.5vw">
217 <span style="color: red">启用规则:</span> 185 <span style="color: red">启用规则:</span>
218 - <a-button style="border-radius: 10px" class="mt-5" @click="clickClearEnableRuleFunc"  
219 - ><PlusCircleOutlined  
220 - /></a-button> 186 + <a-button style="border-radius: 10px" class="mt-5" @click="clickClearEnableRuleFunc">
  187 + <PlusCircleOutlined />
  188 + </a-button>
221 <div> 189 <div>
222 <p v-if="formatEnableRule.length == 0 && !isStep3FatherAddOrEditStatus" 190 <p v-if="formatEnableRule.length == 0 && !isStep3FatherAddOrEditStatus"
223 >启用规则:始终启用</p 191 >启用规则:始终启用</p
@@ -246,9 +214,10 @@ @@ -246,9 +214,10 @@
246 </div> 214 </div>
247 </div> 215 </div>
248 <div style="position: relative; top: -1.2vh"> 216 <div style="position: relative; top: -1.2vh">
249 - <a-button style="border-radius: 10px" class="mt-5" @click="clickAddClearRuleFunc"  
250 - ><PlusCircleOutlined />添加清除条件</a-button  
251 - > 217 + <a-button style="border-radius: 10px" class="mt-5" @click="clickAddClearRuleFunc">
  218 + <PlusCircleOutlined />
  219 + 添加清除条件
  220 + </a-button>
252 </div> 221 </div>
253 </div> 222 </div>
254 <!-- 清除报警规则 --> 223 <!-- 清除报警规则 -->
@@ -289,7 +258,6 @@ @@ -289,7 +258,6 @@
289 setup(props) { 258 setup(props) {
290 const getConditionData = ref([]); 259 const getConditionData = ref([]);
291 const getConditionData1 = ref([{ key: 0, data: {} }]); 260 const getConditionData1 = ref([{ key: 0, data: {} }]);
292 - const clickConditionData = ref([]);  
293 const { proxy } = getCurrentInstance() as any; 261 const { proxy } = getCurrentInstance() as any;
294 const createAlarmRuleData: any = ref([1]); 262 const createAlarmRuleData: any = ref([1]);
295 const createEditAlarmRuleData: any = ref([]); 263 const createEditAlarmRuleData: any = ref([]);
@@ -297,14 +265,18 @@ @@ -297,14 +265,18 @@
297 const EnableRuleRef = ref(null); 265 const EnableRuleRef = ref(null);
298 const AlarmClearRuleConditionsRef = ref(null); 266 const AlarmClearRuleConditionsRef = ref(null);
299 const EnableClearRuleRef = ref(null); 267 const EnableClearRuleRef = ref(null);
300 - const formatAlarmRuleConditions: any = ref([]); 268 + const formatAlarmRuleConditions = ref([]);
301 const formatClearAlarmRuleConditions: any = ref([]); 269 const formatClearAlarmRuleConditions: any = ref([]);
302 const formatEditClearAlarmRuleConditions: any = ref([]); 270 const formatEditClearAlarmRuleConditions: any = ref([]);
303 const formatEnableRule: any = ref([]); 271 const formatEnableRule: any = ref([]);
304 const formatClearEnableRule: any = ref([]); 272 const formatClearEnableRule: any = ref([]);
305 const formatEditClearEnableRule: any = ref([]); 273 const formatEditClearEnableRule: any = ref([]);
  274 + const level = ref(['CRITICAL', 'MAJOR', 'MINOR', 'WARNING', 'INDETERMINATE']);
306 const conditionRefs = { 275 const conditionRefs = {
307 AlarmRuleConditionsRef: ref([]), 276 AlarmRuleConditionsRef: ref([]),
  277 + AlarmSeverityRef: ref([]),
  278 + DetailTemplateRef: ref([]),
  279 + EnableRuleRef: ref([]),
308 }; 280 };
309 let alaramsObj: any = reactive({ 281 let alaramsObj: any = reactive({
310 alarmType: null, 282 alarmType: null,
@@ -383,16 +355,28 @@ @@ -383,16 +355,28 @@
383 i--; 355 i--;
384 createAlarmRuleData.value.push(1); 356 createAlarmRuleData.value.push(1);
385 nextTick(() => { 357 nextTick(() => {
386 - // proxy.$refs['AlarmSeverityRef' + i].updateSchemaSelectDisableFunc(); 358 + conditionRefs.AlarmSeverityRef.value.map((item, index) => {
  359 + if (i === index) {
  360 + nextTick(() => {
  361 + item.updateSchemaSelectDisableFunc();
  362 + });
  363 + }
  364 + });
387 }); 365 });
388 if (isStep3FatherAddOrEditStatus.value) { 366 if (isStep3FatherAddOrEditStatus.value) {
389 createEditAlarmRuleData.value.push(1); 367 createEditAlarmRuleData.value.push(1);
390 } 368 }
391 }; 369 };
392 - const updateCpnSchemaSelectEnableFunc = () => {  
393 - proxy.$refs['AlarmSeverityRef' + 0].updateSchemaSelectEnableFunc();  
394 - proxy.$refs['AlarmSeverityRef' + 1].updateSchemaSelectEnableFunc(); 370 + const updateCpnSchemaSelectEnableFunc = (select) => {
  371 + conditionRefs.AlarmSeverityRef.value.map((item, index) => {
  372 + if (select === index) {
  373 + nextTick(() => {
  374 + item.updateSchemaSelectEnableFunc();
  375 + });
  376 + }
  377 + });
395 }; 378 };
  379 +
396 /** 380 /**
397 * 获取清除报警规则数据 381 * 获取清除报警规则数据
398 */ 382 */
@@ -459,12 +443,21 @@ @@ -459,12 +443,21 @@
459 }); 443 });
460 }; 444 };
461 const getAlarmRuleConditionsValFunc = (e) => { 445 const getAlarmRuleConditionsValFunc = (e) => {
462 - console.log('获取condition的值', e);  
463 - formatAlarmRuleConditions.value.push(e);  
464 - clickConditionData.value = e; 446 + console.log('获取值');
  447 + if (!isStep3FatherAddOrEditStatus) {
  448 + formatAlarmRuleConditions.value.push(e);
  449 + } else {
  450 + for (let i = 0; i < formatAlarmRuleConditions.value.length; i++) {
  451 + if (formatAlarmRuleConditions.value[i].key == e.key) {
  452 + formatAlarmRuleConditions.value.splice(i, 1);
  453 + }
  454 + }
  455 + formatAlarmRuleConditions.value.push(e);
  456 + }
  457 +
465 let addValue = undefined; 458 let addValue = undefined;
466 getConditionData1.value.forEach((obj) => { 459 getConditionData1.value.forEach((obj) => {
467 - if (obj.data.length != undefined && obj.key == e.key) { 460 + if (Object.keys(obj.data).length != 0 && obj.key == e.key) {
468 obj.data = e.data; 461 obj.data = e.data;
469 } else { 462 } else {
470 addValue = e; 463 addValue = e;
@@ -479,18 +472,10 @@ @@ -479,18 +472,10 @@
479 condition: e, 472 condition: e,
480 } as never); 473 } as never);
481 }; 474 };
482 - const formatAlarmRuleConditionsFunc = (e) => { 475 + const formatClearAlarmRuleConditionsFunc = (e) => {
483 // let formatMap = e.condition.map((f: any) => formatAlarmRuleConditionsData(f)); 476 // let formatMap = e.condition.map((f: any) => formatAlarmRuleConditionsData(f));
484 // return formatMap; 477 // return formatMap;
485 }; 478 };
486 - const formatEditRuleDataFunc = (e, i) => {  
487 - let formatMap = e.condition.map((f: any) => formatAlarmRuleConditionsData(f));  
488 - return formatMap;  
489 - };  
490 - const formatClearAlarmRuleConditionsFunc = (e) => {  
491 - let formatMap = e.condition.map((f: any) => formatAlarmRuleConditionsData(f));  
492 - return formatMap;  
493 - };  
494 const getEnableRuleFunc = (e) => { 479 const getEnableRuleFunc = (e) => {
495 formatEnableRule.value.push(e); 480 formatEnableRule.value.push(e);
496 formatEditEnableData.value.push(e); 481 formatEditEnableData.value.push(e);
@@ -513,7 +498,7 @@ @@ -513,7 +498,7 @@
513 /** 498 /**
514 * 获取第三步所有的数据 499 * 获取第三步所有的数据
515 */ 500 */
516 - const getStep3AllDataFunc = async (e) => { 501 + const getStep3AllDataFunc = async () => {
517 try { 502 try {
518 const UUID = generateUUID(); 503 const UUID = generateUUID();
519 const val1 = await getAlarmTypeValFunc(); 504 const val1 = await getAlarmTypeValFunc();
@@ -547,53 +532,48 @@ @@ -547,53 +532,48 @@
547 }, 532 },
548 }; 533 };
549 } 534 }
550 - if (e == 1) {  
551 - alaramsObj.createRules;  
552 - for (let i = 0; i < createAlarmRuleData.value.length; i++) {  
553 - formatAlarmRuleConditions.value.forEach((f, ii) => {  
554 - if (ii == i) {  
555 - val4 = proxy.$refs['AlarmSeverityRef' + ii].getFieldsValueFunc();  
556 - val5 = proxy.$refs['DetailTemplateRef' + ii].getFieldsValueFunc();  
557 - console.log(f.data);  
558 - formatEnableRule.value.forEach((f1, i1) => {  
559 - if (i1 === ii) {  
560 - alaramsObj.createRules[val4?.default] = {  
561 - ...val5,  
562 - ...{  
563 - schedule: f1,  
564 - },  
565 - ...{  
566 - condition: {  
567 - condition: f.data,  
568 - },  
569 - },  
570 - };  
571 - }  
572 - });  
573 - }  
574 - });  
575 - }  
576 - } else if (e == 2) {  
577 - console.log('edit');  
578 - for (let i = 0; i < createEditAlarmRuleData.value.length; i++) {  
579 - const iiii = i;  
580 - val4 = proxy.$refs['AlarmSeverityRef' + iiii].getFieldsValueFunc();  
581 - val5 = proxy.$refs['DetailTemplateRef' + iiii].getFieldsValueFunc();  
582 - val6.value = proxy.$refs['AlarmRuleConditionsRef' + iiii].getFieldsValueFunc();  
583 - console.log(val6.value);  
584 - val7.value = proxy.$refs['EnableRuleRef' + iiii].getFieldsValueFunc();  
585 - alaramsObj.createRules[val4?.default] = {  
586 - ...val5,  
587 - ...{  
588 - schedule: val7.value,  
589 - },  
590 - ...{  
591 - condition: {  
592 - condition: val6.value, 535 + let temp = [];
  536 + if (!isStep3FatherAddOrEditStatus) {
  537 + temp = createAlarmRuleData.value;
  538 + } else {
  539 + temp = createEditAlarmRuleData.value;
  540 + }
  541 + for (let i = 0; i < temp.length; i++) {
  542 + formatAlarmRuleConditions.value.forEach((f, ii) => {
  543 + if (ii == i) {
  544 + conditionRefs.AlarmSeverityRef.value.forEach((item, index) => {
  545 + if (index == ii) {
  546 + val4 = item.getFieldsValueFunc();
  547 + }
  548 + });
  549 + conditionRefs.DetailTemplateRef.value.forEach((item, index) => {
  550 + if (index == ii) {
  551 + val5 = item.getFieldsValueFunc();
  552 + }
  553 + });
  554 + conditionRefs.AlarmRuleConditionsRef.value.forEach((item, index) => {
  555 + if (index == ii) {
  556 + val6.value = item.getFieldsValueFunc();
  557 + }
  558 + });
  559 + conditionRefs.EnableRuleRef.value.forEach((item, index) => {
  560 + if (index == ii) {
  561 + val7.value = item.getFieldsValueFunc();
  562 + }
  563 + });
  564 + alaramsObj.createRules[val4?.default] = {
  565 + ...val5,
  566 + ...{
  567 + schedule: val7.value,
593 }, 568 },
594 - },  
595 - };  
596 - } 569 + ...{
  570 + condition: {
  571 + condition: val6.value,
  572 + },
  573 + },
  574 + };
  575 + }
  576 + });
597 } 577 }
598 return alaramsObj; 578 return alaramsObj;
599 } catch (e) { 579 } catch (e) {
@@ -644,67 +624,65 @@ @@ -644,67 +624,65 @@
644 } 624 }
645 ); 625 );
646 const echoStep3DataCpnFunc = () => { 626 const echoStep3DataCpnFunc = () => {
647 - try {  
648 - if (props.step3FatherEmitCpnData !== 1) {  
649 - if (props.step3FatherEmitCpnData == undefined) return;  
650 - isStep3FatherAddOrEditStatus.value = props.step3FatherEmitCpnStatus;  
651 - for (let i in props.step3FatherEmitCpnData?.createRules) {  
652 - createEditAlarmRuleData.value.push({  
653 - [i]: props.step3FatherEmitCpnData?.createRules[i],  
654 - });  
655 - }  
656 - nextTick(() => {  
657 - setAlarmTypeValFunc({  
658 - alarmType: props.step3FatherEmitCpnData?.alarmType,  
659 - });  
660 - try {  
661 - setDeliverAlertsValFunc({  
662 - propagate: props.step3FatherEmitCpnData?.propagate,  
663 - propagateRelationTypes: props.step3FatherEmitCpnData?.propagateRelationTypes[0],  
664 - });  
665 - } catch {}  
666 - if (props.step3FatherEmitCpnData?.clearRule?.alarmDetails !== '') {  
667 - isClearStatus.value = true;  
668 - nextTick(() => {  
669 - setRegisterFormClearChangeDetailFunc({  
670 - alarmDetails: props.step3FatherEmitCpnData?.clearRule?.alarmDetails, 627 + if (props.step3FatherEmitCpnData !== 1) {
  628 + if (props.step3FatherEmitCpnData == undefined) return;
  629 + isStep3FatherAddOrEditStatus.value = props.step3FatherEmitCpnStatus;
  630 + for (let i in props.step3FatherEmitCpnData?.createRules) {
  631 + console.log(props.step3FatherEmitCpnData);
  632 + createEditAlarmRuleData.value.push({
  633 + [i]: props.step3FatherEmitCpnData?.createRules[i],
  634 + });
  635 + }
  636 + level.value.forEach((item, index) => {
  637 + createEditAlarmRuleData.value.forEach((item1) => {
  638 + for (let i in item1) {
  639 + if (i != undefined && i == item) {
  640 + formatAlarmRuleConditions.value.push({
  641 + key: index,
  642 + data: item1[i].condition.condition,
671 }); 643 });
672 - });  
673 - }  
674 - formatEditClearAlarmRuleConditions.value =  
675 - props.step3FatherEmitCpnData?.clearRule?.condition?.condition;  
676 - formatEditClearEnableRule.value.push(  
677 - props.step3FatherEmitCpnData?.clearRule?.schedule  
678 - );  
679 - if (props.step3FatherEmitCpnData?.clearRule == null) {  
680 - nextTick(() => {  
681 - return (isClearStatus.value = false);  
682 - });  
683 - } else {  
684 - nextTick(() => {  
685 - return (isClearStatus.value = true);  
686 - }); 644 + }
687 } 645 }
688 }); 646 });
689 - }  
690 - } catch {} 647 + });
  648 + getConditionData1.value = formatAlarmRuleConditions.value;
  649 + nextTick(() => {
  650 + setAlarmTypeValFunc({
  651 + alarmType: props.step3FatherEmitCpnData?.alarmType,
  652 + });
  653 + try {
  654 + setDeliverAlertsValFunc({
  655 + propagate: props.step3FatherEmitCpnData?.propagate,
  656 + propagateRelationTypes: props.step3FatherEmitCpnData?.propagateRelationTypes[0],
  657 + });
  658 + } catch {}
  659 + if (props.step3FatherEmitCpnData?.clearRule?.alarmDetails !== '') {
  660 + isClearStatus.value = true;
  661 + nextTick(() => {
  662 + setRegisterFormClearChangeDetailFunc({
  663 + alarmDetails: props.step3FatherEmitCpnData?.clearRule?.alarmDetails,
  664 + });
  665 + });
  666 + }
  667 + formatEditClearAlarmRuleConditions.value =
  668 + props.step3FatherEmitCpnData?.clearRule?.condition?.condition;
  669 + formatEditClearEnableRule.value.push(props.step3FatherEmitCpnData?.clearRule?.schedule);
  670 + if (props.step3FatherEmitCpnData?.clearRule == null) {
  671 + nextTick(() => {
  672 + return (isClearStatus.value = false);
  673 + });
  674 + } else {
  675 + nextTick(() => {
  676 + return (isClearStatus.value = true);
  677 + });
  678 + }
  679 + });
  680 + }
691 }; 681 };
692 echoStep3DataCpnFunc(); 682 echoStep3DataCpnFunc();
693 - const formatAlarmRuleConditionsDataFunc = (v) => {  
694 - let formatMap = formatAlarmRuleConditionsData1(v)?.condition?.condition.map((f: any) =>  
695 - formatAlarmRuleConditionsData(f)  
696 - );  
697 - return formatMap;  
698 - };  
699 -  
700 const formatEnableRuleFuncData = (v) => { 683 const formatEnableRuleFuncData = (v) => {
701 return formatEnableRuleData(formatAlarmRuleConditionsData1(v)?.schedule); 684 return formatEnableRuleData(formatAlarmRuleConditionsData1(v)?.schedule);
702 }; 685 };
703 -  
704 - const forMatAddConditionFunc = (e) => {  
705 - let formatMap = e.data.map((f: any) => formatAlarmRuleConditionsData(f));  
706 - return formatMap;  
707 - };  
708 return { 686 return {
709 registerForm, 687 registerForm,
710 registerFormHighSetting, 688 registerFormHighSetting,
@@ -719,7 +697,6 @@ @@ -719,7 +697,6 @@
719 registerEnableRuleModal, 697 registerEnableRuleModal,
720 getAlarmRuleConditionsValFunc, 698 getAlarmRuleConditionsValFunc,
721 formatAlarmRuleConditions, 699 formatAlarmRuleConditions,
722 - formatAlarmRuleConditionsFunc,  
723 formatEnableRule, 700 formatEnableRule,
724 formatEnableRuleFunc, 701 formatEnableRuleFunc,
725 getEnableRuleFunc, 702 getEnableRuleFunc,
@@ -747,19 +724,17 @@ @@ -747,19 +724,17 @@
747 formatEnableRuleData, 724 formatEnableRuleData,
748 formatEditClearEnableRule, 725 formatEditClearEnableRule,
749 createEditAlarmRuleData, 726 createEditAlarmRuleData,
750 - formatAlarmRuleConditionsDataFunc,  
751 formatEnableRuleFuncData, 727 formatEnableRuleFuncData,
752 AlarmClearRuleConditionsRef, 728 AlarmClearRuleConditionsRef,
753 EnableClearRuleRef, 729 EnableClearRuleRef,
754 formatEditRuleData, 730 formatEditRuleData,
755 - formatEditRuleDataFunc,  
756 formatEditEnableData, 731 formatEditEnableData,
757 formatEditEnableRuleFunc, 732 formatEditEnableRuleFunc,
758 updateCpnSchemaSelectEnableFunc, 733 updateCpnSchemaSelectEnableFunc,
759 getConditionData, 734 getConditionData,
760 getConditionData1, 735 getConditionData1,
761 - forMatAddConditionFunc,  
762 conditionRefs, 736 conditionRefs,
  737 + level,
763 }; 738 };
764 }, 739 },
765 }); 740 });
@@ -9,9 +9,7 @@ @@ -9,9 +9,7 @@
9 @cancel="handleCancel" 9 @cancel="handleCancel"
10 > 10 >
11 <CollapseContainer title="键名筛选器" class="border mb-8"> 11 <CollapseContainer title="键名筛选器" class="border mb-8">
12 - <div class="table-style"  
13 - >{{ currentIndex }}  
14 - {{ getTableApiData.value }} 12 + <div class="table-style">
15 <BasicTable 13 <BasicTable
16 :showIndexColumn="false" 14 :showIndexColumn="false"
17 :dataSource="getTableApiData.value" 15 :dataSource="getTableApiData.value"
@@ -151,6 +149,9 @@ @@ -151,6 +149,9 @@
151 slots: { customRender: 'action' }, 149 slots: { customRender: 'action' },
152 }, 150 },
153 }); 151 });
  152 + const getFieldsValueFunc = () => {
  153 + return watchCurrentAlarmConditionValue.data;
  154 + };
154 const handleSubmit = () => { 155 const handleSubmit = () => {
155 lastValues.value = getFieldsValue(); 156 lastValues.value = getFieldsValue();
156 watchCurrentAlarmConditionValue.key = currentIndex.value; 157 watchCurrentAlarmConditionValue.key = currentIndex.value;
@@ -194,6 +195,7 @@ @@ -194,6 +195,7 @@
194 type: currentAlarmCondition.data[i].key.type, 195 type: currentAlarmCondition.data[i].key.type,
195 operation: currentAlarmCondition.data[i].predicate.operation, 196 operation: currentAlarmCondition.data[i].predicate.operation,
196 value1: currentAlarmCondition.data[i].value, 197 value1: currentAlarmCondition.data[i].value,
  198 + type1: currentAlarmCondition.data[i].valueType,
197 }; 199 };
198 getTableApiData.value.push(obj); 200 getTableApiData.value.push(obj);
199 index++; 201 index++;
@@ -266,6 +268,7 @@ @@ -266,6 +268,7 @@
266 register, 268 register,
267 getTitle, 269 getTitle,
268 currentIndex, 270 currentIndex,
  271 + getFieldsValueFunc,
269 }; 272 };
270 }, 273 },
271 }); 274 });
@@ -8,7 +8,7 @@ export const formSchema: FormSchema[] = [ @@ -8,7 +8,7 @@ export const formSchema: FormSchema[] = [
8 field: 'default', 8 field: 'default',
9 component: 'Select', 9 component: 'Select',
10 label: '报警严重程度:', 10 label: '报警严重程度:',
11 - defaultValue: 'CRITICAL', 11 + required: true,
12 colProps: { 12 colProps: {
13 span: 17, 13 span: 17,
14 }, 14 },
@@ -73,6 +73,7 @@ @@ -73,6 +73,7 @@
73 componentProps: ({ formModel }) => { 73 componentProps: ({ formModel }) => {
74 console.log(formModel); 74 console.log(formModel);
75 return { 75 return {
  76 + disabled: false,
76 options: item, 77 options: item,
77 }; 78 };
78 }, 79 },
@@ -96,6 +97,7 @@ @@ -96,6 +97,7 @@
96 registerForm, 97 registerForm,
97 setFieldsValueFunc, 98 setFieldsValueFunc,
98 updateSchemaSelectEnableFunc, 99 updateSchemaSelectEnableFunc,
  100 + item,
99 }; 101 };
100 }, 102 },
101 }); 103 });