|
|
|
@ -51,7 +51,10 @@
|
|
|
|
|
<span v-else-if="node.level === 2">
|
|
|
|
|
<span class="iconfont icon-dianlihangye" style="margin-right: 6px">
|
|
|
|
|
</span>
|
|
|
|
|
<span>{{ node.label }} </span>
|
|
|
|
|
<span
|
|
|
|
|
>{{ node.label }}
|
|
|
|
|
<span class="num">({{ data.list.length }}) </span></span
|
|
|
|
|
>
|
|
|
|
|
</span>
|
|
|
|
|
<span v-else>
|
|
|
|
|
<span
|
|
|
|
@ -77,7 +80,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
|
|
|
|
import { getdyTreeListJoggle } from "@/utils/api/index";
|
|
|
|
|
import { getdyTreeListJoggle, getzzdyTreeList } from "@/utils/api/index";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
@ -93,6 +96,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
currentData: {}, //当前选中的数据
|
|
|
|
|
currentNodekey: "", //默认选中的节点树,
|
|
|
|
|
role: "",
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
components: {},
|
|
|
|
@ -109,6 +113,9 @@ export default {
|
|
|
|
|
JSON.parse(localStorage.getItem("radio")) !== null
|
|
|
|
|
? JSON.parse(localStorage.getItem("radio"))
|
|
|
|
|
: -1; //获取保存的radio
|
|
|
|
|
this.role = localStorage.getItem("role");
|
|
|
|
|
console.log("用户管理");
|
|
|
|
|
console.log(this.role);
|
|
|
|
|
this.getRadio(); //获取列表在线离线全部
|
|
|
|
|
this.getLineTreeList(); //获取树状图
|
|
|
|
|
},
|
|
|
|
@ -126,34 +133,65 @@ 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.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);
|
|
|
|
|
if (this.role == 4) {
|
|
|
|
|
getzzdyTreeList({ type: this.zzradio })
|
|
|
|
|
.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();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.$refs.tree.setCurrentKey(this.currentData.id); //一定要加这个选中了否则样式没有出来
|
|
|
|
|
this.scrollView();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.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); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//树状图搜索
|
|
|
|
@ -173,34 +211,65 @@ export default {
|
|
|
|
|
//获取树状图列表
|
|
|
|
|
getLineTreeList() {
|
|
|
|
|
console.log(this.zzradio);
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
if (this.role == 4) {
|
|
|
|
|
getzzdyTreeList({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
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();
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
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();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
getdyTreeListJoggle({ type: this.zzradio })
|
|
|
|
|
.then((res) => {
|
|
|
|
|
this.lineTreeData = res.data.list;
|
|
|
|
|
|
|
|
|
|
this.onlineNum = res.data.onlineNum;
|
|
|
|
|
this.totalNum = res.data.totalNum;
|
|
|
|
|
this.currentData = JSON.parse(localStorage.getItem("currentData"));
|
|
|
|
|
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();
|
|
|
|
|
});
|
|
|
|
|
})
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
console.log(err); //代码错误、请求失败捕获
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//点击当前选中的treenode
|
|
|
|
@ -292,6 +361,10 @@ export default {
|
|
|
|
|
display: flex;
|
|
|
|
|
display: inline-table;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
|
|
|
|
.num {
|
|
|
|
|
color: #169e8c;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -308,6 +381,10 @@ export default {
|
|
|
|
|
span {
|
|
|
|
|
display: flex;
|
|
|
|
|
//overflow: hidden;
|
|
|
|
|
align-items: center;
|
|
|
|
|
.num {
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
.iconfont {
|
|
|
|
|
//width: 30px;
|
|
|
|
|
display: inline-table;
|
|
|
|
|