|
@@ -240,7 +240,7 @@ export default {
|
|
|
myModel: null,
|
|
|
filterText: "",
|
|
|
// 存储所有图层的node id
|
|
|
- treeIdMap:new Map()
|
|
|
+ treeIdMap: new Map(),
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -252,14 +252,14 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
watch: {
|
|
|
- // getLeftMenuTitle(val) {
|
|
|
- // console.log(val, "current title");
|
|
|
- // },
|
|
|
getLeftMenuTitle: {
|
|
|
handler(val) {
|
|
|
- console.log(val, "current title");
|
|
|
this.$nextTick(() => {
|
|
|
- // console.log(this.$refs.tree.data[1], "tree");
|
|
|
+ if (this.treeIdMap.has(val)) {
|
|
|
+ console.log(val, "678");
|
|
|
+ // 设置默认勾选项
|
|
|
+ this.$refs.tree.setCheckedKeys([this.treeIdMap.get(val)]);
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
immediate: true,
|
|
@@ -287,8 +287,8 @@ export default {
|
|
|
let myModelRef = this.$refs.tree.data[2];
|
|
|
if (myModelRef.label === "我的模型") {
|
|
|
this.$refs.tree.data[2].children = val.map((ele) => {
|
|
|
- let firstId = publicFun.buildGuid()
|
|
|
- this.treeIdMap.set(`我的模型_${firstId}`, firstId)
|
|
|
+ let firstId = publicFun.buildGuid();
|
|
|
+ this.treeIdMap.set(ele.name, firstId);
|
|
|
return {
|
|
|
id: firstId,
|
|
|
label: ele.name,
|
|
@@ -308,14 +308,17 @@ export default {
|
|
|
if (item1.type === "我的模型") {
|
|
|
this.myModel = item1;
|
|
|
}
|
|
|
+ this.treeIdMap.set(item1.type, item1.id);
|
|
|
return {
|
|
|
id: item1.id,
|
|
|
label: item1.type,
|
|
|
children: item1.children.map((item2) => {
|
|
|
+ this.treeIdMap.set(item2.type, item2.id);
|
|
|
return {
|
|
|
id: item2.id,
|
|
|
label: item2.type,
|
|
|
children: item2.children.map((item3) => {
|
|
|
+ this.treeIdMap.set(item3.type, item3.id);
|
|
|
this.rightPanelDataMap.set(item3.type, item3.children);
|
|
|
return {
|
|
|
id: item3.id,
|
|
@@ -328,6 +331,8 @@ export default {
|
|
|
}),
|
|
|
};
|
|
|
});
|
|
|
+
|
|
|
+ console.log(this.treeIdMap, "treeIdMap");
|
|
|
},
|
|
|
mounted() {
|
|
|
// 引入疑点标记绘制方法
|
|
@@ -344,6 +349,10 @@ export default {
|
|
|
// iconUrl:"../../static/plugins/draw-plugin/images/marker-icon.png"
|
|
|
// });
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ // 销毁前清空存放tree ID 的map
|
|
|
+ this.treeIdMap.clear();
|
|
|
+ },
|
|
|
methods: {
|
|
|
// 回退事件
|
|
|
backEvent() {
|