Commit b6d2a34c320b86e866be9c42c267c762c7783969
Merge branch 'ft-dev' into 'main'
fix:修复场景联动部分编辑问题,主要是数据重复问题,fix:修复租户第一次修改密码时点击新增时闪烁问题 See merge request huang/yun-teng-iot-front!134
Showing
7 changed files
with
129 additions
and
75 deletions
... | ... | @@ -67,26 +67,25 @@ export function createPermissionGuard(router: Router) { |
67 | 67 | const getMenuListData1 = |
68 | 68 | window.localStorage.getItem('menuListStorage') || (await getMenuList()); |
69 | 69 | const getMenuListData = JSON.parse(getMenuListData1); |
70 | - // const getMenuListData = await getMenuList(); | |
71 | 70 | const getHomePage = getMenuListData.find((f) => { |
72 | 71 | return f.path == '/dashboard/workbench'; |
73 | 72 | }); |
74 | 73 | if (getHomePage?.path == '/dashboard/workbench') { |
75 | 74 | setTimeout(() => { |
76 | 75 | router.push('/dashboard/workbench'); |
77 | - }, 200); | |
76 | + }, 1); | |
78 | 77 | } else { |
79 | 78 | const routeF = getMenuListData[0]?.children[0]?.path || getMenuListData[0].path; |
80 | 79 | setTimeout(() => { |
81 | 80 | router.push(routeF); |
82 | - }, 200); | |
81 | + }, 1); | |
83 | 82 | } |
84 | 83 | } |
85 | 84 | |
86 | 85 | if (from.path === LOGIN_PATH && userInfo.value?.needSetPwd == true) { |
87 | 86 | setTimeout(() => { |
88 | 87 | router.push('/system/password'); |
89 | - }, 200); | |
88 | + }, 1); | |
90 | 89 | } |
91 | 90 | |
92 | 91 | if ( | ... | ... |
... | ... | @@ -82,6 +82,7 @@ |
82 | 82 | type: '', |
83 | 83 | configuration: {}, |
84 | 84 | name: '', |
85 | + remark: '', | |
85 | 86 | }); |
86 | 87 | const editTypeFunc = (d) => { |
87 | 88 | editType.type = d.type; |
... | ... | @@ -97,6 +98,7 @@ |
97 | 98 | editNextType.type = data.record.type; |
98 | 99 | editNextType.configuration = data.record; |
99 | 100 | editNextType.name = data.record.name; |
101 | + editNextType.remark = data.record.remark; | |
100 | 102 | proxy.$refs.refTransferConfigMode.setStepOneFieldsValueFunc(editNextType); |
101 | 103 | } |
102 | 104 | }); | ... | ... |
... | ... | @@ -38,21 +38,6 @@ |
38 | 38 | const resetFieldsValueFunc = () => { |
39 | 39 | resetFields(); |
40 | 40 | }; |
41 | - // watch( | |
42 | - // () => props.deviceInfo1, | |
43 | - // async (newV) => { | |
44 | - // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | |
45 | - // options.items.forEach((v) => { | |
46 | - // return (v.value = v.id), (v.label = v.name); | |
47 | - // }); | |
48 | - // updateSchema({ | |
49 | - // field: 'entityId', | |
50 | - // componentProps: { | |
51 | - // options: options.items, | |
52 | - // }, | |
53 | - // }); | |
54 | - // } | |
55 | - // ); | |
56 | 41 | const updateFieldDeviceId = (v) => { |
57 | 42 | setTimeout(() => { |
58 | 43 | updateSchema({ |
... | ... | @@ -69,6 +54,22 @@ |
69 | 54 | if (props.editConditionFather !== 1) { |
70 | 55 | setTimeout(() => { |
71 | 56 | setFieldsValue(props.editConditionFather); |
57 | + setFieldsValue({ | |
58 | + type: | |
59 | + props.editConditionFather?.triggerCondition?.condition[0]?.valueType == 'NUMERIC' | |
60 | + ? 'NUMERIC1' | |
61 | + : 'NUMERIC2', | |
62 | + operation1: | |
63 | + props.editConditionFather?.triggerCondition?.condition[0]?.predicate?.operation, | |
64 | + operation2: | |
65 | + props.editConditionFather?.triggerCondition?.condition[0]?.predicate?.operation, | |
66 | + value1: | |
67 | + props.editConditionFather?.triggerCondition?.condition[0]?.predicate?.value | |
68 | + ?.defaultValue, | |
69 | + value2: | |
70 | + props.editConditionFather?.triggerCondition?.condition[0]?.predicate?.value | |
71 | + ?.defaultValue, | |
72 | + }); | |
72 | 73 | }, 100); |
73 | 74 | } |
74 | 75 | }; | ... | ... |
... | ... | @@ -17,7 +17,6 @@ |
17 | 17 | import { BasicForm, useForm } from '/@/components/Form/index'; |
18 | 18 | import { Input } from 'ant-design-vue'; |
19 | 19 | import { useActionDrawerSchema } from '../config'; |
20 | - // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | |
21 | 20 | |
22 | 21 | export default defineComponent({ |
23 | 22 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
... | ... | @@ -34,28 +33,10 @@ |
34 | 33 | const getFieldsValueFunc = () => { |
35 | 34 | fieldValue.value = getFieldsValue(); |
36 | 35 | return fieldValue.value; |
37 | - // return new Promise((resolve) => { | |
38 | - // resolve(fieldValue.value); | |
39 | - // }); | |
40 | 36 | }; |
41 | 37 | const resetFieldsValueFunc = () => { |
42 | 38 | resetFields(); |
43 | 39 | }; |
44 | - // watch( | |
45 | - // () => props.deviceInfo2, | |
46 | - // async (newV) => { | |
47 | - // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | |
48 | - // options.items.forEach((v) => { | |
49 | - // return (v.value = v.id), (v.label = v.name); | |
50 | - // }); | |
51 | - // updateSchema({ | |
52 | - // field: 'entityId', | |
53 | - // componentProps: { | |
54 | - // options: options.items, | |
55 | - // }, | |
56 | - // }); | |
57 | - // } | |
58 | - // ); | |
59 | 40 | const updateFieldDeviceId = (v) => { |
60 | 41 | setTimeout(() => { |
61 | 42 | updateSchema({ |
... | ... | @@ -98,14 +79,6 @@ |
98 | 79 | }, |
99 | 80 | }); |
100 | 81 | }; |
101 | - // const editSelectDevice = (v) => { | |
102 | - // updateSchema({ | |
103 | - // field: 'entityId', | |
104 | - // componentProps: { | |
105 | - // options: v, | |
106 | - // }, | |
107 | - // }); | |
108 | - // }; | |
109 | 82 | return { |
110 | 83 | updateFieldDeviceId, |
111 | 84 | clearSelectDevice, | ... | ... |
... | ... | @@ -19,7 +19,6 @@ |
19 | 19 | import { BasicForm, useForm } from '/@/components/Form/index'; |
20 | 20 | import { Input } from 'ant-design-vue'; |
21 | 21 | import { useTriggerDrawerSchema } from '../config'; |
22 | - // import { screenLinkPageByDeptIdGetDevice } from '/@/api/ruleengine/ruleengineApi'; | |
23 | 22 | |
24 | 23 | export default defineComponent({ |
25 | 24 | components: { CollapseContainer, BasicForm, [Input.name]: Input }, |
... | ... | @@ -36,16 +35,6 @@ |
36 | 35 | fieldValue.value = getFieldsValue(); |
37 | 36 | return fieldValue.value; |
38 | 37 | }; |
39 | - // watch( | |
40 | - // () => props.deviceInfo | |
41 | - // // async (newV) => { | |
42 | - // // const options = await screenLinkPageByDeptIdGetDevice({ organizationId: newV }); | |
43 | - // // options.items.forEach((v) => { | |
44 | - // // return (v.value = v.id), (v.label = v.name); | |
45 | - // // }); | |
46 | - // // updateFieldDeviceId(options.items); | |
47 | - // // } | |
48 | - // ); | |
49 | 38 | const updateFieldDeviceId = (v) => { |
50 | 39 | setTimeout(() => { |
51 | 40 | updateSchema({ |
... | ... | @@ -65,6 +54,17 @@ |
65 | 54 | if (props.editTriggerFather != 1) { |
66 | 55 | setTimeout(() => { |
67 | 56 | setFieldsValue(props.editTriggerFather); |
57 | + setFieldsValue({ | |
58 | + entityId1: props.editTriggerFather.entityId, | |
59 | + entityId2: props.editTriggerFather.entityId, | |
60 | + type1: props.editTriggerFather?.triggerCondition?.condition[0]?.key?.type, | |
61 | + type2: props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.type, | |
62 | + operation: | |
63 | + props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.operation, | |
64 | + value: | |
65 | + props.editTriggerFather?.triggerCondition?.condition[0]?.predicate?.value | |
66 | + ?.defaultValue, | |
67 | + }); | |
68 | 68 | }, 10); |
69 | 69 | } |
70 | 70 | }; | ... | ... |
... | ... | @@ -241,6 +241,9 @@ |
241 | 241 | }; |
242 | 242 | let optionsItemArray = ref<[]>([]); |
243 | 243 | const isNoChange = ref(false); |
244 | + let kongTriggerObj = {}; | |
245 | + let kongConditionObj = {}; | |
246 | + let kongActionObj = {}; | |
244 | 247 | |
245 | 248 | const [registerForm, { resetFields, setFieldsValue, validateFields }] = useForm({ |
246 | 249 | labelWidth: 120, |
... | ... | @@ -289,7 +292,7 @@ |
289 | 292 | proxy.$refs.refActionChild.clearSelectDevice(); |
290 | 293 | clearActionsAllDevice(); |
291 | 294 | resetActionsAllArrayFunc(); |
292 | - }, 200); | |
295 | + }, 10); | |
293 | 296 | } catch (e) { |
294 | 297 | return e; |
295 | 298 | } |
... | ... | @@ -298,6 +301,10 @@ |
298 | 301 | } |
299 | 302 | } else { |
300 | 303 | try { |
304 | + emit('success'); | |
305 | + kongTriggerObj = {}; | |
306 | + kongConditionObj = {}; | |
307 | + kongActionObj = {}; | |
301 | 308 | pushEditArray.value = []; |
302 | 309 | pushEditArray.value.length = 0; |
303 | 310 | pushEditConditionArray.value.length = 0; |
... | ... | @@ -454,9 +461,80 @@ |
454 | 461 | refTriggerChildDataFunc(); |
455 | 462 | refConditionChildDataFunc(); |
456 | 463 | refActionChildDataFunc(); |
457 | - const newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData); | |
458 | - const newConditionArray = addConditionPushData.value.concat(refConditionChildData); | |
459 | - const newActionArray = addActionPushData.value.concat(refActionChildData); | |
464 | + let newTriggerArray = addTriggerPushData.value.concat(refTriggerChildData); | |
465 | + let newConditionArray = addConditionPushData.value.concat(refConditionChildData); | |
466 | + let newActionArray = addActionPushData.value.concat(refActionChildData); | |
467 | + newTriggerArray = newTriggerArray.map((m) => { | |
468 | + return { | |
469 | + triggerType: m?.triggerType, | |
470 | + entityId: m?.entityId || m?.entityId1 || m?.entityId2, | |
471 | + triggerCondition: { | |
472 | + condition: [ | |
473 | + { | |
474 | + key: { | |
475 | + key: m.key1 == null ? 'CO2' : m.key1, | |
476 | + type: m.type1 == null ? 'TIME_SERIES' : m.type1, | |
477 | + }, | |
478 | + valueType: m.type2 == null ? 'NUMERIC' : m.type2, | |
479 | + value: {}, | |
480 | + predicate: { | |
481 | + type: m.type2 == null ? 'NUMERIC' : m.type2, | |
482 | + value: { | |
483 | + defaultValue: Number(m.value) == null ? 0 : Number(m.value), | |
484 | + }, | |
485 | + operation: m.operation == null ? 'GREATER_OR_EQUAL' : m.operation, | |
486 | + }, | |
487 | + }, | |
488 | + ], | |
489 | + spec: { | |
490 | + type: 'SIMPLE', | |
491 | + }, | |
492 | + }, | |
493 | + }; | |
494 | + }); | |
495 | + newConditionArray = newConditionArray.map((m) => { | |
496 | + return { | |
497 | + triggerType: m?.triggerType, | |
498 | + entityId: m?.entityId, | |
499 | + triggerCondition: { | |
500 | + condition: [ | |
501 | + { | |
502 | + key: { | |
503 | + type: 'TIME_SERIES', | |
504 | + key: 'CO2', | |
505 | + }, | |
506 | + valueType: | |
507 | + m.type == 'NUMERIC1' | |
508 | + ? 'NUMERIC' | |
509 | + : m.type == 'NUMERIC2' | |
510 | + ? 'NUMERIC' | |
511 | + : 'NUMERIC', | |
512 | + value: {}, | |
513 | + predicate: { | |
514 | + type: | |
515 | + m.type == 'NUMERIC1' | |
516 | + ? 'NUMERIC' | |
517 | + : m.type == 'NUMERIC2' | |
518 | + ? 'NUMERIC' | |
519 | + : 'NUMERIC', | |
520 | + value: { | |
521 | + defaultValue: | |
522 | + Number(m.value1) == null | |
523 | + ? 0 | |
524 | + : Number(m.value1) || Number(m.value2) == null | |
525 | + ? 0 | |
526 | + : Number(m.value2), | |
527 | + }, | |
528 | + operation: m.operation1 || m.operatio2, | |
529 | + }, | |
530 | + }, | |
531 | + ], | |
532 | + spec: { | |
533 | + type: 'SIMPLE', | |
534 | + }, | |
535 | + }, | |
536 | + }; | |
537 | + }); | |
460 | 538 | newTriggerArray.shift(); |
461 | 539 | newConditionArray.shift(); |
462 | 540 | newActionArray.shift(); |
... | ... | @@ -473,9 +551,6 @@ |
473 | 551 | }; |
474 | 552 | Object.assign(getAllFormData, triggersObj, conditionsObj, actionsObj); |
475 | 553 | } else { |
476 | - let kongTriggerObj = {}; | |
477 | - let kongConditionObj = {}; | |
478 | - let kongActionObj = {}; | |
479 | 554 | editTriggerPushData.value.forEach((f) => { |
480 | 555 | kongTriggerObj = f; |
481 | 556 | pushEditArray.value.push(kongTriggerObj); |
... | ... | @@ -518,7 +593,13 @@ |
518 | 593 | getDefaultValue(); |
519 | 594 | getValuesFormData = await validateFields(); |
520 | 595 | if (!getValuesFormData) return; |
521 | - if (getAllFormData.doActions.length == 0) return createMessage.error('请填写执行动作'); | |
596 | + let isKongNum = 0; | |
597 | + getAllFormData.doActions.forEach((f) => { | |
598 | + isKongNum = Object.keys(f).length; | |
599 | + }); | |
600 | + | |
601 | + if (getAllFormData.doActions.length == 1 && isKongNum == 0) | |
602 | + return createMessage.error('请填写执行动作'); | |
522 | 603 | Object.assign(getAllFormData, getValuesFormData); |
523 | 604 | await screenLinkPageAddApi(getAllFormData); |
524 | 605 | createMessage.success('场景联动新增成功'); |
... | ... | @@ -534,7 +615,6 @@ |
534 | 615 | pushEditArray.value.length = 0; |
535 | 616 | pushEditConditionArray.value.length = 0; |
536 | 617 | pushEditActionArray.value.length = 0; |
537 | - console.log('edit data', getAllFormData); | |
538 | 618 | await screenLinkPageUpdateApi(getAllFormData); |
539 | 619 | createMessage.success('场景联动编辑成功'); |
540 | 620 | closeDrawer(); |
... | ... | @@ -577,7 +657,7 @@ |
577 | 657 | try { |
578 | 658 | setTimeout(() => { |
579 | 659 | proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); |
580 | - }, 150); | |
660 | + }, 50); | |
581 | 661 | } catch (e) { |
582 | 662 | return e; |
583 | 663 | } |
... | ... | @@ -617,7 +697,7 @@ |
617 | 697 | try { |
618 | 698 | setTimeout(() => { |
619 | 699 | proxy.$refs.refTriggerChild.updateFieldDeviceId(optionsItemArray.value); |
620 | - }, 150); | |
700 | + }, 50); | |
621 | 701 | } catch (e) { |
622 | 702 | return e; |
623 | 703 | } |
... | ... | @@ -691,7 +771,7 @@ |
691 | 771 | try { |
692 | 772 | setTimeout(() => { |
693 | 773 | proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); |
694 | - }, 150); | |
774 | + }, 50); | |
695 | 775 | } catch (e) { |
696 | 776 | return e; |
697 | 777 | } |
... | ... | @@ -746,7 +826,7 @@ |
746 | 826 | try { |
747 | 827 | setTimeout(() => { |
748 | 828 | proxy.$refs.refConditionChild.updateFieldDeviceId(optionsItemArray.value); |
749 | - }, 150); | |
829 | + }, 50); | |
750 | 830 | } catch (e) { |
751 | 831 | return e; |
752 | 832 | } |
... | ... | @@ -762,7 +842,7 @@ |
762 | 842 | } |
763 | 843 | } else { |
764 | 844 | try { |
765 | - unref(editConditionPushData).splice(0, 1); | |
845 | + unref(editConditionPushData).pop(); | |
766 | 846 | } catch (e) { |
767 | 847 | return e; |
768 | 848 | } |
... | ... | @@ -783,7 +863,7 @@ |
783 | 863 | try { |
784 | 864 | setTimeout(() => { |
785 | 865 | proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); |
786 | - }, 150); | |
866 | + }, 50); | |
787 | 867 | } catch (e) { |
788 | 868 | return e; |
789 | 869 | } |
... | ... | @@ -795,7 +875,7 @@ |
795 | 875 | try { |
796 | 876 | setTimeout(() => { |
797 | 877 | proxy.$refs.refActionChild.updateFieldDeviceId(optionsItemArray.value); |
798 | - }, 150); | |
878 | + }, 50); | |
799 | 879 | } catch (e) { |
800 | 880 | return e; |
801 | 881 | } |
... | ... | @@ -811,7 +891,7 @@ |
811 | 891 | } |
812 | 892 | } else { |
813 | 893 | try { |
814 | - unref(editActionPushData).splice(0, 1); | |
894 | + unref(editActionPushData).pop(); | |
815 | 895 | } catch (e) { |
816 | 896 | return e; |
817 | 897 | } | ... | ... |