浏览代码

Merge branch 'master' of http://www.sysuimars.cn:3000/feiniao/agriculture-one-map

wangsisi 1 周之前
父节点
当前提交
2d75307fd2

+ 1 - 1
src/components/chartBox.vue

@@ -58,7 +58,7 @@ const handleShrink = () =>{
     display: flex;
     align-items: center;
     justify-content: space-between;
-    border-bottom: 0.6px solid rgb(255, 255, 255, 0.4);
+    background: rgba(255, 255, 255, 0.05);
     padding-right: 12px;
     box-sizing: border-box;
     flex: none;

+ 2 - 2
src/components/fnHeader.vue

@@ -5,7 +5,7 @@
           <span>{{headerName||"飞鸟智慧巡园平台"}}</span>
           <img class="logo-icon" src="@/assets/images/common/logo-icon.png" alt="" />
         </div>
-        <div class="focus-farm" v-show="!hideSwitch">
+        <!-- <div class="focus-farm" v-show="!hideSwitch">
             <el-select
                 filterable
                 v-model="farmVal"
@@ -16,7 +16,7 @@
             >
                 <el-option v-for="item in options" :key="item.organId" :label="item.name" :value="item.organId" />
             </el-select>
-        </div>
+        </div> -->
         <div class="date" v-show="showDate">
             <el-icon size="25"><MoreFilled /></el-icon>
             <div class="time">

+ 31 - 0
src/views/warningHome/components/chart_components/barChart.vue

@@ -0,0 +1,31 @@
+<template>
+    <div ref="chartDom" class="line-chart"></div>
+</template>
+
+<script setup>
+import { onMounted, ref } from "vue";
+import * as echarts from "echarts";
+import { barOption } from "./chartOption.js";
+import { deepClone } from "@/common/commonFun";
+
+const chartDom = ref(null);
+let myChart = null;
+
+const initData = () => {
+    const newOption = deepClone(barOption);
+    myChart.setOption(newOption);
+};
+
+onMounted(() => {
+    myChart = echarts.init(chartDom.value);
+    initData();
+});
+
+</script>
+
+<style lang="scss" scoped>
+.line-chart {
+    width: 100%;
+    height: 100%;
+}
+</style>

+ 147 - 0
src/views/warningHome/components/chart_components/chartList.vue

@@ -0,0 +1,147 @@
+<template>
+    <div class="chart-list">
+        <div class="chart-item">
+            <chart-box name="2025年广东省作物种植面积占比">
+                <div class="box-content">
+                    <div class="chart-dom">
+                        <pie-chart></pie-chart>
+                    </div>
+                    <div class="box-bg">
+                        <div class="legend-list">
+                            <div class="legend-item" v-for="(item, index) in legendData" :key="index">
+                                <span class="dot" :style="{ background: item.color }"></span>
+                                <span class="text">
+                                    {{ item.name }}
+                                    <span class="percent">{{ item.percent }}%</span>
+                                    <span class="line">|</span>
+                                    <span class="value">{{ item.value }}亩</span>
+                                </span>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </chart-box>
+        </div>
+        <div class="chart-item">
+            <chart-box name="2025年广东省作物区域占比">
+                <div class="box-content">
+                    <div class="chart-dom">
+                        <bar-chart :key="0"></bar-chart>
+                    </div>
+                    <div class="box-bg">从化区的作物种植面积最大,占比***</div>
+                </div>
+            </chart-box>
+        </div>
+        <div class="chart-item">
+            <chart-box name="近三年主要作物种植面积变化趋势">
+                <div class="box-content">
+                    <div class="chart-dom">
+                        <line-chart></line-chart>
+                    </div>
+                    <div class="box-bg">这里是预警提示的内容,有点长,先用这些文字占位,后续开发会把内容不上的。这里是预警提示的内容,有点长,先用这些文字占位,后续开发会把内容不上的。</div>
+                </div>
+            </chart-box>
+        </div>
+        <div class="chart-item">
+            <chart-box name="2025年广东省作物预估产量对比">
+                <div class="box-content">
+                    <div class="chart-dom">
+                        <bar-chart :key="1"></bar-chart>
+                    </div>
+                    <div class="box-bg">从化区的作物种植面积最大,占比***</div>
+                </div>
+            </chart-box>
+        </div>
+    </div>
+</template>
+
+<script setup>
+import chartBox from "@/components/chartBox.vue";
+import pieChart from "./pieChart.vue";
+import lineChart from "./lineChart.vue";
+import { computed } from "vue";
+import { pieOption } from "./chartOption.js";
+import barChart from "./barChart.vue";
+
+// 计算图例数据
+const legendData = computed(() => {
+    const total = 3774; // 总种植面积
+    return pieOption.series[0].data.map((item, index) => {
+        const percent = ((item.value / total) * 100).toFixed(0);
+        return {
+            name: item.name,
+            value: item.value,
+            percent: percent,
+            color: pieOption.color[index],
+        };
+    });
+});
+</script>
+
+<style lang="scss" scoped>
+.chart-list {
+    width: 100%;
+    height: 100%;
+    .chart-item {
+        width: 100%;
+        height: 285px;
+        box-sizing: border-box;
+        margin-bottom: 10px;
+        background: rgba(35, 35, 35, 1);
+        border: 1px solid #444444;
+        border-radius: 4px;
+        .box-content {
+            width: 100%;
+            height: 100%;
+        }
+        .chart-dom {
+            height: calc(100% - 61px);
+            width: 100%;
+        }
+        .box-bg {
+            border-radius: 2px 2px 0 0;
+            font-size: 12px;
+            padding: 6px 8px;
+            box-sizing: border-box;
+            height: 61px;
+            overflow-y: auto;
+            background: linear-gradient(180deg, rgb(85, 85, 85, 0.4) 0%, rgb(35, 35, 35, 1) 100%);
+
+            .legend-list {
+                display: grid;
+                grid-template-columns: 1fr 1fr;
+                gap: 8px 12px;
+                height: 100%;
+                font-size: 12px;
+
+                .legend-item {
+                    display: flex;
+                    align-items: center;
+                    gap: 6px;
+                    line-height: 12px;
+
+                    .dot {
+                        width: 5px;
+                        height: 5px;
+                        border-radius: 50%;
+                        flex-shrink: 0;
+                    }
+
+                    .text {
+                        color: rgba(255, 255, 255, 1);
+                        font-size: 12px;
+                        white-space: nowrap;
+                        .percent {
+                            padding: 0 10px;
+                        }
+                        .line {
+                            color: rgba(255, 255, 255, 0.2);
+                            padding-right: 10px;
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+</style>

+ 176 - 0
src/views/warningHome/components/chart_components/chartOption.js

@@ -0,0 +1,176 @@
+import * as echarts from "echarts";
+
+const commonxAxis = {
+    axisLabel: { color: '#9F9F9F' },
+    axisLine: { lineStyle: { color: 'rgba(185, 185, 185, 0.12)' } },
+}
+const commonyAxis = {
+    splitLine: { lineStyle: { color: 'rgba(185, 185, 185, 0.12)' } },
+    axisLabel: {
+        color: "#9F9F9F",
+    },
+}
+
+export const pieOption = {
+    tooltip: {
+        trigger: 'item',
+        textStyle: {
+            color: "#1D2129",
+            fontSize: 11,
+        },
+        formatter: function (params) {
+            const data = params.data;
+            const total = 3774;
+            const percent = (data.value / total * 100).toFixed(2);
+            return `${params.marker}${data.name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${percent}%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${data.value}亩`;
+        }
+    },
+    title: {
+        text: '总种植面积(亩)',
+        subtext: '1000',
+        x: '49%',
+        y: '39%',
+        textAlign: 'center',
+        textStyle: {
+            fontSize: 11,
+            fontWeight: 'normal',
+            color: '#FFFFFF'
+        },
+        subtextStyle: {
+            fontSize: 13,
+            fontWeight: 'normal',
+            color: '#FFFFFF'
+        }
+    },
+    color: ['#2199F8', '#14C9C9', '#FFCC4B', '#8F46F4', '#FF7878', '#9FDB1D'],
+    series: [
+        {
+            name: '种植作物',
+            type: 'pie',
+            radius: ['56%', '86%'],
+            label: {
+                show: false,
+                position: 'center'
+            },
+            labelLine: {
+                show: false
+            },
+            data: [
+                { value: 1048, name: '水稻' },
+                { value: 735, name: '小麦' },
+                { value: 580, name: '猫草' },
+                { value: 484, name: '中草药' },
+                { value: 300, name: '蔬菜' },
+                { value: 300, name: '荔枝' },
+            ]
+        }
+    ]
+};
+
+
+export const barOption = {
+    grid: {
+        top: 20,
+        left: 10,
+        right: 10,
+        bottom: 10,
+        containLabel: true,
+    },
+    xAxis: {
+        type: 'category',
+        ...commonxAxis,
+        data: ['从化区', '增城区', '花都区', '番禺区', '南沙区', '从化区', '荔湾区']
+    },
+    yAxis: {
+        type: 'value',
+        ...commonyAxis,
+        axisLabel: {
+            formatter: "{value}%",
+            color: "#9F9F9F",
+        },
+    },
+    series: [
+        {
+            data: [50, 20, 15, 58, 7, 28, 13],
+            type: 'bar',
+            barWidth: 10,
+            itemStyle: {
+                borderRadius: [8, 8, 0, 0],
+                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
+                    {
+                        offset: 0,
+                        color: '#FFD489',
+                    },
+                    {
+                        offset: 1,
+                        color: '#996324',
+                    },
+                ]),
+            },
+        }
+    ]
+}
+
+export const lineOption = {
+    tooltip: {
+      trigger: 'axis'
+    },
+    grid: {
+        top: 20,
+        left: 10,
+        right: 10,
+        bottom: 10,
+        containLabel: true,
+    },
+    xAxis: {
+      ...commonxAxis,
+      type: 'category',
+      boundaryGap: false,
+      data: ['2023-6', '2023-12', '2024-6', '2024-12', '2025-6', '2025-12']
+    },
+    yAxis: {
+        ...commonyAxis,
+      type: 'value'
+    },
+    series: [
+      {
+        name: '粮食',
+        type: 'line',
+        smooth: true,
+        showSymbol: false,
+        itemStyle: {
+          color: '#178B00'
+        },
+        lineStyle: {
+          color: '#178B00'
+        },
+        data: [250, 232, 221, 294, 310, 380]
+      },
+      {
+        name: '果类',
+        type: 'line',
+        smooth: true,
+        showSymbol: false,
+        itemStyle: {
+          color: '#2199F8'
+        },
+        lineStyle: {
+          color: '#2199F8'
+        },
+        data: [220, 182, 191, 234, 290, 330]
+      },
+      {
+        name: '蔬菜',
+        type: 'line',
+        smooth: true,
+        showSymbol: false,
+        itemStyle: {
+          color: '#FAA53D'
+        },
+        lineStyle: {
+          color: '#FAA53D'
+        },
+        data: [120, 132, 101, 134, 90, 230]
+      },
+    ]
+  };

+ 31 - 0
src/views/warningHome/components/chart_components/lineChart.vue

@@ -0,0 +1,31 @@
+<template>
+    <div ref="chartDom" class="line-chart"></div>
+</template>
+
+<script setup>
+import { onMounted, ref } from "vue";
+import * as echarts from "echarts";
+import { lineOption } from "./chartOption.js";
+import { deepClone } from "@/common/commonFun";
+
+const chartDom = ref(null);
+let myChart = null;
+
+const initData = () => {
+    const newOption = deepClone(lineOption);
+    myChart.setOption(newOption);
+};
+
+onMounted(() => {
+    myChart = echarts.init(chartDom.value);
+    initData();
+});
+
+</script>
+
+<style lang="scss" scoped>
+.line-chart {
+    width: 100%;
+    height: 100%;
+}
+</style>

+ 31 - 0
src/views/warningHome/components/chart_components/pieChart.vue

@@ -0,0 +1,31 @@
+<template>
+    <div ref="chartDom" class="pie-chart"></div>
+</template>
+
+<script setup>
+import { onMounted, ref } from "vue";
+import * as echarts from "echarts";
+import { pieOption } from "./chartOption.js";
+import { deepClone } from "@/common/commonFun";
+
+const chartDom = ref(null);
+let myChart = null;
+
+const initData = () => {
+    const newOption = deepClone(pieOption);
+    myChart.setOption(newOption);
+};
+
+onMounted(() => {
+    myChart = echarts.init(chartDom.value);
+    initData();
+});
+
+</script>
+
+<style lang="scss" scoped>
+.pie-chart {
+    width: 100%;
+    height: 100%;
+}
+</style>

+ 110 - 21
src/views/warningHome/index.vue

@@ -1,3 +1,4 @@
+-+
 <template>
     <div class="base-container no-events">
         <fnHeader showDate :autoGo="true" hideSwitch></fnHeader>
@@ -50,6 +51,40 @@
                     <time-line></time-line>
                 </div>
             </div>
+            <div class="warning-r right yes-events">
+                <chart-list></chart-list>
+                <!-- <farmInfoGroup></farmInfoGroup> -->
+            </div>
+            <!-- 地图图例 -->
+            <map-legend></map-legend>
+            <div class="warning-search yes-events">
+                <el-select
+                    v-model="locationVal"
+                    filterable
+                    remote
+                    reserve-keyword
+                    placeholder="搜索地区"
+                    :remote-method="remoteMethod"
+                    :loading="loading"
+                    @change="handleSearchRes"
+                    class="v-select"
+                    popper-class="focus-farm-select"
+                    style="width: 375px"
+                >
+                    <template #prefix>
+                        <el-icon class="el-input__icon"><search /></el-icon>
+                    </template>
+                    <el-option
+                        v-for="(item, index) in locationOptions.list"
+                        :key="index"
+                        :label="item.title"
+                        :value="item.point"
+                    >
+                        <span>{{ item.title }}</span>
+                        <span class="sub-title">{{ item.province }}{{ item.city }}{{ item.district }}</span>
+                    </el-option>
+                </el-select>
+            </div>
             <div class="base-tabs yes-events">
                 <div
                     v-for="item in baseTabs"
@@ -61,14 +96,6 @@
                     {{ item }}
                 </div>
             </div>
-            <div class="warning-r right yes-events">
-                <farmInfoGroup></farmInfoGroup>
-            </div>
-            <!-- 地图图例 -->
-            <map-legend></map-legend>
-            <div class="warning-search yes-events">
-                <img src="@/assets/images/warningHome/search-img.png" />
-            </div>
         </div>
     </div>
     <div ref="mapRef" class="bottom-map"></div>
@@ -90,16 +117,12 @@
 <script setup>
 import "./map/mockFarmLayer";
 import StaticMapLayers from "@/components/static_map_change/Layers.js";
-import StaticMapLegend from "@/components/static_map_change/legend.vue";
 import StaticMapPointLayers from "@/components/static_map_change/pointLayer.js";
-import { onMounted, onUnmounted, ref } from "vue";
+import { onMounted, onUnmounted, ref, reactive } from "vue";
 import fnHeader from "@/components/fnHeader.vue";
 import WarningMap from "./warningMap";
 import AlarmLayer from "./map/alarmLayer";
-import GardenPointLayer from "./map/gardenPointLayer";
-import album from "./components/album.vue";
 import trackDialog from "./components/trackDialog.vue";
-import chat from "./components/chat_components/index.vue";
 import alarmList from "./components/alarmList.vue";
 import timeLine from "./components/timeLine.vue";
 import { useRouter } from "vue-router";
@@ -108,12 +131,12 @@ import { areaListOptions } from "./area";
 import { useStore } from "vuex";
 import farmInfoGroup from "./components/farmInfoGroup.vue";
 import mapLegend from "./components/mapLegend.vue";
+import chartList from "./components/chart_components/chartList.vue";
 
 let store = useStore();
 
 let warningMap = new WarningMap();
 let alarmLayer = null;
-let gardenPointLayer = null;
 let staticMapLayers = null;
 let staticMapPointLayers = null;
 const router = useRouter();
@@ -132,7 +155,6 @@ onMounted(() => {
     alarmLayer = new AlarmLayer(warningMap.kmap);
     staticMapLayers = new StaticMapLayers(warningMap.kmap);
     staticMapPointLayers = new StaticMapPointLayers(warningMap.kmap);
-    gardenPointLayer = new GardenPointLayer(warningMap.kmap);
     // setTimeout(() => {
     //   staticMapLayers.show("testpng")
     // },2000)
@@ -227,6 +249,49 @@ const toggleBox = (name) => {
     legendImg.value = warningLayers.value[`${name}图例`];
     eventBus.emit("warningHome:toggleMapLayer", name);
 };
+
+// 搜索
+const locationVal = ref("");
+const loading = ref(false);
+const MAP_KEY = "CZLBZ-LJICQ-R4A5J-BN62X-YXCRJ-GNBUT";
+
+const handleSearchRes = (v) => {
+    warningMap.setMapCenter(v);
+    // onRest();
+};
+
+const locationOptions = reactive({
+    list: [],
+});
+const remoteMethod = async (keyword) => {
+    if (keyword) {
+        locationOptions.list = [];
+        loading.value = true;
+        const params = {
+            key: MAP_KEY,
+            keyword,
+            //   location: location.value,
+            location: "22.574540836684672,113.1093017627431",
+        };
+        await VE_API.old_mini_map.getCtiyList({ word: keyword }).then(({ data }) => {
+            if (data && data.length) {
+                data.forEach((item) => {
+                    item.point = item.location.lat + "," + item.location.lng;
+                    locationOptions.list.push(item);
+                });
+            }
+        });
+        VE_API.old_mini_map.search(params).then(({ data }) => {
+            loading.value = false;
+            data.forEach((item) => {
+                item.point = item.location.lat + "," + item.location.lng;
+                locationOptions.list.push(item);
+            });
+        });
+    } else {
+        locationOptions.list = [];
+    }
+};
 </script>
 
 <style lang="scss" scoped>
@@ -247,7 +312,7 @@ const toggleBox = (name) => {
     .content {
         width: 100%;
         height: calc(100% - 74px - 48px);
-        padding: 0 20px 0 27px;
+        padding: 16px 20px 0 27px;
         display: flex;
         justify-content: space-between;
         box-sizing: border-box;
@@ -256,14 +321,17 @@ const toggleBox = (name) => {
         .right {
             width: calc(376px + 54px);
             height: 100%;
-            padding-top: 10px;
             box-sizing: border-box;
             // display: flex;
         }
         .right {
             // width: 395px;
-            width: 500px;
+            width: 376px;
+            padding: 8px;
+            overflow: auto;
             position: relative;
+            background: #101010;
+            border: 1px solid #444444;
             .list {
                 width: 100%;
                 height: 100%;
@@ -309,14 +377,35 @@ const toggleBox = (name) => {
             }
         }
         .warning-search {
-            position: absolute;
-            right: 208px;
-            top: -44px;
+            position: fixed;
+            right: 207px;
+            top: 28px;
             display: flex;
             align-items: center;
             .focus-farm {
                 padding-left: 15px;
             }
+            ::v-deep {
+                .el-select__wrapper {
+                    background: #1d1d1d;
+                    box-shadow: 0 0 0 1px rgba(255, 212, 137, 0.3) inset;
+                    height: 50px;
+                    line-height: 50px;
+                    .el-select__caret,
+                    .el-select__prefix {
+                        color: rgba(255, 212, 137, 0.6);
+                    }
+                }
+                .el-select__input {
+                    color: rgba(255, 212, 137, 0.6);
+                }
+                .el-select__placeholder {
+                    color: rgba(255, 212, 137, 0.6);
+                    font-size: 20px;
+                    font-family: "PangMenZhengDao";
+                    // text-align: center;
+                }
+            }
         }
         .warning-top {
             display: flex;

+ 0 - 109
src/views/warningHome/map/gardenPointLayer.js

@@ -1,109 +0,0 @@
-import eventBus from "@/api/eventBus";
-import * as KMap from "@/utils/ol-map/KMap";
-import { Vector as VectorSource } from "ol/source.js";
-import Style from "ol/style/Style";
-import { WKT } from 'ol/format'
-import { Fill, Text } from "ol/style";
-import Icon from 'ol/style/Icon.js';
-import { Feature } from "ol";
-import store from '@/store'
-import Photo from "ol-ext/style/Photo";
-import Stroke from 'ol/style/Stroke.js';
-import { newPoint } from "@/utils/map.js";
-
-/**
- *
- */
-class gardenPointLayer {
-    constructor(kmap) {
-        let that = this;
-        this.kmap = kmap
-        let vectorStyle = new KMap.VectorStyle()
-        // this.regionLayer = new KMap.VectorLayer("regionLayer", 3, {
-        //     source: new VectorSource({}),
-        //     style: function (f) {
-        //         let style2 = vectorStyle.getPolygonStyle("#032833" + "30", "#c7cb20", 2)
-        //         return [style2]
-        //     }
-        // });
-        // this.kmap.addLayer(this.regionLayer.layer)
-
-        this.gardenPointLayer = new KMap.VectorLayer("gardenUserLayer", 9999, {
-            minZoom: 0,
-            maxZoom: 22,
-            source: new VectorSource({}),
-            style: (feature) => {
-              const organId = feature.get('organId') === this.organId
-              let style1 = new Style({
-                image: new Icon({
-                  src: '/src/assets/images/map/garden.png',
-                  scale: 0.5,
-                  shadow: 0,
-                  // crop: true,
-                  onload: function () {
-                    that.gardenPointLayer.layer.changed();
-                  },
-                  displacement: [-1, -1],
-                }),
-              });
-              return [style1];
-            },
-          });
-        this.gardenPointLayer2 = new KMap.VectorLayer("gardenUserLayer2", 9999, {
-            minZoom: 0,
-            maxZoom: 22,
-            source: new VectorSource({}),
-            style: (feature) => {
-              const organId = feature.get('organId') === this.organId
-              let style1 = new Style({
-                image: new Icon({
-                  src: '/src/assets/images/map/garden2.png',
-                  scale: 0.5,
-                  shadow: 0,
-                  // crop: true,
-                  onload: function () {
-                    that.gardenPointLayer2.layer.changed();
-                  },
-                  displacement: [-1, -1],
-                }),
-              });
-              return [style1];
-            },
-          });
-          this.kmap.addLayer(this.gardenPointLayer.layer);
-          this.kmap.addLayer(this.gardenPointLayer2.layer);
-          this.initLayer()
-    }
-
-    initLayer(){
-      const gardenList = [
-        {wkt: "POINT(113.61702297075017 23.584863449735067)"}
-      ]
-      const gardenList2 = [
-        {wkt: "POINT(113.5081595 23.5320866)"}
-      ]
-        this.gardenPointLayer.refresh()
-        this.gardenPointLayer2.refresh()
-        if (this.gardenPointLayer.source) {
-          this.gardenPointLayer.source.clear()
-          this.gardenPointLayer2.source.clear()
-          // this.gardenReportPointLayer.source.clear()
-        }
-        for(let garden of gardenList){
-          // this.clearOverLay(garden.organId)
-          garden.wktVal = garden.wkt
-          this.gardenPointLayer.source.addFeature(newPoint(garden, "wktVal", "myGarden"))
-          // this.gardenReportPointLayer.source.addFeature(newPoint(garden, "wkt", "myGardenReport"))
-          // this.initGardenWaring(extractCoordinates(garden.wkt), garden)
-        }
-        for(let garden of gardenList2){
-          // this.clearOverLay(garden.organId)
-          garden.wktVal = garden.wkt
-          this.gardenPointLayer2.source.addFeature(newPoint(garden, "wktVal", "myGarden"))
-          // this.gardenReportPointLayer.source.addFeature(newPoint(garden, "wkt", "myGardenReport"))
-          // this.initGardenWaring(extractCoordinates(garden.wkt), garden)
-        }
-      }
-}
-
-export default gardenPointLayer;

+ 5 - 32
src/views/warningHome/map/mockFarmLayer.js

@@ -44,41 +44,14 @@ class MockFarmLayer {
         });
         eventBus.on("warningMap:init", function (kmap) {
             that.initLayer(kmap)
-            VE_API.mini_farm.weatherRiskVirtualFarmList().then(res => {
-                if(res.code ===0){
-                    const lby = {}
-                    const jgjd = {
-                        disease:'',
-                        grow:'谢花',
-                        img:'https://birdseye-img.sysuimars.com/birdseye-look-mini/img_crop/bch/ch/cropped_DJI_20240707184352_0041_V_9.jpg',
-                        name:'井冈基地',
-                        mapId:2,
-                        nodeType:"mock_farm_data",
-                        mockFarmId:88866,
-                        cloudFilename:'',
-                        dic:{
-                            "病虫异常": 0,
-                            "物候期": "果期",
-                            "比例": 91,
-                            "生育期": "膨果期",
-                            "生长异常": 1
-                        },
-                        targetSampleId:96774,
-                        wkt:'POINT(113.5081595 23.5320866)'
-                    }
-                    res.data.push(jgjd)
-                    console.log('res.data',res.data);
-                    that.setData(res.data)
-                }
-            })
         })
 
         eventBus.on("weatherTime:changeTime", function ({date}) {
-            VE_API.mini_farm.weatherRiskVirtualFarmList({date: "2025-"+date}).then(res => {
-                if(res.code ===0){
-                    that.setData(res.data)
-                }
-            })
+            // VE_API.mini_farm.weatherRiskVirtualFarmList({date: "2025-"+date}).then(res => {
+            //     if(res.code ===0){
+            //         that.setData(res.data)
+            //     }
+            // })
         })
         eventBus.on("MockFarmLayer:click", function ({event, feature}) {
             let targetSampleId = feature.get("targetSampleId")

+ 13 - 1
src/views/warningHome/warningMap.js

@@ -25,7 +25,7 @@ class HomeMap {
     let coordinate = util.wktCastGeom(location).getFirstCoordinate();
     this.kmap = new KMap.Map(target, level, coordinate[0], coordinate[1], null, 9, 22);
     this.addMapListen()
-     // 添加比例尺控件
+    // 添加比例尺控件
     const scaleLine = new ScaleLine({
       units: 'metric' // 可以选择 'imperial' 或 'metric'
     });
@@ -95,6 +95,18 @@ class HomeMap {
       console.log('address', this.address);
     });
   }
+
+  //  设置地图中心点位
+  setMapCenter(v, isPoint = true) {
+    let arrayOfNumbers = [];
+    const arrayOfStrings = v.split(",");
+    arrayOfNumbers = [arrayOfStrings[1], arrayOfStrings[0]];
+    this.kmap.map.getView().setCenter(arrayOfNumbers);
+    if (!isPoint) return
+    // this.locationLayer.source.clear();
+    // let point = new Feature(new Point(arrayOfNumbers));
+    // this.locationLayer.addFeature(point);
+  }
 }
 
 export default HomeMap;