From 4aea2eaed59742807e339962901f5b4537b102ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=89=E6=B5=A9=E6=B5=A9?= <1036606149@qq.com> Date: Sat, 7 Sep 2024 09:46:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9AIOT=20=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/product/index.ts | 50 +++++ src/router/modules/remaining.ts | 21 ++ src/utils/dict.ts | 10 +- src/views/iot/product/ProductForm.vue | 203 +++++++++++++++++ .../product/detail/ProductDetailsHeader.vue | 45 ++++ .../iot/product/detail/ProductDetailsInfo.vue | 37 ++++ src/views/iot/product/detail/index.vue | 51 +++++ src/views/iot/product/index.vue | 206 ++++++++++++++++++ 8 files changed, 622 insertions(+), 1 deletion(-) create mode 100644 src/api/iot/product/index.ts create mode 100644 src/views/iot/product/ProductForm.vue create mode 100644 src/views/iot/product/detail/ProductDetailsHeader.vue create mode 100644 src/views/iot/product/detail/ProductDetailsInfo.vue create mode 100644 src/views/iot/product/detail/index.vue create mode 100644 src/views/iot/product/index.vue diff --git a/src/api/iot/product/index.ts b/src/api/iot/product/index.ts new file mode 100644 index 00000000..4c18426b --- /dev/null +++ b/src/api/iot/product/index.ts @@ -0,0 +1,50 @@ +import request from '@/config/axios' + +// iot 产品 VO +export interface ProductVO { + name: string // 产品名称 + id: number // 产品ID + productKey: string // 产品标识 + protocolId: number // 协议编号(脚本解析 id) + categoryId: number // 产品所属品类标识符 + description: string // 产品描述 + validateType: number // 数据校验级别, 0: 强校验, 1: 弱校验, 2: 免校验 + status: number // 产品状态, 0: DEVELOPMENT_STATUS, 1: RELEASE_STATUS + deviceType: number // 设备类型, 0: 直连设备, 1: 网关子设备, 2: 网关设备 + netType: number // 联网方式, 0: Wi-Fi, 1: Cellular, 2: Ethernet, 3: 其他 + protocolType: number // 接入网关协议, 0: modbus, 1: opc-ua, 2: customize, 3: ble, 4: zigbee + dataFormat: number // 数据格式, 0: 透传模式, 1: Alink JSON +} + +// iot 产品 API +export const ProductApi = { + // 查询iot 产品分页 + getProductPage: async (params: any) => { + return await request.get({ url: `/iot/product/page`, params }) + }, + + // 查询iot 产品详情 + getProduct: async (id: number) => { + return await request.get({ url: `/iot/product/get?id=` + id }) + }, + + // 新增iot 产品 + createProduct: async (data: ProductVO) => { + return await request.post({ url: `/iot/product/create`, data }) + }, + + // 修改iot 产品 + updateProduct: async (data: ProductVO) => { + return await request.put({ url: `/iot/product/update`, data }) + }, + + // 删除iot 产品 + deleteProduct: async (id: number) => { + return await request.delete({ url: `/iot/product/delete?id=` + id }) + }, + + // 导出iot 产品 Excel + exportProduct: async (params) => { + return await request.download({ url: `/iot/product/export-excel`, params }) + } +} \ No newline at end of file diff --git a/src/router/modules/remaining.ts b/src/router/modules/remaining.ts index f19d93ec..6b6acbcf 100644 --- a/src/router/modules/remaining.ts +++ b/src/router/modules/remaining.ts @@ -594,6 +594,27 @@ const remainingRouter: AppRouteRecordRaw[] = [ } } ] + }, + { + path: '/iot', + component: Layout, + name: 'IOT', + meta: { + hidden: true + }, + children: [ + { + path: 'product/detail/:id', + name: 'IotProductDetail', + meta: { + title: '产品详情', + noCache: true, + hidden: true, + activeMenu: '/iot/product' + }, + component: () => import('@/views/iot/product/detail/index.vue') + } + ] } ] diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 7fbcfebc..4a8c017c 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -226,5 +226,13 @@ export enum DICT_TYPE { AI_WRITE_LENGTH = 'ai_write_length', // AI 写作长度 AI_WRITE_FORMAT = 'ai_write_format', // AI 写作格式 AI_WRITE_TONE = 'ai_write_tone', // AI 写作语气 - AI_WRITE_LANGUAGE = 'ai_write_language' // AI 写作语言 + AI_WRITE_LANGUAGE = 'ai_write_language', // AI 写作语言 + + // ========== IOT - 物联网模块 ========== + IOT_NET_TYPE = 'iot_net_type', // IOT 联网方式 + IOT_VALIDATE_TYPE = 'iot_validate_type', // IOT 数据校验级别 + IOT_PRODUCT_STATUS = 'iot_product_status', // IOT 产品状态 + IOT_PRODUCT_DEVICE_TYPE = 'iot_product_device_type', // IOT 产品设备类型 + IOT_DATA_FORMAT = 'iot_data_format', // IOT 数据格式 + IOT_PROTOCOL_TYPE = 'iot_protocol_type' // IOT 接入网关协议 } diff --git a/src/views/iot/product/ProductForm.vue b/src/views/iot/product/ProductForm.vue new file mode 100644 index 00000000..ca7a4134 --- /dev/null +++ b/src/views/iot/product/ProductForm.vue @@ -0,0 +1,203 @@ + + + + + + + + + + {{ dict.label }} + + + + + + + + + + + + + + + + + + + + + + {{ dict.label }} + + + + + + + + + 确 定 + 取 消 + + + + diff --git a/src/views/iot/product/detail/ProductDetailsHeader.vue b/src/views/iot/product/detail/ProductDetailsHeader.vue new file mode 100644 index 00000000..4314652b --- /dev/null +++ b/src/views/iot/product/detail/ProductDetailsHeader.vue @@ -0,0 +1,45 @@ + + + + + + + {{ product.name }} + + + + + + + 编辑 + + + + + + + {{ product.name }} + {{ product.identification }} + + + + + + + + + + + + diff --git a/src/views/iot/product/detail/ProductDetailsInfo.vue b/src/views/iot/product/detail/ProductDetailsInfo.vue new file mode 100644 index 00000000..ced4a98e --- /dev/null +++ b/src/views/iot/product/detail/ProductDetailsInfo.vue @@ -0,0 +1,37 @@ + + + + + + 基本信息 + + + {{ product.name }} + {{ product.identification }} + + + + + + + + + + + + + {{ product.description }} + + + + + + diff --git a/src/views/iot/product/detail/index.vue b/src/views/iot/product/detail/index.vue new file mode 100644 index 00000000..0a3bda5b --- /dev/null +++ b/src/views/iot/product/detail/index.vue @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + diff --git a/src/views/iot/product/index.vue b/src/views/iot/product/index.vue new file mode 100644 index 00000000..9e6d06a7 --- /dev/null +++ b/src/views/iot/product/index.vue @@ -0,0 +1,206 @@ + + + + + + + + + + + + 搜索 + 重置 + + 新增 + + + 导出 + + + + + + + + + + + + + + + + + + + + + + + + + 编辑 + + + 删除 + + + + + + + + + + + + +