设备监控-准实时数据上面修改

This commit is contained in:
GGJ
2024-11-26 16:47:03 +08:00
parent affaafea83
commit 0898cd20d3
5 changed files with 67 additions and 30 deletions

View File

@@ -149,8 +149,7 @@
统计时间:{{ tableData[0]?.time || '' }}
</div>
<nearRealTimeData ref="nearRealTimeDataRef" v-if="dataSet.indexOf('_history') == -1"
/>
<nearRealTimeData ref="nearRealTimeDataRef" v-if="dataSet.indexOf('_history') == -1" />
<!-- 循环渲染的card 最新数据/历史数据显示 -->
@@ -328,6 +327,11 @@
v-loading="tableLoading">
<Event ref="eventRef"></Event>
</div>
<!-- 测试项记录 -->
<div style="height: calc(100vh - 340px)" v-if="dataSet.indexOf('_items') != -1"
v-loading="tableLoading">
<!-- <Event ref="eventRef"></Event> -->
</div>
<div v-if="!tableData" style="height: 42px"></div>
</el-tabs>
</div>
@@ -563,6 +567,12 @@ const deviceId: any = ref('')
const lineId: any = ref('')
const dataLevel: any = ref('')
const nodeClick = async (e: anyObj) => {
await queryDictType({
lineId: e?.id
}).then(res => {
queryList.value = res.data
formInline.targetType = res.data[0].id
})
// console.log("🚀 ~ nodeClick ~ e:", e)
if (e.level == 2) return
deviceId.value = e?.pid
@@ -607,6 +617,9 @@ const nodeClick = async (e: anyObj) => {
if (item.type === 'event') {
item.id = item.id + '_event'
}
if (item.type === 'items') {
item.id = item.id + '_items'
}
})
res.data.dataSetList = res.data.dataSetList.filter((item: any) => item.name != '历史统计数据')
//便携式设备默认二次值
@@ -933,11 +946,9 @@ const handleClick = async (tab?: any) => {
tableLoading.value = false
}, 1500)
}
//查询当前指标
if (!dataSet.value.includes('_')) {
//测试项记录
if (dataSet.value.includes('_items')) {
formInline.id = dataSet.value
console.log("🚀 ~ handleClick ~ formInline:", formInline)
// await deviceRtData(formInline)
await realTimeData(formInline)
.then((res: any) => {
@@ -945,7 +956,7 @@ const handleClick = async (tab?: any) => {
formInline.total = res.data.total
tableLoading.value = false
setTimeout(() => { //targetType
nearRealTimeDataRef.value.setData(res.data, queryList.value.filter((item: any) => item.id == formInline.targetType))
nearRealTimeDataRef.value?.setData(res.data, queryList.value.filter((item: any) => item.id == formInline.targetType))
}, 500)
setTimeout(() => {
@@ -958,6 +969,32 @@ const handleClick = async (tab?: any) => {
}, 1500)
})
}
//查询当前指标
if (!dataSet.value.includes('_')) {
formInline.id = dataSet.value
// await deviceRtData(formInline)
await realTimeData(formInline)
.then((res: any) => {
tableData.value = res.data
formInline.total = res.data.total
tableLoading.value = false
setTimeout(() => { //targetType
nearRealTimeDataRef.value?.setData(res.data, queryList.value.filter((item: any) => item.id == formInline.targetType))
}, 500)
setTimeout(() => {
loading.value = false
}, 1500)
})
.catch(e => {
setTimeout(() => {
tableLoading.value = false
}, 1500)
})
}
if (!dataSet.value.includes('_realtimedata')) {
if (realDataTimer.value) {
window.clearInterval(realDataTimer.value)
@@ -1009,10 +1046,7 @@ queryByCode('Device_Type').then(res => {
})
})
const queryList: any = ref([])
queryDictType().then(res => {
queryList.value = res.data
formInline.targetType = res.data[0].id
})
const echoName = (value: any, arr: any[]) => {
return value ? arr.find(item => item.value == value)?.label : '/'
}