From bc719acbcf9914859db8355784d88dab7c5f6227 Mon Sep 17 00:00:00 2001 From: hwj Date: Mon, 5 Jan 2026 14:54:12 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=8E=86=E5=8F=B2=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=9F=A5=E8=AF=A2-=E5=BC=B9=E6=A1=86=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/iot/device/index.ts | 10 + .../historyData/HistorySingleDeviceDialog.vue | 279 ++++++++++-------- src/views/iot/historyData/index.vue | 32 +- 3 files changed, 169 insertions(+), 152 deletions(-) diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index 234f3d4a..ca15f6fc 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -59,6 +59,12 @@ export interface SingleDeviceParams { deviceId: string | number } +export interface HistoryRecordParams { + deviceId: string | number + collectionStartTime?: string + collectionEndTime?: string +} + // 物联设备 API export const DeviceApi = { // 查询物联设备分页 @@ -111,6 +117,10 @@ export const DeviceApi = { return await request.get({ url: `/iot/device/singleDevice`, params }) }, + getHistoryRecord: async (params: HistoryRecordParams) => { + return await request.get({ url: `/iot/device/historyRecord`, params }) + }, + // ==================== 子表(设备属性) ==================== // 获得设备属性分页 diff --git a/src/views/iot/historyData/HistorySingleDeviceDialog.vue b/src/views/iot/historyData/HistorySingleDeviceDialog.vue index 29452385..123c5155 100644 --- a/src/views/iot/historyData/HistorySingleDeviceDialog.vue +++ b/src/views/iot/historyData/HistorySingleDeviceDialog.vue @@ -1,52 +1,52 @@ diff --git a/src/views/iot/historyData/index.vue b/src/views/iot/historyData/index.vue index 16138902..8d9e8a0d 100644 --- a/src/views/iot/historyData/index.vue +++ b/src/views/iot/historyData/index.vue @@ -43,17 +43,6 @@ class="!w-240px" /> - - - 搜索 @@ -87,7 +76,7 @@ @@ -102,8 +91,8 @@ @@ -125,15 +114,14 @@ const queryParams = reactive({ lineName: undefined as string | undefined, deviceCode: undefined as string | undefined, deviceName: undefined as string | undefined, - status: undefined as string | number | undefined, - collectionTimeRange: [] as string[] + status: undefined as string | number | undefined }) const queryFormRef = ref() const singleDialogVisible = ref(false) +const singleDeviceId = ref() const singleDeviceName = ref('') -const singleCollectionTime = ref() const buildQueryParams = (): LineDevicePageParams => { const params: LineDevicePageParams = { @@ -154,11 +142,6 @@ const buildQueryParams = (): LineDevicePageParams => { params.deviceName = queryParams.deviceName } - if (Array.isArray(queryParams.collectionTimeRange) && queryParams.collectionTimeRange.length === 2) { - params.collectionTimeStart = queryParams.collectionTimeRange[0] - params.collectionTimeEnd = queryParams.collectionTimeRange[1] - } - return params } @@ -180,13 +163,16 @@ const handleQuery = () => { const resetQuery = () => { queryFormRef.value?.resetFields() - queryParams.collectionTimeRange = [] handleQuery() } const handleSingleView = (row: LineDeviceVO) => { + const deviceId = (row as any)?.deviceId ?? row?.id + if (deviceId === undefined || deviceId === null || deviceId === '') { + return + } + singleDeviceId.value = deviceId singleDeviceName.value = row.deviceName || '' - singleCollectionTime.value = (row as any).collectionTime singleDialogVisible.value = true }