Commit fec0753d by YunaiV

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

parent 815c9000
<!-- TODO 芋艿:待 review -->
<!-- 设备物模型 -> 运行状态 -> 查看数据(设备的属性值历史)-->
<template>
<Dialog title="查看数据" v-model="dialogVisible">
<ContentWrap>
......@@ -32,6 +32,9 @@
</el-form-item>
</el-form>
</ContentWrap>
<!-- TODO @haohao:可参考阿里云 IoT,改成“图标”、“表格”两个选项 -->
<!-- 列表 -->
<ContentWrap>
<el-table v-loading="detailLoading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<el-table-column
......
......@@ -34,10 +34,10 @@
</el-form>
<!-- 日志列表 -->
<el-table v-loading="loading" :data="logList" :stripe="true" class="whitespace-nowrap">
<el-table-column label="时间" align="center" prop="time" width="180">
<el-table v-loading="loading" :data="list" :stripe="true" class="whitespace-nowrap">
<el-table-column label="时间" align="center" prop="ts" width="180">
<template #default="scope">
{{ formatDate(scope.row.time) }}
{{ formatDate(scope.row.ts) }}
</template>
</el-table-column>
<el-table-column label="类型" align="center" prop="type" width="120" />
......@@ -78,7 +78,7 @@ const queryParams = reactive({
// 列表数据
const loading = ref(false)
const total = ref(0)
const logList = ref([]) // TODO @super:logList -> list,简洁一点。因为当前就一个 table 哈
const list = ref([])
const autoRefresh = ref(false)
let timer: any = null // TODO @super:autoRefreshEnable,autoRefreshTimer;对应上
......@@ -96,18 +96,9 @@ const getLogList = async () => {
if (!props.deviceKey) return
loading.value = true
try {
const res = await DeviceApi.getDeviceLogPage(queryParams)
total.value = res.total
// TODO @super:尽量不转换
logList.value = res.list.map((item: any) => {
const log = {
time: item.reportTime,
type: item.type,
subType: item.subType,
content: item.content
}
return log
})
const data = await DeviceApi.getDeviceLogPage(queryParams)
total.value = data.total
list.value = data.list
} finally {
loading.value = false
}
......
......@@ -44,6 +44,7 @@
<el-table-column label="属性标识符" align="center" prop="identifier" />
<el-table-column label="属性名称" align="center" prop="name" />
<el-table-column label="数据类型" align="center" prop="dataType" />
<el-table-column label="属性值" align="center" prop="value" />
<el-table-column
label="更新时间"
align="center"
......@@ -51,7 +52,6 @@
:formatter="dateFormatter"
width="180px"
/>
<el-table-column label="最新值" align="center" prop="value" />
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button
......@@ -59,7 +59,7 @@
type="primary"
@click="openDetail(props.device.id, scope.row.identifier)"
>
查看数据
历史
</el-button>
</template>
</el-table-column>
......
......@@ -75,6 +75,6 @@ onMounted(async () => {
return
}
await getDeviceData(id)
activeTab.value = route.query.tab as string
activeTab.value = (route.query.tab as string) || 'info'
})
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment