【功能优化】优化IOT物模型编辑表单验证规则
parent
18eabfb042
commit
05245855eb
|
@ -138,7 +138,7 @@ const formRules = reactive({
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
validator: (rule, value, callback) => {
|
validator: (value, callback) => {
|
||||||
const reservedKeywords = ['set', 'get', 'post', 'property', 'event', 'time', 'value']
|
const reservedKeywords = ['set', 'get', 'post', 'property', 'event', 'time', 'value']
|
||||||
if (reservedKeywords.includes(value)) {
|
if (reservedKeywords.includes(value)) {
|
||||||
callback(
|
callback(
|
||||||
|
@ -153,12 +153,8 @@ const formRules = reactive({
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
property: {
|
'property.dataType.type': [{ required: true, message: '数据类型不能为空', trigger: 'blur' }],
|
||||||
dataType: {
|
'property.accessMode': [{ required: true, message: '读写类型不能为空', trigger: 'blur' }]
|
||||||
type: [{ required: true, message: '数据类型不能为空', trigger: 'blur' }]
|
|
||||||
},
|
|
||||||
accessMode: [{ required: true, message: '读写类型不能为空', trigger: 'blur' }]
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
const formRef = ref()
|
const formRef = ref()
|
||||||
|
|
||||||
|
@ -195,9 +191,9 @@ const submitForm = async () => {
|
||||||
await ThinkModelFunctionApi.updateThinkModelFunction(data)
|
await ThinkModelFunctionApi.updateThinkModelFunction(data)
|
||||||
message.success(t('common.updateSuccess'))
|
message.success(t('common.updateSuccess'))
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
dialogVisible.value = false // 确保关闭弹框
|
dialogVisible.value = false // 确保关闭弹框
|
||||||
emit('success')
|
emit('success')
|
||||||
} finally {
|
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -231,4 +227,4 @@ const resetForm = () => {
|
||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue