Commit 047bba36eef951617c0dcef9e5689b91d254d608

Authored by fengtao
1 parent b8aa0b39

fix:修改场景联动 触发器和执行条件 每个表单实例相互影响问题

@@ -68,6 +68,7 @@ @@ -68,6 +68,7 @@
68 import { scheduleOptions, timeUnitOptions, options } from '../config/formatData.ts'; 68 import { scheduleOptions, timeUnitOptions, options } from '../config/formatData.ts';
69 import AlarmSchedule from './AlarmSchedule.vue'; 69 import AlarmSchedule from './AlarmSchedule.vue';
70 import { useModal } from '/@/components/Modal'; 70 import { useModal } from '/@/components/Modal';
  71 + import { cloneDeep } from 'lodash-es';
71 72
72 const props = defineProps({ 73 const props = defineProps({
73 title: { 74 title: {
@@ -87,7 +88,9 @@ @@ -87,7 +88,9 @@
87 const isUpdate = ref(false); 88 const isUpdate = ref(false);
88 const conditionScreeningRef = ref(); 89 const conditionScreeningRef = ref();
89 const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ 90 const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({
90 - schemas: trigger_condition_schema, 91 + //TODO-wenwei-修复
  92 + schemas: cloneDeep(trigger_condition_schema),
  93 + //TODO-wenwei-修复
91 showActionButtonGroup: false, 94 showActionButtonGroup: false,
92 }); 95 });
93 96
@@ -102,11 +105,21 @@ @@ -102,11 +105,21 @@
102 //TODO-fengtao 105 //TODO-fengtao
103 const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => { 106 const updateFieldDeviceId = (deviceList: any[], orgId, isUpdate) => {
104 //用于编辑回显 107 //用于编辑回显
105 - if (isUpdate.value != 3 && isUpdate.value) { 108 + if (isUpdate.value) {
106 updateSchema({ 109 updateSchema({
107 field: 'entityId', 110 field: 'entityId',
108 componentProps: { 111 componentProps: {
109 options: deviceList, 112 options: deviceList,
  113 + onChange(e) {
  114 + if (e) {
  115 + if (isUpdate.value) {
  116 + setFieldsValue({ type2: '' });
  117 + }
  118 + //fengtao
  119 + updateFieldAttributeFunc(e, orgId.value);
  120 + //fengtao
  121 + }
  122 + },
110 }, 123 },
111 }); 124 });
112 } 125 }
@@ -120,7 +133,7 @@ @@ -120,7 +133,7 @@
120 ], 133 ],
121 async onChange(e) { 134 async onChange(e) {
122 setFieldsValue({ type2: '' }); 135 setFieldsValue({ type2: '' });
123 - //部分切换-清空或者重置为初始值 136 + setFieldsValue({ entityId: [] });
124 updateSchema({ 137 updateSchema({
125 field: 'type2', 138 field: 'type2',
126 componentProps: { 139 componentProps: {