修改设备监测无字段时显示

dev
夜笙歌 5 months ago
parent adde2017b0
commit f53be7b70d

@ -198,11 +198,13 @@ export default {
this.treeData = data this.treeData = data
} }
}, },
treeClick(e) { async treeClick(e) {
if (!e.children?.length > 0) { if (!e.children?.length > 0) {
this.monitorUnitId = e.id this.monitorUnitId = e.id
this.getDevice(e.id)
this.setMonitorById(e)
await this.getDevice(e.id)
await this.setMonitorById(e)
this.show = true this.show = true
if (typeof getDeviceInterval === 'number') { if (typeof getDeviceInterval === 'number') {
clearInterval(getDeviceInterval) clearInterval(getDeviceInterval)

@ -65,7 +65,7 @@
<el-table-column v-for="i in deviceDataColumns" :key="i.columnName" :label="i.columnName" <el-table-column v-for="i in deviceDataColumns" :key="i.columnName" :label="i.columnName"
:prop="i.columnKey"> :prop="i.columnKey">
<template slot-scope="scope"> <template slot-scope="scope">
<el-image v-if="scope.row[i.columnKey].toString().includes('http')" <el-image v-if="(scope.row[i.columnKey] || '').toString().includes('http')"
:preview-src-list="[scope.row[i.columnKey]]" :src="scope.row[i.columnKey]" :preview-src-list="[scope.row[i.columnKey]]" :src="scope.row[i.columnKey]"
style="width: 100px; height: 100px"> style="width: 100px; height: 100px">
</el-image> </el-image>
@ -74,7 +74,8 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination v-show="!isMap" :currentPage="currentPage" :pageSize="10" :total="total" background <el-pagination v-show="!isMap && tableData.length>0" :currentPage="currentPage" :pageSize="10"
:total="total" background
layout="prev, pager, next" @current-change="currentChange"> layout="prev, pager, next" @current-change="currentChange">
</el-pagination> </el-pagination>
</div> </div>
@ -106,7 +107,8 @@
<div style="text-align: center;margin: 8px 0;"> <div style="text-align: center;margin: 8px 0;">
<el-button v-if="isMap" disabled type="primary" <el-button v-if="isMap" disabled type="primary"
@click="continueMap">已加载 {{ (mapOffset + 1) * 100 }} 总计 {{ mapTotal }} @click="continueMap">已加载
{{ ((mapOffset + 1) * 100 > mapTotal) ? mapTotal : ((mapOffset + 1) * 100) }} 总计 {{ mapTotal }}
</el-button> </el-button>
<el-button v-if="isMap" :disabled="mapTotal < (mapOffset + 1) * 100" type="primary" <el-button v-if="isMap" :disabled="mapTotal < (mapOffset + 1) * 100" type="primary"
@click="continueMap">继续加载 @click="continueMap">继续加载
@ -351,10 +353,9 @@ export default {
startTime: this.date?.[0], startTime: this.date?.[0],
endTime: this.date?.[1], endTime: this.date?.[1],
}) })
console.log(data)
let deviceDataColumns = data.deviceDataColumns let deviceDataColumns = data.deviceDataColumns
let dataList = data.historyData?.dataList || [] let dataList = data.historyData?.dataList || []
if (deviceDataColumns.filter(e => e.columnKey === 'longitude' || e.columnKey === '"latitude"').length >0) { if (deviceDataColumns.filter(e => e.columnKey === 'longitude' || e.columnKey === '"latitude"').length > 0 && dataList.length > 0) {
this.isMap = true this.isMap = true
this.mapTotal = data.historyData.count this.mapTotal = data.historyData.count
let mapData = dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('"latitude"'))).map(e => { let mapData = dataList.filter(e => (Object.keys(e).includes('longitude') || Object.keys(e).includes('"latitude"'))).map(e => {
@ -377,8 +378,10 @@ export default {
} else { } else {
this.tableData = data.historyData?.dataList this.tableData = data.historyData?.dataList
this.total = data.historyData?.count this.total = data.historyData?.count
// this.currentPage = 1 if (dataList.length > 0) {
this.deviceDataColumns = data.deviceDataColumns // this.currentPage = 1
this.deviceDataColumns = data.deviceDataColumns
}
this.$nextTick(() => { this.$nextTick(() => {
this.show = true this.show = true
}) })

Loading…
Cancel
Save