添加收藏夹功能

wp1.0
fanluyan 1 year ago
parent ce1b533423
commit c6c82dc570

@ -170,7 +170,7 @@ export default {
console.log(this.role); console.log(this.role);
this.getRadio(); //线线 this.getRadio(); //线线
this.getLineTreeList(); // this.getLineTreeList(); //
this.treeStatustimer = setInterval(this.getLineTreeStatus, 60000); // 10 this.treeStatustimer = setInterval(this.getLineTreeStatus, 60000); // 60
EventBus.$on("treelist", this.getLineTreeStatus); EventBus.$on("treelist", this.getLineTreeStatus);
}, },
methods: { methods: {
@ -187,6 +187,36 @@ export default {
if (this.filterText !== "") { if (this.filterText !== "") {
this.$refs.tree.filter(this.filterText); this.$refs.tree.filter(this.filterText);
} else {
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); //
});
} else { } else {
getdyTreeListJoggle({ type: this.zzradio }) getdyTreeListJoggle({ type: this.zzradio })
.then((res) => { .then((res) => {
@ -201,7 +231,9 @@ export default {
}); });
this.onlineNum = res.data.onlineNum; this.onlineNum = res.data.onlineNum;
this.totalNum = res.data.totalNum; this.totalNum = res.data.totalNum;
this.currentData = JSON.parse(localStorage.getItem("currentData")); this.currentData = JSON.parse(
localStorage.getItem("currentData")
);
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.currentData.id); // this.$refs.tree.setCurrentKey(this.currentData.id); //
}); });
@ -210,6 +242,7 @@ export default {
console.log(err); // console.log(err); //
}); });
} }
}
}, },
handleFilter() { handleFilter() {
// 500 // 500
@ -231,6 +264,50 @@ export default {
// //
getLineTreeList() { getLineTreeList() {
console.log(this.zzradio); console.log(this.zzradio);
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.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); //
});
} else {
getdyTreeListJoggle({ type: this.zzradio }) getdyTreeListJoggle({ type: this.zzradio })
.then((res) => { .then((res) => {
this.lineTreeData = res.data.list; this.lineTreeData = res.data.list;
@ -268,8 +345,8 @@ export default {
this.currentNodekey = this.currentData.id; this.currentNodekey = this.currentData.id;
this.handleNodeClick(this.currentData); this.handleNodeClick(this.currentData);
} else { } else {
this.currentData = this.lineTreeData[0]; // this.currentData = this.lineTreeData[1]; //
this.currentNodekey = this.lineTreeData[0].id; // this.currentNodekey = this.lineTreeData[1].id; //
this.handleNodeClick(this.currentData); this.handleNodeClick(this.currentData);
} }
this.$nextTick(() => { this.$nextTick(() => {
@ -280,6 +357,7 @@ export default {
.catch((err) => { .catch((err) => {
console.log(err); // console.log(err); //
}); });
}
}, },
//treenode //treenode

Loading…
Cancel
Save