diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index 3dbc001f..9932dfcf 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -7,6 +7,7 @@ export interface DeviceVO { deviceName: string // 设备名称 deviceType: string // 设备类型 status: string // 状态 + isConnect?: string | number readTopic: string // 读主题 writeTopic: string // 写主题 gatewayId: number // 网关id @@ -25,6 +26,11 @@ export interface DeviceVO { secretKey?: string // 秘钥 } +export interface DeviceConnectParams { + id: string | number + isConnect: string | number +} + // 物联设备 API export const DeviceApi = { // 查询物联设备分页 @@ -60,6 +66,10 @@ export const DeviceApi = { return await request.post({ url: `/iot/device/copy`, params: { id } }) }, + connectDevice: async (params: DeviceConnectParams) => { + return await request.post({ url: `/iot/device/connect`, data: params }) + }, + // 导出物联设备 Excel exportDevice: async (params) => { return await request.download({ url: `/iot/device/export-excel`, params }) @@ -89,10 +99,5 @@ export const DeviceApi = { // 获得设备属性 getDeviceAttribute: async (id: number) => { return await request.get({ url: `/iot/device-contact-model/get?id=` + id }) - }, - - // 导出设备属性 Excel - exportDeviceAttribute: async (params) => { - return await request.download({ url: `/iot/device-contact-model/export-excel`, params }) } } diff --git a/src/views/iot/device/components/DeviceAttributeList.vue b/src/views/iot/device/components/DeviceAttributeList.vue index 310d7814..2b7ce2e3 100644 --- a/src/views/iot/device/components/DeviceAttributeList.vue +++ b/src/views/iot/device/components/DeviceAttributeList.vue @@ -2,11 +2,13 @@ - - @@ -24,7 +26,8 @@ 新增 - 导出 @@ -36,7 +39,8 @@ - @@ -59,7 +63,8 @@ - - @@ -89,6 +95,7 @@ import { DICT_TYPE } from '@/utils/dict' import { dateFormatter } from '@/utils/formatTime' import download from '@/utils/download' import { DeviceApi } from '@/api/iot/device' +import { DeviceModelAttributeApi } from '@/api/iot/devicemodelattribute' import DeviceAttributeForm from './DeviceAttributeForm.vue' import { DeviceAttributeTypeApi, DeviceAttributeTypeVO } from '@/api/iot/deviceattributetype' @@ -226,7 +233,7 @@ const handleExport = async () => { try { await message.exportConfirm() exportLoading.value = true - const data = await DeviceApi.exportDeviceAttribute({ ids: selectedIds.value.join(',') }) + const data = await DeviceModelAttributeApi.exportDeviceModelAttribute({ ids: selectedIds.value.join(',') }) download.excel(data, '采集设备-点位管理.xls') } catch { } finally { diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 2cb22589..6703ad4e 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -137,7 +137,7 @@ - +