Sfoglia il codice sorgente

fix: 删除多余地图联动

刘秀芳 2 settimane fa
parent
commit
b0648b8174

+ 0 - 26
src/components/navigation.vue

@@ -25,21 +25,6 @@
                 {{ item }}
             </el-checkbox>
         </el-checkbox-group>
-        <!-- <div class="btn" @click="toPage">农场确权</div> -->
-        <!-- 对比 -->
-        <!-- <el-checkbox-group
-            class="checkbox-group compare-btn"
-            v-model="checkedCompareChildren"
-            @change="handleCompareChange"
-        >
-            <el-checkbox label="指标对比" value="1">
-                指标对比
-            </el-checkbox>
-        </el-checkbox-group> -->
-
-        <div class="compare-tips" v-show="checkedCompareChildren.length">
-            <span>提示:</span>请在底图上点选 <span>两棵树</span>,才可以进行对比
-        </div>
     </div>
 </template>
 
@@ -83,13 +68,11 @@ const changeSelect = (e) =>{
 onMounted(()=>{
     gardenOrganId(sessionStorage.getItem('farmId')*1)
     eventBus.on('handleActive',handleActive)
-    eventBus.on('quitCompare', handleQuitCompare)
 })
 const mainMenuArr = computed(() => store.state.home.mainMenu);
 
 onUnmounted(()=>{
     eventBus.off('handleActive',handleActive)
-    eventBus.off('quitCompare', handleQuitCompare)
 })
 
 const emit = defineEmits(["handleTab","handleTabItem"])
@@ -178,16 +161,7 @@ const toPage = () => {
     router.push("/authentic");
 };
 
-// 对比
-const checkedCompareChildren = ref([]);
-function handleCompareChange(v) {
-    eventBus.emit("compareTree", checkedCompareChildren.value.length > 0 ? true : false)
-}
 
-// 退出对比
-function handleQuitCompare() {
-    checkedCompareChildren.value = []
-}
 </script>
 
 <style lang="scss" scoped>

+ 1 - 280
src/views/home/index.vue

@@ -97,7 +97,6 @@ import addressList from "./components/addressList.vue";
 import { useRouter } from "vue-router";
 import SamplePointLayer from "./map/samplePointLayer";
 import { useStore } from "vuex";
-import RegionLayer from "./map/regionLayer";
 import BlueRegionLayer from "./map/blueRegionLayer";
 import eventBus from "@/api/eventBus";
 import AlbumCarousel from "./album_compoents/albumCarousel.vue";
@@ -120,7 +119,6 @@ const currentRegion = {
 };
 let homeMap = new HomeMap();
 let samplePointLayer = null;
-let regionLayer = null;
 let blueRegionLayer = null;
 const router = useRouter();
 const mapRef = ref();
@@ -129,37 +127,20 @@ const activeName = ref('认养列表')
 onMounted(() => {
     homeMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
     // homeMap.initMap(store.getters.userinfo.location, mapRef.value);
-    // regionLayer = new RegionLayer(homeMap.kmap.map, currentFarm, currentRegion)
     samplePointLayer = new SamplePointLayer(homeMap.kmap);
     blueRegionLayer = new BlueRegionLayer(homeMap.kmap);
 
-    getYellow();
     // getFarmLog()
 
     //区域切换监听事件
     eventBus.on("area:id", areaId);
-    //选项卡子项事件监听
-    // eventBus.on("handleTabItem", handleTabItem);
-    // 是否开启指标对比
-    eventBus.on("compareTree", handleCompare)
-    eventBus.on("clickToCompare:point", toggleCompare);
 });
 
 onUnmounted(() => {
     eventBus.off("area:id", areaId);
-    // eventBus.off("handleTabItem", handleTabItem);
-    eventBus.off("compareTree", handleCompare)
-    eventBus.off("clickToCompare:point", toggleCompare);
 });
 
 
-function handleCompare(v) {
-    isShrink.value = v
-    if (v === false) {
-        showCompareBtn.value = v
-    }
-}
-
 const blueList = ref([]);
 const getBlueRegionList = (callback) => {
     let selectAll = undefined;
@@ -214,20 +195,8 @@ const handleTab = async ({ name, id, isUpdate, params, legend, colorObj }) => {
     tabName.value = name;
     tabId.value = id;
     if (id === 0) {
-        getBlueRegionList(() => {
-            if (isUpdate) {
-                handleTabItem(params);
-            }
-        });
-    } else {
-        getFarmIndexReport(() => {
-            if (isUpdate) {
-                handleTabItem(params);
-            }
-        });
+        getBlueRegionList();
     }
-    // 切换点位数据
-    // samplePointLayer.changePointType(name, params)
 };
 
 //区域切换监听事件
@@ -237,263 +206,15 @@ function areaId({ areaId, farmId }) {
     samplePointLayer.initData(farmId, areaId);
     if (tabId.value === 0) {
         getBlueRegionList();
-    } else {
-        getFarmIndexReport();
     }
 }
 
-//选项卡子项事件监听
-const handleTabItem = (e) => {
-    console.log('eeeeeeeeee', e, reportData.value);
-    // if (reportData.value.blueZoneList) {
-    //     const index = reportData.value.blueZoneList.findIndex((item) => item.key === e);
-    //     let arr = [];
-    //     if (reportData.value.blueZoneList.length) {
-    //         arr = blueListConvert(reportData.value.blueZoneList[index].obj, index);
-    //     }
-    //     blueRegionLayer.initData(arr, "87");
-    // }
-};
-
-const reportData = ref({});
-const blueListConvert = (data, index) => {
-    const list = [];
-    for (let key in data) {
-        const filterData = reportData.value.blueZoneLegendList[index].list.filter((item) => item.val === key);
-        const arr = data[key];
-        arr.forEach((item) => {
-            const listObj = blueList.value.filter((ele) => ele.blueZoneCode === item);
-            const updateList = listObj.map((ele) => {
-                return {
-                    ...ele,
-                    level: key,
-                    name: filterData[0].name,
-                    color: filterData[0].color,
-                };
-            });
-            list.push(...updateList);
-        });
-    }
-    return list;
-};
-
-const getFarmIndexReport = (callback) => {
-    // const params = { farmId:organId.value,regionId:regionId.value, type: tabName.value };
-    //   VE_API.farm.farmIndexReport(params).then(({data,code}) => {
-    //     if (code === 0) {
-    //         reportData.value = data || {};
-    //         let arr = []
-    //         if(data.blueZoneList.length){
-    //           arr = blueListConvert(data.blueZoneList[0].obj,0)
-    //         }
-    //         blueRegionLayer.initData(arr,'87')
-    //         callback && callback()
-    //     }
-    // });
-};
-
-const indicatorChartData = ref({});
-const blueZone = ref("ws0y1meyhxp4");
-
-const getFarmLog = () => {
-    console.log("getfarmlog");
-    const params = {
-        id: null,
-        farmId: 766,
-        blueZone: blueZone.value,
-    };
-    VE_API.warning.fetchFarmLog(params).then(({ data }) => {
-        indicatorChartData.value = data || {};
-        eventBus.emit("chart:updateOption", data);
-    });
-};
-
 const urls = ref([]);
 const urlsIndex = ref(0);
-const getYellow = () => {
-    VE_API.home.getYellowList().then((res) => {
-        // urls.value = res.data.map(item =>{
-        //   return {
-        //     ...item,
-        //     imgPath:config.base_img_url2+item.cloudFilename
-        //   }
-        // })
-        // urls.value = [
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-07.jpg",
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-08.jpg",
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-09.jpg",
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-10.jpg",
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-11.jpg",
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-12.jpg",
-        //   "@/assets/images/home/HB-ws0y1menggxv/HB-ws0y1menggxv2025-01-13.jpg",
-        // ]
-    });
-};
-
-const btnIndex = ref(null);
-const btnName = ref("");
-const handleBtn = (e) => {
-    btnName.value = "";
-    btnIndex.value = e;
-    eventBus.emit("clear:area");
-    samplePointLayer.updateAreaStatus(e === 0 ? true : false);
-    regionLayer.resetData();
-    samplePointLayer.resetPoint();
-};
-
-//点击果园日志
-const handleSelectArea = () => {
-    btnName.value = "";
-    btnIndex.value = null;
-    eventBus.emit("clear:area");
-    regionLayer.resetData();
-    samplePointLayer.resetPoint();
-    samplePointLayer.updateAreaStatus(true);
-};
 
-//农事点击高亮
-const act = ref(null);
-const handleAct = (v) => {
-    act.value = v;
-    samplePointLayer.resetPoint();
-    if (v === 1) {
-        regionLayer.selectAreaMultiple([
-            { value: 2, color: "blue" },
-            { value: 4, color: "blue1" },
-            { value: 5, color: "blue2" },
-            { value: 7, color: "blue" },
-            { value: 13, color: "blue2" },
-        ]);
-    }
-    if (v === 2) {
-        regionLayer.selectAreaMultiple([
-            { value: 1, color: "blue" },
-            { value: 2, color: "blue1" },
-            { value: 9, color: "blue2" },
-            { value: 12, color: "blue2" },
-        ]);
-    }
-};
-
-//柱状图点击事件监听
-eventBus.on("echart:barClick", (e) => {
-    btnName.value = "";
-    btnIndex.value = null;
-    eventBus.emit("clear:area");
-    samplePointLayer.updateAreaStatus(false);
-    const arr = ["花穗伸长", "啃食虫害", "毛毡病"];
-    const isDraw = arr.includes(e);
-    const index = arr.indexOf(e);
-    if (isDraw) {
-        if (index === 0) {
-            regionLayer.selectAreaMultiple([
-                { value: 0, color: "green" },
-                { value: 1, color: "green" },
-                { value: 2, color: "green" },
-                { value: 3, color: "green1" },
-                { value: 4, color: "green1" },
-                { value: 5, color: "green2" },
-                { value: 6, color: "green1" },
-                { value: 7, color: "green2" },
-                { value: 8, color: "green2" },
-                { value: 9, color: "green" },
-                { value: 10, color: "green" },
-                { value: 11, color: "green1" },
-                { value: 12, color: "green2" },
-                { value: 13, color: "green" },
-                { value: 14, color: "green2" },
-            ]);
-        } else if (index === 1) {
-            regionLayer.selectAreaMultiple([{ value: 6, color: "red" }]);
-        } else {
-            regionLayer.selectAreaMultiple([
-                { value: 12, color: "red2" },
-                { value: 10, color: "red" },
-                { value: 1, color: "red" },
-            ]);
-        }
-    }
-});
-
-//黄板点击事件监听
-eventBus.on("click:yellowBlock", (e) => {
-    const arr = ["113.61396985128522", "113.61390710255375", "113.61491218688275"];
-    if (arr[0] == e) {
-        urls.value = ["HB-ws0y1menggxv"];
-        urlsIndex.value = 0;
-    }
-    if (arr[1] == e) {
-        urls.value = ["HB-ws0y1mg0pvd"];
-        urlsIndex.value = 3;
-    }
-    if (arr[2] == e) {
-        urls.value = ["HB-ws0y1mg9wpcp"];
-        urlsIndex.value = 6;
-    }
-    eventBus.emit("dialog:show", true);
-});
-
-const showPoint = ref(true);
-const showType = ref("point");
-
-eventBus.on("click:updateArea", (e) => {
-    blueZone.value = e.value;
-    btnName.value = e.name;
-    regionLayer.selectArea(e.name * 1 === 0 ? 0 : e.name * 1 - 1, "blue");
-    //getFarmLog()
-});
 
 const currentComponent = ref("homePage");
 
-// 跳转果园档案
-const toFilePage = () => {
-    router.push("/garden-file");
-};
-
-// 地图图例
-const showMapLegend = ref(true);
-const handleLegend = (e) => {
-    blueRegionLayer.toggleLayer(e);
-};
-
-// 对比
-const compareData = ref([]);
-const showCompareBtn = ref(false);
-function toggleCompare(arr) {
-    // eventBus.emit("clickToCompare:point",{farmId:fs.get("farmId"),sampleId:fs.get("sampleId"), data: fs.getProperties()})
-    compareData.value = [];
-    arr.map((fs) => {
-        compareData.value.push({ farmId: fs.get("farmId"), sampleId: fs.get("id"), data: fs.getProperties() });
-    });
-    console.log("compareData", compareData.value);
-    showCompareBtn.value = compareData.value.length > 1 ? true : false;
-}
-function showCompare() {
-    eventBus.emit("showCompareDialog", compareData.value);
-}
-
-const isShrink = ref(false);
-const isLeftShrink = ref(false);
-const isRightShrink = ref(false);
-const handleShrink = (position) => {
-    switch (position) {
-        case "bottom":
-            isShrink.value = !isShrink.value;
-            break;
-        case "left":
-            isLeftShrink.value = !isLeftShrink.value;
-            break;
-        case "rigth":
-            isRightShrink.value = !isRightShrink.value;
-            break;
-    }
-};
-
-const photoList = ref([
-    {key: "病虫", statement: "病虫 2025年02月19日,发现毛毡病异常1级"},
-    {key: "异常", statement: "2025年03月17日,发现花量大异常3级"},
-    {key: "营养", statement: "无营养异常"},
-]);
 
 </script>
 

+ 0 - 35
src/views/home/map/samplePointLayer.js

@@ -129,17 +129,6 @@ class SamplePointLayer {
 
   addMapSingerClick(kmap) {
     let that = this
-    // 创建弹窗图层
-    this.popup = new Overlay({
-      element: document.getElementById('popup-file'),
-      positioning: 'right-center',
-      offset: [0, 0],
-    });
-    kmap.addOverlay(this.popup);
-    // 点击地图弹窗的关闭-销毁dom
-    // eventBus.on("map:destroyPopup", () => {
-    //   that.popup.setPosition(undefined)
-    // })
     kmap.on("singleclick", (evt) => {
       let hasFeature = false
       kmap.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
@@ -160,30 +149,6 @@ class SamplePointLayer {
           eventBus.emit("click:point", { farmId: fs.get("farmId"), sampleId: fs.get("sampleId"), data: fs.getProperties() })
         }
       })
-      if (!hasFeature) {
-        kmap.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {
-          if (layer instanceof VectorLayer && layer.get("name") === "regionLayer") {
-            hasFeature = false
-            if (that.curArea) {
-              that.curArea.set("bgName", "defalut");
-            }
-            that.curArea = feature
-            if (that.isUpdateArea) {
-              feature.set("bgName", "active");
-              eventBus.emit("click:updateArea", { name: feature.get("id"), value: feature.get("blueZone") })
-            } else {
-              eventBus.emit("click:area", { name: feature.get("id"), value: feature.get("highYield") })
-            }
-          }
-        })
-        if (that.isCompare) {
-          eventBus.emit("quitCompare")
-          eventBus.emit("compareTree", false)
-        }
-        if (that.popup) {
-          that.popup.setPosition(undefined)
-        }
-      }
     })
   }