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}} + + + + + + + + + + + + + + + + + + +