【功能优化】Bpm:完善设备属性的历史值

This commit is contained in:
YunaiV 2025-01-28 10:23:58 +08:00
parent 736b82de18
commit 815c900064
3 changed files with 18 additions and 19 deletions

View File

@ -128,16 +128,6 @@ export const DeviceApi = {
return await request.get({ url: `/iot/device/simple-list?`, params: { deviceType } })
},
// 获取设备属性最<E680A7><E69C80><EFBFBD>数据
getDevicePropertiesLatestData: async (params: any) => {
return await request.get({ url: `/iot/device/data/latest`, params })
},
// 获取设备属性历史数据
getDevicePropertiesHistoryData: async (params: any) => {
return await request.get({ url: `/iot/device/data/history`, params })
},
// 获取导入模板
importDeviceTemplate: async () => {
return await request.download({ url: `/iot/device/get-import-template` })
@ -145,10 +135,19 @@ export const DeviceApi = {
// 模拟设备上报
simulationReportDevice: async (data: IotDeviceSimulationReportReqVO) => {
// TODO @super/iot/device/simulator
return await request.post({ url: `/iot/device/simulation-report`, data })
},
// 获取设备属性最新数据
getLatestDeviceProperties: async (params: any) => {
return await request.get({ url: `/iot/device/property/latest`, params })
},
// 获取设备属性历史数据
getHistoryDevicePropertyPage: async (params: any) => {
return await request.get({ url: `/iot/device/property/history-page`, params })
},
// 查询设备日志分页
getDeviceLogPage: async (params: any) => {
return await request.get({ url: `/iot/device/log/page`, params })

View File

@ -37,11 +37,11 @@
<el-table-column
label="时间"
align="center"
prop="time"
prop="updateTime"
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="原始值" align="center" prop="data" />
<el-table-column label="属性值" align="center" prop="value" />
</el-table>
<!-- 分页 -->
<Pagination
@ -72,7 +72,7 @@ const queryParams = reactive({
pageNo: 1,
pageSize: 10,
deviceId: -1,
identifier: undefined as string | undefined,
identifier: '',
times: [
//
formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7))),
@ -85,7 +85,7 @@ const queryFormRef = ref() // 搜索的表单
const getList = async () => {
detailLoading.value = true
try {
const data = await DeviceApi.getDevicePropertiesHistoryData(queryParams)
const data = await DeviceApi.getHistoryDevicePropertyPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
@ -94,7 +94,7 @@ const getList = async () => {
}
/** 打开弹窗 */
const open = async (deviceId: number, identifier: String) => {
const open = (deviceId: number, identifier: string) => {
dialogVisible.value = true
queryParams.deviceId = deviceId
queryParams.identifier = identifier

View File

@ -57,7 +57,7 @@
<el-button
link
type="primary"
@click="openDetail(scope.row.deviceId, scope.row.identifier)"
@click="openDetail(props.device.id, scope.row.identifier)"
>
查看数据
</el-button>
@ -102,7 +102,7 @@ const getList = async () => {
loading.value = true
try {
queryParams.deviceId = props.device.id
list.value = await DeviceApi.getDevicePropertiesLatestData(queryParams)
list.value = await DeviceApi.getLatestDeviceProperties(queryParams)
} finally {
loading.value = false
}
@ -123,7 +123,7 @@ const resetQuery = () => {
/** 添加/修改操作 */
const detailRef = ref()
const openDetail = (deviceId: number, identifier: String) => {
const openDetail = (deviceId: number, identifier: string) => {
detailRef.value.open(deviceId, identifier)
}