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 }