|
|
@@ -99,6 +99,11 @@ export default {
|
|
|
this.$globalEventBus.$on('toggleLeftPanel', (val) => {
|
|
|
this.leftPanelHide = val
|
|
|
})
|
|
|
+ this.$globalEventBus.$on('closePlanDialog', (data) => {
|
|
|
+ this.checkedNodes = []
|
|
|
+ const ids = data.map(item=>item.id);
|
|
|
+ this.cancelCheckNode(ids)
|
|
|
+ })
|
|
|
},
|
|
|
watch: {
|
|
|
mainMenu: {
|
|
|
@@ -112,16 +117,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ //关闭防汛预案弹窗后取消选中
|
|
|
+ cancelCheckNode(ids) {
|
|
|
+ const currentCheckedKeys = this.$refs.treeRef.getCheckedKeys(true);
|
|
|
+ const newArray= currentCheckedKeys.filter(item=> !ids.includes(item))
|
|
|
+ this.$refs.treeRef.setCheckedKeys(newArray);
|
|
|
+ },
|
|
|
onExpandChange() {
|
|
|
this.isExpanded = !this.isExpanded
|
|
|
},
|
|
|
|
|
|
async onCheckChange(node, checked,) {
|
|
|
- if (checked && node.type === 'plan' &&!node.children) {
|
|
|
- this.checkedNodes.push(node);
|
|
|
- } else if (!checked) {
|
|
|
- this.checkedNodes = this.checkedNodes.filter(n => n.id !== node.id);
|
|
|
+ const checkedNodes = this.$refs.treeRef.getCheckedNodes()
|
|
|
+ this.checkedNodes = []
|
|
|
+ checkedNodes.map((item)=>{
|
|
|
+ if(item.type && item.type == 'plan' && !item.children){
|
|
|
+ this.checkedNodes.push(item)
|
|
|
}
|
|
|
+ })
|
|
|
const id = node.id
|
|
|
if (checked) {
|
|
|
if (node.type && node.type == 'plan') {
|
|
|
@@ -147,7 +160,6 @@ export default {
|
|
|
clampToGround: true,
|
|
|
symbol: this.getStyleByName(node.label)
|
|
|
})
|
|
|
- console.log(window.map, 111111111)
|
|
|
window.map.addLayer(layer)
|
|
|
this.bindEvent(layer)
|
|
|
layerCache[id] = layer
|
|
|
@@ -220,6 +232,9 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
+ },
|
|
|
+ destroyed(){
|
|
|
+ this.$globalEventBus.$off('closePlanDialog')
|
|
|
}
|
|
|
}
|
|
|
</script>
|