|
|
|
@ -170,7 +170,7 @@ export default {
|
|
|
|
|
console.log(this.role);
|
|
|
|
|
this.getRadio(); //获取列表在线离线全部
|
|
|
|
|
this.getLineTreeList(); //获取树状图
|
|
|
|
|
this.treeStatustimer = setInterval(this.getLineTreeStatus, 60000); // 每10秒刷新数据
|
|
|
|
|
this.treeStatustimer = setInterval(this.getLineTreeStatus, 60000); // 每60秒刷新数据
|
|
|
|
|
EventBus.$on("treelist", this.getLineTreeStatus);
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
@ -188,27 +188,60 @@ export default {
|
|
|
|
|
if (this.filterText !== "") {
|
|
|
|
|
this.$refs.tree.filter(this.filterText);
|
|
|
|
|
} else {
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
this.isfavorList = res.data.favorlist;
|
|
|
|
|
this.lineTreeData.unshift({
|
|
|
|
|
id: 0,
|
|
|
|
|
name: "收藏夹",
|
|
|
|
|
bsManufacturer: "收藏夹",
|
|
|
|
|
list: this.isfavorList,
|
|
|
|
|
if (this.role == 4) {
|
|
|
|
|
getzzdyTreeList({ type: this.zzradio, lineid: 127 })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
if (this.zzradio == 0) {
|
|
|
|
|
console.log("装置为离线");
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
console.log(this.lineTreeData);
|
|
|
|
|
this.currentData = this.lineTreeData[0];
|
|
|
|
|
console.log(this.currentData);
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentData.id); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
this.scrollView();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentData.id); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
this.scrollView();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentData.id); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
} else {
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
this.isfavorList = res.data.favorlist;
|
|
|
|
|
this.lineTreeData.unshift({
|
|
|
|
|
id: 0,
|
|
|
|
|
name: "收藏夹",
|
|
|
|
|
bsManufacturer: "收藏夹",
|
|
|
|
|
list: this.isfavorList,
|
|
|
|
|
});
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(
|
|
|
|
|
localStorage.getItem("currentData")
|
|
|
|
|
);
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentData.id); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleFilter() {
|
|
|
|
@ -231,55 +264,100 @@ export default {
|
|
|
|
|
//获取树状图列表
|
|
|
|
|
getLineTreeList() {
|
|
|
|
|
console.log(this.zzradio);
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
this.isfavorList = res.data.favorlist;
|
|
|
|
|
this.lineTreeData.unshift({
|
|
|
|
|
id: 0,
|
|
|
|
|
name: "收藏夹",
|
|
|
|
|
bsManufacturer: "收藏夹",
|
|
|
|
|
list: this.isfavorList,
|
|
|
|
|
});
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
this.lineTreeData.forEach((node) => {
|
|
|
|
|
if (node.list) {
|
|
|
|
|
node.list.forEach((child) => {
|
|
|
|
|
this.defaultExpandedKeys.push(child.id);
|
|
|
|
|
});
|
|
|
|
|
if (this.role == 4) {
|
|
|
|
|
getzzdyTreeList({ type: this.zzradio, lineid: 127 })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
this.lineTreeData.forEach((node) => {
|
|
|
|
|
if (node.list) {
|
|
|
|
|
node.list.forEach((child) => {
|
|
|
|
|
this.defaultExpandedKeys.push(child.id);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.defaultExpandedKeys.push(node.id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.defaultExpandedKeys =
|
|
|
|
|
JSON.parse(localStorage.getItem("defaultKey")) !== null
|
|
|
|
|
? JSON.parse(localStorage.getItem("defaultKey"))
|
|
|
|
|
: []; //获取保存的defaultKey ;
|
|
|
|
|
|
|
|
|
|
console.log(this.defaultExpandedKeys);
|
|
|
|
|
if (this.lineTreeData[0].list[0].list.length > 0) {
|
|
|
|
|
}
|
|
|
|
|
if (
|
|
|
|
|
this.currentData !== null &&
|
|
|
|
|
Object.keys(this.currentData).length !== 0
|
|
|
|
|
) {
|
|
|
|
|
this.currentNodekey = this.currentData.id;
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
} else {
|
|
|
|
|
this.defaultExpandedKeys.push(node.id);
|
|
|
|
|
this.currentData = this.lineTreeData[0]; //第一个选中的数据
|
|
|
|
|
this.currentNodekey = this.lineTreeData[0].id; //第一个数据
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
}
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
this.scrollView();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
this.defaultExpandedKeys =
|
|
|
|
|
JSON.parse(localStorage.getItem("defaultKey")) !== null
|
|
|
|
|
? JSON.parse(localStorage.getItem("defaultKey"))
|
|
|
|
|
: this.defaultExpandedKeys; //获取保存的defaultKey ;
|
|
|
|
|
} else {
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
this.isfavorList = res.data.favorlist;
|
|
|
|
|
this.lineTreeData.unshift({
|
|
|
|
|
id: 0,
|
|
|
|
|
name: "收藏夹",
|
|
|
|
|
bsManufacturer: "收藏夹",
|
|
|
|
|
list: this.isfavorList,
|
|
|
|
|
});
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
this.lineTreeData.forEach((node) => {
|
|
|
|
|
if (node.list) {
|
|
|
|
|
node.list.forEach((child) => {
|
|
|
|
|
this.defaultExpandedKeys.push(child.id);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.defaultExpandedKeys.push(node.id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.defaultExpandedKeys =
|
|
|
|
|
JSON.parse(localStorage.getItem("defaultKey")) !== null
|
|
|
|
|
? JSON.parse(localStorage.getItem("defaultKey"))
|
|
|
|
|
: this.defaultExpandedKeys; //获取保存的defaultKey ;
|
|
|
|
|
|
|
|
|
|
console.log(this.defaultExpandedKeys);
|
|
|
|
|
// if (this.lineTreeData[0].list[0].list.length > 0) {
|
|
|
|
|
// }
|
|
|
|
|
if (
|
|
|
|
|
this.currentData !== null &&
|
|
|
|
|
Object.keys(this.currentData).length !== 0
|
|
|
|
|
) {
|
|
|
|
|
this.currentNodekey = this.currentData.id;
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
} else {
|
|
|
|
|
this.currentData = this.lineTreeData[0]; //第一个选中的数据
|
|
|
|
|
this.currentNodekey = this.lineTreeData[0].id; //第一个数据
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
}
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
this.scrollView();
|
|
|
|
|
console.log(this.defaultExpandedKeys);
|
|
|
|
|
// if (this.lineTreeData[0].list[0].list.length > 0) {
|
|
|
|
|
// }
|
|
|
|
|
if (
|
|
|
|
|
this.currentData !== null &&
|
|
|
|
|
Object.keys(this.currentData).length !== 0
|
|
|
|
|
) {
|
|
|
|
|
this.currentNodekey = this.currentData.id;
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
} else {
|
|
|
|
|
this.currentData = this.lineTreeData[1]; //第一个选中的数据
|
|
|
|
|
this.currentNodekey = this.lineTreeData[1].id; //第一个数据
|
|
|
|
|
this.handleNodeClick(this.currentData);
|
|
|
|
|
}
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
this.scrollView();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//点击当前选中的treenode
|
|
|
|
|