|
|
|
@ -95,33 +95,6 @@ const formData = ref({
|
|
|
|
deviceId: undefined as number | undefined
|
|
|
|
deviceId: undefined as number | undefined
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
const ratioEnabledTypes = new Set([
|
|
|
|
|
|
|
|
'uint8',
|
|
|
|
|
|
|
|
'uint16',
|
|
|
|
|
|
|
|
'uint32',
|
|
|
|
|
|
|
|
'uint64',
|
|
|
|
|
|
|
|
'int8',
|
|
|
|
|
|
|
|
'int16',
|
|
|
|
|
|
|
|
'int32',
|
|
|
|
|
|
|
|
'float32',
|
|
|
|
|
|
|
|
'float64'
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const ratioEnabled = computed(() => {
|
|
|
|
|
|
|
|
const v = formData.value.dataType
|
|
|
|
|
|
|
|
if (!v) return false
|
|
|
|
|
|
|
|
return ratioEnabledTypes.has(v)
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
|
|
|
() => formData.value.dataType,
|
|
|
|
|
|
|
|
() => {
|
|
|
|
|
|
|
|
if (!ratioEnabled.value) {
|
|
|
|
|
|
|
|
formData.value.ratio = undefined
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleAttributeCodeInput = (val: string) => {
|
|
|
|
const handleAttributeCodeInput = (val: string) => {
|
|
|
|
const sanitized = (val || '').replace(/[^A-Za-z0-9_]/g, '')
|
|
|
|
const sanitized = (val || '').replace(/[^A-Za-z0-9_]/g, '')
|
|
|
|
formData.value.attributeCode = sanitized.replace(/^[0-9]+/, '')
|
|
|
|
formData.value.attributeCode = sanitized.replace(/^[0-9]+/, '')
|
|
|
|
|