|
|
|
|
@ -24,8 +24,9 @@
|
|
|
|
|
clearable
|
|
|
|
|
filterable
|
|
|
|
|
placeholder="请选择点位类型"
|
|
|
|
|
@change="handleAttributeTypeChange"
|
|
|
|
|
>
|
|
|
|
|
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.name" />
|
|
|
|
|
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id" />
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="数据类型" prop="dataType">
|
|
|
|
|
@ -95,7 +96,8 @@ const formData = ref({
|
|
|
|
|
id: undefined as number | undefined,
|
|
|
|
|
attributeCode: undefined as string | undefined,
|
|
|
|
|
attributeName: undefined as string | undefined,
|
|
|
|
|
attributeType: undefined as string | undefined,
|
|
|
|
|
attributeType: undefined as number | undefined,
|
|
|
|
|
typeName: undefined as string | undefined,
|
|
|
|
|
dataType: undefined as string | undefined,
|
|
|
|
|
address: undefined as string | undefined,
|
|
|
|
|
dataUnit: undefined as string | undefined,
|
|
|
|
|
@ -140,6 +142,13 @@ const handleSortInput = (val: string) => {
|
|
|
|
|
formData.value.sort = val?.replace(/\D/g, '')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleAttributeTypeChange = (val: number | string) => {
|
|
|
|
|
const matched = typeList.value.find(
|
|
|
|
|
(item) => item.id === val || String(item.id) === String(val)
|
|
|
|
|
)
|
|
|
|
|
formData.value.typeName = matched?.name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const formRules = reactive({
|
|
|
|
|
attributeCode: [
|
|
|
|
|
{ required: true, message: '点位编码不能为空', trigger: 'blur' },
|
|
|
|
|
@ -196,6 +205,7 @@ const buildSubmitData = () => {
|
|
|
|
|
attributeCode,
|
|
|
|
|
attributeName,
|
|
|
|
|
attributeType,
|
|
|
|
|
typeName,
|
|
|
|
|
dataType,
|
|
|
|
|
address,
|
|
|
|
|
dataUnit,
|
|
|
|
|
@ -215,6 +225,7 @@ const buildSubmitData = () => {
|
|
|
|
|
attributeCode,
|
|
|
|
|
attributeName,
|
|
|
|
|
attributeType,
|
|
|
|
|
typeName,
|
|
|
|
|
dataType,
|
|
|
|
|
address,
|
|
|
|
|
dataUnit,
|
|
|
|
|
@ -255,13 +266,14 @@ const open = async (type: string, id?: number, deviceId: number) => {
|
|
|
|
|
if (currentType !== undefined && currentType !== null && currentType !== '') {
|
|
|
|
|
const matched = typeList.value.find(
|
|
|
|
|
(item) =>
|
|
|
|
|
item.name === currentType ||
|
|
|
|
|
item.id === currentType ||
|
|
|
|
|
item.code === currentType ||
|
|
|
|
|
String(item.id) === String(currentType)
|
|
|
|
|
String(item.id) === String(currentType) ||
|
|
|
|
|
item.name === currentType ||
|
|
|
|
|
item.code === currentType
|
|
|
|
|
)
|
|
|
|
|
if (matched?.name) {
|
|
|
|
|
;(formData.value as any).attributeType = matched.name
|
|
|
|
|
if (matched) {
|
|
|
|
|
;(formData.value as any).attributeType = matched.id
|
|
|
|
|
;(formData.value as any).typeName = matched.name
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
@ -302,6 +314,7 @@ const resetForm = () => {
|
|
|
|
|
attributeCode: undefined,
|
|
|
|
|
attributeName: undefined,
|
|
|
|
|
attributeType: undefined,
|
|
|
|
|
typeName: undefined,
|
|
|
|
|
dataType: undefined,
|
|
|
|
|
address: undefined,
|
|
|
|
|
dataUnit: undefined,
|
|
|
|
|
|