rev 优化舞台监控
This commit is contained in:
@@ -166,7 +166,7 @@ import deviceCrud from '@/api/acs/device/device'
|
|||||||
import { getDeviceByCodes } from '@/api/acs/device/deviceStageMonitor'
|
import { getDeviceByCodes } from '@/api/acs/device/deviceStageMonitor'
|
||||||
import '@logicflow/core/dist/style/index.css'
|
import '@logicflow/core/dist/style/index.css'
|
||||||
import '@logicflow/extension/lib/style/index.css'
|
import '@logicflow/extension/lib/style/index.css'
|
||||||
|
import {isEqual} from "lodash"
|
||||||
import { LogicFlow } from '@logicflow/core'
|
import { LogicFlow } from '@logicflow/core'
|
||||||
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
|
import { registerCustomElement } from '@/views/system/logicflow/editor/components/node'
|
||||||
|
|
||||||
@@ -789,35 +789,60 @@ export default {
|
|||||||
let resion = {}
|
let resion = {}
|
||||||
resion = lf.getGraphData().nodes.map(item => ({ id: item.id, device_code: item.properties.device }))
|
resion = lf.getGraphData().nodes.map(item => ({ id: item.id, device_code: item.properties.device }))
|
||||||
getDeviceByCodes(resion).then(res => {
|
getDeviceByCodes(resion).then(res => {
|
||||||
console.log(res)
|
let startTime=new Date().getTime();
|
||||||
|
let arr=[];
|
||||||
|
let obj={};
|
||||||
|
if(window.lastArr){
|
||||||
|
res.forEach(i=>{
|
||||||
|
obj[i.id]=i
|
||||||
|
})
|
||||||
|
|
||||||
|
window.lastArr.forEach(old=>{
|
||||||
|
let _new=obj[old.id];
|
||||||
|
if(!isEqual(old,_new)){
|
||||||
|
arr.push(_new)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
this.allDeviceMsg = res // 拿到所有节点的设备数据
|
this.allDeviceMsg = res // 拿到所有节点的设备数据
|
||||||
// console.log('initStatus-res', res)
|
// console.log('initStatus-res', res)
|
||||||
// 实时设置状态信息
|
// 实时设置状态信息
|
||||||
for (var item of res) { // 循环并且设置属性值
|
for (var item of arr) { // 循环并且设置属性值
|
||||||
|
|
||||||
|
let temp={}
|
||||||
if (item.data !== undefined) {
|
if (item.data !== undefined) {
|
||||||
if (item.data.isOnline !== undefined) {
|
if (item.data.isOnline !== undefined) {
|
||||||
lf.setProperties(item.id, {
|
temp.isOnline = item.data.isOnline
|
||||||
isOnline: item.data.isOnline
|
// lf.setProperties(item.id, {
|
||||||
})
|
// isOnline: item.data.isOnline
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
if (item.data.hasGoods !== undefined) {
|
if (item.data.hasGoods !== undefined) {
|
||||||
lf.setProperties(item.id, {
|
temp.hasGoods = item.data.hasGoods
|
||||||
hasGoods: item.data.hasGoods
|
// lf.setProperties(item.id, {
|
||||||
})
|
// hasGoods: item.data.hasGoods
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
if (item.data.isError !== undefined) {
|
if (item.data.isError !== undefined) {
|
||||||
lf.setProperties(item.id, {
|
temp.isError = item.data.isError
|
||||||
isError: item.data.isError
|
// lf.setProperties(item.id, {
|
||||||
})
|
// isError: item.data.isError
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
lf.setProperties(item.id , temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
window.lastArr = res
|
||||||
// 设置动态实时显示设备信息
|
// 设置动态实时显示设备信息
|
||||||
const { nodes } = lf.getSelectElements() // 获取选中的节点
|
const { nodes } = lf.getSelectElements() // 获取选中的节点
|
||||||
// console.log(nodes)
|
// console.log(nodes)
|
||||||
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
|
if (nodes.length === 1) { // 因为是定时器,没有选中则不用实时更新显示数据
|
||||||
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
|
this.moveShow(nodes[0]) // 监控模式下不可能托选,因此就只有一个数据
|
||||||
}
|
}
|
||||||
|
let endTime=new Date().getTime();
|
||||||
|
|
||||||
|
console.log("time:",endTime - startTime)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
dialogSave() {
|
dialogSave() {
|
||||||
|
|||||||
Reference in New Issue
Block a user