Commit 46673819e18110bb3a25daae9c98e1f6bdb3c8f8
1 parent
08fa1354
fix:修复场景联动 触发器和执行条件设备、属性、条件筛选如果有则必填验证
Showing
1 changed file
with
21 additions
and
0 deletions
| ... | ... | @@ -69,6 +69,7 @@ | 
| 69 | 69 | import AlarmSchedule from './AlarmSchedule.vue'; | 
| 70 | 70 | import { useModal } from '/@/components/Modal'; | 
| 71 | 71 | import { cloneDeep } from 'lodash-es'; | 
| 72 | + import { useMessage } from '/@/hooks/web/useMessage'; | |
| 72 | 73 | |
| 73 | 74 | const props = defineProps({ | 
| 74 | 75 | title: { | 
| ... | ... | @@ -85,6 +86,8 @@ | 
| 85 | 86 | }, | 
| 86 | 87 | }); | 
| 87 | 88 | const emit = defineEmits(['delete']); | 
| 89 | + const { createMessage } = useMessage(); | |
| 90 | + | |
| 88 | 91 | const isUpdate = ref(false); | 
| 89 | 92 | const conditionScreeningRef = ref(); | 
| 90 | 93 | const [registerForm, { resetFields, getFieldsValue, updateSchema, setFieldsValue }] = useForm({ | 
| ... | ... | @@ -99,6 +102,24 @@ | 
| 99 | 102 | const predicate = conditionScreeningRef?.value?.refItem?.conditionScreeningRefs?.value?.map( | 
| 100 | 103 | (item) => item.getFieldsValue() | 
| 101 | 104 | ); | 
| 105 | + //TODO-fengtao-设备、属性、条件筛选验证 | |
| 106 | + const validate = getFieldsValue(); | |
| 107 | + if (validate.device == 'PART') { | |
| 108 | + if (validate.entityId == undefined) return createMessage.error('请选择设备'); | |
| 109 | + } | |
| 110 | + if (validate.type2 == '') return createMessage.error('请选择属性'); | |
| 111 | + if (predicate == undefined) return createMessage.error('请填写条件筛选'); | |
| 112 | + let predicateIsRequired = false; | |
| 113 | + if (predicate) { | |
| 114 | + predicate.some((f) => { | |
| 115 | + let arr = Object.keys(f); | |
| 116 | + if (arr.length == 0) { | |
| 117 | + predicateIsRequired = true; | |
| 118 | + } | |
| 119 | + }); | |
| 120 | + } | |
| 121 | + if (predicateIsRequired) return createMessage.error('请填写条件筛选'); | |
| 122 | + //TODO-fengtao-设备、属性、条件筛选验证 | |
| 102 | 123 | return { ...getFieldsValue(), predicate, schedule: alarmScheduleRef.value.scheduleData }; | 
| 103 | 124 | }; | 
| 104 | 125 | ... | ... |