Commit 8dabb2c14823f1d622b5fab0ad32c2072f81a1c5
1 parent
82e865a1
fix:修复设备配置第三步点击新增数据一样的问题,fix:修改场景联动一些字段
Showing
5 changed files
with
223 additions
and
230 deletions
@@ -65,7 +65,7 @@ function dynamicImport( | @@ -65,7 +65,7 @@ function dynamicImport( | ||
65 | 65 | ||
66 | // Turn background objects into routing objects | 66 | // Turn background objects into routing objects |
67 | export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModule[]): T[] { | 67 | export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModule[]): T[] { |
68 | - routeList.forEach((route) => { | 68 | + routeList?.forEach((route) => { |
69 | const component = route.component as string; | 69 | const component = route.component as string; |
70 | if (component) { | 70 | if (component) { |
71 | if (component.toUpperCase() === 'LAYOUT') { | 71 | if (component.toUpperCase() === 'LAYOUT') { |
@@ -89,25 +89,7 @@ | @@ -89,25 +89,7 @@ | ||
89 | :key="index2" | 89 | :key="index2" |
90 | > | 90 | > |
91 | <p v-if="index2 == createIndex && !getStepThreeEditStatus" | 91 | <p v-if="index2 == createIndex && !getStepThreeEditStatus" |
92 | - >报警规则条件:{{ | ||
93 | - v2.predicate.operation == 'EQUAL' | ||
94 | - ? v2.key.key + '等于' + v2.predicate.value.defaultValue | ||
95 | - : v2.predicate.operation == 'STARTS_WITH' | ||
96 | - ? v2.key.key + '开始于' + v2.predicate.value.defaultValue | ||
97 | - : v2.predicate.operation == 'ENDS_WITH' | ||
98 | - ? v2.key.key + '结束于' + v2.predicate.value.defaultValue | ||
99 | - : v2.predicate.operation == 'NOT_CONTAINS' | ||
100 | - ? v2.key.key + '不包含' + v2.predicate.value.defaultValue | ||
101 | - : v2.predicate.operation == 'NOT_EQUAL' | ||
102 | - ? v2.key.key + '不等于' + v2.predicate.value.defaultValue | ||
103 | - : v2.predicate.operation == 'GREATER' | ||
104 | - ? v2.key.key + '大于' + v2.predicate.value.defaultValue | ||
105 | - : v2.predicate.operation == 'LESS' | ||
106 | - ? v2.key.key + '小于' + v2.predicate.value.defaultValue | ||
107 | - : v2.predicate.operation == 'GREATER_OR_EQUAL' | ||
108 | - ? v2.key.key + '大于或等于' + v2.predicate.value.defaultValue | ||
109 | - : v2.key.key + '小于或等于' + v2.predicate.value.defaultValue | ||
110 | - }}</p | 92 | + >报警规则条件:{{ formatAddRuleFunc(v2) }}</p |
111 | > | 93 | > |
112 | <p v-if="index2 == createIndex && getStepThreeEditStatus" | 94 | <p v-if="index2 == createIndex && getStepThreeEditStatus" |
113 | >报警规则条件:{{ openRuleConditionComp(v2) }}</p | 95 | >报警规则条件:{{ openRuleConditionComp(v2) }}</p |
@@ -462,9 +444,7 @@ | @@ -462,9 +444,7 @@ | ||
462 | schedule: {}, | 444 | schedule: {}, |
463 | }); | 445 | }); |
464 | let kongRuleConditionObj = reactive({ | 446 | let kongRuleConditionObj = reactive({ |
465 | - condition: { | ||
466 | - condition: {}, | ||
467 | - }, | 447 | + condition: {}, |
468 | }); | 448 | }); |
469 | let fliterTempRuleConditionTempArr = ref<[]>([]); | 449 | let fliterTempRuleConditionTempArr = ref<[]>([]); |
470 | let fliterTempOpenRuleTempArr = ref<[]>([]); | 450 | let fliterTempOpenRuleTempArr = ref<[]>([]); |
@@ -829,7 +809,10 @@ | @@ -829,7 +809,10 @@ | ||
829 | addNewOpenRule.schedule = enableObj.value as never; | 809 | addNewOpenRule.schedule = enableObj.value as never; |
830 | addNewRuleTem.condition.condition = ruleObj.value as never; | 810 | addNewRuleTem.condition.condition = ruleObj.value as never; |
831 | tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never); | 811 | tempOpenRuleTempArr.value.push(addNewOpenRule.schedule as never); |
832 | - tempRuleConditionTempArr.value.push(addNewRuleTem.condition.condition as never); | 812 | + tempRuleConditionTempArr.value.push({ |
813 | + condition: addNewRuleTem.condition.condition, | ||
814 | + }); | ||
815 | + console.log(tempRuleConditionTempArr.value); | ||
833 | }; | 816 | }; |
834 | 817 | ||
835 | const getClearOpenRuleAndRuleCondition = () => { | 818 | const getClearOpenRuleAndRuleCondition = () => { |
@@ -867,7 +850,7 @@ | @@ -867,7 +850,7 @@ | ||
867 | }); | 850 | }); |
868 | 851 | ||
869 | tempRuleConditionTempArr.value.forEach((f3) => { | 852 | tempRuleConditionTempArr.value.forEach((f3) => { |
870 | - kongRuleConditionObj.condition.condition = f3; | 853 | + kongRuleConditionObj.condition = f3; |
871 | }); | 854 | }); |
872 | 855 | ||
873 | createRulesObj.value[addChangeSeverity.value?.default] = { | 856 | createRulesObj.value[addChangeSeverity.value?.default] = { |
@@ -920,11 +903,44 @@ | @@ -920,11 +903,44 @@ | ||
920 | //规则条件 | 903 | //规则条件 |
921 | const getAllFieldsRuleFunc = (v) => { | 904 | const getAllFieldsRuleFunc = (v) => { |
922 | ruleObj.value = v; | 905 | ruleObj.value = v; |
923 | - let splitRuleObj = {}; | ||
924 | - ruleObj.value.forEach((f) => { | ||
925 | - splitRuleObj = f; | 906 | + // let splitRuleObj = {}; |
907 | + // ruleObj.value.forEach((f) => { | ||
908 | + // splitRuleObj = f; | ||
909 | + // }); | ||
910 | + // fliterTempRuleConditionTempArr.value.push(splitRuleObj as never); | ||
911 | + // fliterTempRuleConditionTempArr.value = ruleObj.value; | ||
912 | + addNewRuleTem.condition.condition = ruleObj.value as never; | ||
913 | + fliterTempRuleConditionTempArr.value.push({ | ||
914 | + condition: addNewRuleTem.condition.condition, | ||
915 | + }); | ||
916 | + console.log(fliterTempRuleConditionTempArr.value); | ||
917 | + }; | ||
918 | + //格式化新增 | ||
919 | + const formatAddRuleFunc = (v) => { | ||
920 | + console.log(v.condition); | ||
921 | + let kongFormatObj = {}; | ||
922 | + v.condition.forEach((f) => { | ||
923 | + kongFormatObj = | ||
924 | + f.predicate.operation == 'EQUAL' | ||
925 | + ? f.key.key + '等于' + f.predicate.value.defaultValue | ||
926 | + : f.predicate.operation == 'STARTS_WITH' | ||
927 | + ? f.key.key + '开始于' + f.predicate.value.defaultValue | ||
928 | + : f.predicate.operation == 'ENDS_WITH' | ||
929 | + ? f.key.key + '结束于' + f.predicate.value.defaultValue | ||
930 | + : f.predicate.operation == 'NOT_CONTAINS' | ||
931 | + ? f.key.key + '不包含' + f.predicate.value.defaultValue | ||
932 | + : f.predicate.operation == 'NOT_EQUAL' | ||
933 | + ? f.key.key + '不等于' + f.predicate.value.defaultValue | ||
934 | + : f.predicate.operation == 'GREATER' | ||
935 | + ? f.key.key + '大于' + f.predicate.value.defaultValue | ||
936 | + : f.predicate.operation == 'LESS' | ||
937 | + ? f.key.key + '小于' + f.predicate.value.defaultValue | ||
938 | + : f.predicate.operation == 'GREATER_OR_EQUAL' | ||
939 | + ? f.key.key + '大于或等于' + f.predicate.value.defaultValue | ||
940 | + : f.key.key + '小于或等于' + f.predicate.value.defaultValue; | ||
926 | }); | 941 | }); |
927 | - fliterTempRuleConditionTempArr.value.push(splitRuleObj as never); | 942 | + console.log(kongFormatObj); |
943 | + return kongFormatObj; | ||
928 | }; | 944 | }; |
929 | //清除报警规则 | 945 | //清除报警规则 |
930 | //启用规则 | 946 | //启用规则 |
@@ -1057,6 +1073,7 @@ | @@ -1057,6 +1073,7 @@ | ||
1057 | }; | 1073 | }; |
1058 | 1074 | ||
1059 | return { | 1075 | return { |
1076 | + formatAddRuleFunc, | ||
1060 | getFilterStepThreeClearDetailEditArr, | 1077 | getFilterStepThreeClearDetailEditArr, |
1061 | getIsShowAddRule, | 1078 | getIsShowAddRule, |
1062 | openRuleConditionComp, | 1079 | openRuleConditionComp, |
@@ -14,13 +14,13 @@ import { copyTransFun } from '/@/utils/fnUtils'; | @@ -14,13 +14,13 @@ import { copyTransFun } from '/@/utils/fnUtils'; | ||
14 | */ | 14 | */ |
15 | 15 | ||
16 | export enum TriggerEnum { | 16 | export enum TriggerEnum { |
17 | - IS_DEVICE_ACT = 'DEVICE_ACT', | ||
18 | - IS_TIME_ACT = 'TIME_ACT', | ||
19 | - IS_SCENE_ACT = 'SCENE_ACT', | 17 | + IS_DEVICE_ACT = 'DEVICE_TRIGGER', |
18 | + IS_TIME_ACT = 'SCHEDULE_TRIGGER', | ||
19 | + IS_SCENE_ACT = 'SCENE_TRIGGER', | ||
20 | IS_HAND_ACT = 'HAND_ACT', | 20 | IS_HAND_ACT = 'HAND_ACT', |
21 | IS_MSG_NOTIFY = 'MSG_NOTIFY', | 21 | IS_MSG_NOTIFY = 'MSG_NOTIFY', |
22 | IS_DEVICE_STATUS = 'DEVICE_STATUS', | 22 | IS_DEVICE_STATUS = 'DEVICE_STATUS', |
23 | - IS_TIME_ALL = 'TIME_ALL', | 23 | + IS_TIME_ALL = 'SCHEDULE_TRIGGER', |
24 | } | 24 | } |
25 | 25 | ||
26 | export enum AttributeActionEnum { | 26 | export enum AttributeActionEnum { |
@@ -37,6 +37,7 @@ export enum AttrAndWenDuEnum { | @@ -37,6 +37,7 @@ export enum AttrAndWenDuEnum { | ||
37 | export const isShiDu = (type: string) => { | 37 | export const isShiDu = (type: string) => { |
38 | return type === AttrAndWenDuEnum.IS_SHIDU; | 38 | return type === AttrAndWenDuEnum.IS_SHIDU; |
39 | }; | 39 | }; |
40 | + | ||
40 | export const isWenDu = (type: string) => { | 41 | export const isWenDu = (type: string) => { |
41 | return type === AttrAndWenDuEnum.IS_WENDU_ACT; | 42 | return type === AttrAndWenDuEnum.IS_WENDU_ACT; |
42 | }; | 43 | }; |
@@ -77,13 +78,13 @@ export const columns: BasicColumn[] = [ | @@ -77,13 +78,13 @@ export const columns: BasicColumn[] = [ | ||
77 | }, | 78 | }, |
78 | { | 79 | { |
79 | title: '触发方式', | 80 | title: '触发方式', |
80 | - dataIndex: 'triggerEvent', | 81 | + dataIndex: 'triggerType', |
81 | format: (text: string, record: Recordable) => { | 82 | format: (text: string, record: Recordable) => { |
82 | - return record.triggers[0]?.triggerEvent == 'DEVICE_ACT' | 83 | + return record.triggers[0]?.triggerType == 'DEVICE_TRIGGER' |
83 | ? '设备触发' | 84 | ? '设备触发' |
84 | - : record.triggers[0]?.triggerEvent == 'TIME_ACT' | 85 | + : record.triggers[0]?.triggerType == 'SCHEDULE_TRIGGER' |
85 | ? '定时触发' | 86 | ? '定时触发' |
86 | - : record.triggers[0]?.triggerEvent == 'SCENE_ACT' | 87 | + : record.triggers[0]?.triggerType == 'SCENE_TRIGGER' |
87 | ? '场景触发' | 88 | ? '场景触发' |
88 | : '手动触发'; | 89 | : '手动触发'; |
89 | }, | 90 | }, |
@@ -190,19 +191,6 @@ export const formSchema: FormSchema[] = [ | @@ -190,19 +191,6 @@ export const formSchema: FormSchema[] = [ | ||
190 | maxLength: 255, | 191 | maxLength: 255, |
191 | placeholder: '请输入描述', | 192 | placeholder: '请输入描述', |
192 | }, | 193 | }, |
193 | - dynamicRules: () => { | ||
194 | - return [ | ||
195 | - { | ||
196 | - required: false, | ||
197 | - validator: (_, value) => { | ||
198 | - if (String(value).length > 255) { | ||
199 | - return Promise.reject('字数不超过255个字'); | ||
200 | - } | ||
201 | - return Promise.resolve(); | ||
202 | - }, | ||
203 | - }, | ||
204 | - ]; | ||
205 | - }, | ||
206 | }, | 194 | }, |
207 | ]; | 195 | ]; |
208 | 196 | ||
@@ -229,19 +217,6 @@ export const searchFormSchema: FormSchema[] = [ | @@ -229,19 +217,6 @@ export const searchFormSchema: FormSchema[] = [ | ||
229 | maxLength: 36, | 217 | maxLength: 36, |
230 | placeholder: '请输入名称', | 218 | placeholder: '请输入名称', |
231 | }, | 219 | }, |
232 | - dynamicRules: () => { | ||
233 | - return [ | ||
234 | - { | ||
235 | - required: false, | ||
236 | - validator: (_, value) => { | ||
237 | - if (String(value).length > 36) { | ||
238 | - return Promise.reject('字数不超过36个字'); | ||
239 | - } | ||
240 | - return Promise.resolve(); | ||
241 | - }, | ||
242 | - }, | ||
243 | - ]; | ||
244 | - }, | ||
245 | }, | 220 | }, |
246 | { | 221 | { |
247 | field: 'status', | 222 | field: 'status', |
@@ -260,15 +235,15 @@ export const searchFormSchema: FormSchema[] = [ | @@ -260,15 +235,15 @@ export const searchFormSchema: FormSchema[] = [ | ||
260 | 235 | ||
261 | export const useTriggerDrawerSchema: FormSchema[] = [ | 236 | export const useTriggerDrawerSchema: FormSchema[] = [ |
262 | { | 237 | { |
263 | - field: 'triggerEvent', | 238 | + field: 'triggerType', |
264 | label: '', | 239 | label: '', |
265 | component: 'Select', | 240 | component: 'Select', |
266 | componentProps: { | 241 | componentProps: { |
267 | placeholder: '设备触发', | 242 | placeholder: '设备触发', |
268 | options: [ | 243 | options: [ |
269 | - { label: '设备触发', value: 'DEVICE_ACT' }, | ||
270 | - { label: '定时触发', value: 'TIME_ACT' }, | ||
271 | - { label: '场景触发', value: 'SCENE_ACT' }, | 244 | + { label: '设备触发', value: 'DEVICE_TRIGGER' }, |
245 | + { label: '定时触发', value: 'SCHEDULE_TRIGGER' }, | ||
246 | + { label: '场景触发', value: 'SCENE_TRIGGER' }, | ||
272 | { label: '手动触发', value: 'HAND_ACT' }, | 247 | { label: '手动触发', value: 'HAND_ACT' }, |
273 | ], | 248 | ], |
274 | }, | 249 | }, |
@@ -282,9 +257,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -282,9 +257,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
282 | placeholder: '请选择设备', | 257 | placeholder: '请选择设备', |
283 | }, | 258 | }, |
284 | ifShow: ({ values }) => | 259 | ifShow: ({ values }) => |
285 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
286 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
287 | - !isHand(Reflect.get(values, 'triggerEvent')), | 260 | + !isTime(Reflect.get(values, 'triggerType')) && |
261 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
262 | + !isHand(Reflect.get(values, 'triggerType')), | ||
288 | colProps: { | 263 | colProps: { |
289 | span: 12, | 264 | span: 12, |
290 | }, | 265 | }, |
@@ -300,7 +275,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -300,7 +275,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
300 | colProps: { | 275 | colProps: { |
301 | span: 12, | 276 | span: 12, |
302 | }, | 277 | }, |
303 | - ifShow: ({ values }) => isTime(Reflect.get(values, 'triggerEvent')), | 278 | + ifShow: ({ values }) => isTime(Reflect.get(values, 'triggerType')), |
304 | }, | 279 | }, |
305 | { | 280 | { |
306 | field: 'touchWay', | 281 | field: 'touchWay', |
@@ -314,9 +289,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -314,9 +289,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
314 | ], | 289 | ], |
315 | }, | 290 | }, |
316 | ifShow: ({ values }) => | 291 | ifShow: ({ values }) => |
317 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
318 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
319 | - !isHand(Reflect.get(values, 'triggerEvent')), | 292 | + !isTime(Reflect.get(values, 'triggerType')) && |
293 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
294 | + !isHand(Reflect.get(values, 'triggerType')), | ||
320 | colProps: { span: 12 }, | 295 | colProps: { span: 12 }, |
321 | }, | 296 | }, |
322 | { | 297 | { |
@@ -334,9 +309,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -334,9 +309,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
334 | colProps: { span: 12 }, | 309 | colProps: { span: 12 }, |
335 | ifShow: ({ values }) => | 310 | ifShow: ({ values }) => |
336 | isUpAndDown(Reflect.get(values, 'touchWay')) && | 311 | isUpAndDown(Reflect.get(values, 'touchWay')) && |
337 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
338 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
339 | - !isHand(Reflect.get(values, 'triggerEvent')), | 312 | + !isTime(Reflect.get(values, 'triggerType')) && |
313 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
314 | + !isHand(Reflect.get(values, 'triggerType')), | ||
340 | }, | 315 | }, |
341 | { | 316 | { |
342 | field: 'attributeChoose', | 317 | field: 'attributeChoose', |
@@ -350,9 +325,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -350,9 +325,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
350 | ], | 325 | ], |
351 | }, | 326 | }, |
352 | ifShow: ({ values }) => | 327 | ifShow: ({ values }) => |
353 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
354 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
355 | - !isHand(Reflect.get(values, 'triggerEvent')) && | 328 | + !isTime(Reflect.get(values, 'triggerType')) && |
329 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
330 | + !isHand(Reflect.get(values, 'triggerType')) && | ||
356 | !isUpAndDown(Reflect.get(values, 'touchWay')), | 331 | !isUpAndDown(Reflect.get(values, 'touchWay')), |
357 | colProps: { span: 12 }, | 332 | colProps: { span: 12 }, |
358 | }, | 333 | }, |
@@ -373,9 +348,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -373,9 +348,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
373 | ifShow: ({ values }) => | 348 | ifShow: ({ values }) => |
374 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 349 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
375 | !isUpAndDown(Reflect.get(values, 'touchWay')) && | 350 | !isUpAndDown(Reflect.get(values, 'touchWay')) && |
376 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
377 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
378 | - !isHand(Reflect.get(values, 'triggerEvent')), | 351 | + !isTime(Reflect.get(values, 'triggerType')) && |
352 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
353 | + !isHand(Reflect.get(values, 'triggerType')), | ||
379 | colProps: { span: 12 }, | 354 | colProps: { span: 12 }, |
380 | }, | 355 | }, |
381 | { | 356 | { |
@@ -390,9 +365,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -390,9 +365,9 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
390 | ifShow: ({ values }) => | 365 | ifShow: ({ values }) => |
391 | isWenDu(Reflect.get(values, 'attributeChoose')) && | 366 | isWenDu(Reflect.get(values, 'attributeChoose')) && |
392 | !isUpAndDown(Reflect.get(values, 'touchWay')) && | 367 | !isUpAndDown(Reflect.get(values, 'touchWay')) && |
393 | - !isTime(Reflect.get(values, 'triggerEvent')) && | ||
394 | - !isScene(Reflect.get(values, 'triggerEvent')) && | ||
395 | - !isHand(Reflect.get(values, 'triggerEvent')), | 368 | + !isTime(Reflect.get(values, 'triggerType')) && |
369 | + !isScene(Reflect.get(values, 'triggerType')) && | ||
370 | + !isHand(Reflect.get(values, 'triggerType')), | ||
396 | colProps: { | 371 | colProps: { |
397 | span: 12, | 372 | span: 12, |
398 | }, | 373 | }, |
@@ -413,7 +388,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -413,7 +388,7 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
413 | { label: '场景触发器3', value: '3' }, | 388 | { label: '场景触发器3', value: '3' }, |
414 | ], | 389 | ], |
415 | }, | 390 | }, |
416 | - ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerEvent')), | 391 | + ifShow: ({ values }) => isScene(Reflect.get(values, 'triggerType')), |
417 | }, | 392 | }, |
418 | 393 | ||
419 | { | 394 | { |
@@ -426,29 +401,20 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | @@ -426,29 +401,20 @@ export const useTriggerDrawerSchema: FormSchema[] = [ | ||
426 | componentProps: { | 401 | componentProps: { |
427 | placeholder: '暂不实现', | 402 | placeholder: '暂不实现', |
428 | }, | 403 | }, |
429 | - ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerEvent')), | ||
430 | - }, | ||
431 | - { | ||
432 | - field: '0', | ||
433 | - component: 'Input', | ||
434 | - label: ' ', | ||
435 | - colProps: { | ||
436 | - span: 12, | ||
437 | - }, | ||
438 | - slot: 'add', | 404 | + ifShow: ({ values }) => isHand(Reflect.get(values, 'triggerType')), |
439 | }, | 405 | }, |
440 | ]; | 406 | ]; |
441 | 407 | ||
442 | export const useConditionDrawerSchema: FormSchema[] = [ | 408 | export const useConditionDrawerSchema: FormSchema[] = [ |
443 | { | 409 | { |
444 | - field: 'status', | 410 | + field: 'triggerType', |
445 | label: '', | 411 | label: '', |
446 | component: 'Select', | 412 | component: 'Select', |
447 | componentProps: { | 413 | componentProps: { |
448 | placeholder: '设备状态', | 414 | placeholder: '设备状态', |
449 | options: [ | 415 | options: [ |
450 | - { label: '设备触发', value: 'DEVICE_STATUS' }, | ||
451 | - { label: '时间范围', value: 'TIME_ALL' }, | 416 | + { label: '设备触发', value: 'DEVICE_TRIGGER' }, |
417 | + { label: '时间范围', value: 'SCHEDULE_TRIGGER' }, | ||
452 | ], | 418 | ], |
453 | }, | 419 | }, |
454 | colProps: { span: 12 }, | 420 | colProps: { span: 12 }, |
@@ -460,7 +426,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -460,7 +426,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
460 | componentProps: { | 426 | componentProps: { |
461 | placeholder: '请选择设备', | 427 | placeholder: '请选择设备', |
462 | }, | 428 | }, |
463 | - ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | 429 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
464 | colProps: { | 430 | colProps: { |
465 | span: 12, | 431 | span: 12, |
466 | }, | 432 | }, |
@@ -475,7 +441,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -475,7 +441,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
475 | colProps: { | 441 | colProps: { |
476 | span: 12, | 442 | span: 12, |
477 | }, | 443 | }, |
478 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | 444 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), |
479 | }, | 445 | }, |
480 | { | 446 | { |
481 | field: 'updateTime', | 447 | field: 'updateTime', |
@@ -487,7 +453,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -487,7 +453,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
487 | colProps: { | 453 | colProps: { |
488 | span: 12, | 454 | span: 12, |
489 | }, | 455 | }, |
490 | - ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'status')), | 456 | + ifShow: ({ values }) => isTimeAll(Reflect.get(values, 'triggerType')), |
491 | }, | 457 | }, |
492 | { | 458 | { |
493 | field: 'property', | 459 | field: 'property', |
@@ -500,19 +466,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -500,19 +466,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
500 | { label: 'wendu', value: 'WENDU' }, | 466 | { label: 'wendu', value: 'WENDU' }, |
501 | ], | 467 | ], |
502 | }, | 468 | }, |
503 | - ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'status')), | ||
504 | - colProps: { span: 12 }, | ||
505 | - }, | ||
506 | - { | ||
507 | - field: 'wu', | ||
508 | - label: '', | ||
509 | - component: 'Input', | ||
510 | - componentProps: { | ||
511 | - placeholder: '无', | ||
512 | - style: { | ||
513 | - visibility: 'hidden', | ||
514 | - }, | ||
515 | - }, | 469 | + ifShow: ({ values }) => !isTimeAll(Reflect.get(values, 'triggerType')), |
516 | colProps: { span: 12 }, | 470 | colProps: { span: 12 }, |
517 | }, | 471 | }, |
518 | { | 472 | { |
@@ -530,7 +484,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -530,7 +484,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
530 | ], | 484 | ], |
531 | }, | 485 | }, |
532 | ifShow: ({ values }) => | 486 | ifShow: ({ values }) => |
533 | - isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 487 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
534 | colProps: { span: 12 }, | 488 | colProps: { span: 12 }, |
535 | }, | 489 | }, |
536 | { | 490 | { |
@@ -543,7 +497,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -543,7 +497,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
543 | }, | 497 | }, |
544 | 498 | ||
545 | ifShow: ({ values }) => | 499 | ifShow: ({ values }) => |
546 | - isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 500 | + isShiDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
547 | colProps: { | 501 | colProps: { |
548 | span: 12, | 502 | span: 12, |
549 | }, | 503 | }, |
@@ -564,7 +518,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -564,7 +518,7 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
564 | ], | 518 | ], |
565 | }, | 519 | }, |
566 | ifShow: ({ values }) => | 520 | ifShow: ({ values }) => |
567 | - isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 521 | + isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
568 | colProps: { span: 12 }, | 522 | colProps: { span: 12 }, |
569 | }, | 523 | }, |
570 | { | 524 | { |
@@ -576,20 +530,11 @@ export const useConditionDrawerSchema: FormSchema[] = [ | @@ -576,20 +530,11 @@ export const useConditionDrawerSchema: FormSchema[] = [ | ||
576 | placeholder: '请输入比较值', | 530 | placeholder: '请输入比较值', |
577 | }, | 531 | }, |
578 | ifShow: ({ values }) => | 532 | ifShow: ({ values }) => |
579 | - isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'status')), | 533 | + isWenDu(Reflect.get(values, 'property')) && !isTimeAll(Reflect.get(values, 'triggerType')), |
580 | colProps: { | 534 | colProps: { |
581 | span: 12, | 535 | span: 12, |
582 | }, | 536 | }, |
583 | }, | 537 | }, |
584 | - { | ||
585 | - field: '0', | ||
586 | - component: 'Input', | ||
587 | - label: ' ', | ||
588 | - colProps: { | ||
589 | - span: 12, | ||
590 | - }, | ||
591 | - slot: 'add', | ||
592 | - }, | ||
593 | ]; | 538 | ]; |
594 | 539 | ||
595 | export const useActionDrawerSchema: FormSchema[] = [ | 540 | export const useActionDrawerSchema: FormSchema[] = [ |
@@ -602,7 +547,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -602,7 +547,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
602 | options: [ | 547 | options: [ |
603 | { label: '设备输出', value: 'DEVICE_OUT' }, | 548 | { label: '设备输出', value: 'DEVICE_OUT' }, |
604 | { label: '消息通知', value: 'MSG_NOTIFY' }, | 549 | { label: '消息通知', value: 'MSG_NOTIFY' }, |
605 | - { label: '场景联动', value: 'SCENE_ACT' }, | 550 | + { label: '场景联动', value: 'SCENE_TRIGGER' }, |
606 | ], | 551 | ], |
607 | }, | 552 | }, |
608 | colProps: { span: 12 }, | 553 | colProps: { span: 12 }, |
@@ -621,7 +566,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -621,7 +566,7 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
621 | }, | 566 | }, |
622 | }, | 567 | }, |
623 | { | 568 | { |
624 | - field: 'command', | 569 | + field: 'doContext', |
625 | component: 'Input', | 570 | component: 'Input', |
626 | label: '', | 571 | label: '', |
627 | componentProps: { | 572 | componentProps: { |
@@ -635,18 +580,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -635,18 +580,6 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
635 | }, | 580 | }, |
636 | }, | 581 | }, |
637 | { | 582 | { |
638 | - field: 'wu1', | ||
639 | - label: '', | ||
640 | - component: 'Input', | ||
641 | - componentProps: { | ||
642 | - placeholder: '无', | ||
643 | - style: { | ||
644 | - visibility: 'hidden', | ||
645 | - }, | ||
646 | - }, | ||
647 | - colProps: { span: 12 }, | ||
648 | - }, | ||
649 | - { | ||
650 | field: 'wu2', | 583 | field: 'wu2', |
651 | component: 'Input', | 584 | component: 'Input', |
652 | label: '', | 585 | label: '', |
@@ -702,13 +635,4 @@ export const useActionDrawerSchema: FormSchema[] = [ | @@ -702,13 +635,4 @@ export const useActionDrawerSchema: FormSchema[] = [ | ||
702 | colProps: { span: 12 }, | 635 | colProps: { span: 12 }, |
703 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), | 636 | ifShow: ({ values }) => isScene(Reflect.get(values, 'outTarget')), |
704 | }, | 637 | }, |
705 | - { | ||
706 | - field: '0', | ||
707 | - component: 'Input', | ||
708 | - label: ' ', | ||
709 | - colProps: { | ||
710 | - span: 12, | ||
711 | - }, | ||
712 | - slot: 'add', | ||
713 | - }, | ||
714 | ]; | 638 | ]; |
1 | export interface IAddTrigger { | 1 | export interface IAddTrigger { |
2 | - id: string; | ||
3 | - triggerEvent: string; | 2 | + triggerType: string; |
4 | deviceId: string; | 3 | deviceId: string; |
5 | touchWay: string; | 4 | touchWay: string; |
6 | attributeChoose: string; | 5 | attributeChoose: string; |
@@ -9,18 +8,15 @@ export interface IAddTrigger { | @@ -9,18 +8,15 @@ export interface IAddTrigger { | ||
9 | } | 8 | } |
10 | 9 | ||
11 | export interface IAddCondition { | 10 | export interface IAddCondition { |
12 | - id: string; | ||
13 | - status: string; | 11 | + triggerType: string; |
14 | deviceId: string; | 12 | deviceId: string; |
15 | createTime: string; | 13 | createTime: string; |
16 | updateTime: string; | 14 | updateTime: string; |
17 | - property: string; | ||
18 | compare: string; | 15 | compare: string; |
19 | value: string; | 16 | value: string; |
20 | } | 17 | } |
21 | 18 | ||
22 | export interface IAddAction { | 19 | export interface IAddAction { |
23 | - id: string; | ||
24 | outTarget: string; | 20 | outTarget: string; |
25 | deviceId: string; | 21 | deviceId: string; |
26 | command: string; | 22 | command: string; |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | :title="getTitle" | 6 | :title="getTitle" |
7 | width="1000px" | 7 | width="1000px" |
8 | @ok="handleSubmit" | 8 | @ok="handleSubmit" |
9 | + @close="handleClose" | ||
9 | > | 10 | > |
10 | <div> | 11 | <div> |
11 | <BasicForm @register="registerForm" /> | 12 | <BasicForm @register="registerForm" /> |
@@ -56,7 +57,7 @@ | @@ -56,7 +57,7 @@ | ||
56 | </div> | 57 | </div> |
57 | <div style="height: 5vh"></div> | 58 | <div style="height: 5vh"></div> |
58 | <!-- 执行条件 --> | 59 | <!-- 执行条件 --> |
59 | - <div> | 60 | + <div class="condition-style"> |
60 | <template | 61 | <template |
61 | v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData" | 62 | v-for="(item, index) in isUpdate == false ? addConditionPushData : editConditionPushData" |
62 | :key="index" | 63 | :key="index" |
@@ -195,8 +196,7 @@ | @@ -195,8 +196,7 @@ | ||
195 | const refConditionChildData: any = ref({}); | 196 | const refConditionChildData: any = ref({}); |
196 | const refActionChildData: any = ref({}); | 197 | const refActionChildData: any = ref({}); |
197 | const addTriggerData = reactive<IAddTrigger>({ | 198 | const addTriggerData = reactive<IAddTrigger>({ |
198 | - id: Date.now() + Math.random() + '', | ||
199 | - triggerEvent: '', | 199 | + triggerType: '', |
200 | deviceId: '', | 200 | deviceId: '', |
201 | touchWay: '', | 201 | touchWay: '', |
202 | attributeChoose: '', | 202 | attributeChoose: '', |
@@ -204,44 +204,37 @@ | @@ -204,44 +204,37 @@ | ||
204 | value: '', | 204 | value: '', |
205 | }); | 205 | }); |
206 | const editTriggerData = reactive<IAddTrigger>({ | 206 | const editTriggerData = reactive<IAddTrigger>({ |
207 | - id: Date.now() + Math.random() + '', | ||
208 | - triggerEvent: '请选择设备触发', | 207 | + triggerType: '', |
209 | deviceId: '请选择设备', | 208 | deviceId: '请选择设备', |
210 | - touchWay: '请选择出发方式', | 209 | + touchWay: '请选择触发方式', |
211 | attributeChoose: '请选择属性', | 210 | attributeChoose: '请选择属性', |
212 | compare: '', | 211 | compare: '', |
213 | value: '', | 212 | value: '', |
214 | }); | 213 | }); |
215 | const addConditionData = reactive<IAddCondition>({ | 214 | const addConditionData = reactive<IAddCondition>({ |
216 | - id: Date.now() + Math.random() + '', | ||
217 | - status: '', | 215 | + triggerType: '', |
218 | deviceId: '', | 216 | deviceId: '', |
219 | createTime: '', | 217 | createTime: '', |
220 | updateTime: '', | 218 | updateTime: '', |
221 | - property: '', | ||
222 | compare: '', | 219 | compare: '', |
223 | value: '', | 220 | value: '', |
224 | }); | 221 | }); |
225 | const editConditionData = reactive<IAddCondition>({ | 222 | const editConditionData = reactive<IAddCondition>({ |
226 | - id: Date.now() + Math.random() + '', | ||
227 | - status: '', | ||
228 | - deviceId: '', | 223 | + deviceId: '请选择设备', |
229 | createTime: '', | 224 | createTime: '', |
230 | updateTime: '', | 225 | updateTime: '', |
231 | - property: '请选择', | 226 | + triggerType: '', |
232 | compare: '', | 227 | compare: '', |
233 | value: '', | 228 | value: '', |
234 | }); | 229 | }); |
235 | const addActionData = reactive<IAddAction>({ | 230 | const addActionData = reactive<IAddAction>({ |
236 | - id: Date.now() + Math.random() + '', | ||
237 | outTarget: '', | 231 | outTarget: '', |
238 | deviceId: '', | 232 | deviceId: '', |
239 | command: '', | 233 | command: '', |
240 | sceneLinkageId: '', | 234 | sceneLinkageId: '', |
241 | }); | 235 | }); |
242 | const editActionData = reactive<IAddAction>({ | 236 | const editActionData = reactive<IAddAction>({ |
243 | - id: Date.now() + Math.random() + '', | ||
244 | - outTarget: '请选择触发方式', | 237 | + outTarget: '', |
245 | deviceId: '请选择设备', | 238 | deviceId: '请选择设备', |
246 | command: '请输入执行命令', | 239 | command: '请输入执行命令', |
247 | sceneLinkageId: '', | 240 | sceneLinkageId: '', |
@@ -260,7 +253,7 @@ | @@ -260,7 +253,7 @@ | ||
260 | const getConditionChildData = ref(null); | 253 | const getConditionChildData = ref(null); |
261 | const { createMessage } = useMessage(); | 254 | const { createMessage } = useMessage(); |
262 | const isUpdate = ref(true); | 255 | const isUpdate = ref(true); |
263 | - const getAllFormData: any = reactive({}); | 256 | + let getAllFormData: any = reactive({}); |
264 | let getValuesFormData: any = reactive({}); | 257 | let getValuesFormData: any = reactive({}); |
265 | const getId = ref(''); | 258 | const getId = ref(''); |
266 | const getTenantId = ref(''); | 259 | const getTenantId = ref(''); |
@@ -270,18 +263,25 @@ | @@ -270,18 +263,25 @@ | ||
270 | const newFilterMap = ref<[]>([]); | 263 | const newFilterMap = ref<[]>([]); |
271 | const newConditionFilterMap = ref<[]>([]); | 264 | const newConditionFilterMap = ref<[]>([]); |
272 | const newActionFilterMap = ref<[]>([]); | 265 | const newActionFilterMap = ref<[]>([]); |
273 | - const filterNewTriggerArr = ref<[]>([]); | ||
274 | - const filterNewConditionArr = ref<[]>([]); | ||
275 | - const filterNewActionArr = ref<[]>([]); | ||
276 | - const pushEditArray = ref<[]>([]); | ||
277 | - const pushEditConditionArray = ref<[]>([]); | ||
278 | - const pushEditActionArray = ref<[]>([]); | ||
279 | - const filterArrayTrigger = ref<[]>([]); | 266 | + let filterNewConditionArr = []; |
267 | + let filterNewActionArr = []; | ||
268 | + const pushEditArray = []; | ||
269 | + const pushEditConditionArray = []; | ||
270 | + const pushEditActionArray = []; | ||
271 | + let filterArrayTrigger = []; | ||
280 | const filterArrayCondition = ref<[]>([]); | 272 | const filterArrayCondition = ref<[]>([]); |
281 | const filterArrayAction = ref<[]>([]); | 273 | const filterArrayAction = ref<[]>([]); |
282 | - const filterArrayTriggerObj = ref({}); | ||
283 | - const filterArrayConditionObj = ref({}); | ||
284 | - const filterArrayActionObj = ref({}); | 274 | + let filterNewTriggerArr = []; |
275 | + | ||
276 | + let triggersObj = { | ||
277 | + triggers: [], | ||
278 | + }; | ||
279 | + let conditionsObj = { | ||
280 | + doConditions: [], | ||
281 | + }; | ||
282 | + let actionsObj = { | ||
283 | + doActions: [], | ||
284 | + }; | ||
285 | 285 | ||
286 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ | 286 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ |
287 | labelWidth: 120, | 287 | labelWidth: 120, |
@@ -295,16 +295,24 @@ | @@ -295,16 +295,24 @@ | ||
295 | isUpdate.value = !!data?.isUpdate; | 295 | isUpdate.value = !!data?.isUpdate; |
296 | if (!unref(isUpdate)) { | 296 | if (!unref(isUpdate)) { |
297 | try { | 297 | try { |
298 | - proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
299 | - proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
300 | - proxy.$refs.refActionChild.resetFieldsValueFunc(); | 298 | + triggersObj = { |
299 | + triggers: [], | ||
300 | + }; | ||
301 | + filterNewTriggerArr.length = 0; | ||
302 | + filterNewConditionArr.length = 0; | ||
301 | lastRefTriggerChildDataArray.value.length = 0; | 303 | lastRefTriggerChildDataArray.value.length = 0; |
302 | lastRefConditionChildDataArray.value.length = 0; | 304 | lastRefConditionChildDataArray.value.length = 0; |
303 | lastRefActionChildDataArray.value.length = 0; | 305 | lastRefActionChildDataArray.value.length = 0; |
304 | editTriggerPushData.value.length = 0; | 306 | editTriggerPushData.value.length = 0; |
307 | + editConditionPushData.value.length = 0; | ||
308 | + editActionPushData.value.length = 0; | ||
305 | addTriggerPushData.value.length = 0; | 309 | addTriggerPushData.value.length = 0; |
306 | addConditionPushData.value.length = 0; | 310 | addConditionPushData.value.length = 0; |
307 | addActionPushData.value.length = 0; | 311 | addActionPushData.value.length = 0; |
312 | + handleClose(); | ||
313 | + proxy.$refs.refTriggerChild.resetFieldsValueFunc(); | ||
314 | + proxy.$refs.refConditionChild.resetFieldsValueFunc(); | ||
315 | + proxy.$refs.refActionChild.resetFieldsValueFunc(); | ||
308 | } catch (e) { | 316 | } catch (e) { |
309 | return e; | 317 | return e; |
310 | } | 318 | } |
@@ -316,7 +324,9 @@ | @@ -316,7 +324,9 @@ | ||
316 | editTriggerPushData.value = []; | 324 | editTriggerPushData.value = []; |
317 | editTriggerPushData.value.length = 0; | 325 | editTriggerPushData.value.length = 0; |
318 | editConditionPushData.value = []; | 326 | editConditionPushData.value = []; |
327 | + editConditionPushData.value.length = 0; | ||
319 | editActionPushData.value = []; | 328 | editActionPushData.value = []; |
329 | + editActionPushData.value.length = 0; | ||
320 | lastEditRefTriggerChildDataArray.value = []; | 330 | lastEditRefTriggerChildDataArray.value = []; |
321 | getId.value = data.record.id; | 331 | getId.value = data.record.id; |
322 | getTenantId.value = data.record.tenantId; | 332 | getTenantId.value = data.record.tenantId; |
@@ -365,6 +375,16 @@ | @@ -365,6 +375,16 @@ | ||
365 | } | 375 | } |
366 | }); | 376 | }); |
367 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); | 377 | const getTitle = computed(() => (!unref(isUpdate) ? '新增场景联动' : '编辑场景联动')); |
378 | + const handleClose = () => { | ||
379 | + pushEditArray.length = 0; | ||
380 | + lastRefTriggerChildDataArray.value.length = 0; | ||
381 | + lastRefTriggerChildDataArray.value = []; | ||
382 | + lastRefConditionChildDataArray.value.length = 0; | ||
383 | + lastRefActionChildDataArray.value.length = 0; | ||
384 | + filterArrayTrigger.length = 0; | ||
385 | + filterArrayCondition.value.length = 0; | ||
386 | + filterArrayAction.value.length = 0; | ||
387 | + }; | ||
368 | 388 | ||
369 | const clearAllArrayFunc = () => { | 389 | const clearAllArrayFunc = () => { |
370 | unref(addTriggerPushData).length = 0; | 390 | unref(addTriggerPushData).length = 0; |
@@ -430,54 +450,81 @@ | @@ -430,54 +450,81 @@ | ||
430 | lastRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); | 450 | lastRefTriggerChildDataArray.value.push(refTriggerChildData.value as never); |
431 | lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); | 451 | lastRefConditionChildDataArray.value.push(refConditionChildData.value as never); |
432 | lastRefActionChildDataArray.value.push(refActionChildData.value as never); | 452 | lastRefActionChildDataArray.value.push(refActionChildData.value as never); |
433 | - const triggersObj = { | 453 | + triggersObj = { |
434 | triggers: lastRefTriggerChildDataArray.value, | 454 | triggers: lastRefTriggerChildDataArray.value, |
435 | }; | 455 | }; |
436 | - const conditionsObj = { | 456 | + conditionsObj = { |
437 | doConditions: lastRefConditionChildDataArray.value, | 457 | doConditions: lastRefConditionChildDataArray.value, |
438 | }; | 458 | }; |
439 | - const actionsObj = { | 459 | + actionsObj = { |
440 | doActions: lastRefActionChildDataArray.value, | 460 | doActions: lastRefActionChildDataArray.value, |
441 | }; | 461 | }; |
462 | + | ||
442 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 463 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); |
443 | } else { | 464 | } else { |
444 | refTriggerChildDataFunc(); | 465 | refTriggerChildDataFunc(); |
445 | refConditionChildDataFunc(); | 466 | refConditionChildDataFunc(); |
446 | refActionChildDataFunc(); | 467 | refActionChildDataFunc(); |
447 | - pushEditArray.value.push(refTriggerChildData.value as never); | ||
448 | - pushEditConditionArray.value.push(refConditionChildData.value as never); | ||
449 | - pushEditActionArray.value.push(refActionChildData.value as never); | ||
450 | - filterArrayTrigger.value = editTriggerPushData.value.filter( | ||
451 | - (f) => f?.triggerEvent !== '' | 468 | + pushEditArray.push(refTriggerChildData.value as never); |
469 | + pushEditConditionArray.push(refConditionChildData.value as never); | ||
470 | + pushEditActionArray.push(refActionChildData.value as never); | ||
471 | + pushEditArray.forEach((f) => { | ||
472 | + editTriggerPushData.value.push(f as never); | ||
473 | + }); | ||
474 | + pushEditConditionArray.forEach((f) => { | ||
475 | + editConditionPushData.value.push(f as never); | ||
476 | + }); | ||
477 | + pushEditActionArray.forEach((f) => { | ||
478 | + editActionPushData.value.push(f as never); | ||
479 | + }); | ||
480 | + const filterTwoArrayTrigger = editTriggerPushData.value.filter((f) => | ||
481 | + f?.hasOwnProperty('id') | ||
452 | ); | 482 | ); |
453 | - filterArrayCondition.value = editTriggerPushData.value.filter((f) => f?.property !== ''); | ||
454 | 483 | ||
455 | - filterArrayAction.value = editTriggerPushData.value.filter((f) => f?.outTarget !== ''); | 484 | + const filterTwoArrayCondition = editConditionPushData.value.filter((f) => |
485 | + f?.hasOwnProperty('id') | ||
486 | + ); | ||
487 | + | ||
488 | + const filterTwoArrayAction = editActionPushData.value.filter((f) => | ||
489 | + f?.hasOwnProperty('id') | ||
490 | + ); | ||
456 | 491 | ||
457 | - pushEditArray.value.forEach((f) => { | ||
458 | - filterArrayTriggerObj.value = f; | ||
459 | - filterArrayTrigger.value.push(filterArrayTriggerObj.value as never); | 492 | + const filterThreeArrayTrigger = editTriggerPushData.value.filter( |
493 | + (f) => f?.deviceId == '' | ||
494 | + ); | ||
495 | + const filterThreeArrayCondition = editConditionPushData.value.filter( | ||
496 | + (f) => f?.deviceId == '' | ||
497 | + ); | ||
498 | + const filterThreeArrayAction = editActionPushData.value.filter((f) => f?.deviceId == ''); | ||
499 | + const filterFourArrayTrigger = filterThreeArrayTrigger.filter( | ||
500 | + (f) => f?.triggerType !== '' | ||
501 | + ); | ||
502 | + const filterFourArrayCondition = filterThreeArrayCondition.filter( | ||
503 | + (f) => f?.triggerType !== '' | ||
504 | + ); | ||
505 | + | ||
506 | + const filterFourArrayAction = filterThreeArrayAction.filter((f) => f?.outTarget !== ''); | ||
507 | + | ||
508 | + filterFourArrayTrigger.forEach((f) => { | ||
509 | + filterTwoArrayTrigger.push(f); | ||
460 | }); | 510 | }); |
461 | - pushEditConditionArray.value.forEach((f) => { | ||
462 | - filterArrayConditionObj.value = f; | ||
463 | - filterArrayCondition.value.push(filterArrayConditionObj.value as never); | 511 | + filterFourArrayCondition.forEach((f) => { |
512 | + filterTwoArrayCondition.push(f); | ||
464 | }); | 513 | }); |
465 | - | ||
466 | - pushEditActionArray.value.forEach((f) => { | ||
467 | - filterArrayActionObj.value = f; | ||
468 | - filterArrayAction.value.push(filterArrayActionObj.value as never); | 514 | + filterFourArrayAction.forEach((f) => { |
515 | + filterTwoArrayAction.push(f); | ||
469 | }); | 516 | }); |
470 | 517 | ||
471 | - const triggersObj = { | ||
472 | - triggers: filterArrayTrigger.value, | 518 | + let editTriggersObj = { |
519 | + triggers: filterTwoArrayTrigger, | ||
473 | }; | 520 | }; |
474 | - const conditionsObj = { | ||
475 | - doConditions: filterArrayCondition.value, | 521 | + let editConditionsObj = { |
522 | + doConditions: filterTwoArrayCondition, | ||
476 | }; | 523 | }; |
477 | - const actionsObj = { | ||
478 | - doActions: filterArrayAction.value, | 524 | + let editActionsObj = { |
525 | + doActions: filterTwoArrayAction, | ||
479 | }; | 526 | }; |
480 | - Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); | 527 | + Object.assign(getAllFormData, editTriggersObj, editConditionsObj, editActionsObj); |
481 | } | 528 | } |
482 | }; | 529 | }; |
483 | 530 | ||
@@ -518,14 +565,14 @@ | @@ -518,14 +565,14 @@ | ||
518 | unref(addTriggerPushData).push(addTriggerData as never); | 565 | unref(addTriggerPushData).push(addTriggerData as never); |
519 | refTriggerChildDataFunc(); | 566 | refTriggerChildDataFunc(); |
520 | lastRefTriggerChildData.value = refTriggerChildData.value; | 567 | lastRefTriggerChildData.value = refTriggerChildData.value; |
521 | - filterNewTriggerArr.value.push(lastRefTriggerChildData.value as never); | ||
522 | - lastRefTriggerChildDataArray.value = filterNewTriggerArr.value.filter( | 568 | + filterNewTriggerArr.push(lastRefTriggerChildData.value as never); |
569 | + (lastRefTriggerChildDataArray.value as never[]) = filterNewTriggerArr.filter( | ||
523 | (v) => Object.keys(v).length !== 0 | 570 | (v) => Object.keys(v).length !== 0 |
524 | ); | 571 | ); |
525 | } else { | 572 | } else { |
526 | refTriggerChildDataFunc(); | 573 | refTriggerChildDataFunc(); |
527 | - pushEditArray.value.push(refTriggerChildData.value); | ||
528 | - unref(editTriggerPushData).push(editTriggerData as never); | 574 | + pushEditArray.push(refTriggerChildData.value as never); |
575 | + unref(editTriggerPushData).push(addTriggerData as never); | ||
529 | } | 576 | } |
530 | }; | 577 | }; |
531 | const removeTrigger = () => { | 578 | const removeTrigger = () => { |
@@ -539,7 +586,7 @@ | @@ -539,7 +586,7 @@ | ||
539 | } else { | 586 | } else { |
540 | try { | 587 | try { |
541 | unref(editTriggerPushData).splice(0, 1); | 588 | unref(editTriggerPushData).splice(0, 1); |
542 | - lastEditRefTriggerChildDataArray.value.splice(0, 1); | 589 | + lastEditRefTriggerChildDataArray.value.pop(); |
543 | } catch (e) { | 590 | } catch (e) { |
544 | return e; | 591 | return e; |
545 | } | 592 | } |
@@ -558,14 +605,14 @@ | @@ -558,14 +605,14 @@ | ||
558 | unref(addConditionPushData).push(addConditionData as never); | 605 | unref(addConditionPushData).push(addConditionData as never); |
559 | refConditionChildDataFunc(); | 606 | refConditionChildDataFunc(); |
560 | lastRefConditionChildData.value = refConditionChildData.value; | 607 | lastRefConditionChildData.value = refConditionChildData.value; |
561 | - filterNewConditionArr.value.push(lastRefConditionChildData.value as never); | ||
562 | - lastRefConditionChildDataArray.value = filterNewConditionArr.value.filter( | 608 | + filterNewConditionArr.push(lastRefConditionChildData.value as never); |
609 | + (lastRefConditionChildDataArray.value as never[]) = filterNewConditionArr.filter( | ||
563 | (v) => Object.keys(v).length !== 0 | 610 | (v) => Object.keys(v).length !== 0 |
564 | ); | 611 | ); |
565 | } else { | 612 | } else { |
566 | refConditionChildDataFunc(); | 613 | refConditionChildDataFunc(); |
567 | - pushEditConditionArray.value.push(refConditionChildData.value); | ||
568 | - unref(editConditionPushData).push(editConditionData as never); | 614 | + pushEditConditionArray.push(refConditionChildData.value as never); |
615 | + unref(editConditionPushData).push(addConditionData as never); | ||
569 | } | 616 | } |
570 | }; | 617 | }; |
571 | const removeCondition = () => { | 618 | const removeCondition = () => { |
@@ -579,7 +626,7 @@ | @@ -579,7 +626,7 @@ | ||
579 | } else { | 626 | } else { |
580 | try { | 627 | try { |
581 | unref(editConditionPushData).splice(0, 1); | 628 | unref(editConditionPushData).splice(0, 1); |
582 | - lastEditRefConditionChildDataArray.value.splice(0, 1); | 629 | + lastEditRefConditionChildDataArray.value.pop(); |
583 | } catch (e) { | 630 | } catch (e) { |
584 | return e; | 631 | return e; |
585 | } | 632 | } |
@@ -598,14 +645,14 @@ | @@ -598,14 +645,14 @@ | ||
598 | unref(addActionPushData).push(addActionData as never); | 645 | unref(addActionPushData).push(addActionData as never); |
599 | refActionChildDataFunc(); | 646 | refActionChildDataFunc(); |
600 | lastRefActionChildData.value = refActionChildData.value; | 647 | lastRefActionChildData.value = refActionChildData.value; |
601 | - filterNewActionArr.value.push(lastRefActionChildData.value as never); | ||
602 | - lastRefActionChildDataArray.value = filterNewActionArr.value.filter( | 648 | + filterNewActionArr.push(lastRefActionChildData.value as never); |
649 | + (lastRefActionChildDataArray.value as never[]) = filterNewActionArr.filter( | ||
603 | (v) => Object.keys(v).length !== 0 | 650 | (v) => Object.keys(v).length !== 0 |
604 | ); | 651 | ); |
605 | } else { | 652 | } else { |
606 | refActionChildDataFunc(); | 653 | refActionChildDataFunc(); |
607 | - pushEditActionArray.value.push(refActionChildData.value); | ||
608 | - unref(editActionPushData).push(editActionData as never); | 654 | + pushEditActionArray.push(refActionChildData.value as never); |
655 | + unref(editActionPushData).push(addActionData as never); | ||
609 | } | 656 | } |
610 | }; | 657 | }; |
611 | const removeAction = () => { | 658 | const removeAction = () => { |
@@ -619,7 +666,7 @@ | @@ -619,7 +666,7 @@ | ||
619 | } else { | 666 | } else { |
620 | try { | 667 | try { |
621 | unref(editActionPushData).splice(0, 1); | 668 | unref(editActionPushData).splice(0, 1); |
622 | - lastEditRefActionChildDataArray.value.splice(0, 1); | 669 | + lastEditRefActionChildDataArray.value.pop(); |
623 | } catch (e) { | 670 | } catch (e) { |
624 | return e; | 671 | return e; |
625 | } | 672 | } |
@@ -627,6 +674,7 @@ | @@ -627,6 +674,7 @@ | ||
627 | }; | 674 | }; |
628 | 675 | ||
629 | return { | 676 | return { |
677 | + handleClose, | ||
630 | defaultAddTrigger, | 678 | defaultAddTrigger, |
631 | defaultAddCondition, | 679 | defaultAddCondition, |
632 | newFilterMap, | 680 | newFilterMap, |
@@ -667,3 +715,11 @@ | @@ -667,3 +715,11 @@ | ||
667 | }, | 715 | }, |
668 | }); | 716 | }); |
669 | </script> | 717 | </script> |
718 | + | ||
719 | +<style lang="less" scoped> | ||
720 | + .condition-style { | ||
721 | + :deep .ant-calendar-picker { | ||
722 | + width: 24.9vw !important; | ||
723 | + } | ||
724 | + } | ||
725 | +</style> |