diff --git a/src/views/pictureOnMap/LayerControl.vue b/src/views/pictureOnMap/LayerControl.vue
index eea6c5e..f1bd52b 100644
--- a/src/views/pictureOnMap/LayerControl.vue
+++ b/src/views/pictureOnMap/LayerControl.vue
@@ -19,6 +19,8 @@
{{ node.label }}
+
+
恢复默认
@@ -35,21 +37,26 @@
const selectList = ref([]);
const dataSource = ref([
{
+ id:"0",
+ isRadio:true,
value: '地图切换',
label: '地图切换',
class: 'target-class',
children: [
{
+ id:"0-0",
value: '!newfiber-XYZLayer',
label: '电子地图',
icon: getImageUrl('mapone.png', 'images/NewLayercontrol'),
},
{
+ id:"0-1",
value: 'newfiber-XYZLayer',
label: '影像地图',
icon: getImageUrl('maptwo.png', 'images/NewLayercontrol'),
},
{
+ id:"0-2",
value: '高清地图',
label: '高清地图',
icon: getImageUrl('mapthree.png', 'images/NewLayercontrol'),
@@ -57,16 +64,20 @@
],
},
{
+ id:"1",
+ isRadio:true,
value: '排水体系',
label: '排水体系',
class: 'target-class',
children: [
{
+ id:"1-0",
value: '雨水分区',
label: '雨水系统',
icon: getImageUrl('yuliangzhan.png', 'images/NewLayercontrol'),
},
{
+ id:"1-1",
value: '污水分区',
label: '污水系统',
icon: getImageUrl('zishuidian.png', 'images/NewLayercontrol'),
@@ -74,16 +85,20 @@
],
},
{
+ id:"2",
+ isRadio:true,
value: '管网',
label: '管网',
class: 'target-class',
children: [
{
+ id:"2-0",
value: '雨水管网',
label: '雨水管网',
icon: getImageUrl('lay-yushuiguanwang.png', 'images/NewLayercontrol'),
},
{
+ id:"2-1",
value: '污水管网',
label: '污水管网',
icon: getImageUrl('lay-wushuiguanwang.png', 'images/NewLayercontrol'),
@@ -91,11 +106,14 @@
],
},
{
+ id:"3",
+ isRadio:false,
value: '监测点',
label: '监测点',
class: 'target-class',
children: [
{
+ id:"3-0",
value: 'rainwater_pipeline_quality_area',
label: '接驳口',
},
@@ -109,9 +127,8 @@
// 这个方法会出现当前已勾选节点,或者半节点的状态
function check(data, node) {
+ setLayerVisible([],selectList.value);
selectList.value = [];
- console.log('node', node, data.value);
-
if (node) {
let arr = [...node.checkedNodes];
arr.map(item => {
@@ -121,50 +138,28 @@
});
}
- nextTick(() => {
- let arr = [];
- dataSource.value[0].children.map(p => {
- arr.push(p.value);
- });
- console.log('arr', arr);
+ console.log('node',node);
+ nextTick(() => {
+ let arr = dataSource.value[0].children.map(p => p.value);
arr.map(item => {
if (selectList.value.includes(item)) {
selectList.value.splice(selectList.value.indexOf(item), 1);
}
});
- selectList.value.push(data.value);
if (arr.includes(data.value)) {
+ selectList.value.push(data.value);
proxy.$refs.layertree.setCheckedKeys(selectList.value);
}
-
- console.log('selectList.value', selectList.value);
});
}
function setLayerVisible(newVal = [], oldVal = []) {
+ console.log('setLayerVisible',newVal,oldVal);
const openLayer = _.difference(newVal, oldVal);
const closeLayer = _.difference(oldVal, newVal);
- openLayer.length &&
- openLayer
- .map(i => i.split(','))
- .flat(Infinity)
- .forEach(key =>
- bus.emit('setLayerVisible', {
- layername: key,
- isCheck: key.includes('!') ? false : true,
- })
- );
- closeLayer.length &&
- closeLayer
- .map(i => i.split(','))
- .flat(Infinity)
- .forEach(key =>
- bus.emit('setLayerVisible', {
- layername: key,
- isCheck: key.includes('!') ? true : false,
- })
- );
+ openLayer.length && openLayer.map(i => i.split(',')).flat(Infinity).forEach(key => bus.emit('setLayerVisible', {layername: key, isCheck: key.includes('!') ? false : true,}));
+ closeLayer.length && closeLayer.map(i => i.split(',')).flat(Infinity).forEach(key => bus.emit('setLayerVisible', {layername: key, isCheck: key.includes('!') ? true : false,}));
newfiberMap.map.triggerRepaint();
}