diff --git a/src/components/Map/MapBox.vue b/src/components/Map/MapBox.vue index 2f568dc..9188758 100644 --- a/src/components/Map/MapBox.vue +++ b/src/components/Map/MapBox.vue @@ -469,6 +469,7 @@ let prevObj = null; const panelDataToMap = (obj) => { + let isUp=Object.keys(obj).includes('isUp')?obj.isUp:true; //是否触发地图点击事件 默认触发 // debugger const { setLayerVisible, setHighlight } = events_params; // if (prevObj != null) busEmit(setLayerVisible.key, { layername: prevObj.type, isCheck: false }); @@ -477,8 +478,8 @@ // debugger; let features = ["point", "linestring", "polygon","hb_wh_dhgx_psfq_geometrys", "hb_wh_dhgx_merge"].map((key) => newfiberMap.map.getSource(key)._options.data.features.filter((i) => (i.properties.name || "").includes(obj.name) || (obj.id ? obj.id == i.properties.pid : true))).flat(); let feature = features.filter((i) => i.properties.p_type)[0] || features.filter((i) => i.properties.name == obj.name)[0] || features[_.random(0, features.length - 1)]; - console.log('panelDataToMap',feature); - if(feature.properties.p_type) return mapClickEvt(undefined,feature.properties,"排水分区"); + console.log('feature.properties.p_type&&isUp',feature.properties.p_type&&isUp); + if(feature.properties.p_type && isUp) return mapClickEvt(undefined,feature.properties,"排水分区"); if (!feature) return; busEmit(setHighlight.key, [feature]); mapCenterByData(turf.bbox(feature)); diff --git a/src/components/Map/MapBox.vue b/src/components/Map/MapBox.vue index 2f568dc..9188758 100644 --- a/src/components/Map/MapBox.vue +++ b/src/components/Map/MapBox.vue @@ -469,6 +469,7 @@ let prevObj = null; const panelDataToMap = (obj) => { + let isUp=Object.keys(obj).includes('isUp')?obj.isUp:true; //是否触发地图点击事件 默认触发 // debugger const { setLayerVisible, setHighlight } = events_params; // if (prevObj != null) busEmit(setLayerVisible.key, { layername: prevObj.type, isCheck: false }); @@ -477,8 +478,8 @@ // debugger; let features = ["point", "linestring", "polygon","hb_wh_dhgx_psfq_geometrys", "hb_wh_dhgx_merge"].map((key) => newfiberMap.map.getSource(key)._options.data.features.filter((i) => (i.properties.name || "").includes(obj.name) || (obj.id ? obj.id == i.properties.pid : true))).flat(); let feature = features.filter((i) => i.properties.p_type)[0] || features.filter((i) => i.properties.name == obj.name)[0] || features[_.random(0, features.length - 1)]; - console.log('panelDataToMap',feature); - if(feature.properties.p_type) return mapClickEvt(undefined,feature.properties,"排水分区"); + console.log('feature.properties.p_type&&isUp',feature.properties.p_type&&isUp); + if(feature.properties.p_type && isUp) return mapClickEvt(undefined,feature.properties,"排水分区"); if (!feature) return; busEmit(setHighlight.key, [feature]); mapCenterByData(turf.bbox(feature)); diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 7a84d5b..7b8cfab 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -439,3 +439,13 @@ }; }); }; +// 查找匹配对应的obj +export const findDictObj2 = (dic, target, value) => { + for (let i = 0; i < dic.length; i++) { + let id = dic[i][target]; + if (id == value) { + return dic[i]; + } + } + return {}; +}; \ No newline at end of file diff --git a/src/components/Map/MapBox.vue b/src/components/Map/MapBox.vue index 2f568dc..9188758 100644 --- a/src/components/Map/MapBox.vue +++ b/src/components/Map/MapBox.vue @@ -469,6 +469,7 @@ let prevObj = null; const panelDataToMap = (obj) => { + let isUp=Object.keys(obj).includes('isUp')?obj.isUp:true; //是否触发地图点击事件 默认触发 // debugger const { setLayerVisible, setHighlight } = events_params; // if (prevObj != null) busEmit(setLayerVisible.key, { layername: prevObj.type, isCheck: false }); @@ -477,8 +478,8 @@ // debugger; let features = ["point", "linestring", "polygon","hb_wh_dhgx_psfq_geometrys", "hb_wh_dhgx_merge"].map((key) => newfiberMap.map.getSource(key)._options.data.features.filter((i) => (i.properties.name || "").includes(obj.name) || (obj.id ? obj.id == i.properties.pid : true))).flat(); let feature = features.filter((i) => i.properties.p_type)[0] || features.filter((i) => i.properties.name == obj.name)[0] || features[_.random(0, features.length - 1)]; - console.log('panelDataToMap',feature); - if(feature.properties.p_type) return mapClickEvt(undefined,feature.properties,"排水分区"); + console.log('feature.properties.p_type&&isUp',feature.properties.p_type&&isUp); + if(feature.properties.p_type && isUp) return mapClickEvt(undefined,feature.properties,"排水分区"); if (!feature) return; busEmit(setHighlight.key, [feature]); mapCenterByData(turf.bbox(feature)); diff --git a/src/utils/ruoyi.js b/src/utils/ruoyi.js index 7a84d5b..7b8cfab 100644 --- a/src/utils/ruoyi.js +++ b/src/utils/ruoyi.js @@ -439,3 +439,13 @@ }; }); }; +// 查找匹配对应的obj +export const findDictObj2 = (dic, target, value) => { + for (let i = 0; i < dic.length; i++) { + let id = dic[i][target]; + if (id == value) { + return dic[i]; + } + } + return {}; +}; \ No newline at end of file diff --git a/src/views/pictureOnMap/index.vue b/src/views/pictureOnMap/index.vue index 92ba5fd..3441da9 100644 --- a/src/views/pictureOnMap/index.vue +++ b/src/views/pictureOnMap/index.vue @@ -559,12 +559,18 @@ }); // 部分公共弹窗需要使用一个查询时间,目前不确定后期有没有人使用同类型的弹窗,在此初始化,增加公共弹窗的兼容性 // localStorage.setItem("JCFXDialogTimer", moment().format("YYYY-MM-DD")); + bus.on("xiaofeifei", (e) => { + // lngLat, properties = {}, layerId + + mapClick1(e.geometry.coordinates,e.properties,e.geometry.type); + }); }); onBeforeUnmount(() => { bus.off("DynamicBus"); bus.off("closedia"); bus.off("changeData"); + bus.off("xiaofeifei"); });