Browse Source

feat:对接农情档案页面接口和农事规划页面接口

wangsisi 3 tuần trước cách đây
mục cha
commit
71b8a34e88

+ 15 - 48
src/api/modules/monitor.js

@@ -1,43 +1,15 @@
 const config = require("../config")
 
 module.exports = {
-    getCountByStatusAndFarmId: {
-        url: config.base_dev_url + "z_farm_work_record/getCountByStatusAndFarmId",
-        type: "get",
-    },
-    broadcastPage: {
-        url: config.base_dev_url + "farm_broadcast/page/{limit}/{page}",
-        type: "get",
-    },
     farmWorkPlan: {
         url: config.base_dev_url + "container_space_time/farmWorkPlan",
         type: "get",
     },
-    //根据农场ID查询农事列表(按物候期分组)
-    listByFarmId: {
-        url: config.base_dev_url + "z_farm_work_lib/listByFarmId",
-        type: "get",
-    },
-    //根据农事编排ID直接触发农事
-    triggerFarmWork: {
-        url: config.base_dev_url + "container_farm_work_arrange/triggerFarmWorkByArrangeId",
-        type: "post",
-    },
     //添加复核照片
     addReviewImg: {
         url: config.base_dev_url + "z_farm_work_record/addReviewImg",
         type: "post",
     },
-    //领取农场
-    receiveFarm: {
-        url: config.base_dev_url + "z_agricultural_store_farm/receive",
-        type: "post",
-    },
-    //农场作用域:获取讲述信息接口(根据farmId、regionId、varietyId)
-    getFarmSpeakInfo: {
-        url: config.base_dev_url + "container_phenology_sample_files_speak_title/getFarmSpeakInfo",
-        type: "get",
-    },
     //根据containerSpaceTimeId查询物候期列表
     listPhenology: {
         url: config.base_dev_url + "container_space_time/listPhenologyByContainerSpaceTimeId",
@@ -53,11 +25,6 @@ module.exports = {
         url: config.base_dev_url + "container_space_time/batchSaveFarmPhenologyTime",
         type: "post",
     },
-    //保存农事卡片数据(新增或修改)
-    saveFarmWorkLib: {
-        url: config.base_dev_url + "z_farm_work_lib/save",
-        type: "post",
-    },
     //农资用户复制自己的方案
     copyScheme: {
         url: config.base_dev_url + "container_farm_work_scheme/copyMyScheme",
@@ -73,11 +40,6 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_scheme/renameScheme?schemeId={schemeId}&name={name}",
         type: "post",
     },
-    // 验证农事卡片药肥价格完整的接口
-    validatePesticideFertilizerQuotes: {
-        url: config.base_dev_url + "z_farm_work_lib/validatePesticideFertilizerQuotes",
-        type: "get",
-    },
     // 批量验证多个农事药肥报价信息是否完整
     batchValidatePesticideFertilizerQuotes: {
         url: config.base_dev_url + "z_farm_work_lib/batchValidatePesticideFertilizerQuotes",
@@ -88,11 +50,6 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_scheme/enableScheme",
         type: "get",
     },
-    // 自动化完善农事处方中的药肥数据
-    completeMedicationData: {
-        url: config.base_dev_url + "container_farm_work_automation/completeMedicationData?schemeId={schemeId}&containerId={containerId}",
-        type: "post",
-    },
     // 获取作物档案列表
     getArchivesList: {
         url: config.base_dev_url + "container_crop_archive/cropArchiveV2",
@@ -103,11 +60,6 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_group/farmWorkPlan",
         type: "get",
     },
-    //关闭当天弹窗:记录该互动在当天已展示过弹窗
-    closeTodayPopup: {
-        url: config.base_dev_url + "container_phenology_interaction/closeTodayUnrepliedInteraction",
-        type: "get",
-    },
     //根据农场主体ID查询其下所有农场的分区列表
     listRegionsBySubjectId: {
         url: config.base_dev_url + "farm_subject/listRegionsBySubjectId",
@@ -123,4 +75,19 @@ module.exports = {
         url: config.base_dev_url + "farm_subject/listFarmsBySubjectId",
         type: "get",
     },
+    //获取物候列表
+    getPhenologyList: {
+        url: config.base_new_url + "farm_works",
+        type: "get",
+    },
+    //农场互动信息
+    getFarmRiskAndTracking: {
+        url: config.base_new_url + "farm_risk_and_tracking",
+        type: "get",
+    },
+    //农场农情档案查询
+    getFarmRecord: {
+        url: config.base_new_url + "find_farm_record",
+        type: "get",
+    },
 };

+ 7 - 4
src/components/gardenList.vue

@@ -87,6 +87,7 @@ function saveSelectedFarm(farm) {
     localStorage.setItem("selectedFarmId", farm.id);
     localStorage.setItem("selectedFarmName", farm.name || "");
     localStorage.setItem("selectedFarmPoint", farm.wkt || "");
+    localStorage.setItem("selectedFarmData", JSON.stringify(farm));
 }
 
 function emitSelectedFarm(farm) {
@@ -137,21 +138,23 @@ function selectFarmFromList(data) {
 function normalizeFarmList(data) {
     return (data || []).map((farm) => ({
         ...farm,
+        id: farm.farm_id,
+        name: farm.farm_name,
         warningText: "干旱预警",
-        address: farm.address || farm.city || "暂无地址",
+        wkt: farm.geom_wkt,
+        address: farm.farm_address || farm.city || "暂无地址",
         stats: mapStats(),
         isCurrent: false
     }));
 }
 
 function getFarmList() {
-    VE_API.farm.listByUserId().then(({ data }) => {
-    // VE_API.farm.getFarmList().then(({ data }) => {
+    VE_API.farm.getFarmList().then(({ data }) => {
         const fullData = normalizeFarmList(data);
         gardenList.value = fullData;
         if (!fullData.length) {
             emit("loaded", { hasFarm: false });
-            emit("selectGarden", { id: null, name: "", wkt: "", defaultOption: false });
+            emit("selectGarden", { farm_id: null, farm_name: "", geom_wkt: "", defaultOption: false });
             return;
         }
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 153 - 654
src/components/pageComponents/ArchivesFarmTimeLine.vue


+ 54 - 52
src/views/old_mini/agri_file/components/fileFloat.vue

@@ -1,23 +1,23 @@
 <template>
-
-<div class="add-btn">点击新建管理分区</div>
-
-    <floating-panel class="file-float-panel" :class="{'custom-panel': height === anchors[0]}" v-model:height="height" :anchors="anchors">
+    <!-- <div class="add-btn">点击新建管理分区</div> -->
+    <floating-panel class="file-float-panel" :class="{ 'custom-panel': height === anchors[0] }" v-model:height="height"
+        :anchors="anchors">
         <div class="file-float-content">
             <div class="float-tabs">
                 <div class="tab-active-bg" :style="activeBgStyle"></div>
-                <div class="tab-item" @click="changeTab(0)" :class="{ 'tab-item-active': activeTab === 0 }">物候记录</div>
-                <div class="tab-item" @click="changeTab(1)" :class="{ 'tab-item-active': activeTab === 1 }">异常记录</div>
-                <div class="tab-item" @click="changeTab(2)" :class="{ 'tab-item-active': activeTab === 2 }">农事记录</div>
+                <div v-for="(item, index) in floatTabLabels" :key="index" class="tab-item" @click="changeTab(item,index)"
+                    :class="{ 'tab-item-active': activeTab === index }">
+                    {{ item.title }}
+                </div>
             </div>
 
             <div class="tab-content-group" v-show="height !== anchors[0]">
-                <div class="tab-loading" v-if="isCurrentTabLoading">加载中...</div>
-                <div class="tab-empty" v-else-if="currentList.length === 0">暂无记录</div>
+                <!-- <div class="tab-loading" v-if="isCurrentTabLoading">加载中...</div>
+                <div class="tab-empty" v-else-if="currentList.length === 0">暂无记录</div> -->
                 <div class="tab-content-item" v-for="item in currentList" :key="item.id">
-                    <div class="time-tag">{{ item.date }}</div>
+                    <div class="time-tag">{{ item.time }}</div>
                     <div class="item-info">
-                        {{ item.textPrefix }} <span class="blue-text">{{ item.highlight }}</span>
+                        {{ item.record }} <span class="blue-text">{{ item.ratio }}{{ floatTabLabels[activeTab].value !== 'farming' ? '%' : '' }}</span>
                     </div>
                 </div>
             </div>
@@ -28,7 +28,9 @@
 <script setup>
 
 import { FloatingPanel } from 'vant';
-import { computed, ref } from 'vue';
+import { computed, ref, onMounted } from 'vue';
+
+const emit = defineEmits(['map-farm-record']);
 const anchors = [
     130,
     Math.round(0.4 * window.innerHeight),
@@ -36,62 +38,55 @@ const anchors = [
 ];
 const height = ref(anchors[0]);
 
+const floatTabLabels = [{
+    title: "物候记录",
+    value: "phenology",
+}, {
+    title: "异常记录",
+    value: "abnormal",
+}, {
+    title: "农事记录",
+    value: "farming",
+}];
+
+const currentList = ref([]);
 const activeTab = ref(0);
-const dataMap = ref({ 0: [], 1: [], 2: [] });
-const loadingMap = ref({ 0: false, 1: false, 2: false });
-const loadedMap = ref({ 0: false, 1: false, 2: false });
+const syncMapFarmRecord = () => {
+    emit('map-farm-record', {
+        polygonWkt: mapPolygonData.value,
+        records: currentList.value,
+    });
+};
 
-const changeTab = (index) => {
+const changeTab = (item, index) => {
     activeTab.value = index;
-    ensureTabData(index);
+    currentList.value = farmRecordData.value?.[item.value] || [];
+    syncMapFarmRecord();
 };
 
 const activeBgStyle = computed(() => ({
     transform: `translateX(${activeTab.value * 100}%)`,
 }));
 
-const currentList = computed(() => dataMap.value[activeTab.value] || []);
-const isCurrentTabLoading = computed(() => !!loadingMap.value[activeTab.value]);
 
-function getMockDataByTab(tab) {
-    if (tab === 0) {
-        return [
-            { id: "p1", date: "04/18", textPrefix: "管理分区一出现 新梢占比为", highlight: "15 %" },
-            { id: "p2", date: "04/19", textPrefix: "管理分区二进入 花穗萌动", highlight: "60 %" },
-        ];
-    }
-    if (tab === 1) {
-        return [
-            { id: "a1", date: "04/18", textPrefix: "管理分区三发现 异常叶片占比", highlight: "8 %" },
-        ];
-    }
-    return [
-        { id: "w1", date: "04/17", textPrefix: "管理分区一完成 修枝作业进度", highlight: "100 %" },
-        { id: "w2", date: "04/18", textPrefix: "管理分区二完成 灌溉作业进度", highlight: "100 %" },
-    ];
-}
+onMounted(() => {
+    getFarmRecord();
+});
 
-async function ensureTabData(tab) {
-    if (loadedMap.value[tab] || loadingMap.value[tab]) return;
-    loadingMap.value[tab] = true;
-    try {
-        // TODO: 替换为真实接口请求,按 tab 类型获取不同记录
-        const list = await new Promise((resolve) => {
-            setTimeout(() => resolve(getMockDataByTab(tab)), 250);
-        });
-        dataMap.value[tab] = list || [];
-        loadedMap.value[tab] = true;
-    } finally {
-        loadingMap.value[tab] = false;
+const mapPolygonData = ref("");
+const farmRecordData = ref({});
+const getFarmRecord = async () => {
+    const res = await VE_API.monitor.getFarmRecord();
+    if (res.code === 200) {
+        mapPolygonData.value = res.data.polygon;
+        farmRecordData.value = res.data || {};
+        changeTab(floatTabLabels[0],0);
     }
 }
 
-ensureTabData(0);
-
 </script>
 
 <style lang="scss" scoped>
-
 .add-btn {
     position: fixed;
     top: 50%;
@@ -105,16 +100,20 @@ ensureTabData(0);
     line-height: 40px;
     cursor: pointer;
 }
+
 .file-float-panel {
     left: 12px;
     width: calc(100% - 24px);
+
     &.custom-panel {
         background: transparent;
+
         ::v-deep {
             .van-floating-panel__header {
                 background: #fff;
                 border-radius: 10px 10px 0 0;
             }
+
             .van-floating-panel__content {
                 background: transparent;
                 margin-top: -1px;
@@ -122,10 +121,12 @@ ensureTabData(0);
         }
     }
 }
+
 .file-float-content {
     padding: 0 10px 10px;
     background: #fff;
     border-radius: 0 0 10px 10px;
+
     .float-tabs {
         position: relative;
         border-radius: 4px;
@@ -157,6 +158,7 @@ ensureTabData(0);
             color: #767676;
             border-radius: 4px;
             transition: color 0.2s ease;
+
             &.tab-item-active {
                 color: #0D0D0D;
             }
@@ -174,7 +176,7 @@ ensureTabData(0);
             padding: 14px 0;
         }
 
-        .tab-content-item + .tab-content-item {
+        .tab-content-item+.tab-content-item {
             margin-top: 10px;
         }
 

+ 122 - 9
src/views/old_mini/agri_file/fileMap.js

@@ -1,17 +1,74 @@
 import * as KMap from "@/utils/ol-map/KMap";
 import * as util from "@/common/ol_common.js";
 import config from "@/api/config.js";
-import { Point } from 'ol/geom';
+import { Vector as VectorSource } from "ol/source.js";
+import { newAreaFeature, newPoint } from "@/utils/map";
+import Style from "ol/style/Style";
+import Icon from "ol/style/Icon";
+import Text from "ol/style/Text";
+import { Fill, Stroke } from "ol/style";
+import { createEmpty, extend as extendExtent, isEmpty as isEmptyExtent } from "ol/extent";
+
+function getRecordPointWkt(item) {
+    if (!item || typeof item !== "object") return null;
+    const candidates = [item.pointWkt, item.point_wkt, item.positionWkt, item.position_wkt];
+    for (const v of candidates) {
+        if (v && typeof v === "string" && v.trim().toUpperCase().startsWith("POINT")) {
+            return v.trim();
+        }
+    }
+    const w = item.wkt;
+    if (w && typeof w === "string" && w.trim().toUpperCase().startsWith("POINT")) {
+        return w.trim();
+    }
+    return null;
+}
 
 /**
  *
  */
 class FileMap {
     constructor() {
-        let that = this;
-        // let vectorStyle = new KMap.VectorStyle();
-    }
+        /** @type {{ polygonWkt: string, pointItems: object[] } | null} */
+        this._pendingFarmRecordOverlay = null;
+        const vectorStyle = new KMap.VectorStyle();
+        this.gardenPolygonLayer = new KMap.VectorLayer("gardenPolygonLayer", 999, {
+            minZoom: 8,
+            maxZoom: 22,
+            source: new VectorSource({}),
+            style: function () {
+                return [vectorStyle.getPolygonStyle("#00000040", "#2199F8", 2)];
+            },
+        });
 
+        this.recordPointLayer = new KMap.VectorLayer("fileRecordPointLayer", 1000, {
+            minZoom: 8,
+            maxZoom: 22,
+            source: new VectorSource({}),
+            style: (f) => {
+                const pointIcon = new Style({
+                    image: new Icon({
+                        src: require("@/assets/img/home/garden-point.png"),
+                        scale: 0.5,
+                        anchor: [0.5, 1],
+                    }),
+                });
+                const label = f.get("labelText");
+                const nameText = label
+                    ? new Style({
+                          text: new Text({
+                              font: "12px sans-serif",
+                              text: label,
+                              offsetY: -28,
+                              fill: new Fill({ color: "#fff" }),
+                              stroke: new Stroke({ color: "#000", width: 0.5 }),
+                          }),
+                      })
+                    : null;
+                return nameText ? [pointIcon, nameText] : [pointIcon];
+            },
+        });
+    }
 
     initMap(location, target) {
         let level = 16;
@@ -19,15 +76,71 @@ class FileMap {
         this.kmap = new KMap.Map(target, level, coordinate[0], coordinate[1], null, 8, 22);
         let xyz2 = config.base_img_url3 + "map/lby/{z}/{x}/{y}.png";
         this.kmap.addXYZLayer(xyz2, { minZoom: 8, maxZoom: 22 }, 2);
+        this.kmap.addLayer(this.gardenPolygonLayer.layer);
+        this.kmap.addLayer(this.recordPointLayer.layer);
+        if (this._pendingFarmRecordOverlay) {
+            const p = this._pendingFarmRecordOverlay;
+            this._pendingFarmRecordOverlay = null;
+            this.setFarmRecordOverlay(p.polygonWkt, p.pointItems);
+        }
     }
 
     /**
-   * 调整地图视图以适应地块范围
-   */
+     * 农情档案:地块边界 + 记录点位(带 pointWkt / wkt 等)
+     * @param {string} polygonWkt 地块 MULTIPOLYGON / POLYGON WKT
+     * @param {Array<object>} pointItems 当前 Tab 下列表项
+     */
+    setFarmRecordOverlay(polygonWkt, pointItems) {
+        if (!this.kmap) {
+            this._pendingFarmRecordOverlay = { polygonWkt, pointItems };
+            return;
+        }
+
+        this.gardenPolygonLayer.source.clear();
+        this.recordPointLayer.source.clear();
+
+        if (polygonWkt && typeof polygonWkt === "string" && polygonWkt.trim()) {
+            try {
+                const f = newAreaFeature({ id: "farm-record-boundary", geomWkt: polygonWkt.trim() }, "geomWkt");
+                this.gardenPolygonLayer.source.addFeature(f);
+            } catch (e) {
+                console.warn("[FileMap] polygon WKT parse failed", e);
+            }
+        }
+
+        const list = Array.isArray(pointItems) ? pointItems : [];
+        list.forEach((item, idx) => {
+            const ptWkt = getRecordPointWkt(item);
+            if (!ptWkt) return;
+            try {
+                const row = { ...item, id: item.id ?? `record-pt-${idx}`, pointWkt: ptWkt };
+                const f = newPoint(row, "pointWkt");
+                const labelText = [item.time, item.record].filter(Boolean).join(" ");
+                f.set("labelText", labelText || String(item.record ?? ""));
+                this.recordPointLayer.source.addFeature(f);
+            } catch (e) {
+                console.warn("[FileMap] record point WKT parse failed", e);
+            }
+        });
+
+        this.fitView();
+    }
+
+    /**
+     * 调整地图视图以适应地块与点位范围
+     */
     fitView() {
-        let extent = this.gardenPolygonLayer.source.getExtent()
-        if (extent) {
-            // 地图自适应到区域可视范围
+        if (!this.kmap) return;
+        let extent = createEmpty();
+        const polyFeats = this.gardenPolygonLayer.source.getFeatures().length;
+        const ptFeats = this.recordPointLayer.source.getFeatures().length;
+        if (polyFeats) {
+            extendExtent(extent, this.gardenPolygonLayer.source.getExtent());
+        }
+        if (ptFeats) {
+            extendExtent(extent, this.recordPointLayer.source.getExtent());
+        }
+        if (!isEmptyExtent(extent)) {
             this.kmap.getView().fit(extent, { duration: 50, padding: [80, 80, 80, 80] });
         }
     }

+ 5 - 1
src/views/old_mini/agri_file/index.vue

@@ -23,7 +23,7 @@
 
         <div class="file-content" v-show="activeGardenTab === 'current'">
             <div class="map-container" ref="mapContainer"></div>
-            <file-float></file-float>
+            <file-float @map-farm-record="onFarmRecordMap"></file-float>
         </div>
     </div>
 </template>
@@ -51,6 +51,10 @@ const activeType = ref("荔枝");
 
 const fileMap = new FileMap();
 
+const onFarmRecordMap = ({ polygonWkt, records }) => {
+    fileMap.setFarmRecordOverlay?.(polygonWkt, records);
+};
+
 const weatherExpanded = (isExpandedValue) => {
     isExpanded.value = isExpandedValue;
 };

+ 22 - 83
src/views/old_mini/agri_record/index.vue

@@ -15,28 +15,28 @@
         <!-- 作物档案 -->
         <div class="archives-time-line" v-show="activeGardenTab === 'current'">
             <div class="trend-monitor-list">
-                <div class="trend-monitor-card" @click="handleTrendMonitorCardClick(item)" v-for="(item, index) in trendMonitorMockList" :key="index">
+                <div class="trend-monitor-card" @click="handleTrendMonitorCardClick(item)"
+                    v-for="(item, index) in trendMonitorMockList" :key="index">
                     <div class="card-header">
                         <div class="header-left">
-                            <span class="title">{{ item.title }}</span>
-                            <span class="level-tag">{{ item.level }}</span>
+                            <span class="title">{{ item.first_work.work_name }}</span>
+                            <span class="level-tag">二级</span>
                         </div>
-                        <div class="status-tag">{{ item.status }}</div>
+                        <div class="status-tag" v-if="item.risk_level">待记录</div>
                     </div>
                     <div class="card-row">
-                        <div class="reason-text">{{ item.reason }}</div>
-                        <div class="question-tag">{{ item.question }}</div>
+                        <div class="reason-text">{{ item.first_work.work_reason_short }}</div>
+                        <div class="question-tag">{{ item.first_work.interaction_issue }}</div>
                     </div>
-                    <div class="record-list">
+                    <!-- <div class="record-list">
                         <div class="record-item" v-for="(record, recordIndex) in item.records" :key="recordIndex">
                             {{ record }}
                         </div>
-                    </div>
+                    </div> -->
                 </div>
             </div>
             <div class="archives-time-line-content">
-                <archives-farm-time-line :year="2026" :farmId="98570" :regionId="235997"
-                    @card-click="handleCardClick"></archives-farm-time-line>
+                <archives-farm-time-line :farmId="98570" :regionId="235997"></archives-farm-time-line>
             </div>
         </div>
     </div>
@@ -53,75 +53,25 @@ import gardenList from "@/components/gardenList.vue";
 
 const router = useRouter();
 
-// 品种选择(作物档案内)- 根据主体ID动态获取分区列表
-const varietyTabs = ref([]);
-const activeVariety = ref(0);
-
-const getVarietyTabs = async () => {
-    if (!gardenId.value) {
-        return;
-    }
-    try {
-        // const res = await VE_API.monitor.listRegionsBySubjectId({
-        //     subjectId: gardenId.value,
-        // });
-        const res = await VE_API.basic_farm.fetchProblemZoneList({
-            subjectId: gardenId.value,
-        });
-        if (res.data && res.data.regionList && res.data.problemZones) {
-            varietyTabs.value = res.data.regionList.concat(res.data.problemZones)
-        }
-        if (varietyTabs.value.length > 0) {
-            handleVarietyClick(varietyTabs.value[activeVariety.value || 0], activeVariety.value || 0)
-        }
-    } catch (error) {
-        console.error("获取主体分区列表失败:", error);
-    }
-};
-
-const handleVarietyClick = (tab, index) => {
-    activeVariety.value = index;
-    if (tab.lastViewTime == null && tab.regionId) {
-        VE_API.basic_farm.updateLastViewTime({
-            regionId: tab.regionId,
-        });
-    }
-};
-
 const defaultGardenId = ref(null);
 const selectedGardenId = ref(null);
 const gardenListRef = ref(null);
 const activeGardenTab = ref('current');
-const trendMonitorMockList = ref([
-    {
-        title: "病虫害态势监控",
-        level: "二级",
-        status: "待记录",
-        reason: "互动原因互动原因",
-        question: "互动问题互动问题互动问题",
-        records: ["真菌类", "真菌类", "真菌类"],
-    },
-    {
-        title: "长势异常态势跟踪",
-        level: "二级",
-        status: "待记录",
-        reason: "互动原因互动原因",
-        question: "互动问题互动问题互动问题",
-        records: ["长势异常一", "长势异常二", "长势异常"],
-    },
-    {
-        title: "物候跟踪记录",
-        level: "二级",
-        status: "待记录",
-        reason: "互动原因互动原因",
-        question: "互动问题互动问题互动问题",
-        records: ["04/16(某某分区)", "04/19(某某分区)", "04/20(某某分区)"],
-    },
-]);
+const trendMonitorMockList = ref([]);
 const changeGardenTab = (tab) => {
     activeGardenTab.value = tab;
 };
 
+const getFarmRiskAndTracking = async () => {
+    const res = await VE_API.monitor.getFarmRiskAndTracking({
+        farm_id: gardenId.value,
+        crop_type: JSON.parse(localStorage.getItem("selectedFarmData")).farm_variety,
+    });
+    if (res.code === 200) {
+        trendMonitorMockList.value.push(res.data?.growth_abnormal_tracking, res.data?.pest_risk_assessment, res.data?.phenology_tracking);
+    }
+}
+
 const handleGardenLoaded = ({ hasFarm }) => {
     weatherInfoRef.value?.setGardenLoaded?.(hasFarm);
 };
@@ -166,27 +116,16 @@ const gardenId = ref(store.state.home.gardenId);
 // 初始化加载数据
 onMounted(() => {
     if (gardenId.value) {
-        getVarietyTabs();
+        getFarmRiskAndTracking();
     }
 });
 
 const changeGarden = ({ id }) => {
     gardenId.value = id;
-    if (sessionStorage.getItem('activeVariety')) {
-        activeVariety.value = Number(sessionStorage.getItem('activeVariety'));
-        sessionStorage.removeItem('activeVariety');
-    } else {
-        activeVariety.value = 0;
-    }
     // 更新 store 中的状态
     store.commit("home/SET_GARDEN_ID", id);
-    getVarietyTabs();
 };
 
-const handleCardClick = () => {
-    sessionStorage.setItem('activeVariety', activeVariety.value);
-}
-
 const handleTrendMonitorCardClick = (item) => {
     router.push({
         path: "/record_details",

+ 1 - 1
src/views/old_mini/monitor/index.vue

@@ -56,7 +56,7 @@
             </template>
             <div class="archives-time-line-content">
                 <div class="time-line">
-                    <archives-farm-time-line :year="date.getFullYear()" :farmId="farmIdData" :regionId="regionData" @card-click="handleCardClick"></archives-farm-time-line>
+                    <archives-farm-time-line :farmId="farmIdData" :regionId="regionData" @card-click="handleCardClick"></archives-farm-time-line>
                 </div>
             </div>
         </div>

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác