Skip to content

Commit 815c900

Browse files
committed
【功能优化】Bpm:完善设备属性的历史值
1 parent 736b82d commit 815c900

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

src/api/iot/device/device/index.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,27 +128,26 @@ export const DeviceApi = {
128128
return await request.get({ url: `/iot/device/simple-list?`, params: { deviceType } })
129129
},
130130

131-
// 获取设备属性最���数据
132-
getDevicePropertiesLatestData: async (params: any) => {
133-
return await request.get({ url: `/iot/device/data/latest`, params })
134-
},
135-
136-
// 获取设备属性历史数据
137-
getDevicePropertiesHistoryData: async (params: any) => {
138-
return await request.get({ url: `/iot/device/data/history`, params })
139-
},
140-
141131
// 获取导入模板
142132
importDeviceTemplate: async () => {
143133
return await request.download({ url: `/iot/device/get-import-template` })
144134
},
145135

146136
// 模拟设备上报
147137
simulationReportDevice: async (data: IotDeviceSimulationReportReqVO) => {
148-
// TODO @super:/iot/device/simulator
149138
return await request.post({ url: `/iot/device/simulation-report`, data })
150139
},
151140

141+
// 获取设备属性最新数据
142+
getLatestDeviceProperties: async (params: any) => {
143+
return await request.get({ url: `/iot/device/property/latest`, params })
144+
},
145+
146+
// 获取设备属性历史数据
147+
getHistoryDevicePropertyPage: async (params: any) => {
148+
return await request.get({ url: `/iot/device/property/history-page`, params })
149+
},
150+
152151
// 查询设备日志分页
153152
getDeviceLogPage: async (params: any) => {
154153
return await request.get({ url: `/iot/device/log/page`, params })

src/views/iot/device/device/detail/DeviceDataDetail.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
<el-table-column
3838
label="时间"
3939
align="center"
40-
prop="time"
40+
prop="updateTime"
4141
:formatter="dateFormatter"
4242
width="180px"
4343
/>
44-
<el-table-column label="原始值" align="center" prop="data" />
44+
<el-table-column label="属性值" align="center" prop="value" />
4545
</el-table>
4646
<!-- 分页 -->
4747
<Pagination
@@ -72,7 +72,7 @@ const queryParams = reactive({
7272
pageNo: 1,
7373
pageSize: 10,
7474
deviceId: -1,
75-
identifier: undefined as string | undefined,
75+
identifier: '',
7676
times: [
7777
// 默认显示最近一周的数据
7878
formatDate(beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7))),
@@ -85,7 +85,7 @@ const queryFormRef = ref() // 搜索的表单
8585
const getList = async () => {
8686
detailLoading.value = true
8787
try {
88-
const data = await DeviceApi.getDevicePropertiesHistoryData(queryParams)
88+
const data = await DeviceApi.getHistoryDevicePropertyPage(queryParams)
8989
list.value = data.list
9090
total.value = data.total
9191
} finally {
@@ -94,7 +94,7 @@ const getList = async () => {
9494
}
9595
9696
/** 打开弹窗 */
97-
const open = async (deviceId: number, identifier: String) => {
97+
const open = (deviceId: number, identifier: string) => {
9898
dialogVisible.value = true
9999
queryParams.deviceId = deviceId
100100
queryParams.identifier = identifier

src/views/iot/device/device/detail/DeviceDetailsModel.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<el-button
5858
link
5959
type="primary"
60-
@click="openDetail(scope.row.deviceId, scope.row.identifier)"
60+
@click="openDetail(props.device.id, scope.row.identifier)"
6161
>
6262
查看数据
6363
</el-button>
@@ -102,7 +102,7 @@ const getList = async () => {
102102
loading.value = true
103103
try {
104104
queryParams.deviceId = props.device.id
105-
list.value = await DeviceApi.getDevicePropertiesLatestData(queryParams)
105+
list.value = await DeviceApi.getLatestDeviceProperties(queryParams)
106106
} finally {
107107
loading.value = false
108108
}
@@ -123,7 +123,7 @@ const resetQuery = () => {
123123
124124
/** 添加/修改操作 */
125125
const detailRef = ref()
126-
const openDetail = (deviceId: number, identifier: String) => {
126+
const openDetail = (deviceId: number, identifier: string) => {
127127
detailRef.value.open(deviceId, identifier)
128128
}
129129

0 commit comments

Comments
 (0)