From 5e3c0a953a42df105529048f0339894ee7b1337b Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Sat, 4 Jan 2025 21:47:34 +0800 Subject: [PATCH] =?UTF-8?q?perf(iot=E4=BA=A7=E5=93=81=E5=92=8C=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97):=20=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=E4=BA=A7=E5=93=81=E5=92=8C=E8=AE=BE=E5=A4=87=E7=9A=84?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device.ts | 8 +- src/api/product.ts | 9 +- src/router/routes/modules/iot.ts | 22 +- .../iot/device/components/device-edit.vue | 241 +++++------ src/views/iot/device/index.vue | 26 +- src/views/iot/product/index.vue | 392 ++++++++++++++++++ 6 files changed, 537 insertions(+), 161 deletions(-) diff --git a/src/api/device.ts b/src/api/device.ts index d4ceacb..aa26e7e 100644 --- a/src/api/device.ts +++ b/src/api/device.ts @@ -22,6 +22,10 @@ export interface DeviceCreateRecord { productId: number; } +export interface DeviceUpdateRecord extends DeviceCreateRecord { + id: number; +} + export interface DeviceEventRecord { id: number; clientId: string; @@ -49,8 +53,8 @@ export function createDevice(data: DeviceCreateRecord) { } // 修改 -export function updateDevice(id: number, data: DeviceCreateRecord) { - return axios.put(`/api/rest/device/${id}`, data); +export function updateDevice(data:DeviceUpdateRecord) { + return axios.put(`/api/rest/device/${data.id}`, data); } // 删除 export function deleteDevice(id: number) { diff --git a/src/api/product.ts b/src/api/product.ts index 3a841e0..c71d190 100644 --- a/src/api/product.ts +++ b/src/api/product.ts @@ -23,6 +23,11 @@ export interface ProductCreateRecord { }]; } +export interface ProductUpdateRecord extends ProductCreateRecord { + id: number; + productType: string; +} + // 分页查询 export function queryProductList(data: ProductRecord) { @@ -52,8 +57,8 @@ export function createProduct(data: ProductCreateRecord) { } // 修改 -export function updateProduct(id: number, data: ProductCreateRecord){ - return axios.patch(`/api/rest/product/${id}`, data); +export function updateProduct(data: ProductUpdateRecord){ + return axios.patch(`/api/rest/product/${data.id}`, data); } // 删除 diff --git a/src/router/routes/modules/iot.ts b/src/router/routes/modules/iot.ts index d5067ef..698c191 100644 --- a/src/router/routes/modules/iot.ts +++ b/src/router/routes/modules/iot.ts @@ -13,17 +13,6 @@ const IOT: AppRouteRecordRaw = { order: 1, }, children: [ - { - path: 'device', - name: 'Device', - component: () => import('@/views/iot/device/index.vue'), - meta: { - // locale: 'menu.system.role', - title: '设备管理', - requiresAuth: true, - permissions: ['*'], - }, - }, { path: 'product', name: 'Product', @@ -35,6 +24,17 @@ const IOT: AppRouteRecordRaw = { permissions: ['*'], }, }, + { + path: 'device', + name: 'Device', + component: () => import('@/views/iot/device/index.vue'), + meta: { + // locale: 'menu.system.role', + title: '设备管理', + requiresAuth: true, + permissions: ['*'], + }, + } ], }; diff --git a/src/views/iot/device/components/device-edit.vue b/src/views/iot/device/components/device-edit.vue index 368b786..540db64 100644 --- a/src/views/iot/device/components/device-edit.vue +++ b/src/views/iot/device/components/device-edit.vue @@ -20,7 +20,77 @@ @cancel="handleCancel" > - + + + + + {{item}} + + + + + + + + + + + + + + + + + + +