Sfoglia il codice sorgente

fix: 诊断报告弹窗,切换bug

lxf 2 giorni fa
parent
commit
f796409b31

+ 5 - 0
src/api/modules/pheno.js

@@ -52,4 +52,9 @@ module.exports = {
         url: config.base_new_url + "report/query_abnormal_report_by_zone",
         type: "get",
     },
+    // 是否有新的诊断报告生成
+    hasNewReport: {
+        url: config.base_new_url + "report/farm_new_abnormal",
+        type: "get",
+    },
 }

+ 143 - 22
src/components/popup/patrolDiagnosisPopup.vue

@@ -1,11 +1,11 @@
 <template>
     <popup
-        v-model:show="showValue"
+        v-model:show="visible"
         round
         teleport="body"
         class="patrol-diagnosis-popup"
         :z-index="20000"
-        @closed="handleClosed"
+        :close-on-click-overlay="true"
     >
         <div class="patrol-diagnosis-popup__content">
             <img
@@ -42,34 +42,151 @@
 </template>
 
 <script setup>
-import { computed, ref } from "vue";
+import { onActivated, ref } from "vue";
+import { useRouter } from "vue-router";
 import { Popup } from "vant";
 
 // ---------------------------------------------------------------------------
-// Props / Emits
+// Props / Emits — 显隐由组件内接口控制
 // ---------------------------------------------------------------------------
-const props = defineProps({
-    show: { type: Boolean, default: false },
-});
+const router = useRouter();
 
-const zoneName = ref("分区一");
-const cropName = ref("荔枝");
-const diagnosisPoint = ref("水分失衡");
-const generateTime = ref("10/16");
+// ---------------------------------------------------------------------------
+// 常量
+// ---------------------------------------------------------------------------
+/** 同一报告只弹一次,避免 has_new 仍为 true 时反复打断 */
+const SHOWN_CACHE_PREFIX = "PATROL_DIAGNOSIS_POPUP_SHOWN_";
 
-const emit = defineEmits(["update:show"]);
+// ---------------------------------------------------------------------------
+// 页面状态
+// ---------------------------------------------------------------------------
+const visible = ref(false);
+const zoneName = ref("");
+const cropName = ref("");
+const diagnosisPoint = ref("");
+const generateTime = ref("");
+/** 查看报告跳转用 */
+const currentTaskId = ref("");
+const currentReportId = ref("");
 
-const showValue = computed({
-    get: () => props.show,
-    set: (val) => emit("update:show", val),
-});
+// ---------------------------------------------------------------------------
+// 工具函数
+// ---------------------------------------------------------------------------
+const getSelectedFarmId = () => {
+    try {
+        const farm = JSON.parse(localStorage.getItem("selectedFarmData") || "{}");
+        return String(
+            localStorage.getItem("selectedFarmId") || farm.farm_id || farm.id || "",
+        );
+    } catch {
+        return String(localStorage.getItem("selectedFarmId") || "");
+    }
+};
 
-const handleView = () => {
-    showValue.value = false;
+const getShownCacheKey = (farmId, reportId) =>
+    `${SHOWN_CACHE_PREFIX}${farmId}_${reportId || ""}`;
+
+const hasShownPopup = (farmId, reportId) =>
+    !!localStorage.getItem(getShownCacheKey(farmId, reportId));
+
+const markPopupShown = (farmId, reportId) => {
+    if (!farmId || reportId == null || reportId === "") return;
+    localStorage.setItem(getShownCacheKey(farmId, reportId), "1");
+};
+
+/** "2026-11-26 09:17:00" → "11/26" */
+function formatMd(dateStr) {
+    if (dateStr == null || dateStr === "") return "";
+    const text = String(dateStr).trim();
+    const matched = text.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
+    if (matched) {
+        return `${String(matched[2]).padStart(2, "0")}/${String(matched[3]).padStart(2, "0")}`;
+    }
+    const d = new Date(text.replace(/-/g, "/"));
+    if (Number.isNaN(d.getTime())) return text;
+    return `${String(d.getMonth() + 1).padStart(2, "0")}/${String(d.getDate()).padStart(2, "0")}`;
+}
+
+function applyLatestItem(item = {}) {
+    zoneName.value = item.zone_name || "";
+    cropName.value = item.crop_name || "";
+    diagnosisPoint.value = item.summary || "";
+    generateTime.value = formatMd(item.date);
+    currentTaskId.value = item.task_id || "";
+    currentReportId.value =
+        item.report_id != null && item.report_id !== "" ? String(item.report_id) : "";
+}
+
+function resetDisplay() {
+    zoneName.value = "";
+    cropName.value = "";
+    diagnosisPoint.value = "";
+    generateTime.value = "";
+    currentTaskId.value = "";
+    currentReportId.value = "";
+}
+
+// ---------------------------------------------------------------------------
+// 业务逻辑
+// ---------------------------------------------------------------------------
+/** has_new=true 且该 report 本地未展示过时弹窗;展示字段取 items[0] */
+const checkShouldShow = async () => {
+    const farmId = getSelectedFarmId();
+    if (!farmId) {
+        visible.value = false;
+        return;
+    }
+    try {
+        const res = await VE_API.pheno.hasNewReport({ farm_id: farmId });
+        const data = res?.data || {};
+        const items = Array.isArray(data.items) ? data.items : [];
+        const first = items[0] || data.latest || null;
+        const reportId =
+            first?.report_id != null && first.report_id !== ""
+                ? String(first.report_id)
+                : "";
+
+        const shouldShow =
+            res?.code === 200 && data.has_new === true && !!first && !hasShownPopup(farmId, reportId);
+
+        if (shouldShow) {
+            applyLatestItem(first);
+            visible.value = true;
+            markPopupShown(farmId, reportId);
+        } else {
+            visible.value = false;
+            if (!shouldShow) resetDisplay();
+        }
+    } catch {
+        visible.value = false;
+    }
 };
 
-const handleClosed = () => {
+const handleView = () => {
+    const farmId = getSelectedFarmId();
+    markPopupShown(farmId, currentReportId.value);
+    visible.value = false;
+    const taskId = currentTaskId.value;
+    if (!taskId) {
+        router.push({ path: "/agri_file", query: { nav: "report" } });
+        return;
+    }
+    router.push({
+        path: "/abnormal_diagnosis_report",
+        query: {
+            task_id: taskId,
+            title: "诊断报告",
+        },
+    });
 };
+
+onActivated(() => {
+    checkShouldShow();
+});
+
+defineExpose({
+    checkShouldShow,
+});
 </script>
 
 <style scoped lang="scss">
@@ -143,12 +260,16 @@ const handleClosed = () => {
             justify-content: flex-end;
             gap: 8px;
             min-width: 0;
+            flex: 1;
         }
 
         &__text {
+            flex: 1;
+            min-width: 0;
             font-size: 14px;
             line-height: 20px;
             color: #fff;
+            text-align: right;
             overflow: hidden;
             text-overflow: ellipsis;
             white-space: nowrap;
@@ -172,8 +293,8 @@ const handleClosed = () => {
         height: 40px;
         line-height: 40px;
         border-radius: 20px;
-        background: linear-gradient(90deg, #FFEBC9 0%, #FFCA6D 100%);
-        color: #1A1408;
+        background: linear-gradient(90deg, #ffebc9 0%, #ffca6d 100%);
+        color: #1a1408;
         font-size: 16px;
         cursor: pointer;
     }
@@ -185,7 +306,7 @@ const handleClosed = () => {
         color: rgba(255, 255, 255, 0.6);
 
         .highlight {
-            color: #FFD489;
+            color: #ffd489;
         }
     }
 }

+ 2 - 2
src/utils/tiandituLocation.js

@@ -168,10 +168,10 @@ export async function fetchPlaceSuggestion(keyword, locationLngLat) {
     const postObj = {
         keyWord: keyword,
         mapBound: buildMapBound(center.lng, center.lat, 1),
-        level: "8",
+        level: "12",
         queryType: "7",
         start: "0",
-        count: "20",
+        count: "30",
         show: "2",
     };
 

+ 8 - 2
src/views/old_mini/agri_file/components/albumPanel.vue

@@ -349,8 +349,14 @@ const handleUploadClick = (zoneId, geom) => {
 };
 
 // ---------- 生命周期 ----------
-onMounted(initAlbumMap);
-onActivated(initAlbumMap);
+/** 仅相册 Tab 可见时初始化;v-show 隐藏态 init 会零尺寸触发地图空指针 */
+const tryInitAlbumMap = () => {
+    if (!props.active) return;
+    initAlbumMap();
+};
+
+onMounted(tryInitAlbumMap);
+onActivated(tryInitAlbumMap);
 onBeforeUnmount(clearMapOverlays);
 
 watch(

+ 24 - 1
src/views/old_mini/agri_file/components/reportPanel.vue

@@ -45,7 +45,10 @@
                             <el-icon><Search /></el-icon>
                         </div>
                         <div class="latest-card__type-meta">
-                            <div class="latest-card__type-name">{{ report.title || "—" }}</div>
+                            <div class="latest-card__type-name">
+                                {{ report.title || "—" }}
+                                <span v-if="report.showUnRead" class="new-report-badge"></span>
+                            </div>
                             <div class="latest-card__date">{{ report.dateText }}</div>
                         </div>
                     </div>
@@ -398,6 +401,7 @@ const parseReportTime = (raw) => {
 
 const mapReportItem = (item, index) => {
     const timeInfo = parseReportTime(item.time || item.date);
+    console.log("iiiii", item)
     return {
         id: item.id ?? `${item.time || ""}-${index}`,
         taskId: item.task_id || "",
@@ -405,6 +409,7 @@ const mapReportItem = (item, index) => {
         type: item.type || "",
         desc: item.content || "",
         date: item.time || "",
+        showUnRead: item.is_read === false,
         dateText: timeInfo.dateText,
         monthKey: timeInfo.monthKey,
         monthLabel: timeInfo.monthLabel,
@@ -434,11 +439,16 @@ const handleReportClick = (item) => {
         });
         return;
     }
+    const farmId = getSelectedFarmId();
+    const zoneId = selectedZoneId.value;
     router.push({
         path: "/alert_detail",
         query: {
             title: item?.title || "具体预警",
             type: item?.type || "warning",
+            ...(farmId != null && farmId !== "" && zoneId != null && zoneId !== ""
+                ? { farm_id: farmId, zone_id: zoneId }
+                : {}),
         },
     });
 };
@@ -463,6 +473,8 @@ const handleShare = (item) => {
     }
 
     const shareText = item?.type === "warning" ? "预警报告已生成,请点击查看吧!" : "胁迫报告已生成,请点击查看吧!";
+    const farmId = getSelectedFarmId();
+    const zoneId = selectedZoneId.value;
     const query = {
         askInfo: { title: "转发报告", content: "是否分享给好友" },
         shareText,
@@ -471,6 +483,9 @@ const handleShare = (item) => {
             title: item?.title || "报告",
             type: item?.type || "warning",
             fromShare: 1,
+            ...(farmId != null && farmId !== "" && zoneId != null && zoneId !== ""
+                ? { farm_id: farmId, zone_id: zoneId }
+                : {}),
         }),
         imageUrl: "https://birdseye-img.sysuimars.com/farm-h5/report_cover.png",
     };
@@ -725,6 +740,14 @@ watch(
             font-size: 12px;
             color: rgba(255, 255, 255, 0.6);
             line-height: 18px;
+            .new-report-badge {
+                margin-left: 2px;
+                display: inline-block;
+                width: 8px;
+                height: 8px;
+                border-radius: 50%;
+                background: #FF7D7B;
+            }
         }
 
         &__date {

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

@@ -74,9 +74,7 @@
         />
 
         <!-- 诊断报告 -->
-        <patrol-diagnosis-popup
-            v-model:show="showPatrolDiagnosis"
-            />
+        <patrol-diagnosis-popup />
     </div>
 </template>
 
@@ -136,7 +134,6 @@ const guideVisible = ref(false);
 const showUploadPopup = ref(false);
 const showSuccessPopup = ref(false);
 const patrolPanelRef = ref(null);
-const showPatrolDiagnosis = ref(false);
 /** 后续由接口控制是否展示代管授权弹窗 */
 const showProxyAuthPopup = ref(false);
 const proxyServiceName = ref("农服名称");

+ 172 - 83
src/views/old_mini/agri_file/pages/diagnosisReport.vue

@@ -12,7 +12,8 @@
             :isGoBack="false"
         />
         <div class="page-content">
-            <div v-if="reportGenerating" class="report-progress">
+            <!-- 无分区且生成中:整页进度(如无农场按定位生成) -->
+            <div v-if="reportGenerating && !zoneList.length" class="report-progress">
                 <div class="report-progress__content">
                     <div>
                         <el-progress :percentage="progressPercent" :stroke-width="15" :duration="30" status="warning"
@@ -24,6 +25,7 @@
                     </div>
                 </div>
             </div>
+            <!-- 有分区时生成中也保留头部与分区切换;进度条显示在下方 -->
             <template v-else>
                 <div class="diagnosis-header">
                     <div class="header-share" @click="handleShare">
@@ -41,7 +43,7 @@
                     <!-- <div class="diagnosis-header__base">{{ headerBase }}</div> -->
                 </div>
                 <div class="diagnosis-content">
-                    <div class="variety-bar">
+                    <div v-if="zoneList.length" class="variety-bar">
                         <div class="variety-bar__tags">
                             <div
                                 v-for="item in zoneList"
@@ -60,85 +62,102 @@
                             <span>新增品种</span>
                         </div>
                     </div>
-                    <div class="base-data">
-                        <!-- <div class="base-data__title">
-                            <span class="title-dot"></span>
-                            <span>基本信息</span>
-                        </div> -->
-                        <div class="base-data__body">
-                            <div v-if="!loading && !baseInfoList.length" class="base-data__empty">暂无基本信息</div>
-                            <div v-for="item in baseInfoList" :key="item.key" class="base-info-item">
-                                <div class="base-info-item__row">
-                                    <span class="base-info-item__label">{{ item.label }}</span>
-                                    <span class="base-info-item__value">{{ item.value }}</span>
-                                    <!-- <span v-if="item.actionInline" class="base-info-action"
-                                    @click="handleBaseAction(item.actionInline.key)">
-                                    {{ item.actionInline.text }}
-                                    <el-icon><Edit /></el-icon>
-                                </span> -->
-                                </div>
-                                <!-- <div v-if="item.actionBlock" class="base-info-action base-info-action--block"
-                                @click="handleBaseAction(item.actionBlock.key)">
-                                {{ item.actionBlock.text }}
-                                <el-icon><Edit /></el-icon>
-                            </div> -->
+
+                    <div v-if="reportGenerating" class="report-progress report-progress--inline">
+                        <div class="report-progress__content">
+                            <div>
+                                <el-progress :percentage="progressPercent" :stroke-width="15" :duration="30" status="warning"
+                                    striped striped-flow />
+                            </div>
+                            <div class="report-progress__desc">
+                                依据您的农场定位,
+                                <div>正在生成专属报告,预计耗时2分钟...</div>
                             </div>
                         </div>
                     </div>
-                    <div class="report-module">
-                        <div class="report-tabs">
-                            <div v-for="tab in reportTabs" :key="tab.key" class="report-tabs__item"
-                                :class="{ active: tab.key === activeReportTab }" @click="activeReportTab = tab.key">
-                                {{ tab.label }}
+                    <template v-else>
+                        <div class="base-data">
+                            <!-- <div class="base-data__title">
+                                <span class="title-dot"></span>
+                                <span>基本信息</span>
+                            </div> -->
+                            <div class="base-data__body">
+                                <div v-if="!loading && !baseInfoList.length" class="base-data__empty">暂无基本信息</div>
+                                <div v-if="baseInfoList.length">
+                                    <div v-for="item in baseInfoList" :key="item.key" class="base-info-item">
+                                        <div class="base-info-item__row">
+                                            <span class="base-info-item__label">{{ item.label }}</span>
+                                            <span class="base-info-item__value">{{ item.value }}</span>
+                                            <!-- <span v-if="item.actionInline" class="base-info-action"
+                                            @click="handleBaseAction(item.actionInline.key)">
+                                            {{ item.actionInline.text }}
+                                            <el-icon><Edit /></el-icon>
+                                        </span> -->
+                                        </div>
+                                        <!-- <div v-if="item.actionBlock" class="base-info-action base-info-action--block"
+                                        @click="handleBaseAction(item.actionBlock.key)">
+                                        {{ item.actionBlock.text }}
+                                        <el-icon><Edit /></el-icon>
+                                    </div> -->
+                                    </div>
+                                </div>
                             </div>
                         </div>
-                        <div class="report-panel">
-                            <template v-if="activeModule">
-                                <div v-if="activeModule.lead" class="core-card">
-                                    <div class="core-card__head">
-                                        <img class="core-card__star" src="@/assets/img/home/start-icon.png" alt="" />
-                                        <span>核心结论</span>
-                                    </div>
-                                    <div class="core-card__body">{{ activeModule.lead }}</div>
+                        <div class="report-module">
+                            <div class="report-tabs">
+                                <div v-for="tab in reportTabs" :key="tab.key" class="report-tabs__item"
+                                    :class="{ active: tab.key === activeReportTab }" @click="activeReportTab = tab.key">
+                                    {{ tab.label }}
                                 </div>
-
-                                <div v-for="(block, bi) in activeModule.blocks" :key="`${block.no}-${bi}`"
-                                    class="point-block" :class="`point-block--s${bi % 3}`">
-                                    <div class="point-block__head">
-                                        <span class="point-block__no">{{ block.no }}</span>
-                                        <span class="point-block__title">{{ block.title }}</span>
+                            </div>
+                            <div class="report-panel">
+                                <template v-if="activeModule">
+                                    <div v-if="activeModule.lead" class="core-card">
+                                        <div class="core-card__head">
+                                            <img class="core-card__star" src="@/assets/img/home/start-icon.png" alt="" />
+                                            <span>核心结论</span>
+                                        </div>
+                                        <div class="core-card__body">{{ activeModule.lead }}</div>
                                     </div>
-                                    <div v-if="block.sub?.length" class="point-block__card">
-                                        <div v-for="(sub, si) in block.sub" :key="`${bi}-${si}`" class="point-sub">
-                                            <!-- 样式 0:金色描边标签 -->
-                                            <template v-if="bi % 3 === 0">
-                                                <span class="point-sub__badge">{{ sub.title }}</span>
-                                                <div class="point-sub__text">{{ sub.text }}</div>
-                                            </template>
-                                            <!-- 样式 1:纯白标题 -->
-                                            <template v-else-if="bi % 3 === 1">
-                                                <div class="point-sub__plain">{{ sub.title }}</div>
-                                                <div class="point-sub__text">{{ sub.text }}</div>
-                                            </template>
-                                            <!-- 样式 2:图标 + 标题 -->
-                                            <template v-else>
-                                                <div class="point-sub__icon-row">
-                                                    <span class="point-sub__icon">
-                                                        <el-icon size="16">
-                                                            <List />
-                                                        </el-icon>
-                                                    </span>
-                                                    <span class="point-sub__icon-title">{{ sub.title }}</span>
-                                                </div>
-                                                <div class="point-sub__text">{{ sub.text }}</div>
-                                            </template>
+
+                                    <div v-for="(block, bi) in activeModule.blocks" :key="`${block.no}-${bi}`"
+                                        class="point-block" :class="`point-block--s${bi % 3}`">
+                                        <div class="point-block__head">
+                                            <span class="point-block__no">{{ block.no }}</span>
+                                            <span class="point-block__title">{{ block.title }}</span>
+                                        </div>
+                                        <div v-if="block.sub?.length" class="point-block__card">
+                                            <div v-for="(sub, si) in block.sub" :key="`${bi}-${si}`" class="point-sub">
+                                                <!-- 样式 0:金色描边标签 -->
+                                                <template v-if="bi % 3 === 0">
+                                                    <span class="point-sub__badge">{{ sub.title }}</span>
+                                                    <div class="point-sub__text">{{ sub.text }}</div>
+                                                </template>
+                                                <!-- 样式 1:纯白标题 -->
+                                                <template v-else-if="bi % 3 === 1">
+                                                    <div class="point-sub__plain">{{ sub.title }}</div>
+                                                    <div class="point-sub__text">{{ sub.text }}</div>
+                                                </template>
+                                                <!-- 样式 2:图标 + 标题 -->
+                                                <template v-else>
+                                                    <div class="point-sub__icon-row">
+                                                        <span class="point-sub__icon">
+                                                            <el-icon size="16">
+                                                                <List />
+                                                            </el-icon>
+                                                        </span>
+                                                        <span class="point-sub__icon-title">{{ sub.title }}</span>
+                                                    </div>
+                                                    <div class="point-sub__text">{{ sub.text }}</div>
+                                                </template>
+                                            </div>
                                         </div>
                                     </div>
-                                </div>
-                            </template>
-                            <div v-else class="report-panel__empty">暂无报告内容</div>
+                                </template>
+                                <div v-else class="report-panel__empty">暂无报告内容</div>
+                            </div>
                         </div>
-                    </div>
+                    </template>
                 </div>
             </template>
         </div>
@@ -225,6 +244,8 @@ const progressPercent = ref(10);
 /** 分区列表(getZones) */
 const zoneList = ref([]);
 const selectedZoneId = ref(null);
+/** 新增品种前校验范围,避免重复跳转 */
+const addVarietyChecking = ref(false);
 const headerDesc = ref("");
 const headerBase = ref("");
 const baseInfoList = ref([]);
@@ -632,17 +653,19 @@ async function pollLatlonReport({ pointText, crop }, token) {
     }
 }
 
-/** 无农场:按定位点 + 水稻拉取 / 轮询六模块报告 */
+/** 无农场:按定位点 + 水稻拉取 / 轮询六模块报告(请求期间即展示整页进度条) */
 async function fetchLatlonReport(token) {
     const pointText = getPointText();
     const crop = NO_FARM_CROP;
     const params = { pointText, crop };
 
-    loading.value = true;
+    // 无农场不用整页 v-loading,避免遮住 reportGenerating 进度条
+    loading.value = false;
+    beginProgress({});
     try {
         const raw = await VE_API.report.report6Latlon({
             point_text: pointText,
-            crop: '水稻',
+            crop: "水稻",
         });
         if (token !== viewToken) return;
         const res = Array.isArray(raw) ? raw[0] : raw;
@@ -652,7 +675,6 @@ async function fetchLatlonReport(token) {
             return;
         }
         resetReportView({});
-        beginProgress({});
         startReportPolling("latlon", params, token);
     } catch (error) {
         if (token !== viewToken) return;
@@ -661,8 +683,6 @@ async function fetchLatlonReport(token) {
         reportGenerating.value = false;
         stopProgressTimer();
         ElMessage.error("报告加载失败");
-    } finally {
-        if (token === viewToken) loading.value = false;
     }
 }
 
@@ -713,6 +733,7 @@ async function fetchDiagnosisReport() {
     if (farmId == null || farmId === "") {
         zoneList.value = [];
         selectedZoneId.value = null;
+        loading.value = false;
         await fetchLatlonReport(token);
         return;
     }
@@ -743,12 +764,74 @@ const handleSelectZone = (zone) => {
     fetchFarmReport(getSelectedFarm(), token);
 };
 
-/** 与巡园面板一致:进入新增分区 */
-const goAddVariety = () => {
-    router.push({
-        path: "/add_zone",
-        query: { type: "region", isSuccessPopup: "1" },
-    });
+/** status=1 表示已勾画种植范围;信息不全 / 校验异常时不拦截 */
+async function hasZoneRange(zoneId) {
+    const farm = getSelectedFarm();
+    const farmId = farm.farm_id ?? farm.id;
+    if (farmId == null || farmId === "" || zoneId == null || zoneId === "") return true;
+    const belongsToFarm = zoneList.value.some((z) => String(z.zone_id) === String(zoneId));
+    if (!belongsToFarm) return false;
+    try {
+        const res = await VE_API.questionnaire.checkZoneRange({
+            farm_id: farmId,
+            zone_id: zoneId,
+        });
+        return Number(res?.data?.status) === 1;
+    } catch (e) {
+        console.warn("[diagnosisReport] checkZoneRange failed", e);
+        return true;
+    }
+}
+
+/**
+ * 新增品种前校验当前选中品种是否已勾画范围(同 patrolPanel):
+ * 已勾画 → 直接进新增分区;未勾画 → 先 type=farm 画范围,
+ * 画完后 addZone 会继续进 type=region&isSuccessPopup=1
+ */
+const goAddVariety = async () => {
+    if (addVarietyChecking.value) return;
+    const goRegionAdd = () => {
+        router.push({
+            path: "/add_zone",
+            query: { type: "region", isSuccessPopup: "1" },
+        });
+    };
+
+    const zoneId = selectedZoneId.value;
+    if (zoneId == null || zoneId === "") {
+        goRegionAdd();
+        return;
+    }
+
+    addVarietyChecking.value = true;
+    try {
+        if (await hasZoneRange(zoneId)) {
+            goRegionAdd();
+            return;
+        }
+        const currentZone = zoneList.value.find(
+            (z) => String(z.zone_id) === String(zoneId),
+        );
+        const varietyName = currentZone?.zone_name || "当前品类";
+        ElMessage({
+            message: `请先勾画「${varietyName}」的种植范围,\n完成后再新增品种`,
+            type: "warning",
+            customClass: "restore-planting-message",
+            zIndex: 40000,
+        });
+        setTimeout(() => {
+            router.push({
+                path: "/add_zone",
+                query: {
+                    type: "farm",
+                    continueAddVariety: "1",
+                    zoneId,
+                },
+            });
+        }, 800);
+    } finally {
+        addVarietyChecking.value = false;
+    }
 };
 
 /** 转发种植全析:带 farm_id / zone_id / fromShare */
@@ -913,6 +996,12 @@ onBeforeUnmount(() => {
         padding: 0 36px;
         box-sizing: border-box;
 
+        &--inline {
+            min-height: 320px;
+            padding: 90px 24px 32px;
+            align-items: flex-start;
+        }
+
         :deep(.el-progress) {
             width: 100%;
         }

+ 72 - 5
src/views/old_mini/agri_file/pages/soilRootTrack.vue

@@ -251,6 +251,20 @@
                 </div>
             </template>
         </tip-popup>
+        <tip-popup
+            v-model:show="showInteractSuccessPopup"
+            type="executeSuccess"
+            :text="interactSuccessText"
+            :text2="interactSuccessText2"
+            hideBtn
+        >
+            <template #footer>
+                <div class="bottom-btn-container">
+                    <div class="bottom-btn secondary-btn" @click="handleInteractComplete">完成</div>
+                    <div class="bottom-btn primary-btn" @click="handleViewWorkDetail">查看详情</div>
+                </div>
+            </template>
+        </tip-popup>
     </div>
 </template>
 
@@ -291,6 +305,15 @@ const loading = ref(false);
 const submitting = ref(false);
 const showUploadPopup = ref(false);
 const showSuccessPopup = ref(false);
+const showInteractSuccessPopup = ref(false);
+/** 异常确认成功弹窗:文案与跳转参数来自接口 farmwork_brief */
+const interactSuccessBrief = ref({
+    fw_name: "",
+    suggest_execute_date: "",
+    farm_id: null,
+    zone_id: null,
+    fw_code: "",
+});
 const needDraw = ref(true); // status≠1 时需先勾画种植范围
 const interactList = ref([]); // root 根系排查互动项(取 data.root)
 const soilSections = ref([]); // 土壤条件判断(质地/酸碱/墒情/氮磷钾/持水)
@@ -306,6 +329,15 @@ const queryContext = ref({
     crop_type: "",
 });
 
+const interactSuccessText = computed(() => {
+    const name = interactSuccessBrief.value.fw_name || "";
+    return `系统已触发了 ${name}农事`;
+});
+const interactSuccessText2 = computed(() => {
+    const date = interactSuccessBrief.value.suggest_execute_date || "";
+    return `建议 ${date} 执行`;
+});
+
 // ---------- 工具函数 ----------
 function isTruthyFlag(value) {
     return value === 1 || value === "1" || value === true || value === "true";
@@ -594,6 +626,27 @@ const handleComplete = () => {
     router.replace("/agri_file");
 };
 
+const handleInteractComplete = () => {
+    showInteractSuccessPopup.value = false;
+};
+
+const handleViewWorkDetail = () => {
+    const { farm_id, zone_id, fw_code } = interactSuccessBrief.value;
+    showInteractSuccessPopup.value = false;
+    if (farm_id == null || zone_id == null || !fw_code) {
+        ElMessage.warning("农事信息不完整,无法查看详情");
+        return;
+    }
+    router.push({
+        path: "/work_detail",
+        query: {
+            farm_id,
+            zone_id,
+            fw_code,
+        },
+    });
+};
+
 const handleSubmit = async (item, index) => {
     const key = interactKey(item, index);
     const optIndex = selectedMap[key];
@@ -615,9 +668,18 @@ const handleSubmit = async (item, index) => {
             options: String(optionText),
         });
         if (res?.code === 200) {
-            ElMessage.success(t("agriFile.submitSuccess"));
+            const data = res?.data || {};
+            const brief = data.farmwork_brief || {};
+            interactSuccessBrief.value = {
+                fw_name: brief.fw_name || "",
+                suggest_execute_date: brief.suggest_execute_date || "",
+                farm_id: data.farm_id ?? queryContext.value.farm_id,
+                zone_id: data.zone_id ?? queryContext.value.zone_id,
+                fw_code: brief.fw_code || data.fw_code || "",
+            };
             editingMap[key] = false;
             await fetchSoilRootInteract();
+            showInteractSuccessPopup.value = true;
             return;
         }
         ElMessage.error(res?.msg || "提交失败,请稍后再试");
@@ -1235,17 +1297,22 @@ onActivated(async () => {
     width: 100%;
 
     .bottom-btn {
+        flex: 1;
         padding: 0 25px;
         border-radius: 8px;
         font-size: 16px;
-        height: 40px;
-        line-height: 40px;
+        height: 44px;
+        line-height: 44px;
         box-sizing: border-box;
-        font-weight: 500;
         text-align: center;
 
+        &.secondary-btn {
+            color: rgba(255, 255, 255, 0.6);
+            border: 1px solid rgba(255, 255, 255, 0.12);
+            background: transparent;
+        }
+
         &.primary-btn {
-            flex: 1;
             background: linear-gradient(90deg, #ffebc9 0%, #ffca6d 100%);
             color: #1a1408;
         }

+ 1 - 1
src/views/old_mini/entry_information/components/baInformation.vue

@@ -9,7 +9,7 @@
                         class="farm-name-input__field"
                         type="text"
                         maxlength="30"
-                        placeholder="农场名称农场名称"
+                        placeholder="请输入农场名称"
                     />
                     <div
                         v-if="farmName"

+ 38 - 17
src/views/old_mini/growth_report/alert_detail.vue

@@ -115,16 +115,27 @@ function parseMaybeJson(value) {
     }
 }
 
-/** 分享进入:不展示返回箭头 */
-const isFromShare = computed(() => {
-    if (isTruthyFlag(route.query.fromShare)) return true;
+/**
+ * 分享链路:dev_login 把整份登录 query 塞进 miniJson,
+ * 真正的页面参数在 miniJson.paramsPage(farm_id / zone_id / type / title / fromShare)
+ */
+function resolvePageParams() {
+    const mini = parseMaybeJson(route.query.miniJson);
+    if (mini) {
+        const page = parseMaybeJson(mini.paramsPage) || {};
+        return { ...mini, ...page };
+    }
     const paramsPage = parseMaybeJson(route.query.paramsPage);
-    if (isTruthyFlag(paramsPage?.fromShare)) return true;
-    const miniJson = parseMaybeJson(route.query.miniJson);
-    if (isTruthyFlag(miniJson?.fromShare)) return true;
-    if (isTruthyFlag(parseMaybeJson(miniJson?.paramsPage)?.fromShare)) return true;
-    return false;
-});
+    if (paramsPage) {
+        return { ...route.query, ...paramsPage };
+    }
+    return { ...(route.query || {}) };
+}
+
+const pageParams = computed(() => resolvePageParams());
+
+/** 分享进入:不展示返回箭头 */
+const isFromShare = computed(() => isTruthyFlag(pageParams.value?.fromShare));
 
 const phenologyIcon = require("@/assets/img/common/header-icon-3.png");
 const weatherIcon = require("@/assets/img/common/header-icon-1.png");
@@ -134,10 +145,14 @@ const cropCover = require("@/assets/img/home/plant.png");
 const resolveCropCover = (cropName) => resolveCropIcon(cropName, cropCover);
 
 const detailType = computed(() =>
-    String(route.query.type || "") === DETAIL_TYPE.STRESS ? DETAIL_TYPE.STRESS : DETAIL_TYPE.WARNING,
+    String(pageParams.value.type || "") === DETAIL_TYPE.STRESS
+        ? DETAIL_TYPE.STRESS
+        : DETAIL_TYPE.WARNING,
 );
 const detailTitle = ref("");
-const pageTitle = computed(() => detailTitle.value || route.query.title || "具体预警/具体胁迫");
+const pageTitle = computed(
+    () => detailTitle.value || pageParams.value.title || "具体预警/具体胁迫",
+);
 
 const analysis = ref({
     summary: "",
@@ -167,11 +182,12 @@ const formatLocalDate = (date) => {
     return `${y}-${m}-${d}`;
 };
 
-/** 有选中农场用缓存 farm_id/zone_id + 当天日期 */
+/** 有农场:优先路由 farm_id/zone_id,缺省再回退选中农场缓存 */
 const getQueryParams = () => {
+    const q = pageParams.value || {};
     const farm = getSelectedFarm();
-    const farmId = farm.farm_id ?? farm.id;
-    const zoneId = farm.zone_id ?? farm.zoneId;
+    const farmId = q.farm_id ?? q.farmId ?? farm.farm_id ?? farm.id;
+    const zoneId = q.zone_id ?? q.zoneId ?? farm.zone_id ?? farm.zoneId;
     if (farmId == null || farmId === "" || zoneId == null || zoneId === "") {
         return null;
     }
@@ -303,18 +319,23 @@ const fetchDetail = async () => {
     }
 };
 
-/** 转发仍落到本页 alert_detail,带 fromShare 隐藏返回箭头 */
+/** 转发仍落到本页 alert_detail,带 fromShare 隐藏返回箭头;有农场一并带上 farm_id/zone_id */
 const handleShare = () => {
     const type = detailType.value;
-    const shareText = type === 'warning' ? '预警报告已生成,请点击查看吧!' : '胁迫报告已生成,请点击查看吧!';
+    const farmParams = getQueryParams();
+    const shareText =
+        type === "warning" ? "预警报告已生成,请点击查看吧!" : "胁迫报告已生成,请点击查看吧!";
     const query = {
         askInfo: { title: "转发报告", content: "是否分享给好友" },
-        shareText: shareText,
+        shareText,
         targetUrl: "alert_detail",
         paramsPage: JSON.stringify({
             title: pageTitle.value || "具体预警",
             type,
             fromShare: 1,
+            ...(farmParams
+                ? { farm_id: farmParams.farm_id, zone_id: farmParams.zone_id }
+                : {}),
         }),
         imageUrl: "https://birdseye-img.sysuimars.com/farm-h5/report_cover.png",
     };

+ 5 - 0
src/views/old_mini/growth_report/components/CropAlertPanel.vue

@@ -631,11 +631,16 @@ const fetchAlertCards = async (token = reloadToken, options = {}) => {
 };
 
 const handleViewDetail = (item) => {
+    const farmId = resolveFarmId();
+    const zoneId = selectedZoneId.value;
     router.push({
         path: "/alert_detail",
         query: {
             title: item?.title || "具体预警",
             type: item?.source || "warning",
+            ...(farmId != null && farmId !== "" && zoneId != null && zoneId !== ""
+                ? { farm_id: farmId, zone_id: zoneId }
+                : {}),
         },
     });
 };

+ 1 - 10
src/views/old_mini/work_detail/index.vue

@@ -116,7 +116,7 @@
                 <!-- 执行区域:图1,地图逻辑不动 -->
                 <div class="box-wrap stage-card">
                     <div class="work-info">
-                        <div class="execution-area-card" @click="handleViewArea">
+                        <div class="execution-area-card">
                             <div class="execution-area-card__header">
                                 <div class="title">
                                     <span class="title-bar"></span>
@@ -789,15 +789,6 @@ const displayStatusText = computed(() => {
     return farmWorkTypeObj[farmData.value?.farm_work_type] || "待执行";
 });
 
-const handleViewArea = () => {
-    router.push({
-        path: "/view_area",
-        query: {
-            subjectId: localStorage.getItem("selectedFarmId"),
-            varietyId: 2,
-        },
-    });
-};
 
 const goGrowthTrack = () => {
     router.push({

+ 7 - 1
src/views/old_mini/work_execute/index.vue

@@ -111,7 +111,9 @@
                     </div>
                 </div>
 
-                <div v-if="!displayTaskList.length" class="empty-tip">{{ t("workExecute.noData") }}</div>
+                <div v-if="!displayTaskList.length" class="empty-tip">
+                    {{ activeTab === 'pending' ? t("workExecute.noData") : '暂无已完成农事' }}
+                </div>
             </div>
         </div>
         <survey-ask-popup v-model:show="showSurveyAskPopup" @confirm="handleSurveyConfirm" />
@@ -121,6 +123,9 @@
 
         <!-- 恢复种植弹窗 -->
         <restore-planting-popup />
+
+        <!-- 诊断报告 -->
+        <patrol-diagnosis-popup />
     </div>
 </template>
 
@@ -139,6 +144,7 @@ import { useI18n } from "@/i18n";
 import { ensureValidSelectedFarm } from "@/utils/selectedFarm";
 import wx from "weixin-js-sdk";
 import { Icon } from 'vant';
+import patrolDiagnosisPopup from "@/components/popup/patrolDiagnosisPopup.vue";
 
 
 // ---------- 常量 ----------