diff --git a/src/api/iot/thingmodel/index.ts b/src/api/iot/thingmodel/index.ts
index 8e2b69ade77ff7c6688d086d92c94caa9bcb2e53..9cb795aca98f1741ec2b4d42a89b4cda23be0df8 100644
--- a/src/api/iot/thingmodel/index.ts
+++ b/src/api/iot/thingmodel/index.ts
@@ -11,7 +11,7 @@ export interface ThingModelData {
productId?: number // 产品编号
productKey?: string // 产品标识
dataType: string // 数据类型,与 dataSpecs 的 dataType 保持一致
- type: ProductFunctionTypeEnum // 功能类型
+ type: number // 功能类型
property: ThingModelProperty // 属性
event?: ThingModelEvent // 事件
service?: ThingModelService // 服务
@@ -38,19 +38,6 @@ export interface ThingModelService {
[key: string]: any
}
-// IOT 产品功能(物模型)类型枚举类
-export enum ProductFunctionTypeEnum {
- PROPERTY = 1, // 属性
- SERVICE = 2, // 服务
- EVENT = 3 // 事件
-}
-
-// IOT 产品功能(物模型)访问模式枚举类
-export enum ProductFunctionAccessModeEnum {
- READ_WRITE = 'rw', // 读写
- READ_ONLY = 'r' // 只读
-}
-
// IoT 产品物模型 API
export const ThingModelApi = {
// 查询产品物模型分页
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index eae50a273bb9af54f61f9b9d6742a1d5eebd3cc7..c18236318f0fed5ce82d97a8a09e712a257fdd51 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -238,7 +238,7 @@ export enum DICT_TYPE {
IOT_DEVICE_STATUS = 'iot_device_status', // IOT 设备状态
IOT_PRODUCT_THING_MODEL_TYPE = 'iot_product_thing_model_type', // IOT 产品功能类型
IOT_DATA_TYPE = 'iot_data_type', // IOT 数据类型
- IOT_UNIT_TYPE = 'iot_unit_type', // IOT 单位类型
+ IOT_PRODUCT_THING_MODEL_UNIT = 'iot_product_thing_model_unit', // IOT 物模型单位
IOT_RW_TYPE = 'iot_rw_type', // IOT 读写类型
IOT_PLUGIN_DEPLOY_TYPE = 'iot_plugin_deploy_type', // IOT 插件部署类型
IOT_PLUGIN_STATUS = 'iot_plugin_status', // IOT 插件状态
diff --git a/src/views/iot/thingmodel/ThingModelEvent.vue b/src/views/iot/thingmodel/ThingModelEvent.vue
new file mode 100644
index 0000000000000000000000000000000000000000..827e59dcf8f32cabb736768023b92258fb8dd306
--- /dev/null
+++ b/src/views/iot/thingmodel/ThingModelEvent.vue
@@ -0,0 +1,47 @@
+
+
+
+
+ {{ ThingModelEventType.INFO.label }}
+
+
+ {{ ThingModelEventType.ALERT.label }}
+
+
+ {{ ThingModelEventType.ERROR.label }}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/iot/thingmodel/ThingModelForm.vue b/src/views/iot/thingmodel/ThingModelForm.vue
index 173dab344fa4decd69750a770f67eca12a0278ae..c22601495d515e4dfde82970bae37c0dbff2fef0 100644
--- a/src/views/iot/thingmodel/ThingModelForm.vue
+++ b/src/views/iot/thingmodel/ThingModelForm.vue
@@ -25,10 +25,26 @@
-
+
+
+
+
+
+
+
@@ -40,12 +56,15 @@
+
+
diff --git a/src/views/iot/thingmodel/ThingModelDataSpecs.vue b/src/views/iot/thingmodel/ThingModelProperty.vue
similarity index 84%
rename from src/views/iot/thingmodel/ThingModelDataSpecs.vue
rename to src/views/iot/thingmodel/ThingModelProperty.vue
index 5bced55cfe65c11f58804f9ef2413a418b3b6904..cb3bfa152fd8c04372ee6ff57d7b69b7b3caef02 100644
--- a/src/views/iot/thingmodel/ThingModelDataSpecs.vue
+++ b/src/views/iot/thingmodel/ThingModelProperty.vue
@@ -75,26 +75,26 @@
v-if="property.dataType === DataSpecsDataType.STRUCT"
v-model="property.dataSpecsList"
/>
-
+
- 读写
- 只读
+
+ {{ ThingModelAccessMode.READ_WRITE.label }}
+
+
+ {{ ThingModelAccessMode.READ_ONLY.label }}
+
-
-
-
+
+
diff --git a/src/views/iot/thingmodel/config.ts b/src/views/iot/thingmodel/config.ts
index 8dc00ee490ae22526df9997fca7fde43f45fade5..d9b43dc73ca78efe5460cadbb097aed3b5ae7098 100644
--- a/src/views/iot/thingmodel/config.ts
+++ b/src/views/iot/thingmodel/config.ts
@@ -1,4 +1,4 @@
-import {isEmpty} from '@/utils/is'
+import { isEmpty } from '@/utils/is'
/** dataSpecs 数值型数据结构 */
export interface DataSpecsNumberDataVO {
@@ -48,9 +48,69 @@ export const dataTypeOptions = [
/** 获得物体模型数据类型配置项名称 */
export const getDataTypeOptionsLabel = (value: string) => {
+ if (isEmpty(value)) {
+ return value
+ }
return dataTypeOptions.find((option) => option.value === value)?.label
}
+// IOT 产品物模型类型枚举类
+export const ThingModelType = {
+ PROPERTY: 1, // 属性
+ SERVICE: 2, // 服务
+ EVENT: 3 // 事件
+} as const
+
+// IOT 产品物模型访问模式枚举类
+export const ThingModelAccessMode = {
+ READ_WRITE: {
+ label: '读写',
+ value: 'rw'
+ },
+ READ_ONLY: {
+ label: '只读',
+ value: 'r'
+ }
+} as const
+
+// IOT 产品物模型服务调用方式枚举
+export const ThingModelServiceCallType = {
+ ASYNC: {
+ label: '异步调用',
+ value: 'async'
+ },
+ SYNC: {
+ label: '同步调用',
+ value: 'sync'
+ }
+} as const
+export const getCallTypeByValue = (value: string): string | undefined =>
+ Object.values(ThingModelServiceCallType).find((type) => type.value === value)?.label
+
+// IOT 产品物模型事件类型枚举
+export const ThingModelEventType = {
+ INFO: {
+ label: '信息',
+ value: 'info'
+ },
+ ALERT: {
+ label: '告警',
+ value: 'alert'
+ },
+ ERROR: {
+ label: '故障',
+ value: 'error'
+ }
+} as const
+export const getEventTypeByValue = (value: string): string | undefined =>
+ Object.values(ThingModelEventType).find((type) => type.value === value)?.label
+
+// IOT 产品物模型参数是输入参数还是输出参数
+export const ThingModelParamDirection = {
+ INPUT: 'input', // 输入参数
+ OUTPUT: 'output' // 输出参数
+} as const
+
/** 公共校验规则 */
export const ThingModelFormRules = {
name: [
diff --git a/src/views/iot/thingmodel/dataSpecs/ThingModelNumberDataSpecs.vue b/src/views/iot/thingmodel/dataSpecs/ThingModelNumberDataSpecs.vue
index bd60d6a43fa1fa078876ecc11b4771668cd02191..2340c556599680892e892cf3fe198b925f874ff6 100644
--- a/src/views/iot/thingmodel/dataSpecs/ThingModelNumberDataSpecs.vue
+++ b/src/views/iot/thingmodel/dataSpecs/ThingModelNumberDataSpecs.vue
@@ -47,10 +47,10 @@
@change="unitChange"
>
@@ -58,8 +58,8 @@