diff --git a/src/api/iot/thingmodel/index.ts b/src/api/iot/thingmodel/index.ts index 8e2b69ad..3c21ee80 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,18 +38,58 @@ export interface ThingModelService { [key: string]: any } -// IOT 产品功能(物模型)类型枚举类 -export enum ProductFunctionTypeEnum { - PROPERTY = 1, // 属性 - SERVICE = 2, // 服务 - EVENT = 3 // 事件 -} +// IOT 产品物模型类型枚举类 +export const ThingModelType = { + PROPERTY: 1, // 属性 + SERVICE: 2, // 服务 + EVENT: 3 // 事件 +} as const -// IOT 产品功能(物模型)访问模式枚举类 -export enum ProductFunctionAccessModeEnum { - READ_WRITE = 'rw', // 读写 - READ_ONLY = 'r' // 只读 -} +// 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 + +// IOT 产品物模型事件类型枚举 +export const ThingModelServiceEventType = { + INFO: { + label: '信息', + value: 'info' + }, + ALERT: { + label: '告警', + value: 'alert' + }, + ERROR: { + label: '故障', + value: 'error' + } +} as const + +// IOT 产品物模型参数是输入参数还是输出参数 +export const ThingModelParamDirection = { + INPUT: 'input', // 输入参数 + OUTPUT: 'output' // 输出参数 +} as const // IoT 产品物模型 API export const ThingModelApi = { diff --git a/src/utils/dict.ts b/src/utils/dict.ts index eae50a27..c1823631 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 00000000..7a49b2e7 --- /dev/null +++ b/src/views/iot/thingmodel/ThingModelEvent.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/src/views/iot/thingmodel/ThingModelForm.vue b/src/views/iot/thingmodel/ThingModelForm.vue index f178cdf8..c821f540 100644 --- a/src/views/iot/thingmodel/ThingModelForm.vue +++ b/src/views/iot/thingmodel/ThingModelForm.vue @@ -25,10 +25,17 @@ - + + + +