Showing
1 changed file
with
4 additions
and
2 deletions
@@ -17,7 +17,7 @@ | @@ -17,7 +17,7 @@ | ||
17 | defineEmits(['register']); | 17 | defineEmits(['register']); |
18 | const props = defineProps<{ deviceId: string; deviceName: string }>(); | 18 | const props = defineProps<{ deviceId: string; deviceName: string }>(); |
19 | 19 | ||
20 | - const [registerForm, { setProps, getFieldsValue, resetFields }] = useForm({ | 20 | + const [registerForm, { setProps, getFieldsValue, resetFields, validate }] = useForm({ |
21 | schemas: [], | 21 | schemas: [], |
22 | showActionButtonGroup: false, | 22 | showActionButtonGroup: false, |
23 | layout: 'vertical', | 23 | layout: 'vertical', |
@@ -95,13 +95,15 @@ | @@ -95,13 +95,15 @@ | ||
95 | createMessage.warning('当前物模型扩展描述没有填写'); | 95 | createMessage.warning('当前物模型扩展描述没有填写'); |
96 | return; | 96 | return; |
97 | } | 97 | } |
98 | + const flag = await validate(); | ||
99 | + if (!flag) return; | ||
98 | const sendValue = ref({}); | 100 | const sendValue = ref({}); |
99 | //判断tcp类型 标识符是自定义还是ModBus | 101 | //判断tcp类型 标识符是自定义还是ModBus |
100 | if (unref(isShowModBUS)) { | 102 | if (unref(isShowModBUS)) { |
101 | const oldValue = getFieldsValue()[unref(formField)]; | 103 | const oldValue = getFieldsValue()[unref(formField)]; |
102 | modBUSForm.value.registerValues = [oldValue]; | 104 | modBUSForm.value.registerValues = [oldValue]; |
103 | modBUSForm.value.registerNumber = 1; | 105 | modBUSForm.value.registerNumber = 1; |
104 | - // 只有 | 106 | + |
105 | if (unref(modBUSForm).method == '16') { | 107 | if (unref(modBUSForm).method == '16') { |
106 | const newValue = getArray(SingleToHex(oldValue)); | 108 | const newValue = getArray(SingleToHex(oldValue)); |
107 | modBUSForm.value.registerValues = newValue; | 109 | modBUSForm.value.registerValues = newValue; |