From 81a710c02df7ba92c64b7c0b73d4b933efe9af2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=B5=A9=E6=B5=A9?= <1036606149@qq.com> Date: Sun, 29 Sep 2024 21:58:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E3=80=91=20IOT=20=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E7=89=A9=E6=A8=A1=E5=9E=8B=E6=96=B0=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/thinkmodelfunction/index.ts | 55 +++++ src/utils/dict.ts | 6 +- .../iot/product/detail/ThinkModelFunction.vue | 149 ++++++++++++++ .../product/detail/ThinkModelFunctionForm.vue | 194 ++++++++++++++++++ src/views/iot/product/detail/index.vue | 20 +- 5 files changed, 414 insertions(+), 10 deletions(-) create mode 100644 src/api/iot/thinkmodelfunction/index.ts create mode 100644 src/views/iot/product/detail/ThinkModelFunction.vue create mode 100644 src/views/iot/product/detail/ThinkModelFunctionForm.vue diff --git a/src/api/iot/thinkmodelfunction/index.ts b/src/api/iot/thinkmodelfunction/index.ts new file mode 100644 index 00000000..29f06a78 --- /dev/null +++ b/src/api/iot/thinkmodelfunction/index.ts @@ -0,0 +1,55 @@ +import request from '@/config/axios' + +// IoT 产品物模型 VO +export interface ThinkModelFunctionVO { + id: number // 物模型功能编号 + identifier: string // 功能标识 + name: string // 功能名称 + description: string // 功能描述 + productId: number // 产品ID(关联 IotProductDO 的 id) + productKey: string // 产品Key(关联 IotProductDO 的 productKey) + type: number // 功能类型(1 - 属性,2 - 服务,3 - 事件) + property: string // 属性(存储 ThingModelProperty 的 JSON 数据) + event: string // 事件(存储 ThingModelEvent 的 JSON 数据) + service: string // 服务(存储服务的 JSON 数据) +} + +// IoT 产品物模型 API +export const ThinkModelFunctionApi = { + // 查询IoT 产品物模型分页 + getThinkModelFunctionPage: async (params: any) => { + return await request.get({ url: `/iot/think-model-function/page`, params }) + }, + // 获得IoT 产品物模型 + getThinkModelFunctionListByProductId: async (params: any) => { + return await request.get({ + url: `/iot/think-model-function/list-by-product-id`, + params + }) + }, + + // 查询IoT 产品物模型详情 + getThinkModelFunction: async (id: number) => { + return await request.get({ url: `/iot/think-model-function/get?id=` + id }) + }, + + // 新增IoT 产品物模型 + createThinkModelFunction: async (data: ThinkModelFunctionVO) => { + return await request.post({ url: `/iot/think-model-function/create`, data }) + }, + + // 修改IoT 产品物模型 + updateThinkModelFunction: async (data: ThinkModelFunctionVO) => { + return await request.put({ url: `/iot/think-model-function/update`, data }) + }, + + // 删除IoT 产品物模型 + deleteThinkModelFunction: async (id: number) => { + return await request.delete({ url: `/iot/think-model-function/delete?id=` + id }) + }, + + // 导出IoT 产品物模型 Excel + exportThinkModelFunction: async (params) => { + return await request.download({ url: `/iot/think-model-function/export-excel`, params }) + } +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 82f9218f..e8deb60a 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -235,5 +235,9 @@ export enum DICT_TYPE { IOT_PRODUCT_DEVICE_TYPE = 'iot_product_device_type', // IOT 产品设备类型 IOT_DATA_FORMAT = 'iot_data_format', // IOT 数据格式 IOT_PROTOCOL_TYPE = 'iot_protocol_type', // IOT 接入网关协议 - IOT_DEVICE_STATUS = 'iot_device_status' // IOT 设备状态 + IOT_DEVICE_STATUS = 'iot_device_status', // IOT 设备状态 + IOT_PRODUCT_FUNCTION_TYPE = 'iot_product_function_type', // IOT 产品功能类型 + IOT_DATA_TYPE = 'iot_data_type', // IOT 数据类型 + IOT_UNIT_TYPE = 'iot_unit_type', // IOT 单位类型 + IOT_RW_TYPE = 'iot_rw_type' // IOT 读写类型 } diff --git a/src/views/iot/product/detail/ThinkModelFunction.vue b/src/views/iot/product/detail/ThinkModelFunction.vue new file mode 100644 index 00000000..95089c62 --- /dev/null +++ b/src/views/iot/product/detail/ThinkModelFunction.vue @@ -0,0 +1,149 @@ + + diff --git a/src/views/iot/product/detail/ThinkModelFunctionForm.vue b/src/views/iot/product/detail/ThinkModelFunctionForm.vue new file mode 100644 index 00000000..976ca717 --- /dev/null +++ b/src/views/iot/product/detail/ThinkModelFunctionForm.vue @@ -0,0 +1,194 @@ + + + diff --git a/src/views/iot/product/detail/index.vue b/src/views/iot/product/detail/index.vue index 6ff97bb8..f57fc4d6 100644 --- a/src/views/iot/product/detail/index.vue +++ b/src/views/iot/product/detail/index.vue @@ -1,18 +1,18 @@ @@ -22,6 +22,7 @@ import { DeviceApi } from '@/api/iot/device' import ProductDetailsHeader from '@/views/iot/product/detail/ProductDetailsHeader.vue' import ProductDetailsInfo from '@/views/iot/product/detail/ProductDetailsInfo.vue' import ProductTopic from '@/views/iot/product/detail/ProductTopic.vue' +import ThinkModelFunction from '@/views/iot/product/detail/ThinkModelFunction.vue' defineOptions({ name: 'IoTProductDetail' }) @@ -30,6 +31,7 @@ const message = useMessage() const id = Number(route.params.id) // 编号 const loading = ref(true) // 加载中 const product = ref({} as ProductVO) // 详情 +const activeTab = ref('info') // 默认激活的标签页 /** 获取详情 */ const getProductData = async (id: number) => {