فهرست منبع

Merge branch 'agriculture' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 into agriculture

刘秀芳 1 هفته پیش
والد
کامیت
a0ce09e6ec
1فایلهای تغییر یافته به همراه32 افزوده شده و 0 حذف شده
  1. 32 0
      src/views/old_mini/work_execute/index.vue

+ 32 - 0
src/views/old_mini/work_execute/index.vue

@@ -69,6 +69,12 @@
         </div>
         <farm-calendar-popup v-model:show="showFarmCalendarPopup" @confirm="goCompleteFarmInfo" />
         <survey-ask-popup v-model:show="showSurveyAskPopup" @confirm="handleSurveyConfirm" />
+
+        <!-- 诊断报告弹窗:组件内接口判断 exists=2 且本地未展示过 -->
+        <diagnosis-report-popup />
+
+        <!-- 恢复种植弹窗 -->
+        <restore-planting-popup />
     </div>
 </template>
 
@@ -81,9 +87,12 @@ import customCalendar from "./components/calendar.vue";
 import farmHeader from "@/components/farmHeader.vue";
 import farmCalendarPopup from "@/components/popup/farmCalendarPopup.vue";
 import surveyAskPopup from "@/components/popup/surveyAskPopup.vue";
+import diagnosisReportPopup from "@/components/popup/diagnosisReportPopup.vue";
+import restorePlantingPopup from "@/components/popup/restorePlantingPopup.vue";
 import { useI18n } from "@/i18n";
 import wx from "weixin-js-sdk";
 
+
 // ---------- 常量 ----------
 /** zoneId / date 临时固定,后续改为当前分区 / 当天 */
 const QUERY = {
@@ -118,6 +127,10 @@ const completedCount = computed(() => dayTaskList.value.filter((item) => item.st
 const displayTaskList = computed(() => dayTaskList.value.filter((item) => item.status === activeTab.value));
 
 // ---------- 工具函数 ----------
+function getMiniUserId() {
+    return store.state.home.miniUserId || localStorage.getItem("MINI_USER_ID");
+}
+
 const isCompletedStatus = (status) => COMPLETED_STATUS_RE.test(String(status || ""));
 
 const formatExecuteDate = (dateStr) => {
@@ -170,6 +183,23 @@ const resolveRangeStart = (data) => {
 };
 
 // ---------- 业务逻辑 ----------
+/** 无果园信息时展示「完善农场信息 / 专属农事日历」弹窗 */
+async function checkFarmCalendarPopup() {
+    const id = getMiniUserId();
+    if (!id) {
+        showFarmCalendarPopup.value = false;
+        return;
+    }
+    try {
+        const res = await VE_API.questionnaire.getFarms({ id });
+        const list = Array.isArray(res?.data) ? res.data : [];
+        showFarmCalendarPopup.value = list.length === 0;
+    } catch (e) {
+        console.warn("[work_execute] getFarms failed", e);
+        showFarmCalendarPopup.value = false;
+    }
+}
+
 const refreshMapMarkers = () => {
     if (!indexMap.kmap) return;
     indexMap.initData(getMapMarkerList(), "farmName", "wkt");
@@ -295,6 +325,7 @@ const initMap = () => {
 };
 
 onMounted(() => {
+    checkFarmCalendarPopup();
     nextTick(async () => {
         await fetchFwTasks();
         initMap();
@@ -302,6 +333,7 @@ onMounted(() => {
 });
 
 onActivated(() => {
+    checkFarmCalendarPopup();
     nextTick(() => {
         if (!indexMap.kmap) {
             initMap();