From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/iot/thingmodel/dataSpecs/ThingModelArrayDataSpecs.vue | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/src/views/iot/thingmodel/dataSpecs/ThingModelArrayDataSpecs.vue b/src/views/iot/thingmodel/dataSpecs/ThingModelArrayDataSpecs.vue
new file mode 100644
index 0000000..888df2b
--- /dev/null
+++ b/src/views/iot/thingmodel/dataSpecs/ThingModelArrayDataSpecs.vue
@@ -0,0 +1,56 @@
+<!-- dataType锛歛rray 鏁扮粍绫诲瀷 -->
+<template>
+ <el-form-item label="鍏冪礌绫诲瀷" prop="property.dataSpecs.childDataType">
+ <el-radio-group v-model="dataSpecs.childDataType" @change="handleChange">
+ <template v-for="item in getDataTypeOptions()" :key="item.value">
+ <el-radio
+ v-if="
+ !(
+ [
+ IoTDataSpecsDataTypeEnum.ENUM,
+ IoTDataSpecsDataTypeEnum.ARRAY,
+ IoTDataSpecsDataTypeEnum.DATE
+ ] as any[]
+ ).includes(item.value)
+ "
+ :value="item.value"
+ class="w-1/3"
+ >
+ {{ `${item.value}(${item.label})` }}
+ </el-radio>
+ </template>
+ </el-radio-group>
+ </el-form-item>
+ <el-form-item label="鍏冪礌涓暟" prop="property.dataSpecs.size">
+ <el-input v-model="dataSpecs.size" placeholder="璇疯緭鍏ユ暟缁勪腑鐨勫厓绱犱釜鏁�" />
+ </el-form-item>
+ <!-- Struct 鍨嬮厤缃�-->
+ <ThingModelStructDataSpecs
+ v-if="dataSpecs.childDataType === IoTDataSpecsDataTypeEnum.STRUCT"
+ v-model="dataSpecs.dataSpecsList"
+ />
+</template>
+
+<script lang="ts" setup>
+import { useVModel } from '@vueuse/core'
+import ThingModelStructDataSpecs from './ThingModelStructDataSpecs.vue'
+import { getDataTypeOptions, IoTDataSpecsDataTypeEnum } from '@/views/iot/utils/constants'
+
+/** 鏁扮粍鍨嬬殑 dataSpecs 閰嶇疆缁勪欢 */
+defineOptions({ name: 'ThingModelArrayDataSpecs' })
+
+const props = defineProps<{ modelValue: any }>()
+const emits = defineEmits(['update:modelValue'])
+const dataSpecs = useVModel(props, 'modelValue', emits) as Ref<any>
+
+/** 鍏冪礌绫诲瀷鏀瑰彉鏃堕棿銆傚綋鍊间负 struct 鏃讹紝瀵� dataSpecs 涓殑 dataSpecsList 杩涜鍒濆鍖� */
+const handleChange = (val: string) => {
+ if (val !== IoTDataSpecsDataTypeEnum.STRUCT) {
+ return
+ }
+
+ dataSpecs.value.dataSpecsList = []
+}
+</script>
+
+<style lang="scss" scoped></style>
--
Gitblit v1.8.0