|
|
|
@ -22,10 +22,17 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div class="radioFilter">
|
|
|
|
|
<el-radio-group v-model="zzradio" @input="getRadio">
|
|
|
|
|
<el-radio label="-1">全部</el-radio>
|
|
|
|
|
<el-radio label="1">在线</el-radio>
|
|
|
|
|
<el-radio label="2">离线</el-radio>
|
|
|
|
|
<el-radio :label="-1">全部</el-radio>
|
|
|
|
|
<el-radio :label="1">在线</el-radio>
|
|
|
|
|
<el-radio :label="0">离线</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
<el-button
|
|
|
|
|
class="refresh"
|
|
|
|
|
@click="getLineTreeStatus"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-refresh-right"
|
|
|
|
|
>刷新</el-button
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<el-tree
|
|
|
|
|
ref="tree"
|
|
|
|
@ -376,7 +383,7 @@ export default {
|
|
|
|
|
selectLineId: "",
|
|
|
|
|
selectTowerId: "",
|
|
|
|
|
currentData: "", //保存选中的数据
|
|
|
|
|
zzradio: "-1",
|
|
|
|
|
zzradio: -1,
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
@ -393,6 +400,8 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
//获取日期
|
|
|
|
|
this.zzradio = JSON.parse(localStorage.getItem("radio"));
|
|
|
|
|
this.getRadio();
|
|
|
|
|
this.getLineTreeList();
|
|
|
|
|
this.treetimer = window.setInterval(() => {
|
|
|
|
|
setTimeout(this.getLineTreeStatus(), 0);
|
|
|
|
@ -401,7 +410,9 @@ export default {
|
|
|
|
|
methods: {
|
|
|
|
|
//获取当前选中的radio
|
|
|
|
|
getRadio() {
|
|
|
|
|
console.log();
|
|
|
|
|
console.log(this.zzradio);
|
|
|
|
|
localStorage.setItem("radio", JSON.stringify(this.zzradio));
|
|
|
|
|
this.getLineTreeStatus();
|
|
|
|
|
},
|
|
|
|
|
//获取当前时间
|
|
|
|
|
getDateTime() {
|
|
|
|
@ -455,10 +466,11 @@ export default {
|
|
|
|
|
if (this.filterText !== "") {
|
|
|
|
|
this.$refs.tree.filter(this.filterText);
|
|
|
|
|
} else {
|
|
|
|
|
getdyTreeListJoggle()
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.selectData.id); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
});
|
|
|
|
@ -484,11 +496,13 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
//获取左侧树结构
|
|
|
|
|
getLineTreeList() {
|
|
|
|
|
getdyTreeListJoggle()
|
|
|
|
|
console.log(this.zzradio);
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
console.log(this.lineTreeData);
|
|
|
|
|
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
@ -521,6 +535,45 @@ export default {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentNodekey); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// if (this.zzradio == -1) {
|
|
|
|
|
// this.lineTreeData = this.lineTreeData;
|
|
|
|
|
// } else if (this.zzradio == 1) {
|
|
|
|
|
// //在线
|
|
|
|
|
// var data = JSON.parse(JSON.stringify(this.lineTreeData));
|
|
|
|
|
// console.log(data);
|
|
|
|
|
// const filterId = (data, id) => {
|
|
|
|
|
// if (!Array.isArray(data)) {
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// return data.filter((item) => {
|
|
|
|
|
// if ("list" in item) {
|
|
|
|
|
// item.list = filterId(item.list, id);
|
|
|
|
|
// }
|
|
|
|
|
// return item.onlinestatus !== 0;
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
// const filtredData = filterId(data);
|
|
|
|
|
// console.log(filtredData);
|
|
|
|
|
// this.lineTreeData = filtredData;
|
|
|
|
|
// } else if (this.zzradio == 0) {
|
|
|
|
|
// //离线
|
|
|
|
|
// var data = JSON.parse(JSON.stringify(this.lineTreeData));
|
|
|
|
|
// console.log(data);
|
|
|
|
|
// const filterId = (data, id) => {
|
|
|
|
|
// if (!Array.isArray(data)) {
|
|
|
|
|
// return data;
|
|
|
|
|
// }
|
|
|
|
|
// return data.filter((item) => {
|
|
|
|
|
// if ("list" in item) {
|
|
|
|
|
// item.list = filterId(item.list, id);
|
|
|
|
|
// }
|
|
|
|
|
// return item.onlinestatus !== 1;
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
// const filtredData = filterId(data);
|
|
|
|
|
// console.log(filtredData);
|
|
|
|
|
// this.lineTreeData = filtredData;
|
|
|
|
|
// }
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
@ -1224,6 +1277,10 @@ export default {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
.refresh {
|
|
|
|
|
}
|
|
|
|
|
.el-radio-group {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|