From 840adcafce289f94c19486061224076dbda6a74d Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Mon, 9 Jun 2025 17:19:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E7=9A=84=E5=88=97=E8=A1=A8=E5=92=8C=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/device/index.ts | 106 +++++------ src/utils/dict.ts | 5 +- src/views/devices/DetailsForm.vue | 168 +++++------------ src/views/devices/devices_cards.vue | 275 +++++++++++++++++----------- src/views/devices/index.vue | 110 +++++------ 5 files changed, 332 insertions(+), 332 deletions(-) diff --git a/src/api/device/index.ts b/src/api/device/index.ts index 51153f25..1cab5831 100644 --- a/src/api/device/index.ts +++ b/src/api/device/index.ts @@ -1,51 +1,55 @@ -import request from '@/config/axios' - -// 设备 VO -export interface DeviceVO { - id: number // 主键ID - devicename: string // 设备名称 - devicecode: string // 设备ID/编号 - devicetype: string // 设备类型 - location: string // 设备位置 - devicestatus: number // 设备状态(0:待激活 1 在线 2 离线 ,3 禁用 ) - orgid: number // 机构ID - orgname: string // 机构名称 - description: string // 设备描述 - createtime: Date // 创建时间 - updatetime: Date // 更新时间 - createby: string // 创建人 - updateby: string // 更新人 -} - -// 设备 API -export const DeviceApi = { - // 查询设备分页 - getDevicePage: async (params: any) => { - return await request.get({ url: `/system/device/page`, params }) - }, - - // 查询设备详情 - getDevice: async (id: number) => { - return await request.get({ url: `/system/device/get?id=` + id }) - }, - - // 新增设备 - createDevice: async (data: DeviceVO) => { - return await request.post({ url: `/system/device/create`, data }) - }, - - // 修改设备 - updateDevice: async (data: DeviceVO) => { - return await request.put({ url: `/system/device/update`, data }) - }, - - // 删除设备 - deleteDevice: async (id: number) => { - return await request.delete({ url: `/system/device/delete?id=` + id }) - }, - - // 导出设备 Excel - exportDevice: async (params) => { - return await request.download({ url: `/system/device/export-excel`, params }) - }, -} \ No newline at end of file +import request from '@/config/axios' + +// 设备 VO +export interface DeviceVO { + id: number // 主键ID + devicename: string // 设备名称 + devicecode: number // 设备ID/编号 + devicetype: string // 设备类型 + location: string // 设备位置 + devicestatus: number // 设备状态(0:待激活 1 在线 2 离线 ,3 禁用 ) + orgid: number // 机构ID + orgname: string // 机构名称 + description: string // 设备描述 + createtime: Date // 创建时间 + updatetime: Date // 更新时间 + createby: string // 创建人 + updateby: string // 更新人 +} + +// 设备 API +export const DeviceApi = { + // 查询设备分页 + getDevicePage: async (params: any) => { + return await request.get({ url: `/system/device/page`, params }) + }, + + // 查询设备详情 + getDevice: async (id: number) => { + return await request.get({ url: `/system/device/get?id=` + id }) + }, + // 查询设备详情 + getDeviceId: async (devicecode: number) => { + return await request.get({ url: `/system/device/getDeviceId?devicecode=` + devicecode }) + }, + + // 新增设备 + createDevice: async (data: DeviceVO) => { + return await request.post({ url: `/system/device/create`, data }) + }, + + // 修改设备 + updateDevice: async (data: DeviceVO) => { + return await request.put({ url: `/system/device/update`, data }) + }, + + // 删除设备 + deleteDevice: async (id: number) => { + return await request.delete({ url: `/system/device/delete?id=` + id }) + }, + + // 导出设备 Excel + exportDevice: async (params) => { + return await request.download({ url: `/system/device/export-excel`, params }) + }, +} diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 947f9f31..9cc686b5 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -244,5 +244,8 @@ export enum DICT_TYPE { IOT_PLUGIN_STATUS = 'iot_plugin_status', // IOT 插件状态 IOT_PLUGIN_TYPE = 'iot_plugin_type', // IOT 插件类型 IOT_DATA_BRIDGE_DIRECTION_ENUM = 'iot_data_bridge_direction_enum', // 桥梁方向 - IOT_DATA_BRIDGE_TYPE_ENUM = 'iot_data_bridge_type_enum' // 桥梁类型 + IOT_DATA_BRIDGE_TYPE_ENUM = 'iot_data_bridge_type_enum', // 桥梁类型 + //===================设备类型=================== + IOT_DEVICE_TYPE = 'iot_device_type', // 设备类型 + IOT_DEVICE_STATUS = 'iot_device_status', // 设备状态 } diff --git a/src/views/devices/DetailsForm.vue b/src/views/devices/DetailsForm.vue index 51a70292..06aab1af 100644 --- a/src/views/devices/DetailsForm.vue +++ b/src/views/devices/DetailsForm.vue @@ -8,25 +8,25 @@ :disabled="true" > - {{ formData.deviceKey }} + {{ formData.devicecode }} - {{ formData.deviceName }} + {{ formData.devicename }} - {{ getOrgName(formData.productId) }} + {{ formData.orgname }} - {{ getDeviceTypeName(formData.deviceType) }} + {{ getDeviceTypeName(formData.devicetype) }} - {{ formData.address }} + {{ formData.location }} - {{ getDeviceStateName(formData.state) }} + {{ getDeviceStatusName(formData.devicestatus) }} - {{ formData.description || '-' }} + {{ formData.description }} diff --git a/src/views/devices/devices_cards.vue b/src/views/devices/devices_cards.vue index bd29d6d5..875bb396 100644 --- a/src/views/devices/devices_cards.vue +++ b/src/views/devices/devices_cards.vue @@ -1,64 +1,77 @@ - diff --git a/src/views/devices/index.vue b/src/views/devices/index.vue index e830a3d4..439e7082 100644 --- a/src/views/devices/index.vue +++ b/src/views/devices/index.vue @@ -10,7 +10,7 @@ > + + @@ -82,60 +89,38 @@ @@ -185,4 +183,10 @@ onMounted(() => { gap: 20px; padding: 20px; } + +.pagination-container { + display: flex; + justify-content: center; + margin-top: 20px; +}