Commit 047bba36eef951617c0dcef9e5689b91d254d608

Authored by fengtao
1 parent b8aa0b39

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

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