Commit c7019a2451620cf5779299af776270f9903676ea

Authored by xp.Huang
2 parents e7f4a57c afd51011

Merge branch 'ww' into 'main'

fix: DEFECT-1031 trigger action deviceType echo incorrect

See merge request yunteng/thingskit-front!476
@@ -324,6 +324,7 @@ @@ -324,6 +324,7 @@
324 detail: condition?.triggerCondition?.alarmDetails, 324 detail: condition?.triggerCondition?.alarmDetails,
325 entityId: condition?.entityId, 325 entityId: condition?.entityId,
326 deviceProfileId: condition?.deviceProfileId, 326 deviceProfileId: condition?.deviceProfileId,
  327 + deviceType: condition?.deviceType,
327 replaceValue: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, 328 replaceValue: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue,
328 time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue, 329 time: condition?.triggerCondition?.condition?.spec?.predicate?.defaultValue,
329 timeUnit: condition?.triggerCondition?.condition?.spec?.unit, 330 timeUnit: condition?.triggerCondition?.condition?.spec?.unit,
@@ -348,7 +349,7 @@ @@ -348,7 +349,7 @@
348 unref(skipUnwrap.conditionItemRefs)[index].setConditionScreeningList([ 349 unref(skipUnwrap.conditionItemRefs)[index].setConditionScreeningList([
349 ...new Array(condition.triggerCondition.condition.condition.length).keys(), 350 ...new Array(condition.triggerCondition.condition.condition.length).keys(),
350 ]); 351 ]);
351 - // 操作符类型 NUMERIC|String|Boolean|DATE_TIME 352 + // 操作符类型 NUMERIC|String|Boolean|DATorganizeImportsE_TIME
352 const valueType = condition.triggerCondition?.condition.condition[0].valueType; 353 const valueType = condition.triggerCondition?.condition.condition[0].valueType;
353 354
354 // 循环设置条件筛选值。TODO:此处设置顺序有问题 355 // 循环设置条件筛选值。TODO:此处设置顺序有问题
@@ -387,7 +388,6 @@ @@ -387,7 +388,6 @@
387 doActions.forEach((action, index) => { 388 doActions.forEach((action, index) => {
388 nextTick(() => { 389 nextTick(() => {
389 const selectProductId = ref(''); 390 const selectProductId = ref('');
390 - console.log('doActions', unref(skipUnwrap.actionItemRefs));  
391 // 设置执行动作外层值 391 // 设置执行动作外层值
392 unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({ 392 unref(skipUnwrap.actionItemRefs)[index].setFieldsFormValueFun({
393 ...action, 393 ...action,
@@ -566,10 +566,10 @@ @@ -566,10 +566,10 @@
566 //TODO fengtao 566 //TODO fengtao
567 setFields(skipUnwrap.triggerItemRefs, true); 567 setFields(skipUnwrap.triggerItemRefs, true);
568 setFields(skipUnwrap.conditionItemRefs, true); 568 setFields(skipUnwrap.conditionItemRefs, true);
569 - // setFields(skipUnwrap.actionItemRefs, true); 569 + setFields(skipUnwrap.actionItemRefs, true);
570 const data = await getOrganizationAlarmConfig({ organizationId: newValue }); 570 const data = await getOrganizationAlarmConfig({ organizationId: newValue });
571 alarmConfigList.value = data.map((item) => ({ label: item.name, value: item.id })); 571 alarmConfigList.value = data.map((item) => ({ label: item.name, value: item.id }));
572 - setFields(skipUnwrap.actionItemRefs, true); 572 + // setFields(skipUnwrap.actionItemRefs, true);
573 // console.log(unref(organizationIdRef)); 573 // console.log(unref(organizationIdRef));
574 // setAlarmConfig(skipUnwrap.actionItemRefs, true); 574 // setAlarmConfig(skipUnwrap.actionItemRefs, true);
575 }); 575 });
@@ -694,6 +694,8 @@ @@ -694,6 +694,8 @@
694 } 694 }
695 if (mustTriggerCondition) return; 695 if (mustTriggerCondition) return;
696 if (mustCondition) return; 696 if (mustCondition) return;
  697 + console.log(postAddOrEditData);
  698 + return;
697 //FT change 699 //FT change
698 await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); 700 await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate));
699 createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); 701 createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`);
@@ -250,8 +250,7 @@ export const trigger_condition_schema: FormSchema[] = [ @@ -250,8 +250,7 @@ export const trigger_condition_schema: FormSchema[] = [
250 getPopupContainer: () => document.body, 250 getPopupContainer: () => document.body,
251 onChange: async (e) => { 251 onChange: async (e) => {
252 if (e) { 252 if (e) {
253 - setFieldsValue({ type2: '' });  
254 - setFieldsValue({ entityId: [] }); 253 + setFieldsValue({ type2: '', entityId: [] });
255 const res = await getAttribute(e); 254 const res = await getAttribute(e);
256 const options = ref<TOption[]>([]); 255 const options = ref<TOption[]>([]);
257 useByProductGetAttribute(res, updateSchema, options); 256 useByProductGetAttribute(res, updateSchema, options);
@@ -446,7 +445,6 @@ export const actionSchema: FormSchema[] = [ @@ -446,7 +445,6 @@ export const actionSchema: FormSchema[] = [
446 componentProps: ({ formActionType, formModel }) => { 445 componentProps: ({ formActionType, formModel }) => {
447 const { setFieldsValue } = formActionType; 446 const { setFieldsValue } = formActionType;
448 const deviceType = formModel['deviceType']; 447 const deviceType = formModel['deviceType'];
449 - console.log(deviceType);  
450 return { 448 return {
451 api: queryDeviceProfileBy, 449 api: queryDeviceProfileBy,
452 params: { 450 params: {
@@ -457,8 +455,7 @@ export const actionSchema: FormSchema[] = [ @@ -457,8 +455,7 @@ export const actionSchema: FormSchema[] = [
457 valueField: 'id', 455 valueField: 'id',
458 getPopupContainer: () => document.body, 456 getPopupContainer: () => document.body,
459 onChange: () => { 457 onChange: () => {
460 - setFieldsValue({ deviceId: [] });  
461 - setFieldsValue({ thingsModelId: '' }); 458 + setFieldsValue({ thingsModelId: '', deviceId: [] });
462 }, 459 },
463 }; 460 };
464 }, 461 },
@@ -101,9 +101,9 @@ @@ -101,9 +101,9 @@
101 return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; 101 return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData };
102 }; 102 };
103 103
104 - const updateFieldDeviceId = (deviceList: any[], _, isUpdate) => {  
105 - console.log(deviceList);  
106 - console.log(isUpdate); 104 + const updateFieldDeviceId = () => {
  105 + // console.log(deviceList);
  106 + // console.log(isUpdate);
107 }; 107 };
108 108
109 const resetFieldsValueFunc = () => resetFields(); 109 const resetFieldsValueFunc = () => resetFields();
@@ -157,7 +157,6 @@ @@ -157,7 +157,6 @@
157 alarmScheduleRef.value.scheduleData = { 157 alarmScheduleRef.value.scheduleData = {
158 type: value, 158 type: value,
159 }; 159 };
160 - console.log(value);  
161 } 160 }
162 currentIndex.value = index; 161 currentIndex.value = index;
163 }; 162 };
@@ -57,20 +57,20 @@ @@ -57,20 +57,20 @@
57 </div> 57 </div>
58 </template> 58 </template>
59 <script lang="ts" setup> 59 <script lang="ts" setup>
60 - import { ref, provide, nextTick } from 'vue'; 60 + import { Card, Input, Select, Tooltip } from 'ant-design-vue';
  61 + import { cloneDeep } from 'lodash-es';
  62 + import { nextTick, provide, ref } from 'vue';
  63 + import { TOption, trigger_condition_schema } from '../config/config.data';
  64 + import { options, scheduleOptions, timeUnitOptions } from '../config/formatData';
  65 + import useCommonFun from '../hooks/useCommonFun';
  66 + import AlarmSchedule from './AlarmSchedule.vue';
  67 + import ConditionScreening from './ConditionScreening.vue';
  68 + import { getAttribute } from '/@/api/ruleengine/ruleengineApi';
61 import { CollapseContainer } from '/@/components/Container/index'; 69 import { CollapseContainer } from '/@/components/Container/index';
62 import { BasicForm, useForm } from '/@/components/Form/index'; 70 import { BasicForm, useForm } from '/@/components/Form/index';
63 import { Icon } from '/@/components/Icon'; 71 import { Icon } from '/@/components/Icon';
64 - import { Tooltip, Card, Select, Input } from 'ant-design-vue';  
65 - import { trigger_condition_schema, TOption } from '../config/config.data';  
66 - import { getAttribute } from '/@/api/ruleengine/ruleengineApi';  
67 - import ConditionScreening from './ConditionScreening.vue';  
68 - import { scheduleOptions, timeUnitOptions, options } from '../config/formatData';  
69 - import AlarmSchedule from './AlarmSchedule.vue';  
70 import { useModal } from '/@/components/Modal'; 72 import { useModal } from '/@/components/Modal';
71 - import { cloneDeep } from 'lodash-es';  
72 import { useMessage } from '/@/hooks/web/useMessage'; 73 import { useMessage } from '/@/hooks/web/useMessage';
73 - import useCommonFun from '../hooks/useCommonFun';  
74 74
75 const { useByProductGetAttribute } = useCommonFun(); 75 const { useByProductGetAttribute } = useCommonFun();
76 defineProps({ 76 defineProps({
@@ -203,7 +203,6 @@ @@ -203,7 +203,6 @@
203 alarmScheduleRef.value.scheduleData = { 203 alarmScheduleRef.value.scheduleData = {
204 type: value, 204 type: value,
205 }; 205 };
206 - console.log(value);  
207 } 206 }
208 currentIndex.value = index; 207 currentIndex.value = index;
209 }; 208 };
@@ -212,14 +211,14 @@ @@ -212,14 +211,14 @@
212 }; 211 };
213 const scheduleData = ref(null); 212 const scheduleData = ref(null);
214 //FT add 2022-10-27 213 //FT add 2022-10-27
215 - const updateFieldAlarmConfig = (alarmConfigList) => { 214 + const updateFieldAlarmConfig = () => {
216 //什么也不做 215 //什么也不做
217 - console.log(alarmConfigList); 216 + // console.log(alarmConfigList);
218 }; 217 };
219 //FT add 2022-10-27 218 //FT add 2022-10-27
220 - const updateEditFieldAlarmConfig = (alarmConfigList) => { 219 + const updateEditFieldAlarmConfig = () => {
221 //什么也不做 220 //什么也不做
222 - console.log(alarmConfigList); 221 + // console.log(alarmConfigList);
223 }; 222 };
224 223
225 defineExpose({ 224 defineExpose({
@@ -19,7 +19,8 @@ @@ -19,7 +19,8 @@
19 @dropdown-visible-change="handleDropdownVisibleChange" 19 @dropdown-visible-change="handleDropdownVisibleChange"
20 placeholder="请选择执行动作" 20 placeholder="请选择执行动作"
21 allowClear 21 allowClear
22 - /></template> 22 + />
  23 + </template>
23 <template #alarmConfigSlot="{ model, field }"> 24 <template #alarmConfigSlot="{ model, field }">
24 <a-select 25 <a-select
25 allowClear 26 allowClear
@@ -169,6 +170,7 @@ @@ -169,6 +170,7 @@
169 }, 170 },
170 ]; 171 ];
171 }); 172 });
  173 +
172 const changeOutTarget = () => { 174 const changeOutTarget = () => {
173 emit('getActionFormArr'); 175 emit('getActionFormArr');
174 }; 176 };
@@ -262,8 +264,6 @@ @@ -262,8 +264,6 @@
262 }; 264 };
263 265
264 const setFieldsFormValueFun = (fieldsValue) => { 266 const setFieldsFormValueFun = (fieldsValue) => {
265 - console.log(getFieldsValue());  
266 -  
267 setFieldsValue({ 267 setFieldsValue({
268 ...fieldsValue, 268 ...fieldsValue,
269 ...(isNumber(fieldsValue.commandType) 269 ...(isNumber(fieldsValue.commandType)