|
@@ -97,7 +97,6 @@ import addressList from "./components/addressList.vue";
|
|
import { useRouter } from "vue-router";
|
|
import { useRouter } from "vue-router";
|
|
import SamplePointLayer from "./map/samplePointLayer";
|
|
import SamplePointLayer from "./map/samplePointLayer";
|
|
import { useStore } from "vuex";
|
|
import { useStore } from "vuex";
|
|
-import RegionLayer from "./map/regionLayer";
|
|
|
|
import BlueRegionLayer from "./map/blueRegionLayer";
|
|
import BlueRegionLayer from "./map/blueRegionLayer";
|
|
import eventBus from "@/api/eventBus";
|
|
import eventBus from "@/api/eventBus";
|
|
import AlbumCarousel from "./album_compoents/albumCarousel.vue";
|
|
import AlbumCarousel from "./album_compoents/albumCarousel.vue";
|
|
@@ -120,7 +119,6 @@ const currentRegion = {
|
|
};
|
|
};
|
|
let homeMap = new HomeMap();
|
|
let homeMap = new HomeMap();
|
|
let samplePointLayer = null;
|
|
let samplePointLayer = null;
|
|
-let regionLayer = null;
|
|
|
|
let blueRegionLayer = null;
|
|
let blueRegionLayer = null;
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
const mapRef = ref();
|
|
const mapRef = ref();
|
|
@@ -129,37 +127,20 @@ const activeName = ref('认养列表')
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
homeMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
|
|
homeMap.initMap("POINT(113.61448114737868 23.585550924763083)", mapRef.value);
|
|
// homeMap.initMap(store.getters.userinfo.location, mapRef.value);
|
|
// homeMap.initMap(store.getters.userinfo.location, mapRef.value);
|
|
- // regionLayer = new RegionLayer(homeMap.kmap.map, currentFarm, currentRegion)
|
|
|
|
samplePointLayer = new SamplePointLayer(homeMap.kmap);
|
|
samplePointLayer = new SamplePointLayer(homeMap.kmap);
|
|
blueRegionLayer = new BlueRegionLayer(homeMap.kmap);
|
|
blueRegionLayer = new BlueRegionLayer(homeMap.kmap);
|
|
|
|
|
|
- getYellow();
|
|
|
|
// getFarmLog()
|
|
// getFarmLog()
|
|
|
|
|
|
//区域切换监听事件
|
|
//区域切换监听事件
|
|
eventBus.on("area:id", areaId);
|
|
eventBus.on("area:id", areaId);
|
|
- //选项卡子项事件监听
|
|
|
|
- // eventBus.on("handleTabItem", handleTabItem);
|
|
|
|
- // 是否开启指标对比
|
|
|
|
- eventBus.on("compareTree", handleCompare)
|
|
|
|
- eventBus.on("clickToCompare:point", toggleCompare);
|
|
|
|
});
|
|
});
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
eventBus.off("area:id", areaId);
|
|
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 blueList = ref([]);
|
|
const getBlueRegionList = (callback) => {
|
|
const getBlueRegionList = (callback) => {
|
|
let selectAll = undefined;
|
|
let selectAll = undefined;
|
|
@@ -214,20 +195,8 @@ const handleTab = async ({ name, id, isUpdate, params, legend, colorObj }) => {
|
|
tabName.value = name;
|
|
tabName.value = name;
|
|
tabId.value = id;
|
|
tabId.value = id;
|
|
if (id === 0) {
|
|
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);
|
|
samplePointLayer.initData(farmId, areaId);
|
|
if (tabId.value === 0) {
|
|
if (tabId.value === 0) {
|
|
getBlueRegionList();
|
|
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 urls = ref([]);
|
|
const urlsIndex = ref(0);
|
|
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 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>
|
|
</script>
|
|
|
|
|