Commit 67e1cea4bcdc68edf32c0e0967dba1b55385f9c7

Authored by xp.Huang
2 parents df4a6fbf 2406ce67

Merge branch 'ft-dev' into 'main'

feat:新增场景联动新增按钮,删除按钮和编辑按钮权限,fix:修复设备配置编辑第三步数据回显和无法删除报警规则,修改设备配置文件夹名字

See merge request huang/yun-teng-iot-front!142
Showing 29 changed files with 521 additions and 1054 deletions
  1 +//生成uuid
  2 +export function generateUUID() {
  3 + let d = new Date().getTime();
  4 + if (window.performance && typeof window.performance.now === 'function') {
  5 + d += performance.now();
  6 + }
  7 + const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
  8 + const r = (d + Math.random() * 16) % 16 | 0;
  9 + d = Math.floor(d / 16);
  10 + return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);
  11 + });
  12 + return uuid;
  13 +}
1 -import { FormSchema } from '/@/components/Form';  
2 -import { findDictItemByCode } from '/@/api/system/dict';  
3 -import { alarmContactGetPage } from '/@/api/device/deviceConfigApi';  
4 -  
5 -export const alertContactsSchemas: FormSchema[] = [  
6 - {  
7 - field: 'alarmContactId',  
8 - label: '告警通知联系人',  
9 - component: 'ApiSelect',  
10 - required: true,  
11 - componentProps: {  
12 - mode: 'multiple',  
13 - api: alarmContactGetPage,  
14 - labelField: 'username',  
15 - valueField: 'id',  
16 - resultField: 'items',  
17 - },  
18 - },  
19 - {  
20 - field: 'messageMode',  
21 - label: '告警通知方式',  
22 - required: true,  
23 - component: 'ApiSelect',  
24 - componentProps: {  
25 - mode: 'multiple',  
26 - api: findDictItemByCode,  
27 - params: {  
28 - dictCode: 'message_type',  
29 - },  
30 - labelField: 'itemText',  
31 - valueField: 'itemValue',  
32 - },  
33 - },  
34 -];  
1 -<template>  
2 - <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" />  
3 -</template>  
4 -<script lang="ts">  
5 - import { defineComponent, ref } from 'vue';  
6 - import { BasicForm, useForm } from '/@/components/Form/index';  
7 - import { alertContactsSchemas } from './config';  
8 -  
9 - export default defineComponent({  
10 - components: { BasicForm },  
11 - setup() {  
12 - const getValueData: any = ref({});  
13 - const [register, { getFieldsValue, resetFields }] = useForm({  
14 - schemas: alertContactsSchemas,  
15 - actionColOptions: {  
16 - span: 24,  
17 - },  
18 - });  
19 - function getAllFields(getV) {  
20 - const values = getFieldsValue();  
21 - getValueData.value = values;  
22 - getV = getValueData.value;  
23 - return getV;  
24 - }  
25 - const customResetStep4AndFunc = () => {  
26 - resetFields();  
27 - };  
28 - return {  
29 - customResetStep4AndFunc,  
30 - getAllFields,  
31 - register,  
32 - };  
33 - },  
34 - });  
35 -</script>  
1 -<template>  
2 - <div>  
3 - <BasicModal  
4 - :showCancelBtn="false"  
5 - :showOkBtn="false"  
6 - v-bind="$attrs"  
7 - width="55rem"  
8 - @register="register"  
9 - :title="getTitle"  
10 - >  
11 - <Tabs @change="handleChange" v-model:activeKey="activeKey">  
12 - <TabPane key="1" tab="详情">  
13 - <BasicForm  
14 - :showSubmitButton="false"  
15 - :showResetButton="false"  
16 - @register="registerDetail"  
17 - />  
18 - </TabPane>  
19 - <TabPane key="2" tab="传输配置" force-render>  
20 - <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerTrans"  
21 - /></TabPane>  
22 - <TabPane key="3" tab="报警规则">  
23 - <div style="padding-top: 10px">  
24 - <div style="border-radius: 10px">  
25 - <p style="font-weight: 900">报警规则</p>  
26 - <div class="input-style" style="margin-left: 15px">  
27 - <BasicForm  
28 - :showSubmitButton="false"  
29 - :showResetButton="false"  
30 - @register="registerStep3Schemas"  
31 - />  
32 - <BasicForm  
33 - :showSubmitButton="false"  
34 - :showResetButton="false"  
35 - @register="registerStep3HighSetting"  
36 - />  
37 - <BasicForm  
38 - :showSubmitButton="false"  
39 - :showResetButton="false"  
40 - @register="registerStep3CreateAlarm"  
41 - />  
42 - <BasicForm  
43 - :showSubmitButton="false"  
44 - :showResetButton="false"  
45 - @register="registerStep3RuleAlarm"  
46 - />  
47 - <BasicForm  
48 - :showSubmitButton="false"  
49 - :showResetButton="false"  
50 - @register="registerStep3Condition"  
51 - />  
52 - <BasicForm  
53 - :showSubmitButton="false"  
54 - :showResetButton="false"  
55 - @register="registerStep3Enable"  
56 - />  
57 - <BasicForm  
58 - :showSubmitButton="false"  
59 - :showResetButton="false"  
60 - @register="registerStep3TemplateDetail"  
61 - />  
62 - </div>  
63 - </div>  
64 - <div style="border-radius: 10px; margin-top: 15px">  
65 - <p style="font-weight: 900">清除报警规则</p>  
66 - <div class="clear-input-style" style="margin-left: 15px">  
67 - <BasicForm  
68 - :showSubmitButton="false"  
69 - :showResetButton="false"  
70 - @register="registerStep3ClearRuleAlarm"  
71 - />  
72 - <BasicForm  
73 - :showSubmitButton="false"  
74 - :showResetButton="false"  
75 - @register="registerStep3ClearCondition"  
76 - />  
77 - <BasicForm  
78 - :showSubmitButton="false"  
79 - :showResetButton="false"  
80 - @register="registerStep3ClearEnable"  
81 - />  
82 - <BasicForm  
83 - :showSubmitButton="false"  
84 - :showResetButton="false"  
85 - @register="registerStep3ClearTemplateDetail"  
86 - />  
87 - </div>  
88 - </div>  
89 - </div>  
90 - </TabPane>  
91 - <TabPane key="4" tab="告警管理">  
92 - <BasicForm :showSubmitButton="false" :showResetButton="false" @register="registerContact"  
93 - /></TabPane>  
94 - </Tabs>  
95 - </BasicModal>  
96 - </div>  
97 -</template>  
98 -<script lang="ts">  
99 - import { defineComponent, ref, computed, watch } from 'vue';  
100 - import { BasicModal, useModalInner } from '/@/components/Modal';  
101 - import { Tabs } from 'ant-design-vue';  
102 - import { deviceConfigGetDetail } from '/@/api/device/deviceConfigApi';  
103 - import { BasicForm, useForm } from '/@/components/Form/index';  
104 - import {  
105 - step1Schemas,  
106 - step2Schemas,  
107 - step3Schemas,  
108 - step3ViewHighSetting,  
109 - step3CreateAlarm,  
110 - alertContactsSchemas,  
111 - } from './step/data';  
112 -  
113 - import { formSchema as conditionFormSchema } from './step/cpns/alarmruleconditions/config';  
114 - import { formSchema as enableSchema } from './step/cpns/enablerule/config';  
115 - import { formSchema as detailSchema } from './step/cpns/detailtemplate/config';  
116 - import { formSchema as echoFormSchema } from './step/cpns/alarmruleconditions/cpns/config';  
117 - import { formSchema as conditionFormClearschema } from './step/cpns/alarmruleconditions/config';  
118 - import { formSchema as enableClearSchema } from './step/cpns/enablerule/config';  
119 - import { formSchema as detailClearSchema } from './step/cpns/detailtemplate/config';  
120 - import { formSchema as echoFormClearSchema } from './step/cpns/alarmruleconditions/cpns/config';  
121 -  
122 - export default defineComponent({  
123 - name: 'ConfigDrawer',  
124 - components: { Tabs, TabPane: Tabs.TabPane, BasicModal, BasicForm },  
125 - emits: ['success', 'register'],  
126 - setup() {  
127 - const activeKey = ref('1');  
128 - const isUpdate = ref(true);  
129 - const descInfo: any = ref(null);  
130 - const dataInfo: any = ref('');  
131 - const [registerDetail, { resetFields, setFieldsValue: setRegisterDetail }] = useForm({  
132 - schemas: step1Schemas,  
133 - actionColOptions: {  
134 - span: 24,  
135 - },  
136 - });  
137 - const [registerTrans, { setFieldsValue: setRegisterTrans }] = useForm({  
138 - schemas: step2Schemas,  
139 - actionColOptions: {  
140 - span: 24,  
141 - },  
142 - });  
143 - const [  
144 - registerStep3Schemas,  
145 - { setFieldsValue: setRegisterStep3Schemas, resetFields: resetFieldsStep3Schemas },  
146 - ] = useForm({  
147 - schemas: step3Schemas,  
148 - actionColOptions: {  
149 - span: 24,  
150 - },  
151 - });  
152 - const [  
153 - registerStep3HighSetting,  
154 - { setFieldsValue: setRegisterStep3HighSetting, resetFields: resetFieldsStep3HighSetting },  
155 - ] = useForm({  
156 - schemas: step3ViewHighSetting,  
157 - actionColOptions: {  
158 - span: 24,  
159 - },  
160 - });  
161 - const [  
162 - registerStep3CreateAlarm,  
163 - { setFieldsValue: setRegisterStep3CreateAlarm, resetFields: resetFieldsStep3CreateAlarm },  
164 - ] = useForm({  
165 - schemas: step3CreateAlarm,  
166 - actionColOptions: {  
167 - span: 24,  
168 - },  
169 - });  
170 - const [  
171 - registerContact,  
172 - { setFieldsValue: setRegisterContact, resetFields: resetFieldsContact },  
173 - ] = useForm({  
174 - schemas: alertContactsSchemas,  
175 - actionColOptions: {  
176 - span: 24,  
177 - },  
178 - });  
179 - const [  
180 - registerStep3RuleAlarm,  
181 - { setFieldsValue: setRegisterStep3RuleAlarm, resetFields: resetFieldsStep3RuleAlarm },  
182 - ] = useForm({  
183 - schemas: echoFormSchema,  
184 - actionColOptions: {  
185 - span: 24,  
186 - },  
187 - });  
188 - const [  
189 - registerStep3Condition,  
190 - { setFieldsValue: setRegisterStep3Condition, resetFields: resetFieldsrStep3Condition },  
191 - ] = useForm({  
192 - schemas: conditionFormSchema,  
193 - actionColOptions: {  
194 - span: 24,  
195 - },  
196 - });  
197 - const [  
198 - registerStep3Enable,  
199 - { setFieldsValue: setRegisterStep3Enable, resetFields: resetFieldsStep3Enable },  
200 - ] = useForm({  
201 - schemas: enableSchema,  
202 - actionColOptions: {  
203 - span: 24,  
204 - },  
205 - });  
206 - const [  
207 - registerStep3TemplateDetail,  
208 - {  
209 - setFieldsValue: setRegisterStep3TemplateDetail,  
210 - resetFields: resetFieldsStep3TemplateDetail,  
211 - },  
212 - ] = useForm({  
213 - schemas: detailSchema,  
214 - actionColOptions: {  
215 - span: 24,  
216 - },  
217 - });  
218 -  
219 - //清除报警  
220 - const [  
221 - registerStep3ClearRuleAlarm,  
222 - {  
223 - setFieldsValue: setRegisterStep3ClearRuleAlarm,  
224 - resetFields: resetFieldsStep3ClearRuleAlarm,  
225 - },  
226 - ] = useForm({  
227 - schemas: echoFormClearSchema,  
228 - actionColOptions: {  
229 - span: 24,  
230 - },  
231 - });  
232 - const [  
233 - registerStep3ClearCondition,  
234 - {  
235 - setFieldsValue: setRegisterStep3ClearCondition,  
236 - resetFields: resetFieldsStep3ClearCondition,  
237 - },  
238 - ] = useForm({  
239 - schemas: conditionFormClearschema,  
240 - actionColOptions: {  
241 - span: 24,  
242 - },  
243 - });  
244 - const [  
245 - registerStep3ClearEnable,  
246 - { setFieldsValue: setRegisterStep3ClearEnable, resetFields: resetFieldStep3ClearEnablel },  
247 - ] = useForm({  
248 - schemas: enableClearSchema,  
249 - actionColOptions: {  
250 - span: 24,  
251 - },  
252 - });  
253 - const [  
254 - registerStep3ClearTemplateDetail,  
255 - {  
256 - setFieldsValue: setRegisterStep3ClearTemplateDetail,  
257 - resetFields: resetFieldStep3ClearTemplateDetail,  
258 - },  
259 - ] = useForm({  
260 - schemas: detailClearSchema,  
261 - actionColOptions: {  
262 - span: 24,  
263 - },  
264 - });  
265 -  
266 - const [register] = useModalInner(async (data) => {  
267 - activeKey.value = '1';  
268 - isUpdate.value = !!data?.isUpdate;  
269 - const getV = await deviceConfigGetDetail(data.record.id);  
270 - descInfo.value = getV;  
271 - try {  
272 - resetFields();  
273 - await setRegisterDetail({ ...descInfo.value });  
274 - } catch (e) {  
275 - return e;  
276 - }  
277 - });  
278 - const handleChange = (v) => {  
279 - try {  
280 - switch (v) {  
281 - // case '1':  
282 - // setRegisterDetail({ ...descInfo.value });  
283 - // break;  
284 - case '2':  
285 - setRegisterTrans({  
286 - transportType: descInfo.value.profileData?.transportConfiguration.type,  
287 - });  
288 - break;  
289 - case '3':  
290 - setTimeout(() => {  
291 - resetFieldsStep3SchemasFunc();  
292 - resetFieldsStep3HighSettingFunc();  
293 - resetFieldsStep3CreateAlarmFunc();  
294 - resetFieldsStep3RuleAlarmFunc();  
295 - resetFieldsStep3RuleAlarmFunc1();  
296 - resetFieldsrStep3ConditionFunc();  
297 - resetFieldsStep3EnableFunc();  
298 - resetFieldsStep3TemplateDetailFunc();  
299 - resetFieldsStep3ClearRuleAlarmFunc();  
300 - resetFieldsStep3ClearRuleAlarmlFunc();  
301 - resetFieldsStep3ClearConditionFunc();  
302 - resetFieldStep3ClearEnablelFunc();  
303 - resetFieldStep3ClearTemplateDetailFunc();  
304 - }, 100);  
305 - setTimeout(() => {  
306 - try {  
307 - setRegisterStep3Schemas({  
308 - alarmType: descInfo.value.profileData?.alarms[0]?.alarmType,  
309 - });  
310 - } catch (e) {  
311 - return e;  
312 - }  
313 -  
314 - try {  
315 - setRegisterStep3HighSetting({  
316 - propagate: descInfo.value.profileData?.alarms[0]?.propagate,  
317 - propagateRelationTypes:  
318 - descInfo.value.profileData?.alarms[0]?.propagateRelationTypes[0],  
319 - });  
320 - const getKey = Object.keys(descInfo.value.profileData?.alarms[0]?.createRules);  
321 - setRegisterStep3CreateAlarm({  
322 - default: getKey[0],  
323 - });  
324 - setRegisterStep3RuleAlarm({  
325 - type: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition  
326 - .condition[0].key.type,  
327 - key1: descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition  
328 - .condition[0].key.key,  
329 - type1:  
330 - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition  
331 - .condition[0].valueType,  
332 - value1:  
333 - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition  
334 - .condition[0].predicate.value.defaultValue,  
335 - operation:  
336 - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition  
337 - .condition[0].predicate.operation,  
338 - });  
339 - setRegisterStep3Condition({  
340 - conditionType:  
341 - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].condition.spec  
342 - .type,  
343 - });  
344 - setRegisterStep3Enable({  
345 - schedule:  
346 - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].schedule.type,  
347 - });  
348 - setRegisterStep3TemplateDetail({  
349 - alarmDetails:  
350 - descInfo.value.profileData?.alarms[0].createRules[getKey[0]].alarmDetails,  
351 - });  
352 - //清除报警  
353 - setRegisterStep3ClearRuleAlarm({  
354 - type: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key  
355 - .type,  
356 - key1: descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0].key  
357 - .key,  
358 - type1:  
359 - descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0]  
360 - .valueType,  
361 - value1:  
362 - descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0]  
363 - .predicate.value.defaultValue,  
364 - operation:  
365 - descInfo.value.profileData?.alarms[0].clearRule.condition.condition[0]  
366 - .predicate.operation,  
367 - });  
368 - setRegisterStep3ClearCondition({  
369 - conditionType:  
370 - descInfo.value.profileData?.alarms[0].clearRule.condition.spec.type,  
371 - });  
372 - setRegisterStep3ClearEnable({  
373 - schedule: descInfo.value.profileData?.alarms[0].clearRule.schedule.type,  
374 - });  
375 - setRegisterStep3ClearTemplateDetail({  
376 - alarmDetails: descInfo.value.profileData?.alarms[0].clearRule.alarmDetails,  
377 - });  
378 - } catch (e) {  
379 - return e;  
380 - }  
381 - }, 1000);  
382 - break;  
383 - case '4':  
384 - setTimeout(() => {  
385 - resetFieldsContactFunc();  
386 - }, 100);  
387 - setTimeout(() => {  
388 - try {  
389 - setRegisterContact({  
390 - alarmContactId: descInfo.value.alarmProfile.alarmContactId,  
391 - messageMode: descInfo.value.alarmProfile.messageMode,  
392 - });  
393 - } catch (e) {  
394 - return e;  
395 - }  
396 - }, 500);  
397 -  
398 - break;  
399 - }  
400 - } catch (e) {  
401 - return e;  
402 - }  
403 - };  
404 -  
405 - const resetFieldsContactFunc = () => {  
406 - resetFieldsContact();  
407 - };  
408 - const resetFieldsStep3SchemasFunc = () => {  
409 - resetFieldsStep3Schemas();  
410 - };  
411 -  
412 - const resetFieldsStep3HighSettingFunc = () => {  
413 - resetFieldsStep3HighSetting();  
414 - };  
415 - const resetFieldsStep3CreateAlarmFunc = () => {  
416 - resetFieldsStep3CreateAlarm();  
417 - };  
418 - const resetFieldsStep3RuleAlarmFunc = () => {  
419 - resetFieldsStep3RuleAlarm();  
420 - };  
421 -  
422 - const resetFieldsrStep3ConditionFunc = () => {  
423 - resetFieldsrStep3Condition();  
424 - };  
425 -  
426 - const resetFieldsStep3RuleAlarmFunc1 = () => {  
427 - resetFieldsStep3RuleAlarm();  
428 - };  
429 -  
430 - const resetFieldsStep3EnableFunc = () => {  
431 - resetFieldsStep3Enable();  
432 - };  
433 - const resetFieldsStep3TemplateDetailFunc = () => {  
434 - resetFieldsStep3TemplateDetail();  
435 - };  
436 - //清除报警  
437 - const resetFieldsStep3ClearRuleAlarmFunc = () => {  
438 - resetFieldsStep3ClearRuleAlarm();  
439 - };  
440 - const resetFieldsStep3ClearRuleAlarmlFunc = () => {  
441 - resetFieldsStep3ClearRuleAlarm();  
442 - };  
443 - const resetFieldsStep3ClearConditionFunc = () => {  
444 - resetFieldsStep3ClearCondition();  
445 - };  
446 - const resetFieldStep3ClearEnablelFunc = () => {  
447 - resetFieldStep3ClearEnablel();  
448 - };  
449 - const resetFieldStep3ClearTemplateDetailFunc = () => {  
450 - resetFieldStep3ClearTemplateDetail();  
451 - };  
452 - watch(  
453 - () => activeKey.value,  
454 - (v) => {  
455 - dataInfo.value = v;  
456 - }  
457 - );  
458 - const getTitle = computed(() => {  
459 - return '设备配置详情';  
460 - });  
461 -  
462 - return {  
463 - resetFieldsContactFunc,  
464 - registerStep3ClearTemplateDetail,  
465 - registerStep3ClearEnable,  
466 - registerStep3ClearCondition,  
467 - registerStep3ClearRuleAlarm,  
468 - handleChange,  
469 - registerStep3TemplateDetail,  
470 - registerStep3Enable,  
471 - registerStep3Condition,  
472 - registerStep3RuleAlarm,  
473 - registerContact,  
474 - registerStep3HighSetting,  
475 - registerStep3CreateAlarm,  
476 - registerStep3Schemas,  
477 - registerTrans,  
478 - activeKey,  
479 - registerDetail,  
480 - register,  
481 - getTitle,  
482 - };  
483 - },  
484 - });  
485 -</script>  
486 -  
487 -<style scoped lang="less">  
488 - .input-style {  
489 - :deep .ant-form-item-control-input {  
490 - position: relative;  
491 - display: flex;  
492 - align-items: center;  
493 - min-height: 02px;  
494 - }  
495 - :deep.ant-col-24 {  
496 - display: block;  
497 - flex: 0 0 100%;  
498 - max-width: 100%;  
499 - margin-top: -20px;  
500 - }  
501 - }  
502 -  
503 - .clear-input-style {  
504 - :deep .ant-form-item-control-input {  
505 - position: relative;  
506 - display: flex;  
507 - align-items: center;  
508 - min-height: 02px;  
509 - }  
510 - :deep.ant-col-24 {  
511 - display: block;  
512 - flex: 0 0 100%;  
513 - max-width: 100%;  
514 - margin-top: -20px;  
515 - }  
516 - }  
517 -</style>  
src/views/device/profiles/DeviceProfileModal.vue renamed from src/views/device/profile/DeviceProfileModal.vue
@@ -80,7 +80,7 @@ @@ -80,7 +80,7 @@
80 'handleStep2Next', 80 'handleStep2Next',
81 ], 81 ],
82 setup(_, { emit }) { 82 setup(_, { emit }) {
83 - const { proxy } = getCurrentInstance(); 83 + const { proxy } = getCurrentInstance() as any;
84 const DeviceProfileStep1Ref = ref(null); 84 const DeviceProfileStep1Ref = ref(null);
85 const DeviceProfileStep2Ref = ref(null); 85 const DeviceProfileStep2Ref = ref(null);
86 const DeviceProfileStep3Ref = ref(null); 86 const DeviceProfileStep3Ref = ref(null);
@@ -90,9 +90,9 @@ @@ -90,9 +90,9 @@
90 const getStepOneData: any = ref({}); 90 const getStepOneData: any = ref({});
91 const getStepTwoData: any = ref({}); 91 const getStepTwoData: any = ref({});
92 const getStepThreeData = ref([]); 92 const getStepThreeData = ref([]);
93 - const editData = ref({}); 93 + const editData: any = ref({});
94 let getBackendData = reactive({}); 94 let getBackendData = reactive({});
95 - let getStepFourData = reactive({}); 95 + let getStepFourData: any = reactive({});
96 const alarmProfileData = reactive({ 96 const alarmProfileData = reactive({
97 alarmProfile: { 97 alarmProfile: {
98 alarmContactId: '', 98 alarmContactId: '',
@@ -112,6 +112,7 @@ @@ -112,6 +112,7 @@
112 const isStatus: any = ref(null); 112 const isStatus: any = ref(null);
113 const isShowOkBtnFalse = ref(true); 113 const isShowOkBtnFalse = ref(true);
114 const isShowRule = ref(true); 114 const isShowRule = ref(true);
  115 + const isEditAndChange = ref(true);
115 116
116 const getTitle = computed(() => 117 const getTitle = computed(() =>
117 isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情' 118 isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情'
@@ -135,6 +136,12 @@ @@ -135,6 +136,12 @@
135 stepThreeData: {}, 136 stepThreeData: {},
136 }); 137 });
137 } else if (isUpdate.value == 2) { 138 } else if (isUpdate.value == 2) {
  139 + isGetStepThreeData.profileData.alarms.length = 0;
  140 + try {
  141 + proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc();
  142 + } catch (e) {
  143 + return e;
  144 + }
138 postEditId.value = data.record.id; 145 postEditId.value = data.record.id;
139 getBackendData = await deviceConfigGetDetail(postEditId.value); 146 getBackendData = await deviceConfigGetDetail(postEditId.value);
140 editData.value = getBackendData; 147 editData.value = getBackendData;
@@ -253,7 +260,9 @@ @@ -253,7 +260,9 @@
253 //回显创建报警规则和清除报警规则 260 //回显创建报警规则和清除报警规则
254 } 261 }
255 } 262 }
256 - function handleStep3Next(v) { 263 + function handleStep3Next(v, v1) {
  264 + console.log(v1);
  265 + isEditAndChange.value = v1;
257 current.value++; 266 current.value++;
258 getStepThreeData.value = v; 267 getStepThreeData.value = v;
259 if (isUpdate.value == 1) { 268 if (isUpdate.value == 1) {
@@ -295,8 +304,12 @@ @@ -295,8 +304,12 @@
295 closeModal(); 304 closeModal();
296 emit('success'); 305 emit('success');
297 } else if (isUpdate.value == 2) { 306 } else if (isUpdate.value == 2) {
  307 + isGetStepThreeData.profileData.alarms =
  308 + isEditAndChange.value == true
  309 + ? editData.value.profileData.alarms
  310 + : getStepThreeData.value;
  311 + // isGetStepThreeData.profileData.alarms = getStepThreeData.value;
298 postDeviceConfogData.value.id = postEditId.value; 312 postDeviceConfogData.value.id = postEditId.value;
299 - isGetStepThreeData.profileData.alarms = getStepThreeData.value;  
300 getStepFourData = await proxy.$refs.DeviceProfileStep4Ref.getAllFields(); 313 getStepFourData = await proxy.$refs.DeviceProfileStep4Ref.getAllFields();
301 const getJoinAlarmContactIdData = getStepFourData.alarmContactId.join(','); 314 const getJoinAlarmContactIdData = getStepFourData.alarmContactId.join(',');
302 const getJoinMessageModeData = getStepFourData.messageMode.join(','); 315 const getJoinMessageModeData = getStepFourData.messageMode.join(',');
@@ -322,11 +335,14 @@ @@ -322,11 +335,14 @@
322 closeModal(); 335 closeModal();
323 try { 336 try {
324 proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc(); 337 proxy.$refs.DeviceProfileStep4Ref.clearAlaramContactAndNoticeMethodFunc();
  338 + proxy.$refs.DeviceProfileStep3Ref.clearDetailTemplateFunc();
  339 + proxy.$refs.DeviceProfileStep3Ref.clearEditAllRegisterFormFunc();
325 } catch (e) { 340 } catch (e) {
326 return e; 341 return e;
327 } 342 }
328 }; 343 };
329 return { 344 return {
  345 + // isEditFunc,
330 isShowRule, 346 isShowRule,
331 isShowOkBtnFalse, 347 isShowOkBtnFalse,
332 isStatus, 348 isStatus,
src/views/device/profiles/device.profile.data.ts renamed from src/views/device/profile/device.profile.data.ts
@@ -2,8 +2,6 @@ import { BasicColumn } from '/@/components/Table'; @@ -2,8 +2,6 @@ import { BasicColumn } from '/@/components/Table';
2 import { FormSchema } from '/@/components/Table'; 2 import { FormSchema } from '/@/components/Table';
3 import { findDictItemByCode } from '/@/api/system/dict'; 3 import { findDictItemByCode } from '/@/api/system/dict';
4 import { MessageEnum } from '/@/enums/messageEnum'; 4 import { MessageEnum } from '/@/enums/messageEnum';
5 -// import { getOrganizationList } from '/@/api/system/system';  
6 -// import { copyTransFun } from '/@/utils/fnUtils';  
7 import { numberRule } from '/@/utils/rules'; 5 import { numberRule } from '/@/utils/rules';
8 6
9 export const columns: BasicColumn[] = [ 7 export const columns: BasicColumn[] = [
@@ -34,24 +32,11 @@ export const searchFormSchema: FormSchema[] = [ @@ -34,24 +32,11 @@ export const searchFormSchema: FormSchema[] = [
34 field: 'name', 32 field: 'name',
35 label: '配置名称', 33 label: '配置名称',
36 component: 'Input', 34 component: 'Input',
37 - colProps: { span: 8 }, 35 + colProps: { span: 6 },
38 componentProps: { 36 componentProps: {
39 maxLength: 255, 37 maxLength: 255,
40 placeholder: '请输入配置名称', 38 placeholder: '请输入配置名称',
41 }, 39 },
42 - dynamicRules: () => {  
43 - return [  
44 - {  
45 - required: false,  
46 - validator: (_, value) => {  
47 - if (String(value).length > 255) {  
48 - return Promise.reject('字数不超过255个字');  
49 - }  
50 - return Promise.resolve();  
51 - },  
52 - },  
53 - ];  
54 - },  
55 }, 40 },
56 ]; 41 ];
57 42
@@ -181,19 +166,6 @@ export const formSchema: FormSchema[] = [ @@ -181,19 +166,6 @@ export const formSchema: FormSchema[] = [
181 maxLength: 255, 166 maxLength: 255,
182 placeholder: '请输入消息配置', 167 placeholder: '请输入消息配置',
183 }, 168 },
184 - dynamicRules: () => {  
185 - return [  
186 - {  
187 - required: false,  
188 - validator: (_, value) => {  
189 - if (String(value).length > 255) {  
190 - return Promise.reject('字数不超过255个字');  
191 - }  
192 - return Promise.resolve();  
193 - },  
194 - },  
195 - ];  
196 - },  
197 }, 169 },
198 { 170 {
199 field: 'id', 171 field: 'id',
@@ -225,18 +197,5 @@ export const formSchema: FormSchema[] = [ @@ -225,18 +197,5 @@ export const formSchema: FormSchema[] = [
225 maxLength: 255, 197 maxLength: 255,
226 placeholder: '请输入备注', 198 placeholder: '请输入备注',
227 }, 199 },
228 - dynamicRules: () => {  
229 - return [  
230 - {  
231 - required: false,  
232 - validator: (_, value) => {  
233 - if (String(value).length > 255) {  
234 - return Promise.reject('字数不超过255个字');  
235 - }  
236 - return Promise.resolve();  
237 - },  
238 - },  
239 - ];  
240 - },  
241 }, 200 },
242 ]; 201 ];
src/views/device/profiles/index.vue renamed from src/views/device/profile/index.vue
@@ -5,7 +5,6 @@ @@ -5,7 +5,6 @@
5 @selection-change="useSelectionChange" 5 @selection-change="useSelectionChange"
6 @register="registerTable" 6 @register="registerTable"
7 :rowSelection="{ type: 'checkbox' }" 7 :rowSelection="{ type: 'checkbox' }"
8 - :rowClassName="setRowClassName"  
9 > 8 >
10 <template #toolbar> 9 <template #toolbar>
11 <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button> 10 <a-button type="primary" @click="handleCreate"> 新增设备配置 </a-button>
@@ -48,31 +47,24 @@ @@ -48,31 +47,24 @@
48 </template> 47 </template>
49 </BasicTable> 48 </BasicTable>
50 <DeviceProfileModal @register="registerModal" @success="handleSuccess" /> 49 <DeviceProfileModal @register="registerModal" @success="handleSuccess" />
51 - <DeviceConfigDetail  
52 - ref="deviceDetailRef"  
53 - @register="registerModalDetail"  
54 - @success="handleSuccess"  
55 - />  
56 <!-- <ExpExcelModal @register="register1" @success="defaultHeader" /> --> 50 <!-- <ExpExcelModal @register="register1" @success="defaultHeader" /> -->
57 </div> 51 </div>
58 </template> 52 </template>
59 <script lang="ts"> 53 <script lang="ts">
60 - import { defineComponent, ref, reactive, getCurrentInstance } from 'vue'; 54 + import { defineComponent, ref, reactive } from 'vue';
61 import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table'; 55 import { BasicTable, useTable, TableAction, BasicColumn } from '/@/components/Table';
62 import { columns, searchFormSchema } from './device.profile.data'; 56 import { columns, searchFormSchema } from './device.profile.data';
63 import { useMessage } from '/@/hooks/web/useMessage'; 57 import { useMessage } from '/@/hooks/web/useMessage';
64 import { deviceConfigGetQuery, deviceConfigDelete } from '/@/api/device/deviceConfigApi'; 58 import { deviceConfigGetQuery, deviceConfigDelete } from '/@/api/device/deviceConfigApi';
65 import { useModal } from '/@/components/Modal'; 59 import { useModal } from '/@/components/Modal';
66 import DeviceProfileModal from '/@/views/device/profile/DeviceProfileModal.vue'; 60 import DeviceProfileModal from '/@/views/device/profile/DeviceProfileModal.vue';
67 - import DeviceConfigDetail from '/@/views/device/profile/deviceConfigDetail.vue';  
68 import { ImpExcel, ExcelData } from '/@/components/Excel'; 61 import { ImpExcel, ExcelData } from '/@/components/Excel';
69 // import { jsonToSheetXlsx, ExportModalResult } from '/@/components/Excel'; 62 // import { jsonToSheetXlsx, ExportModalResult } from '/@/components/Excel';
70 63
71 export default defineComponent({ 64 export default defineComponent({
72 name: 'DeviceProfileManagement', 65 name: 'DeviceProfileManagement',
73 - components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel, DeviceConfigDetail }, 66 + components: { BasicTable, DeviceProfileModal, TableAction, ImpExcel },
74 setup() { 67 setup() {
75 - const { proxy } = getCurrentInstance();  
76 const deviceDetailRef = ref(null); 68 const deviceDetailRef = ref(null);
77 let selectedRowKeys: string[] = reactive([]); 69 let selectedRowKeys: string[] = reactive([]);
78 const getPathUrl = ref(''); 70 const getPathUrl = ref('');
@@ -125,11 +117,11 @@ @@ -125,11 +117,11 @@
125 const getName = getParam(getPathUrl.value, name); 117 const getName = getParam(getPathUrl.value, name);
126 getPathUrlName.value = decodeURIComponent(getName); 118 getPathUrlName.value = decodeURIComponent(getName);
127 119
128 - const setRowClassName = (record) => {  
129 - if (record.name === getPathUrlName.value) {  
130 - return 'rowcolor2';  
131 - }  
132 - }; 120 + // const setRowClassName = (record) => {
  121 + // if (record.name === getPathUrlName.value) {
  122 + // return 'rowcolor2';
  123 + // }
  124 + // };
133 125
134 const tableListRef = ref< 126 const tableListRef = ref<
135 { 127 {
@@ -231,7 +223,7 @@ @@ -231,7 +223,7 @@
231 return { 223 return {
232 disabled, 224 disabled,
233 deviceDetailRef, 225 deviceDetailRef,
234 - setRowClassName, 226 + // setRowClassName,
235 registerModalDetail, 227 registerModalDetail,
236 // register1, 228 // register1,
237 // defaultHeader, 229 // defaultHeader,
src/views/device/profiles/step/DeviceProfileStep1.vue renamed from src/views/device/profile/step/DeviceProfileStep1.vue
src/views/device/profiles/step/DeviceProfileStep2.vue renamed from src/views/device/profile/step/DeviceProfileStep2.vue
src/views/device/profiles/step/DeviceProfileStep3.vue renamed from src/views/device/profile/step/DeviceProfileStep3.vue
@@ -67,24 +67,14 @@ @@ -67,24 +67,14 @@
67 <div class="aic" style="border: 1px solid #bfbfbf"> 67 <div class="aic" style="border: 1px solid #bfbfbf">
68 <div class="w-3/4" style="margin-left: 40px"> 68 <div class="w-3/4" style="margin-left: 40px">
69 <!-- 报警严重程度 --> 69 <!-- 报警严重程度 -->
70 - <div style="margin-left: 10px; margin-top: 20px"  
71 - ><BasicForm v-if="childItem" @register="registerFormCreateAlarm" />  
72 - <div>  
73 - <div  
74 - v-for="(i8, index8) in getStepThreeEditStatus ? createAlarmArray : []"  
75 - :key="index8"  
76 - style="position: relative"  
77 - >  
78 - <p  
79 - style="position: absolute; top: -10.2vh; left: 6.5vw; z-index: 1"  
80 - v-if="index8 == createIndex"  
81 - >{{ formatAlarmFunc(i8) }}</p  
82 - >  
83 - </div>  
84 - </div> 70 + <div style="height: 2vh; margin-top: 0.8vh; margin-left: 0.35vw">
  71 + <AlarmSeverity
  72 + ref="alarmSeverityRef"
  73 + :alarmSeverityInfo="getStepThreeEditStatus ? childItem : 1"
  74 + />
85 </div> 75 </div>
86 <!-- 报警严重程度 --> 76 <!-- 报警严重程度 -->
87 - <div style="margin-left: 5px; margin-top: -35px"> 77 + <div style="margin-left: 5px; margin-top: 35px">
88 <div style="color: #f5594e" class="ml-4" 78 <div style="color: #f5594e" class="ml-4"
89 >报警规则条件: 79 >报警规则条件:
90 <Button 80 <Button
@@ -107,14 +97,6 @@ @@ -107,14 +97,6 @@
107 >报警规则条件:{{ openRuleConditionComp(v2) }}</p 97 >报警规则条件:{{ openRuleConditionComp(v2) }}</p
108 > 98 >
109 </template> 99 </template>
110 - <template  
111 - v-for="(vi, indexi) in isEditDataAndValue ? getEditDataAndValue : []"  
112 - :key="indexi"  
113 - >  
114 - <p v-if="indexi == createIndex && isEditDataAndValue"  
115 - >报警规则条件:{{ isEditDataAndValueFunc(vi) }}</p  
116 - >  
117 - </template>  
118 </div> 100 </div>
119 <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4" 101 <div style="white-space: wrap; margin-top: 25px" class="mt-4 ml-4"
120 >报警启用规则: 102 >报警启用规则:
@@ -144,27 +126,30 @@ @@ -144,27 +126,30 @@
144 启用方式:{{ openRuleComp(v1) }} 126 启用方式:{{ openRuleComp(v1) }}
145 </p> 127 </p>
146 </template> 128 </template>
  129 + <!-- 报警详情模板-->
147 <div 130 <div
148 class="mt-4 ml-4" 131 class="mt-4 ml-4"
149 - style="margin-left: 0px; position: relative; margin-top: 25px"  
150 - >报警详情模板:  
151 - <div style="position: absolute; top: -5px; left: 106px; width: 581px">  
152 - <BasicForm @register="registerFormChangeDetail" />  
153 - </div>  
154 - <div  
155 - style="position: relative"  
156 - v-for="(i7, index7) in getStepThreeEditStatus  
157 - ? detailDetailModelArray  
158 - : []"  
159 - :key="index7"  
160 - >  
161 - <p  
162 - style="position: absolute; top: -2.3vh; left: 5.68vw"  
163 - v-if="index7 == createIndex"  
164 - >{{ i7 }}</p  
165 - > 132 + style="
  133 + margin-left: -0.2vw;
  134 + margin-top: 25px;
  135 + display: flex;
  136 + flex-direction: row;
  137 + justify-content: space-between;
  138 + width: 29vw;
  139 + height: 2vh;
  140 + "
  141 + >
  142 + <div style="width: 6vw; height: 2vh"> 报警详情模板: </div>
  143 + <div style="width: 25vw; height: 2vh">
  144 + <DetailTemplate
  145 + ref="detailTemplateRef"
  146 + :detailTemplateInfo="
  147 + getStepThreeEditStatus ? returnChildItem(childItem) : 1
  148 + "
  149 + />
166 </div> 150 </div>
167 </div> 151 </div>
  152 + <!-- 报警详情模板-->
168 <div style="margin-top: 25px; position: relative"> 153 <div style="margin-top: 25px; position: relative">
169 <div style="margin-left: -14px"> 154 <div style="margin-left: -14px">
170 <BasicForm @register="dashboardForm" /> 155 <BasicForm @register="dashboardForm" />
@@ -172,9 +157,10 @@ @@ -172,9 +157,10 @@
172 </div> 157 </div>
173 </div> 158 </div>
174 </div> 159 </div>
  160 + <!-- 移除按钮 -->
175 <div 161 <div
176 class="remove-type" 162 class="remove-type"
177 - style="display: inline-block; position: relative; top: -33vh; left: 39.4vw" 163 + style="display: inline-block; position: relative; top: -25.2vh; left: 39.4vw"
178 > 164 >
179 <img 165 <img
180 v-if="isAddRuleStatus" 166 v-if="isAddRuleStatus"
@@ -184,6 +170,7 @@ @@ -184,6 +170,7 @@
184 src="../../../../assets/images/close.png" 170 src="../../../../assets/images/close.png"
185 /> 171 />
186 </div> 172 </div>
  173 + <!-- 移除按钮 -->
187 </div> 174 </div>
188 </div> 175 </div>
189 </div> 176 </div>
@@ -237,7 +224,6 @@ @@ -237,7 +224,6 @@
237 @click="handleOpenClearAlaramRuleConditions" 224 @click="handleOpenClearAlaramRuleConditions"
238 >添加</Button 225 >添加</Button
239 > 226 >
240 -  
241 <template 227 <template
242 v-for="(v4, index4) in getStepThreeEditStatus 228 v-for="(v4, index4) in getStepThreeEditStatus
243 ? getFilterStepThreeEditClearArr 229 ? getFilterStepThreeEditClearArr
@@ -334,10 +320,8 @@ @@ -334,10 +320,8 @@
334 import { 320 import {
335 step3Schemas, 321 step3Schemas,
336 step3HighSetting, 322 step3HighSetting,
337 - step3CreateAlarm,  
338 dashboardFormScheme, 323 dashboardFormScheme,
339 isWhereType, 324 isWhereType,
340 - isLostFocux,  
341 formChangeDetailSchema, 325 formChangeDetailSchema,
342 } from './data'; 326 } from './data';
343 import { PlusCircleOutlined } from '@ant-design/icons-vue'; 327 import { PlusCircleOutlined } from '@ant-design/icons-vue';
@@ -347,6 +331,9 @@ @@ -347,6 +331,9 @@
347 import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue'; 331 import AlarmRuleConditions from './cpns/alarmruleconditions/index.vue';
348 import { Button } from '/@/components/Button'; 332 import { Button } from '/@/components/Button';
349 export const isWhereTypeValueDisabled = ref(false); 333 export const isWhereTypeValueDisabled = ref(false);
  334 + import AlarmSeverity from './cpns/alarmseverity/index.vue';
  335 + import DetailTemplate from './cpns/detailtemplate/index.vue';
  336 + import { generateUUID } from '/@/hooks/web/useGenerateUUID';
350 337
351 export default defineComponent({ 338 export default defineComponent({
352 components: { 339 components: {
@@ -357,12 +344,17 @@ @@ -357,12 +344,17 @@
357 EnableRule, 344 EnableRule,
358 AlarmRuleConditions, 345 AlarmRuleConditions,
359 Button, 346 Button,
  347 + AlarmSeverity,
  348 + DetailTemplate,
360 }, 349 },
361 - emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next'], 350 + emits: ['prev', 'next', 'redo', 'handleFormStep3toStep4Next', 'isEdit'],
362 props: ['getAllStepThreeData', 'isAddOrEdit', 'isShowAddRule'], 351 props: ['getAllStepThreeData', 'isAddOrEdit', 'isShowAddRule'],
  352 +
363 setup(props, { emit }) { 353 setup(props, { emit }) {
  354 + const detailTemplateRef = ref(null);
  355 + const alarmSeverityRef = ref(null);
364 const isAddRuleStatus = ref(true); 356 const isAddRuleStatus = ref(true);
365 - const { proxy } = getCurrentInstance(); 357 + const { proxy } = getCurrentInstance() as any;
366 const changeGetDetailValue = ref({}); 358 const changeGetDetailValue = ref({});
367 const changeGetClearDetailValue = ref({}); 359 const changeGetClearDetailValue = ref({});
368 const getChildData1 = ref(null); 360 const getChildData1 = ref(null);
@@ -384,7 +376,7 @@ @@ -384,7 +376,7 @@
384 const detailClearTemplateData: any = ref(null); 376 const detailClearTemplateData: any = ref(null);
385 //重构 377 //重构
386 //告警列表接口 378 //告警列表接口
387 - let profileData = ref<IProfileData[]>([]); 379 + let profileData: any = ref<IProfileData[]>([]);
388 //初始化alarams数据 380 //初始化alarams数据
389 const initProfileData = reactive({ 381 const initProfileData = reactive({
390 alarms: [ 382 alarms: [
@@ -407,7 +399,7 @@ @@ -407,7 +399,7 @@
407 propagate: '', 399 propagate: '',
408 propagateRelationTypes: [''], 400 propagateRelationTypes: [''],
409 schedule: { 401 schedule: {
410 - type: 'string', 402 + type: '',
411 }, 403 },
412 condition: {}, 404 condition: {},
413 }, 405 },
@@ -426,11 +418,11 @@ @@ -426,11 +418,11 @@
426 //接收临时规则条件数据 418 //接收临时规则条件数据
427 const receiveRuleConditionTempArr = ref<[]>([]); 419 const receiveRuleConditionTempArr = ref<[]>([]);
428 //创建条件总对象 420 //创建条件总对象
429 - const createRulesObj = ref({}); 421 + const createRulesObj: any = ref({});
430 let addCreateRulesObj = reactive({ 422 let addCreateRulesObj = reactive({
431 createRules: {}, 423 createRules: {},
432 }); 424 });
433 - const addChangeSeverity = ref({}); 425 + const addChangeSeverity: any = ref({});
434 let addNewOpenRule = reactive({ 426 let addNewOpenRule = reactive({
435 schedule: {}, 427 schedule: {},
436 }); 428 });
@@ -473,20 +465,21 @@ @@ -473,20 +465,21 @@
473 condition: {}, 465 condition: {},
474 }); 466 });
475 let fliterTempRuleConditionTempArr = ref<[]>([]); 467 let fliterTempRuleConditionTempArr = ref<[]>([]);
476 - let fliterTempOpenRuleTempArr = ref<[]>([]); 468 + let fliterTempOpenRuleTempArr: any = ref<[]>([]);
477 let fliterClearTempRuleConditionTempArr = ref<[]>([]); 469 let fliterClearTempRuleConditionTempArr = ref<[]>([]);
478 - let fliterClearTempOpenRuleTempArr = ref<[]>([]); 470 + let fliterClearTempOpenRuleTempArr: any = ref<[]>([]);
479 const getStepThreeEditStatus: any = ref(false); 471 const getStepThreeEditStatus: any = ref(false);
480 - const isEditDataAndValue = ref(false); 472 + // const isEditDataAndValue = ref(false);
481 const getStepThreeEditArr = ref<[]>([]); 473 const getStepThreeEditArr = ref<[]>([]);
482 - const getFilterStepThreeEditArr = ref<[]>([]);  
483 - const getFilterStepThreeEditClearArr = ref<[]>([]); 474 + const getFilterStepThreeEditArr: any = ref<[]>([]);
  475 + const getFilterStepThreeEditClearArr: any = ref<[]>([]);
484 const getFilterStepThreeClearDetailEditArr = ref<[]>([]); 476 const getFilterStepThreeClearDetailEditArr = ref<[]>([]);
485 let getIsShowAddRule = true; 477 let getIsShowAddRule = true;
486 const detailDetailModelArray = ref<[]>([]); 478 const detailDetailModelArray = ref<[]>([]);
487 const createAlarmArray = ref<[]>([]); 479 const createAlarmArray = ref<[]>([]);
488 const isLostFocuxStatus = ref(true); 480 const isLostFocuxStatus = ref(true);
489 - const getEditDataAndValue = ref<[]>([]); 481 + // const getEditDataAndValue = ref<[]>([]);
  482 + const editIndex = ref(-1);
490 483
491 setTimeout(() => { 484 setTimeout(() => {
492 getIsShowAddRule = props.isShowAddRule; 485 getIsShowAddRule = props.isShowAddRule;
@@ -558,19 +551,6 @@ @@ -558,19 +551,6 @@
558 span: 24, 551 span: 24,
559 }, 552 },
560 }); 553 });
561 - //详情模板  
562 - const [  
563 - registerFormChangeDetail,  
564 - { getFieldsValue: getRegisterFormChangeDetail, resetFields: resetRegisterFormChangeDetail },  
565 - ] = useForm({  
566 - labelWidth: 120,  
567 - schemas: formChangeDetailSchema,  
568 - showResetButton: false,  
569 - showSubmitButton: false,  
570 - actionColOptions: {  
571 - span: 24,  
572 - },  
573 - });  
574 //清除详情模板 554 //清除详情模板
575 const [ 555 const [
576 registerFormChangeClearDetail, 556 registerFormChangeClearDetail,
@@ -588,36 +568,20 @@ @@ -588,36 +568,20 @@
588 span: 24, 568 span: 24,
589 }, 569 },
590 }); 570 });
591 - // 添加创建条件表单  
592 - const [  
593 - registerFormCreateAlarm,  
594 - {  
595 - setFieldsValue: setRegisterFormCreateAlarm,  
596 - resetFields: resetRegisterFormCreateAlarm,  
597 - validate: validateRegisterFormCreateAlarm,  
598 - },  
599 - ] = useForm({  
600 - labelWidth: 120,  
601 - schemas: step3CreateAlarm,  
602 - showResetButton: false,  
603 - showSubmitButton: false,  
604 - actionColOptions: {  
605 - span: 24,  
606 - },  
607 - });  
608 571
609 - const resetRegisterFormCreateAlarmFunc = () => {  
610 - resetRegisterFormCreateAlarm(); 572 + //重置编辑数据
  573 + const clearEditAllRegisterFormFunc = () => {
  574 + getFilterStepThreeEditArr.value.length = 0;
  575 + getFilterStepThreeEditArr.value = [];
611 }; 576 };
  577 +
612 //重置表单数据 578 //重置表单数据
613 const clearAllRegisterFormFunc = () => { 579 const clearAllRegisterFormFunc = () => {
614 setTimeout(() => { 580 setTimeout(() => {
615 clearAlaramTypeValueFunc(); 581 clearAlaramTypeValueFunc();
616 clearTransmitAlarmFunc(); 582 clearTransmitAlarmFunc();
617 - resetRegisterFormChangeDetailFunc();  
618 resetRegisterFormClearChangeDetailFunc(); 583 resetRegisterFormClearChangeDetailFunc();
619 resetAllTemplateFunc(); 584 resetAllTemplateFunc();
620 - resetRegisterFormCreateAlarmFunc();  
621 }, 10); 585 }, 10);
622 }; 586 };
623 //重置报警启用规则-报警规则条件 587 //重置报警启用规则-报警规则条件
@@ -647,10 +611,6 @@ @@ -647,10 +611,6 @@
647 }); 611 });
648 }; 612 };
649 613
650 - //重置详情模板数据  
651 - const resetRegisterFormChangeDetailFunc = () => {  
652 - resetRegisterFormChangeDetail();  
653 - };  
654 //清除修改详情模板 614 //清除修改详情模板
655 const resetRegisterFormClearChangeDetailFunc = () => { 615 const resetRegisterFormClearChangeDetailFunc = () => {
656 resetRegisterFormClearChangeDetail(); 616 resetRegisterFormClearChangeDetail();
@@ -663,13 +623,8 @@ @@ -663,13 +623,8 @@
663 const setTransmitAlarmFormFunc = (v) => { 623 const setTransmitAlarmFormFunc = (v) => {
664 setTransmitAlarmFunc(v); 624 setTransmitAlarmFunc(v);
665 }; 625 };
666 - const setRegisterFormCreateAlarmFunc = async () => {  
667 - setRegisterFormCreateAlarm({  
668 - default: '',  
669 - });  
670 - };  
671 const openRuleComp = (v1) => { 626 const openRuleComp = (v1) => {
672 - let openSchemObj = {}; 627 + let openSchemObj: any = {};
673 for (let i in v1) { 628 for (let i in v1) {
674 if (i == 'CRITICAL') { 629 if (i == 'CRITICAL') {
675 openSchemObj = v1[i]; 630 openSchemObj = v1[i];
@@ -721,7 +676,7 @@ @@ -721,7 +676,7 @@
721 676
722 const openRuleConditionComp = (v2) => { 677 const openRuleConditionComp = (v2) => {
723 try { 678 try {
724 - let openRuleConditObj = {}; 679 + let openRuleConditObj: any = {};
725 for (let i in v2) { 680 for (let i in v2) {
726 if (i == 'CRITICAL') { 681 if (i == 'CRITICAL') {
727 openRuleConditObj = v2[i]; 682 openRuleConditObj = v2[i];
@@ -766,7 +721,7 @@ @@ -766,7 +721,7 @@
766 getFilterStepThreeEditArr.value = []; 721 getFilterStepThreeEditArr.value = [];
767 getFilterStepThreeEditClearArr.value = []; 722 getFilterStepThreeEditClearArr.value = [];
768 getStepThreeEditStatus.value = v.isEditStatus; 723 getStepThreeEditStatus.value = v.isEditStatus;
769 - isEditDataAndValue.value = v.isEditStatus; 724 + // isEditDataAndValue.value = v.isEditStatus;
770 getStepThreeEditArr.value = v.stepThreeData; 725 getStepThreeEditArr.value = v.stepThreeData;
771 if (getFilterStepThreeEditClearArr.value.length == 0) { 726 if (getFilterStepThreeEditClearArr.value.length == 0) {
772 getFilterStepThreeEditClearArr.value.push(v.stepThreeClearData as never); 727 getFilterStepThreeEditClearArr.value.push(v.stepThreeClearData as never);
@@ -784,17 +739,6 @@ @@ -784,17 +739,6 @@
784 createAlarmArray.value.push(i as never); 739 createAlarmArray.value.push(i as never);
785 } 740 }
786 }; 741 };
787 - const formatAlarmFunc = (v) => {  
788 - return v == 'CRITICAL'  
789 - ? '危险'  
790 - : v == 'MAJOR'  
791 - ? '重要'  
792 - : v == 'MINOR'  
793 - ? '次要'  
794 - : v == 'WARNING'  
795 - ? '警告'  
796 - : '不确定';  
797 - };  
798 742
799 //清除修改详情模板 743 //清除修改详情模板
800 const setRegisterFormClearChangeDetailFunc = (v) => { 744 const setRegisterFormClearChangeDetailFunc = (v) => {
@@ -802,7 +746,18 @@ @@ -802,7 +746,18 @@
802 }; 746 };
803 747
804 const getRegisterFormChangeDetailFunc = () => { 748 const getRegisterFormChangeDetailFunc = () => {
805 - changeGetDetailValue.value = getRegisterFormChangeDetail(); 749 + try {
  750 + changeGetDetailValue.value = proxy.$refs.detailTemplateRef.getFieldsValueFunc();
  751 + } catch (e) {
  752 + return e;
  753 + }
  754 + };
  755 + const clearDetailTemplateFunc = () => {
  756 + try {
  757 + proxy.$refs.detailTemplateRef.resetFieldsFunc();
  758 + } catch (e) {
  759 + return e;
  760 + }
806 }; 761 };
807 const getRegisterClearFormChangeDetailFunc = () => { 762 const getRegisterClearFormChangeDetailFunc = () => {
808 changeGetClearDetailValue.value = getRegisterFormClearChangeDetail(); 763 changeGetClearDetailValue.value = getRegisterFormClearChangeDetail();
@@ -821,7 +776,7 @@ @@ -821,7 +776,7 @@
821 tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never); 776 tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never);
822 tempRuleConditionTempArr.value.push({ 777 tempRuleConditionTempArr.value.push({
823 condition: addNewRuleTem.condition.condition, 778 condition: addNewRuleTem.condition.condition,
824 - }); 779 + } as never);
825 }; 780 };
826 781
827 const getClearOpenRuleAndRuleCondition = () => { 782 const getClearOpenRuleAndRuleCondition = () => {
@@ -845,32 +800,36 @@ @@ -845,32 +800,36 @@
845 800
846 // 添加创建条件方法 801 // 添加创建条件方法
847 const addCreateRuleFunc = async () => { 802 const addCreateRuleFunc = async () => {
848 - getRegisterFormChangeDetailFunc();  
849 - tempDetailTempArr.value.push(changeGetDetailValue.value as never);  
850 - tempDetailTempArr.value.forEach((f1) => {  
851 - kongDetail.value = f1;  
852 - });  
853 - addChangeSeverity.value = await validateRegisterFormCreateAlarm();  
854 - emptyCreateRoleFunc();  
855 - getOpenRuleAndRuleCondition(); 803 + try {
  804 + getRegisterFormChangeDetailFunc();
  805 + tempDetailTempArr.value.push(changeGetDetailValue.value as never);
  806 + tempDetailTempArr.value.forEach((f1) => {
  807 + kongDetail.value = f1;
  808 + });
  809 + addChangeSeverity.value = proxy.$refs.alarmSeverityRef.getFieldsValueFunc();
  810 + emptyCreateRoleFunc();
  811 + getOpenRuleAndRuleCondition();
856 812
857 - tempOpenRuleTempArr.value.forEach((f2) => {  
858 - kongOpenRuleObj.schedule = f2;  
859 - }); 813 + tempOpenRuleTempArr.value.forEach((f2) => {
  814 + kongOpenRuleObj.schedule = f2;
  815 + });
860 816
861 - tempRuleConditionTempArr.value.forEach((f3) => {  
862 - kongRuleConditionObj.condition = f3;  
863 - }); 817 + tempRuleConditionTempArr.value.forEach((f3) => {
  818 + kongRuleConditionObj.condition = f3;
  819 + });
864 820
865 - createRulesObj.value[addChangeSeverity.value?.default] = {  
866 - ...kongDetail.value,  
867 - ...addNewOpenRule,  
868 - ...addNewRuleTem,  
869 - ...kongOpenRuleObj,  
870 - ...kongRuleConditionObj,  
871 - };  
872 - addCreateRulesObj.createRules = createRulesObj.value;  
873 - initCreateRules.createRules = addCreateRulesObj; 821 + createRulesObj.value[addChangeSeverity.value?.default] = {
  822 + ...kongDetail.value,
  823 + ...addNewOpenRule,
  824 + ...addNewRuleTem,
  825 + ...kongOpenRuleObj,
  826 + ...kongRuleConditionObj,
  827 + };
  828 + addCreateRulesObj.createRules = createRulesObj.value;
  829 + initCreateRules.createRules = addCreateRulesObj;
  830 + } catch (e) {
  831 + return e;
  832 + }
874 }; 833 };
875 834
876 //清除报警规则 835 //清除报警规则
@@ -894,6 +853,9 @@ @@ -894,6 +853,9 @@
894 // 删除创建条件 853 // 删除创建条件
895 const deleteCondition = (index: number, createIndex: number) => { 854 const deleteCondition = (index: number, createIndex: number) => {
896 profileData.value[index].alarms.splice(createIndex, 1); 855 profileData.value[index].alarms.splice(createIndex, 1);
  856 + if (getStepThreeEditStatus.value) {
  857 + getFilterStepThreeEditArr.value.pop();
  858 + }
897 }; 859 };
898 860
899 watch(isWhereType, (nV) => { 861 watch(isWhereType, (nV) => {
@@ -902,9 +864,6 @@ @@ -902,9 +864,6 @@
902 isWhereTypeValueDisabled.value = true; 864 isWhereTypeValueDisabled.value = true;
903 } 865 }
904 }); 866 });
905 - watch(isLostFocux, (nV) => {  
906 - isLostFocuxStatus.value = nV;  
907 - });  
908 //报警规则 867 //报警规则
909 //启用规则 868 //启用规则
910 const getAllFieldsEnabFunc = (v) => { 869 const getAllFieldsEnabFunc = (v) => {
@@ -917,36 +876,34 @@ @@ -917,36 +876,34 @@
917 addNewRuleTem.condition.condition = ruleObj.value as never; 876 addNewRuleTem.condition.condition = ruleObj.value as never;
918 fliterTempRuleConditionTempArr.value.push({ 877 fliterTempRuleConditionTempArr.value.push({
919 condition: addNewRuleTem.condition.condition, 878 condition: addNewRuleTem.condition.condition,
920 - });  
921 -  
922 - getEditDataAndValue.value.push({  
923 - condition: addNewRuleTem.condition.condition,  
924 - });  
925 - console.log(getEditDataAndValue.value); 879 + } as never);
  880 + // getEditDataAndValue.value.push({
  881 + // condition: addNewRuleTem.condition.condition,
  882 + // } as never);
926 }; 883 };
927 //格式化编辑 884 //格式化编辑
928 - const isEditDataAndValueFunc = (v) => {  
929 - let formatMap = v.condition.map((f) => {  
930 - return f.predicate.operation == 'EQUAL'  
931 - ? f.key.key + '等于' + f.predicate.value.defaultValue  
932 - : f.predicate.operation == 'STARTS_WITH'  
933 - ? f.key.key + '开始于' + f.predicate.value.defaultValue  
934 - : f.predicate.operation == 'ENDS_WITH'  
935 - ? f.key.key + '结束于' + f.predicate.value.defaultValue  
936 - : f.predicate.operation == 'NOT_CONTAINS'  
937 - ? f.key.key + '不包含' + f.predicate.value.defaultValue  
938 - : f.predicate.operation == 'NOT_EQUAL'  
939 - ? f.key.key + '不等于' + f.predicate.value.defaultValue  
940 - : f.predicate.operation == 'GREATER'  
941 - ? f.key.key + '大于' + f.predicate.value.defaultValue  
942 - : f.predicate.operation == 'LESS'  
943 - ? f.key.key + '小于' + f.predicate.value.defaultValue  
944 - : f.predicate.operation == 'GREATER_OR_EQUAL'  
945 - ? f.key.key + '大于或等于' + f.predicate.value.defaultValue  
946 - : f.key.key + '小于或等于' + f.predicate.value.defaultValue;  
947 - });  
948 - return formatMap;  
949 - }; 885 + // const isEditDataAndValueFunc = (v) => {
  886 + // let formatMap = v.condition.map((f) => {
  887 + // return f.predicate.operation == 'EQUAL'
  888 + // ? f.key.key + '等于' + f.predicate.value.defaultValue
  889 + // : f.predicate.operation == 'STARTS_WITH'
  890 + // ? f.key.key + '开始于' + f.predicate.value.defaultValue
  891 + // : f.predicate.operation == 'ENDS_WITH'
  892 + // ? f.key.key + '结束于' + f.predicate.value.defaultValue
  893 + // : f.predicate.operation == 'NOT_CONTAINS'
  894 + // ? f.key.key + '不包含' + f.predicate.value.defaultValue
  895 + // : f.predicate.operation == 'NOT_EQUAL'
  896 + // ? f.key.key + '不等于' + f.predicate.value.defaultValue
  897 + // : f.predicate.operation == 'GREATER'
  898 + // ? f.key.key + '大于' + f.predicate.value.defaultValue
  899 + // : f.predicate.operation == 'LESS'
  900 + // ? f.key.key + '小于' + f.predicate.value.defaultValue
  901 + // : f.predicate.operation == 'GREATER_OR_EQUAL'
  902 + // ? f.key.key + '大于或等于' + f.predicate.value.defaultValue
  903 + // : f.key.key + '小于或等于' + f.predicate.value.defaultValue;
  904 + // });
  905 + // return formatMap;
  906 + // };
950 //格式化新增 907 //格式化新增
951 const formatAddRuleFunc = (v) => { 908 const formatAddRuleFunc = (v) => {
952 let formatMap = v.condition.map((f) => { 909 let formatMap = v.condition.map((f) => {
@@ -982,7 +939,7 @@ @@ -982,7 +939,7 @@
982 addNewRuleTem.condition.condition = ruleLastObj.value as never; 939 addNewRuleTem.condition.condition = ruleLastObj.value as never;
983 fliterClearTempRuleConditionTempArr.value.push({ 940 fliterClearTempRuleConditionTempArr.value.push({
984 condition: addNewRuleTem.condition.condition, 941 condition: addNewRuleTem.condition.condition,
985 - }); 942 + } as never);
986 }; 943 };
987 944
988 const formatClearRuleFunc = (v) => { 945 const formatClearRuleFunc = (v) => {
@@ -1008,19 +965,6 @@ @@ -1008,19 +965,6 @@
1008 return formatMap; 965 return formatMap;
1009 }; 966 };
1010 967
1011 - //生成uuid  
1012 - function generateUUID() {  
1013 - let d = new Date().getTime();  
1014 - if (window.performance && typeof window.performance.now === 'function') {  
1015 - d += performance.now();  
1016 - }  
1017 - let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {  
1018 - let r = (d + Math.random() * 16) % 16 | 0;  
1019 - d = Math.floor(d / 16);  
1020 - return (c == 'x' ? r : (r & 0x3) | 0x8).toString(16);  
1021 - });  
1022 - return uuid;  
1023 - }  
1024 const handleFormStep3toStep4Next = () => { 968 const handleFormStep3toStep4Next = () => {
1025 try { 969 try {
1026 validateRegisterFormFunc(); 970 validateRegisterFormFunc();
@@ -1031,7 +975,6 @@ @@ -1031,7 +975,6 @@
1031 getRegisterFormChangeDetailFunc(); 975 getRegisterFormChangeDetailFunc();
1032 addCreateRuleFunc(); 976 addCreateRuleFunc();
1033 addClearAlaramRule(); 977 addClearAlaramRule();
1034 -  
1035 getAllObjTemp = { 978 getAllObjTemp = {
1036 ...alarmTypeGet.value, 979 ...alarmTypeGet.value,
1037 ...propagateAndpropagateRelationTypes, 980 ...propagateAndpropagateRelationTypes,
@@ -1041,7 +984,7 @@ @@ -1041,7 +984,7 @@
1041 Object.assign(getAllObjTemp, addCreateRulesObj, getClearObj); 984 Object.assign(getAllObjTemp, addCreateRulesObj, getClearObj);
1042 }, 10); 985 }, 10);
1043 allAlarms.value.push(getAllObjTemp as never); 986 allAlarms.value.push(getAllObjTemp as never);
1044 - emit('next', allAlarms.value); 987 + emit('next', allAlarms.value, getStepThreeEditStatus.value);
1045 } catch (e) { 988 } catch (e) {
1046 return e; 989 return e;
1047 } 990 }
@@ -1073,6 +1016,7 @@ @@ -1073,6 +1016,7 @@
1073 }; 1016 };
1074 const handleOpenAlaramRuleConditions = () => { 1017 const handleOpenAlaramRuleConditions = () => {
1075 isRuleAlarmRuleConditions.value = 3; 1018 isRuleAlarmRuleConditions.value = 3;
  1019 + getStepThreeEditStatus.value = false;
1076 setTimeout(() => { 1020 setTimeout(() => {
1077 openModal3(true); 1021 openModal3(true);
1078 try { 1022 try {
@@ -1109,11 +1053,33 @@ @@ -1109,11 +1053,33 @@
1109 openModal6(true); 1053 openModal6(true);
1110 }, 10); 1054 }, 10);
1111 }; 1055 };
  1056 + const handleClickHidenEdit = (v) => {
  1057 + editIndex.value = v;
  1058 + };
  1059 + const returnChildItem = (v) => {
  1060 + let openRuleConditObj: any = {};
  1061 + for (let i in v) {
  1062 + if (i == 'CRITICAL') {
  1063 + openRuleConditObj = v[i];
  1064 + } else if (i == 'MAJOR') {
  1065 + openRuleConditObj = v[i];
  1066 + } else if (i == 'MINOR') {
  1067 + openRuleConditObj = v[i];
  1068 + } else if (i == 'WARNING') {
  1069 + openRuleConditObj = v[i];
  1070 + } else if (i == 'INDETERMINATE') {
  1071 + openRuleConditObj = v[i];
  1072 + }
  1073 + }
  1074 + return openRuleConditObj.alarmDetails;
  1075 + };
1112 1076
1113 return { 1077 return {
  1078 + clearEditAllRegisterFormFunc,
  1079 + returnChildItem,
  1080 + editIndex,
1114 isAddRuleStatusFunc, 1081 isAddRuleStatusFunc,
1115 isAddRuleStatus, 1082 isAddRuleStatus,
1116 - formatAlarmFunc,  
1117 createAlarmArray, 1083 createAlarmArray,
1118 formatClearRuleFunc, 1084 formatClearRuleFunc,
1119 formatAddRuleFunc, 1085 formatAddRuleFunc,
@@ -1126,8 +1092,6 @@ @@ -1126,8 +1092,6 @@
1126 getFilterStepThreeEditArr, 1092 getFilterStepThreeEditArr,
1127 getStepThreeEditStatus, 1093 getStepThreeEditStatus,
1128 getStepThreeEditArr, 1094 getStepThreeEditArr,
1129 - setRegisterFormCreateAlarmFunc,  
1130 - resetRegisterFormCreateAlarmFunc,  
1131 initClearCreateRuleFunc, 1095 initClearCreateRuleFunc,
1132 fliterTempOpenRuleTempArr, 1096 fliterTempOpenRuleTempArr,
1133 fliterTempRuleConditionTempArr, 1097 fliterTempRuleConditionTempArr,
@@ -1144,7 +1108,6 @@ @@ -1144,7 +1108,6 @@
1144 setRegisterFormClearChangeDetailFunc, 1108 setRegisterFormClearChangeDetailFunc,
1145 setRegisterFormChangeDetailFunc, 1109 setRegisterFormChangeDetailFunc,
1146 registerFormChangeClearDetail, 1110 registerFormChangeClearDetail,
1147 - registerFormChangeDetail,  
1148 clearProfileDataFunc, 1111 clearProfileDataFunc,
1149 setAlaramTypeFormFunc, 1112 setAlaramTypeFormFunc,
1150 setTransmitAlarmFormFunc, 1113 setTransmitAlarmFormFunc,
@@ -1184,15 +1147,18 @@ @@ -1184,15 +1147,18 @@
1184 addAlarmRule, 1147 addAlarmRule,
1185 registerForm, 1148 registerForm,
1186 registerFormHighSetting, 1149 registerFormHighSetting,
1187 - registerFormCreateAlarm,  
1188 addCreateRole, 1150 addCreateRole,
1189 deleteCondition, 1151 deleteCondition,
1190 setCreateRegisterFormChangeDetailFunc, 1152 setCreateRegisterFormChangeDetailFunc,
1191 detailDetailModelArray, 1153 detailDetailModelArray,
1192 isLostFocuxStatus, 1154 isLostFocuxStatus,
1193 - isEditDataAndValue,  
1194 - getEditDataAndValue,  
1195 - isEditDataAndValueFunc, 1155 + // isEditDataAndValue,
  1156 + // getEditDataAndValue,
  1157 + // isEditDataAndValueFunc,
  1158 + handleClickHidenEdit,
  1159 + alarmSeverityRef,
  1160 + detailTemplateRef,
  1161 + clearDetailTemplateFunc,
1196 }; 1162 };
1197 }, 1163 },
1198 }); 1164 });
src/views/device/profiles/step/DeviceProfileStep4.vue renamed from src/views/device/profile/step/DeviceProfileStep4.vue
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <script lang="ts"> 6 <script lang="ts">
7 import { defineComponent, ref } from 'vue'; 7 import { defineComponent, ref } from 'vue';
8 import { BasicForm, useForm } from '/@/components/Form/index'; 8 import { BasicForm, useForm } from '/@/components/Form/index';
9 - import { alertContactsSchemas } from '../cpns/config'; 9 + import { alertContactsSchemas } from './data';
10 10
11 export default defineComponent({ 11 export default defineComponent({
12 components: { 12 components: {
src/views/device/profiles/step/cpns/alarmruleconditions/config.ts renamed from src/views/device/profile/step/cpns/alarmruleconditions/config.ts
src/views/device/profiles/step/cpns/alarmruleconditions/cpns/config.ts renamed from src/views/device/profile/step/cpns/alarmruleconditions/cpns/config.ts
src/views/device/profiles/step/cpns/alarmruleconditions/cpns/cpns/config.ts renamed from src/views/device/profile/step/cpns/alarmruleconditions/cpns/cpns/config.ts
src/views/device/profiles/step/cpns/alarmruleconditions/cpns/cpns/index.vue renamed from src/views/device/profile/step/cpns/alarmruleconditions/cpns/cpns/index.vue
src/views/device/profiles/step/cpns/alarmruleconditions/cpns/index.vue renamed from src/views/device/profile/step/cpns/alarmruleconditions/cpns/index.vue
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 if (!unref(isUpdate)) { 106 if (!unref(isUpdate)) {
107 getValue.value = getFieldsValue(); 107 getValue.value = getFieldsValue();
108 getKeyAndValArr.value.push(getValue.value); 108 getKeyAndValArr.value.push(getValue.value);
109 - mapGetKeyAndValArr = getKeyAndValArr.value.map((m) => { 109 + mapGetKeyAndValArr = getKeyAndValArr.value.map((m: any) => {
110 return { 110 return {
111 key: { 111 key: {
112 type: m.type, 112 type: m.type,
@@ -131,7 +131,7 @@ @@ -131,7 +131,7 @@
131 } else { 131 } else {
132 getValue.value = getFieldsValue(); 132 getValue.value = getFieldsValue();
133 getKeyAndValArr.value.push(getValue.value); 133 getKeyAndValArr.value.push(getValue.value);
134 - mapGetKeyAndValArr = getKeyAndValArr.value.map((m) => { 134 + mapGetKeyAndValArr = getKeyAndValArr.value.map((m: any) => {
135 return { 135 return {
136 key: { 136 key: {
137 type: m.type, 137 type: m.type,
@@ -207,7 +207,6 @@ @@ -207,7 +207,6 @@
207 } 207 }
208 watch(isWhereType, (v) => { 208 watch(isWhereType, (v) => {
209 switch (v) { 209 switch (v) {
210 - // console.log(v)  
211 case 'STRING': 210 case 'STRING':
212 getIsWhereType.value = v; 211 getIsWhereType.value = v;
213 break; 212 break;
src/views/device/profiles/step/cpns/alarmruleconditions/index.vue renamed from src/views/device/profile/step/cpns/alarmruleconditions/index.vue
  1 +import { FormSchema } from '/@/components/Table';
  2 +import { ref } from 'vue';
  3 +export const isWhereType = ref(null);
  4 +
  5 +export const formSchema: FormSchema[] = [
  6 + {
  7 + field: 'default',
  8 + component: 'Select',
  9 + label: '报警严重程度:',
  10 + colProps: {
  11 + span: 17,
  12 + },
  13 + componentProps() {
  14 + return {
  15 + options: [
  16 + {
  17 + value: 'CRITICAL',
  18 + label: '危险',
  19 + },
  20 + {
  21 + value: 'MAJOR',
  22 + label: '重要',
  23 + },
  24 + {
  25 + value: 'MINOR',
  26 + label: '次要',
  27 + },
  28 + {
  29 + value: 'WARNING',
  30 + label: '警告',
  31 + },
  32 + {
  33 + value: 'INDETERMINATE',
  34 + label: '不确定',
  35 + },
  36 + ],
  37 + onChange: (v) => {
  38 + isWhereType.value = v ? v : 'CRITICAL';
  39 + },
  40 + };
  41 + },
  42 + },
  43 +];
src/views/device/profiles/step/cpns/alarmseverity/index.vue renamed from src/views/device/profile/step/cpns/detailtemplate/index.vue
@@ -13,10 +13,11 @@ @@ -13,10 +13,11 @@
13 components: { 13 components: {
14 BasicForm, 14 BasicForm,
15 }, 15 },
  16 + props: ['alarmSeverityInfo'],
16 emits: ['success', 'register', 'getAllFields'], 17 emits: ['success', 'register', 'getAllFields'],
17 - setup() { 18 + setup(props) {
18 const fieldValue: any = ref({}); 19 const fieldValue: any = ref({});
19 - const [registerForm, { getFieldsValue }] = useForm({ 20 + const [registerForm, { getFieldsValue, setFieldsValue }] = useForm({
20 labelWidth: 120, 21 labelWidth: 120,
21 schemas: formSchema, 22 schemas: formSchema,
22 }); 23 });
@@ -26,6 +27,17 @@ @@ -26,6 +27,17 @@
26 return fieldValue.value; 27 return fieldValue.value;
27 }; 28 };
28 29
  30 + const setFieldsValueFunc = () => {
  31 + if (props.alarmSeverityInfo != 1) {
  32 + let newArr = Object.keys(props.alarmSeverityInfo);
  33 + setTimeout(() => {
  34 + newArr.forEach((f) => {
  35 + setFieldsValue({ default: f });
  36 + });
  37 + }, 10);
  38 + }
  39 + };
  40 + setFieldsValueFunc();
29 return { 41 return {
30 getFieldsValueFunc, 42 getFieldsValueFunc,
31 registerForm, 43 registerForm,
src/views/device/profiles/step/cpns/detailtemplate/config.ts renamed from src/views/device/profile/step/cpns/detailtemplate/config.ts
  1 +<template>
  2 + <div>
  3 + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerForm" />
  4 + </div>
  5 +</template>
  6 +<script lang="ts">
  7 + import { defineComponent, ref } from 'vue';
  8 + import { BasicForm, useForm } from '/@/components/Form';
  9 + import { formSchema } from './config';
  10 +
  11 + export default defineComponent({
  12 + name: 'DetailTemplate',
  13 + components: {
  14 + BasicForm,
  15 + },
  16 + props: ['detailTemplateInfo'],
  17 + emits: ['success', 'register', 'getAllFields'],
  18 + setup(props) {
  19 + const fieldValue: any = ref({});
  20 + const [registerForm, { getFieldsValue, setFieldsValue, resetFields }] = useForm({
  21 + labelWidth: 120,
  22 + schemas: formSchema,
  23 + });
  24 +
  25 + const getFieldsValueFunc = () => {
  26 + fieldValue.value = getFieldsValue();
  27 + return fieldValue.value;
  28 + };
  29 + const setFieldsValueFunc = () => {
  30 + if (props.detailTemplateInfo != 1) {
  31 + resetFields();
  32 + setTimeout(() => {
  33 + setFieldsValue({
  34 + alarmDetails: props.detailTemplateInfo,
  35 + });
  36 + }, 10);
  37 + }
  38 + };
  39 + setFieldsValueFunc();
  40 +
  41 + const resetFieldsFunc = () => {
  42 + resetFields();
  43 + };
  44 + return {
  45 + resetFieldsFunc,
  46 + getFieldsValueFunc,
  47 + registerForm,
  48 + };
  49 + },
  50 + });
  51 +</script>
src/views/device/profiles/step/cpns/enablerule/config.ts renamed from src/views/device/profile/step/cpns/enablerule/config.ts
src/views/device/profiles/step/cpns/enablerule/index.vue renamed from src/views/device/profile/step/cpns/enablerule/index.vue
@@ -23,7 +23,6 @@ @@ -23,7 +23,6 @@
23 }, 23 },
24 emits: ['success', 'register', 'getAllFieldsEnab'], 24 emits: ['success', 'register', 'getAllFieldsEnab'],
25 setup(_, { emit }) { 25 setup(_, { emit }) {
26 - // const getValueData: any = ref({});  
27 const isUpdate = ref(true); 26 const isUpdate = ref(true);
28 const [registerForm, { getFieldsValue, resetFields }] = useForm({ 27 const [registerForm, { getFieldsValue, resetFields }] = useForm({
29 labelWidth: 120, 28 labelWidth: 120,
@@ -39,19 +38,10 @@ @@ -39,19 +38,10 @@
39 const handleSubmit = () => { 38 const handleSubmit = () => {
40 const values = getFieldsValue(); 39 const values = getFieldsValue();
41 emit('getAllFieldsEnab', values); 40 emit('getAllFieldsEnab', values);
42 - // let getV = {};  
43 - // getAllFieldsEnab(getV);  
44 closeModal(); 41 closeModal();
45 }; 42 };
46 - // function getAllFieldsEnab(getV) {  
47 - // const values = getFieldsValue();  
48 - // getValueData.value = values;  
49 - // getV = getValueData.value;  
50 - // return getV;  
51 - // }  
52 return { 43 return {
53 resetDataFunc, 44 resetDataFunc,
54 - // getAllFieldsEnab,  
55 registerForm, 45 registerForm,
56 handleSubmit, 46 handleSubmit,
57 register, 47 register,
src/views/device/profiles/step/data.ts renamed from src/views/device/profile/step/data.ts
1 import { FormSchema } from '/@/components/Form'; 1 import { FormSchema } from '/@/components/Form';
2 -// import { getOrganizationList } from '/@/api/system/system';  
3 -// import { copyTransFun } from '/@/utils/fnUtils';  
4 import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi'; 2 import { deviceConfigGetRuleChain } from '/@/api/device/deviceConfigApi';
5 import { ref } from 'vue'; 3 import { ref } from 'vue';
6 import { findDictItemByCode } from '/@/api/system/dict'; 4 import { findDictItemByCode } from '/@/api/system/dict';
@@ -148,7 +146,6 @@ export const step3HighSetting: FormSchema[] = [ @@ -148,7 +146,6 @@ export const step3HighSetting: FormSchema[] = [
148 ]; 146 ];
149 147
150 export const isWhereType = ref(null); 148 export const isWhereType = ref(null);
151 -export const isLostFocux = ref(true);  
152 149
153 export const step3CreateAlarm: FormSchema[] = [ 150 export const step3CreateAlarm: FormSchema[] = [
154 { 151 {
@@ -185,9 +182,6 @@ export const step3CreateAlarm: FormSchema[] = [ @@ -185,9 +182,6 @@ export const step3CreateAlarm: FormSchema[] = [
185 onChange: (v) => { 182 onChange: (v) => {
186 isWhereType.value = v ? v : 'INDETERMINATE'; 183 isWhereType.value = v ? v : 'INDETERMINATE';
187 }, 184 },
188 - onFocus: () => {  
189 - isLostFocux.value = false;  
190 - },  
191 }; 185 };
192 }, 186 },
193 }, 187 },
@@ -224,7 +218,9 @@ export const alertContactsSchemas: FormSchema[] = [ @@ -224,7 +218,9 @@ export const alertContactsSchemas: FormSchema[] = [
224 field: 'alarmContactId', 218 field: 'alarmContactId',
225 label: '告警通知联系人', 219 label: '告警通知联系人',
226 component: 'ApiSelect', 220 component: 'ApiSelect',
  221 + required: true,
227 componentProps: { 222 componentProps: {
  223 + mode: 'multiple',
228 placeholder: '请选择告警通知联系人', 224 placeholder: '请选择告警通知联系人',
229 api: alarmContactGetPage, 225 api: alarmContactGetPage,
230 labelField: 'username', 226 labelField: 'username',
@@ -236,7 +232,9 @@ export const alertContactsSchemas: FormSchema[] = [ @@ -236,7 +232,9 @@ export const alertContactsSchemas: FormSchema[] = [
236 field: 'messageMode', 232 field: 'messageMode',
237 label: '告警通知方式', 233 label: '告警通知方式',
238 component: 'ApiSelect', 234 component: 'ApiSelect',
  235 + required: true,
239 componentProps: { 236 componentProps: {
  237 + mode: 'multiple',
240 placeholder: '请选择告警通知方式', 238 placeholder: '请选择告警通知方式',
241 api: findDictItemByCode, 239 api: findDictItemByCode,
242 params: { 240 params: {
@@ -256,7 +254,7 @@ export const formChangeDetailSchema: FormSchema[] = [ @@ -256,7 +254,7 @@ export const formChangeDetailSchema: FormSchema[] = [
256 component: 'Input', 254 component: 'Input',
257 defaultValue: '', 255 defaultValue: '',
258 componentProps: { 256 componentProps: {
259 - placeholder: '.', 257 + placeholder: '',
260 maxLength: 255, 258 maxLength: 255,
261 }, 259 },
262 }, 260 },
src/views/device/profiles/step/index.t.ts renamed from src/views/device/profile/step/index.t.ts
@@ -17,7 +17,6 @@ @@ -17,7 +17,6 @@
17 import { BasicForm, useForm } from '/@/components/Form/index'; 17 import { BasicForm, useForm } from '/@/components/Form/index';
18 import { Input } from 'ant-design-vue'; 18 import { Input } from 'ant-design-vue';
19 import { useConditionDrawerSchema } from '../config'; 19 import { useConditionDrawerSchema } from '../config';
20 - // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi';  
21 20
22 export default defineComponent({ 21 export default defineComponent({
23 components: { CollapseContainer, BasicForm, [Input.name]: Input }, 22 components: { CollapseContainer, BasicForm, [Input.name]: Input },
@@ -96,14 +95,6 @@ @@ -96,14 +95,6 @@
96 }, 95 },
97 }); 96 });
98 }; 97 };
99 - // const editSelectDevice = (v) => {  
100 - // updateSchema({  
101 - // field: 'entityId',  
102 - // componentProps: {  
103 - // options: v,  
104 - // },  
105 - // });  
106 - // };  
107 return { 98 return {
108 updateFieldDeviceId, 99 updateFieldDeviceId,
109 resetFieldsValueFunc, 100 resetFieldsValueFunc,
@@ -293,7 +293,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -293,7 +293,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [
293 placeholder: '属性触发', 293 placeholder: '属性触发',
294 options: [ 294 options: [
295 { label: '属性触发', value: 'ATTRIBUTE' }, 295 { label: '属性触发', value: 'ATTRIBUTE' },
296 - { label: '上下线触发', value: 'TIME_SERIES' }, 296 + // { label: '上下线触发', value: 'ATTRIBUTE' },
297 ], 297 ],
298 }, 298 },
299 ifShow: ({ values }) => 299 ifShow: ({ values }) =>
@@ -302,25 +302,25 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -302,25 +302,25 @@ export const useTriggerDrawerSchema: FormSchema[] = [
302 !isHand(Reflect.get(values, 'triggerType')), 302 !isHand(Reflect.get(values, 'triggerType')),
303 colProps: { span: 12 }, 303 colProps: { span: 12 },
304 }, 304 },
305 - {  
306 - field: 'key1',  
307 - label: '',  
308 - component: 'Select',  
309 - componentProps: {  
310 - placeholder: '请选择上下线',  
311 - options: [  
312 - { label: '上下线', value: '1' },  
313 - { label: '上线', value: '2' },  
314 - { label: '下线', value: '3' },  
315 - ],  
316 - },  
317 - colProps: { span: 12 },  
318 - ifShow: ({ values }) =>  
319 - isUpAndDown(Reflect.get(values, 'type1')) &&  
320 - !isTime(Reflect.get(values, 'triggerType')) &&  
321 - !isScene(Reflect.get(values, 'triggerType')) &&  
322 - !isHand(Reflect.get(values, 'triggerType')),  
323 - }, 305 + // {
  306 + // field: 'key1',
  307 + // label: '',
  308 + // component: 'Select',
  309 + // componentProps: {
  310 + // placeholder: '请选择上下线',
  311 + // options: [
  312 + // { label: '上下线', value: '1' },
  313 + // { label: '上线', value: '2' },
  314 + // { label: '下线', value: '3' },
  315 + // ],
  316 + // },
  317 + // colProps: { span: 12 },
  318 + // ifShow: ({ values }) =>
  319 + // isUpAndDown(Reflect.get(values, 'type1')) &&
  320 + // !isTime(Reflect.get(values, 'triggerType')) &&
  321 + // !isScene(Reflect.get(values, 'triggerType')) &&
  322 + // !isHand(Reflect.get(values, 'triggerType')),
  323 + // },
324 { 324 {
325 field: 'type2', 325 field: 'type2',
326 label: '', 326 label: '',
@@ -369,7 +369,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [ @@ -369,7 +369,6 @@ export const useTriggerDrawerSchema: FormSchema[] = [
369 maxLength: 16, 369 maxLength: 16,
370 placeholder: '请输入比较值', 370 placeholder: '请输入比较值',
371 }, 371 },
372 -  
373 ifShow: ({ values }) => 372 ifShow: ({ values }) =>
374 isWenDu(Reflect.get(values, 'type2')) && 373 isWenDu(Reflect.get(values, 'type2')) &&
375 !isUpAndDown(Reflect.get(values, 'type1')) && 374 !isUpAndDown(Reflect.get(values, 'type1')) &&
@@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
6 :rowSelection="{ type: 'checkbox' }" 6 :rowSelection="{ type: 'checkbox' }"
7 > 7 >
8 <template #toolbar> 8 <template #toolbar>
9 - <a-button type="primary" @click="handleAdd"> 新增场景联动 </a-button> 9 + <a-button v-if="isSysadmin || isCustomer || isPlatform" type="primary" @click="handleAdd">
  10 + 新增场景联动
  11 + </a-button>
10 <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete"> 12 <a-button color="error" @click="handleDeleteOrBatchDelete(null)" :disabled="hasBatchDelete">
11 批量删除 13 批量删除
12 </a-button> 14 </a-button>
@@ -18,11 +20,13 @@ @@ -18,11 +20,13 @@
18 label: '编辑', 20 label: '编辑',
19 icon: 'clarity:note-edit-line', 21 icon: 'clarity:note-edit-line',
20 onClick: handleEdit.bind(null, record), 22 onClick: handleEdit.bind(null, record),
  23 + ifShow: isTenant,
21 }, 24 },
22 { 25 {
23 label: '删除', 26 label: '删除',
24 icon: 'ant-design:delete-outlined', 27 icon: 'ant-design:delete-outlined',
25 color: 'error', 28 color: 'error',
  29 + ifShow: isTenant,
26 popConfirm: { 30 popConfirm: {
27 title: '是否确认删除', 31 title: '是否确认删除',
28 confirm: handleDeleteOrBatchDelete.bind(null, record), 32 confirm: handleDeleteOrBatchDelete.bind(null, record),
@@ -40,7 +44,7 @@ @@ -40,7 +44,7 @@
40 </div> 44 </div>
41 </template> 45 </template>
42 <script lang="ts"> 46 <script lang="ts">
43 - import { defineComponent, getCurrentInstance, ref } from 'vue'; 47 + import { defineComponent, getCurrentInstance, ref, computed } from 'vue';
44 import { BasicTable, useTable, TableAction } from '/@/components/Table'; 48 import { BasicTable, useTable, TableAction } from '/@/components/Table';
45 import { useDrawer } from '/@/components/Drawer'; 49 import { useDrawer } from '/@/components/Drawer';
46 import SceneLinkAgeDrawer from './useDrawer.vue'; 50 import SceneLinkAgeDrawer from './useDrawer.vue';
@@ -48,13 +52,22 @@ @@ -48,13 +52,22 @@
48 import { useMessage } from '/@/hooks/web/useMessage'; 52 import { useMessage } from '/@/hooks/web/useMessage';
49 import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi'; 53 import { screenLinkPageGetApi, screenLinkPageDeleteApi } from '/@/api/ruleengine/ruleengineApi';
50 import { useBatchDelete } from '/@/hooks/web/useBatchDelete'; 54 import { useBatchDelete } from '/@/hooks/web/useBatchDelete';
  55 + import { RoleEnum } from '/@/enums/roleEnum';
  56 + import { usePermission } from '/@/hooks/web/usePermission';
  57 + import { useUserStore } from '/@/store/modules/user';
51 58
52 export default defineComponent({ 59 export default defineComponent({
53 name: 'Index', 60 name: 'Index',
54 components: { BasicTable, SceneLinkAgeDrawer, TableAction }, 61 components: { BasicTable, SceneLinkAgeDrawer, TableAction },
55 emits: ['default', 'registerTable', 'registerDrawer', 'register'], 62 emits: ['default', 'registerTable', 'registerDrawer', 'register'],
56 setup() { 63 setup() {
57 - const { proxy } = getCurrentInstance(); 64 + const { hasPermission } = usePermission();
  65 + const userStore = useUserStore();
  66 + const isTenant = computed(() => userStore.getRoleList.includes(RoleEnum.TENANT_ADMIN));
  67 + const isCustomer = computed(() => userStore.getRoleList.includes(RoleEnum.CUSTOMER_USER));
  68 + const isSysadmin = computed(() => userStore.getRoleList.includes(RoleEnum.SYS_ADMIN));
  69 + const isPlatform = computed(() => userStore.getRoleList.includes(RoleEnum.PLATFORM_ADMIN));
  70 + const { proxy } = getCurrentInstance() as any;
58 const sceneLinkAgeDrawerRef: any = ref(null); 71 const sceneLinkAgeDrawerRef: any = ref(null);
59 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete( 72 const { hasBatchDelete, handleDeleteOrBatchDelete, selectionOptions } = useBatchDelete(
60 screenLinkPageDeleteApi, 73 screenLinkPageDeleteApi,
@@ -91,8 +104,6 @@ @@ -91,8 +104,6 @@
91 }); 104 });
92 try { 105 try {
93 setTimeout(() => { 106 setTimeout(() => {
94 - // proxy.$refs.sceneLinkAgeDrawerRef.defaultAddTrigger();  
95 - // proxy.$refs.sceneLinkAgeDrawerRef.defaultAddCondition();  
96 proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction(); 107 proxy.$refs.sceneLinkAgeDrawerRef.defaultAddAction();
97 }, 50); 108 }, 50);
98 } catch (e) { 109 } catch (e) {
@@ -130,6 +141,12 @@ @@ -130,6 +141,12 @@
130 reload(); 141 reload();
131 } 142 }
132 return { 143 return {
  144 + isPlatform,
  145 + isSysadmin,
  146 + isCustomer,
  147 + isTenant,
  148 + RoleEnum,
  149 + hasPermission,
133 sceneLinkAgeDrawerRef, 150 sceneLinkAgeDrawerRef,
134 useSelectionChange, 151 useSelectionChange,
135 registerTable, 152 registerTable,
1 <template> 1 <template>
2 - <BasicDrawer  
3 - v-bind="$attrs"  
4 - @register="registerDrawer"  
5 - showFooter  
6 - :title="getTitle"  
7 - width="1000px"  
8 - @ok="handleSubmit"  
9 - @close="handleClose"  
10 - >  
11 - <div>  
12 - <BasicForm @register="registerForm" />  
13 - <!-- 触发器 -->  
14 - <div style="border-radius: 4px">  
15 - <template  
16 - v-for="(item, index) in isUpdate == false ? addTriggerPushData : editTriggerPushData"  
17 - :key="index"  
18 - >  
19 - <span style="display: none">{{ item + index }}</span>  
20 - <span style="position: relative; top: 3.2vh; left: 0.5vw">触发器 {{ index + 1 }}</span>  
21 - <div style="display: block">  
22 - <AddTriggerForm  
23 - ref="refTriggerChild"  
24 - :editTriggerFather="isUpdate == false ? 1 : item"  
25 - :newFilterMapFather="isUpdate == false ? 1 : newFilterMap"  
26 - :deviceInfo="getDeviceInfo"  
27 - />  
28 - </div>  
29 - <div style="height: 3vh"></div>  
30 - </template>  
31 - <div  
32 - style="  
33 - display: flex;  
34 - width: 11vw;  
35 - height: 4vh;  
36 - flex-direction: row;  
37 - justify-content: space-between;  
38 - "  
39 - >  
40 - <div style="display: flex; width: 4vw; height: 4vh">  
41 - <Button type="primary" style="border-radius: 2px" class="mt-5" @click="addTrigger"  
42 - >新增触发器</Button  
43 - >  
44 - </div>  
45 - <div style="display: flex; width: 4vw; height: 4vh">  
46 - <Button  
47 - v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0"  
48 - type="default"  
49 - style="border-radius: 2px; background-color: rgba(237, 111, 111, 1)"  
50 - class="mt-5"  
51 - @click="removeTrigger"  
52 - >  
53 - <span style="color: white">删除</span></Button  
54 - > 2 + <div>
  3 + <BasicDrawer
  4 + v-bind="$attrs"
  5 + @register="registerDrawer"
  6 + showFooter
  7 + :title="getTitle"
  8 + width="1000px"
  9 + @ok="handleSubmit"
  10 + @close="handleClose"
  11 + >
  12 + <div>
  13 + <BasicForm @register="registerForm" />
  14 + <!-- 触发器 -->
  15 + <div style="border-radius: 4px">
  16 + <template
  17 + v-for="(item, index) in isUpdate == false ? addTriggerPushData : editTriggerPushData"
  18 + :key="index"
  19 + >
  20 + <span style="display: none">{{ item + index }}</span>
  21 + <span style="position: relative; top: 3.2vh; left: 0.5vw">触发器 {{ index + 1 }}</span>
  22 + <div style="display: block">
  23 + <AddTriggerForm
  24 + ref="refTriggerChild"
  25 + :editTriggerFather="isUpdate == false ? 1 : item"
  26 + :newFilterMapFather="isUpdate == false ? 1 : newFilterMap"
  27 + :deviceInfo="getDeviceInfo"
  28 + />
  29 + </div>
  30 + <div style="height: 3vh"></div>
  31 + </template>
  32 + <div
  33 + style="
  34 + display: flex;
  35 + width: 11vw;
  36 + height: 4vh;
  37 + flex-direction: row;
  38 + justify-content: space-between;
  39 + "
  40 + >
  41 + <div style="display: flex; width: 4vw; height: 4vh">
  42 + <Button type="primary" style="border-radius: 2px" class="mt-5" @click="addTrigger"
  43 + >新增触发器</Button
  44 + >
  45 + </div>
  46 + <div style="display: flex; width: 4vw; height: 4vh">
  47 + <Button
  48 + v-if="addTriggerPushData.length != 0 || editTriggerPushData.length != 0"
  49 + type="default"
  50 + style="border-radius: 2px; background-color: rgba(237, 111, 111, 1)"
  51 + class="mt-5"
  52 + @click="removeTrigger"
  53 + >
  54 + <span style="color: white">删除</span></Button
  55 + >
  56 + </div>
55 </div> 57 </div>
56 </div> 58 </div>
57 - </div>  
58 - <div style="height: 5vh"></div>  
59 - <!-- 执行条件 -->  
60 - <div style="border-radius: 4px" class="condition-style">  
61 - <template  
62 - v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData"  
63 - :key="index"  
64 - >  
65 - <span style="display: none">{{ item + index }}</span>  
66 - <span style="position: relative; top: 3.2vh; left: 0.5vw">执行条件 {{ index + 1 }}</span>  
67 -  
68 - <div>  
69 - <AddConditiForm  
70 - :editConditionFather="isUpdate == false ? 1 : item"  
71 - :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap"  
72 - :deviceInfo1="getDeviceInfo1"  
73 - ref="refConditionChild"  
74 - />  
75 - </div>  
76 - <div style="height: 3vh"></div>  
77 - </template>  
78 - <div  
79 - style="  
80 - display: flex;  
81 - width: 11vw;  
82 - height: 4vh;  
83 - flex-direction: row;  
84 - justify-content: space-between;  
85 - "  
86 - >  
87 - <div style="display: flex; width: 4vw; height: 4vh">  
88 - <Button type="primary" style="border-radius: 2px" class="mt-5" @click="addCondition"  
89 - >新增执行条件</Button  
90 - >  
91 - </div>  
92 - <div style="display: flex; width: 4vw; height: 4vh">  
93 - <Button  
94 - v-if="addConditionPushData.length != 0 || editConditionPushData.length != 0"  
95 - style="border-radius: 2px; background-color: rgba(237, 111, 111, 1)"  
96 - type="default"  
97 - class="mt-5"  
98 - @click="removeCondition"  
99 - >  
100 - <span style="color: white">删除</span></Button 59 + <div style="height: 5vh"></div>
  60 + <!-- 执行条件 -->
  61 + <div style="border-radius: 4px" class="condition-style">
  62 + <template
  63 + v-for="(item, index) in isUpdate == false
  64 + ? addConditionPushData
  65 + : editConditionPushData"
  66 + :key="index"
  67 + >
  68 + <span style="display: none">{{ item + index }}</span>
  69 + <span style="position: relative; top: 3.2vh; left: 0.5vw"
  70 + >执行条件 {{ index + 1 }}</span
101 > 71 >
102 - </div>  
103 - </div>  
104 - </div>  
105 - <!-- 执行动作 -->  
106 - <div style="height: 5vh"></div>  
107 - <div style="border-radius: 4px">  
108 - <template  
109 - v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData"  
110 - :key="index"  
111 - >  
112 - <span style="display: none">{{ item + index }}</span>  
113 - <span style="position: relative; top: 4.2vh; left: 0.65vw">执行动作 {{ index + 1 }}</span>  
114 72
115 - <div>  
116 - <AddActionForm  
117 - :editActionFather="isUpdate == false ? 1 : item"  
118 - :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap"  
119 - :deviceInfo2="getDeviceInfo2"  
120 - ref="refActionChild"  
121 - />  
122 - </div>  
123 - <div style="height: 3vh"></div>  
124 - </template>  
125 - <div  
126 - style="  
127 - display: flex;  
128 - width: 11vw;  
129 - height: 4vh;  
130 - flex-direction: row;  
131 - justify-content: space-between;  
132 - "  
133 - >  
134 - <div style="display: flex; width: 4vw; height: 4vh">  
135 - <Button type="primary" style="border-radius: 2px" class="mt-5" @click="addAction"  
136 - >新增执行动作</Button  
137 - > 73 + <div>
  74 + <AddConditiForm
  75 + :editConditionFather="isUpdate == false ? 1 : item"
  76 + :newConditionMapFather="isUpdate == false ? 1 : newConditionFilterMap"
  77 + :deviceInfo1="getDeviceInfo1"
  78 + ref="refConditionChild"
  79 + />
  80 + </div>
  81 + <div style="height: 3vh"></div>
  82 + </template>
  83 + <div
  84 + style="
  85 + display: flex;
  86 + width: 11vw;
  87 + height: 4vh;
  88 + flex-direction: row;
  89 + justify-content: space-between;
  90 + "
  91 + >
  92 + <div style="display: flex; width: 4vw; height: 4vh">
  93 + <Button type="primary" style="border-radius: 2px" class="mt-5" @click="addCondition"
  94 + >新增执行条件</Button
  95 + >
  96 + </div>
  97 + <div style="display: flex; width: 4vw; height: 4vh">
  98 + <Button
  99 + v-if="addConditionPushData.length != 0 || editConditionPushData.length != 0"
  100 + style="border-radius: 2px; background-color: rgba(237, 111, 111, 1)"
  101 + type="default"
  102 + class="mt-5"
  103 + @click="removeCondition"
  104 + >
  105 + <span style="color: white">删除</span></Button
  106 + >
  107 + </div>
138 </div> 108 </div>
139 - <div style="display: flex; width: 4vw; height: 4vh">  
140 - <Button  
141 - v-if="addActionPushData.length !== 0 || editActionPushData.length !== 0"  
142 - style="border-radius: 2px; background-color: rgba(237, 111, 111, 1)"  
143 - type="default"  
144 - class="mt-5"  
145 - @click="removeAction"  
146 - >  
147 - <span style="color: white">删除</span></Button 109 + </div>
  110 + <!-- 执行动作 -->
  111 + <div style="height: 5vh"></div>
  112 + <div style="border-radius: 4px">
  113 + <template
  114 + v-for="(item, index) in isUpdate == false ? addActionPushData : editActionPushData"
  115 + :key="index"
  116 + >
  117 + <span style="display: none">{{ item + index }}</span>
  118 + <span style="position: relative; top: 4.2vh; left: 0.65vw"
  119 + >执行动作 {{ index + 1 }}</span
148 > 120 >
  121 +
  122 + <div>
  123 + <AddActionForm
  124 + :editActionFather="isUpdate == false ? 1 : item"
  125 + :newActionMapFather="isUpdate == false ? 1 : newActionFilterMap"
  126 + :deviceInfo2="getDeviceInfo2"
  127 + ref="refActionChild"
  128 + />
  129 + </div>
  130 + <div style="height: 3vh"></div>
  131 + </template>
  132 + <div
  133 + style="
  134 + display: flex;
  135 + width: 11vw;
  136 + height: 4vh;
  137 + flex-direction: row;
  138 + justify-content: space-between;
  139 + "
  140 + >
  141 + <div style="display: flex; width: 4vw; height: 4vh">
  142 + <Button type="primary" style="border-radius: 2px" class="mt-5" @click="addAction"
  143 + >新增执行动作</Button
  144 + >
  145 + </div>
  146 + <div style="display: flex; width: 4vw; height: 4vh">
  147 + <Button
  148 + v-if="addActionPushData.length !== 0 || editActionPushData.length !== 0"
  149 + style="border-radius: 2px; background-color: rgba(237, 111, 111, 1)"
  150 + type="default"
  151 + class="mt-5"
  152 + @click="removeAction"
  153 + >
  154 + <span style="color: white">删除</span></Button
  155 + >
  156 + </div>
149 </div> 157 </div>
  158 + <div style="height: 5vh"></div>
150 </div> 159 </div>
151 - <div style="height: 5vh"></div>  
152 </div> 160 </div>
153 - </div>  
154 - </BasicDrawer> 161 + </BasicDrawer>
  162 + </div>
155 </template> 163 </template>
156 <script lang="ts"> 164 <script lang="ts">
157 import { defineComponent, ref, computed, unref, reactive, getCurrentInstance, watch } from 'vue'; 165 import { defineComponent, ref, computed, unref, reactive, getCurrentInstance, watch } from 'vue';
@@ -182,7 +190,7 @@ @@ -182,7 +190,7 @@
182 }, 190 },
183 emits: ['success', 'register', 'registerForm'], 191 emits: ['success', 'register', 'registerForm'],
184 setup(_, { emit }) { 192 setup(_, { emit }) {
185 - const { proxy } = getCurrentInstance(); 193 + const { proxy } = getCurrentInstance() as any;
186 const lastEditRefTriggerChildDataArray = ref<[]>([]); 194 const lastEditRefTriggerChildDataArray = ref<[]>([]);
187 const lastRefTriggerChildDataArray = ref<[]>([]); 195 const lastRefTriggerChildDataArray = ref<[]>([]);
188 const lastRefConditionChildDataArray = ref<[]>([]); 196 const lastRefConditionChildDataArray = ref<[]>([]);
@@ -301,7 +309,6 @@ @@ -301,7 +309,6 @@
301 } 309 }
302 } else { 310 } else {
303 try { 311 try {
304 - emit('success');  
305 kongTriggerObj = {}; 312 kongTriggerObj = {};
306 kongConditionObj = {}; 313 kongConditionObj = {};
307 kongActionObj = {}; 314 kongActionObj = {};
@@ -364,6 +371,7 @@ @@ -364,6 +371,7 @@
364 } 371 }
365 }); 372 });
366 }); 373 });
  374 + emit('success');
367 } catch (e) { 375 } catch (e) {
368 return e; 376 return e;
369 } 377 }
@@ -464,7 +472,7 @@ @@ -464,7 +472,7 @@
464 let newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData); 472 let newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData);
465 let newConditionArray = addConditionPushData.value.concat(refConditionChildData); 473 let newConditionArray = addConditionPushData.value.concat(refConditionChildData);
466 let newActionArray = addActionPushData.value.concat(refActionChildData); 474 let newActionArray = addActionPushData.value.concat(refActionChildData);
467 - (newTriggerArray as any) = newTriggerArray.map((m) => { 475 + (newTriggerArray as any) = newTriggerArray.map((m: any) => {
468 return { 476 return {
469 triggerType: m?.triggerType, 477 triggerType: m?.triggerType,
470 entityId: m?.entityId || m?.entityId1 || m?.entityId2, 478 entityId: m?.entityId || m?.entityId1 || m?.entityId2,
@@ -492,7 +500,7 @@ @@ -492,7 +500,7 @@
492 }, 500 },
493 }; 501 };
494 }); 502 });
495 - (newConditionArray as any) = newConditionArray.map((m) => { 503 + (newConditionArray as any) = newConditionArray.map((m: any) => {
496 return { 504 return {
497 triggerType: m?.triggerType, 505 triggerType: m?.triggerType,
498 entityId: m?.entityId, 506 entityId: m?.entityId,
@@ -597,7 +605,6 @@ @@ -597,7 +605,6 @@
597 getAllFormData.doActions.forEach((f) => { 605 getAllFormData.doActions.forEach((f) => {
598 isKongNum = Object.keys(f).length; 606 isKongNum = Object.keys(f).length;
599 }); 607 });
600 -  
601 if (getAllFormData.doActions.length == 1 && isKongNum == 0) 608 if (getAllFormData.doActions.length == 1 && isKongNum == 0)
602 return createMessage.error('请填写执行动作'); 609 return createMessage.error('请填写执行动作');
603 Object.assign(getAllFormData, getValuesFormData); 610 Object.assign(getAllFormData, getValuesFormData);
@@ -626,7 +633,7 @@ @@ -626,7 +633,7 @@
626 if (!unref(isUpdate)) { 633 if (!unref(isUpdate)) {
627 refTriggerChildDataFunc(); 634 refTriggerChildDataFunc();
628 unref(addTriggerPushData).push(refTriggerChildData as never); 635 unref(addTriggerPushData).push(refTriggerChildData as never);
629 - (addTriggerPushData.value as any) = addTriggerPushData.value.map((m) => { 636 + (addTriggerPushData.value as any) = addTriggerPushData.value.map((m: any) => {
630 return { 637 return {
631 triggerType: m?.triggerType, 638 triggerType: m?.triggerType,
632 entityId: m?.entityId || m?.entityId1 || m?.entityId2, 639 entityId: m?.entityId || m?.entityId1 || m?.entityId2,
@@ -644,7 +651,7 @@ @@ -644,7 +651,7 @@
644 value: { 651 value: {
645 defaultValue: Number(m.value) == null ? 0 : Number(m.value), 652 defaultValue: Number(m.value) == null ? 0 : Number(m.value),
646 }, 653 },
647 - operation: m.operation == null ? 'GREATER_OR_EQUAL' : m.operation, 654 + operation: m.operation == null ? 'EQUAL' : m.operation,
648 }, 655 },
649 }, 656 },
650 ], 657 ],
@@ -684,7 +691,7 @@ @@ -684,7 +691,7 @@
684 value: { 691 value: {
685 defaultValue: Number(m.value) == null ? 0 : Number(m.value), 692 defaultValue: Number(m.value) == null ? 0 : Number(m.value),
686 }, 693 },
687 - operation: m.operation == null ? 'GREATER_OR_EQUAL' : m.operation, 694 + operation: m.operation == null ? 'EQUAL' : m.operation,
688 }, 695 },
689 }, 696 },
690 ], 697 ],
@@ -725,7 +732,7 @@ @@ -725,7 +732,7 @@
725 if (!unref(isUpdate)) { 732 if (!unref(isUpdate)) {
726 refConditionChildDataFunc(); 733 refConditionChildDataFunc();
727 unref(addConditionPushData).push(refConditionChildData as never); 734 unref(addConditionPushData).push(refConditionChildData as never);
728 - (addConditionPushData.value as any) = addConditionPushData.value.map((m) => { 735 + (addConditionPushData.value as any) = addConditionPushData.value.map((m: any) => {
729 return { 736 return {
730 triggerType: m?.triggerType, 737 triggerType: m?.triggerType,
731 entityId: m?.entityId, 738 entityId: m?.entityId,