diff --git a/src/api/iot/device/index.ts b/src/api/iot/device/index.ts index de0fb6b2..ca15f6fc 100644 --- a/src/api/iot/device/index.ts +++ b/src/api/iot/device/index.ts @@ -51,6 +51,18 @@ export interface LineDevicePageParams { deviceName?: string status?: string | number collectionTime?: string | number + collectionTimeStart?: string + collectionTimeEnd?: string +} + +export interface SingleDeviceParams { + deviceId: string | number +} + +export interface HistoryRecordParams { + deviceId: string | number + collectionStartTime?: string + collectionEndTime?: string } // 物联设备 API @@ -101,6 +113,14 @@ export const DeviceApi = { return await request.get({ url: `/iot/device/lineDevicePage`, params }) }, + getSingleDevice: async (params: SingleDeviceParams) => { + 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/device/components/DeviceAttributeList.vue b/src/views/iot/device/components/DeviceAttributeList.vue index 2b7ce2e3..8c55bc14 100644 --- a/src/views/iot/device/components/DeviceAttributeList.vue +++ b/src/views/iot/device/components/DeviceAttributeList.vue @@ -56,16 +56,20 @@ ref="tableRef" v-loading="loading" :data="list" :stripe="true" :show-overflow-to - + - {{ scope.row.latestValue ?? '-' }} + {{ formatAddressValue(scope.row.addressValue) }} + label="最新采集时间" + align="center" + prop="latestCollectionTime" + :formatter="dateFormatter" + width="170px" + /> {{ scope.row.sort ?? '-' }} @@ -126,6 +130,16 @@ const queryFormRef = ref() const exportLoading = ref(false) +const formatAddressValue = (value: unknown) => { + if (value === null || value === undefined) { + return '-' + } + if (typeof value === 'string' || typeof value === 'number') { + return value + } + return '' +} + const selectedIds = ref([]) const handleSelectionChange = (rows: any[]) => { selectedIds.value = rows?.map((row) => row.id).filter((id) => id !== undefined) ?? [] diff --git a/src/views/iot/device/index.vue b/src/views/iot/device/index.vue index 0f7a901f..76ce27b0 100644 --- a/src/views/iot/device/index.vue +++ b/src/views/iot/device/index.vue @@ -3,11 +3,13 @@ - - @@ -48,7 +50,8 @@ 新增 - 导出 @@ -61,7 +64,8 @@ - @@ -71,7 +75,7 @@ --> - + @@ -81,7 +85,7 @@ - + - + @@ -120,7 +124,8 @@ 编辑 - {{ isRowConnected(scope.row) ? '断开连接' : '连接' }} @@ -131,7 +136,8 @@ - @@ -339,20 +345,9 @@ const handleToggleConnect = async (row: DeviceVO) => { } } -let timer: any = null; /** 初始化 **/ onMounted(() => { getList() - timer = setInterval(async () => { - const data = await DeviceApi.getDevicePage(queryParams) - list.value = data.list - total.value = data.total - }, 5000); -}) -// 组件卸载时销毁图表 -onUnmounted(() => { - if (timer) { - clearInterval(timer); - } }) + diff --git a/src/views/iot/deviceParamAnalysis/index.vue b/src/views/iot/deviceParamAnalysis/index.vue new file mode 100644 index 00000000..731424a0 --- /dev/null +++ b/src/views/iot/deviceParamAnalysis/index.vue @@ -0,0 +1,315 @@ + + + + + + + + + + + + + + + + + + + + 搜索 + + + 重置 + + + + + + + + + + + + + + + + + + + diff --git a/src/views/iot/devicemodel/components/ModelAttributeList.vue b/src/views/iot/devicemodel/components/ModelAttributeList.vue index defc8605..83e6a8a2 100644 --- a/src/views/iot/devicemodel/components/ModelAttributeList.vue +++ b/src/views/iot/devicemodel/components/ModelAttributeList.vue @@ -3,11 +3,13 @@ - - @@ -45,7 +47,8 @@ 新增 - 导出 @@ -59,7 +62,8 @@ - @@ -75,7 +79,8 @@ - 编辑 @@ -86,7 +91,8 @@ - diff --git a/src/views/iot/devicemodel/index.vue b/src/views/iot/devicemodel/index.vue index f81da142..d7de7ec8 100644 --- a/src/views/iot/devicemodel/index.vue +++ b/src/views/iot/devicemodel/index.vue @@ -3,17 +3,20 @@ - - - @@ -51,7 +54,8 @@ 批量删除 - 导出 @@ -61,7 +65,8 @@ - @@ -79,7 +84,8 @@ 复制 - 编辑 @@ -90,7 +96,8 @@ - diff --git a/src/views/iot/historyData/HistorySingleDeviceDialog.vue b/src/views/iot/historyData/HistorySingleDeviceDialog.vue new file mode 100644 index 00000000..d2d668e3 --- /dev/null +++ b/src/views/iot/historyData/HistorySingleDeviceDialog.vue @@ -0,0 +1,266 @@ + + + + + + + + + 查询 + 重置 + + + + + + + 采集时间:{{ group.collectTime || '-' }} + + + + + {{ section.title }} + + + + + + {{ formatCell(scope.row[col.prop]) }} + + + + + + + + + + + + + + + + + diff --git a/src/views/iot/historyData/index.vue b/src/views/iot/historyData/index.vue new file mode 100644 index 00000000..8d9e8a0d --- /dev/null +++ b/src/views/iot/historyData/index.vue @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + 搜索 + + + 重置 + + + + + + + + + + + + + + + + 历史记录 + + + + + + + + + + + diff --git a/src/views/iot/realTimeMonitoring/SingleDeviceMonitorDialog.vue b/src/views/iot/realTimeMonitoring/SingleDeviceMonitorDialog.vue new file mode 100644 index 00000000..20a6f8ed --- /dev/null +++ b/src/views/iot/realTimeMonitoring/SingleDeviceMonitorDialog.vue @@ -0,0 +1,215 @@ + + + + + 设备名称:{{ deviceName || '-' }} + 采集时间:{{ displayTime }} + + + + + + {{ section.title }} + + + + + + {{ formatCell(scope.row[col.prop]) }} + + + + + + + + + + + + + + diff --git a/src/views/iot/realTimeMonitoring/index.vue b/src/views/iot/realTimeMonitoring/index.vue index b97ce46b..f5accc16 100644 --- a/src/views/iot/realTimeMonitoring/index.vue +++ b/src/views/iot/realTimeMonitoring/index.vue @@ -3,39 +3,23 @@ +v-model="queryParams.lineNode" placeholder="请输入产线编码" clearable @keyup.enter="handleQuery" + class="!w-240px" /> +v-model="queryParams.lineName" placeholder="请输入产线名称" clearable @keyup.enter="handleQuery" + class="!w-240px" /> +v-model="queryParams.deviceCode" placeholder="请输入设备编码" clearable @keyup.enter="handleQuery" + class="!w-240px" /> +v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" + class="!w-240px" /> @@ -49,13 +33,7 @@ - + @@ -65,13 +43,7 @@ - + 单设备监控 @@ -79,50 +51,28 @@ +:total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" + @pagination="getList" /> - - - - - - - - - {{ scope.row.latestValue === null ? 'null' : scope.row.latestValue }} - - - - - - - +