2 Commits f964e8f6f1 ... 78c388733b

Author SHA1 Message Date
  lxf 78c388733b Merge branch 'farmer' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 into farmer 5 days ago
  lxf 5a399c442f fix: 长势报告 5 days ago

+ 12 - 0
src/api/modules/farm.js

@@ -86,4 +86,16 @@ module.exports = {
         url: config.base_dev_url + "container/growthReport/generate/result",
         type: "get",
     },
+    growthReportByFarm: {
+        url: config.base_dev_url + "container/growthReport/listByFarm",
+        type: "get",
+    },
+    readReportByFarm: {
+        url: config.base_dev_url + "container/growthReport/read",
+        type: "post",
+    },
+    getReportStatus: {
+        url: config.base_dev_url + "container/growthReport/read",
+        type: "get",
+    },
 }

+ 1 - 1
src/components/pageComponents/ArchivesFarmTimeLine.vue

@@ -42,7 +42,7 @@
                                                 执行者:{{ fw.sourceDataJson.executorName }}
                                             </div> -->
                                         </div>
-                                        <div class="title-text van-ellipsis" v-if="shouldShowBlue(p)">{{ fw.content }}123123123123</div>
+                                        <div class="title-text van-ellipsis" v-if="shouldShowBlue(p)">{{ fw.content }}</div>
                                     </div>
                                     <div class="card-left agri-record-card" v-else>
                                         <div class="left-info">

+ 10 - 4
src/views/old_mini/growth_report/index.vue

@@ -116,17 +116,23 @@ onActivated(() => {
     window.scrollTo(0, 0);
     paramsPage.value = route.query.miniJson ? JSON.parse(route.query.miniJson) : {};
     getDetail();
+    setReadStatus();
     // getResultReport();
 });
 
+
+const setReadStatus = () => {
+    VE_API.farm.readReportByFarm({ id: workItem.value.id }).then(({ data }) => {
+        console.log(data);
+    });
+}
 const getDetail = () => {
-    if (!paramsPage.value.id) return;
+    if (!paramsPage.value.farmId) return;
     loading.value = true;
     VE_API.farm
-        // .growthReport({ reportId: paramsPage.value.id })
-        .growthReport({ reportId: 1 })
+        .growthReportByFarm({ farmId: paramsPage.value.farmId, limit: 20 })
         .then(({ data }) => {
-            workItem.value = data;
+            workItem.value = data[0];
         })
         .finally(() => {
             loading.value = false;

+ 36 - 0
src/views/old_mini/home/index.vue

@@ -70,6 +70,12 @@
 
     <!-- 执行轨迹弹窗 -->
     <execute-trace-popup v-model:show="showExecuteTracePopup" @later="handleTraceLater" @confirm="handleTraceConfirm" />
+
+    <tip-popup v-model:show="showReportPopup" type="success" text="请查看" buttonText="去查看" @confirm="handleReportBtn" :zIndex="9999">
+        <template #default>
+            <div class="report-text">您的农情报告已生成</div>
+        </template>
+    </tip-popup>
 </template>
 
 <script setup>
@@ -100,6 +106,13 @@ const handleBtn = () => {
     router.push("/plan?pageType=plant&headerTitle=请设置您的种植方案");
 };
 
+const handleReportBtn = () => {
+    router.push({
+        path: "/growth_report",
+        query: { miniJson: JSON.stringify({ farmId: gardenId.value }) },
+    });
+}
+
 // 农事执行弹窗相关
 const showAgriExecutePopup = ref(false); // 农事执行弹窗
 const agriExecuteData = ref({
@@ -177,6 +190,24 @@ const getExpertByFarmId = () => {
     });
 };
 
+const showReportPopup = ref(false);
+const getReport = () => {
+    if (!gardenId.value) return;
+    VE_API.farm.growthReportByFarm({farmId: gardenId.value, limit: 20}).then(({ data }) => {
+        if (data && data.length > 0) {
+            VE_API.farm.getReportStatus({ farmId: gardenId.value }).then(({ data }) => {
+                if (data) {
+                    showReportPopup.value = true;
+                } else {
+                    showReportPopup.value = false;
+                }
+            });
+        } else {
+            showReportPopup.value = false;
+        }
+    });
+}
+
 // 监测卡片数据
 const monitorCards = ref({
     left: {
@@ -221,6 +252,7 @@ const handleCardClick = (card) => {
 };
 
 onActivated(() => {
+    getReport();
     getManagerList();
     if (userType.value != 2) {
         checkExistsEnabledScheme()
@@ -490,4 +522,8 @@ const handleBannerClick = () => {
         }
     }
 }
+
+.report-text {
+    font-size: 20px;
+}
 </style>

+ 2 - 2
src/views/old_mini/interactionList/index.vue

@@ -186,8 +186,8 @@
     <!-- 查看更多弹窗 -->
     <more-popup ref="morePopupRef" />
 
-    <tip-popup v-model:show="showTipPopup" type="success" text="2025.02.05农情报告已生成
-        请点击查看" buttonText="查看报告" @confirm="handleBtn" :zIndex="9999" />
+    <tip-popup v-model:show="showTipPopup" type="success" text="您的农情报告已生成
+        请查看" buttonText="查看报告" @confirm="handleBtn" :zIndex="9999" />
 </template>
 <script setup>
 import { ref, onMounted, onActivated, computed, onUnmounted } from "vue";

+ 20 - 4
src/views/old_mini/monitor/index.vue

@@ -13,7 +13,7 @@
                 <!-- <el-date-picker style="width: 110px" v-model="date" type="year" placeholder="全部日期" /> -->
             </div>
             <div class="archives-time-line-content">
-                <div class="report-box">
+                <div class="report-box" v-if="hasReport">
                     <div class="box-content">
                         <div class="box-title" @click="handleReportClick">
                             <span>农情互动报告</span>
@@ -25,7 +25,7 @@
                     </div>
                     <img src="@/assets/img/monitor/report-icon.png" alt="" class="report-icon" />
                 </div>
-                <div class="time-line">
+                <div class="time-line" :class="{ 'no-report': !hasReport }">
                     <archives-farm-time-line :farmId="gardenId"></archives-farm-time-line>
                 </div>
             </div>
@@ -90,7 +90,7 @@ const defaultGardenId = ref(null);
 const isHeaderShow = ref(false);
 const isDefaultFarm = ref(false);
 const weatherInfoRef = ref(null);
-
+const hasReport = ref(false);
 onActivated(() => {
     // 用来接收我的农场跳转过来的农场详情逻辑
     if (route.query.isHeaderShow) {
@@ -99,6 +99,8 @@ onActivated(() => {
         // 统一转换为布尔值
         isDefaultFarm.value = route.query.defaultFarm === "true" || route.query.defaultFarm === true;
     }
+    
+    getReport();
 });
 
 const receiveFarm = (json) => {
@@ -338,6 +340,7 @@ const changeGarden = ({ id }) => {
     getStayCount();
     getBroadcastList(1, false);
     checkHasUnrepliedTriggeredInteraction();
+    getReport();
 };
 
 function handlePage(url) {
@@ -356,7 +359,7 @@ function handlePage(url) {
 function handleReportClick() {
     router.push({
         path: "/growth_report",
-        query: { miniJson: JSON.stringify({ id: gardenId.value }) },
+        query: { miniJson: JSON.stringify({ farmId: gardenId.value }) },
     });
 }
 
@@ -365,6 +368,16 @@ const handleClosePopup = () => {
         interactionId: expertInfo.value.id,
     });
 }
+
+const getReport = () => {
+    VE_API.farm.growthReportByFarm({farmId: gardenId.value, limit: 20}).then(({ data }) => {
+        if (data && data.length > 0) {
+            hasReport.value = true;
+        } else {
+            hasReport.value = false;
+        }
+    });
+}
 </script>
 
 <style scoped lang="scss">
@@ -460,6 +473,9 @@ const handleClosePopup = () => {
 
             .time-line {
                 height: calc(100% - 100px);
+                &.no-report {
+                    height: 100%;
+                }
             }
         }
     }