Просмотр исходного кода

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

wangsisi 1 день назад
Родитель
Сommit
df6c9925db

+ 1 - 1
src/api/modules/report.js

@@ -3,7 +3,7 @@ const config = require("../config")
 module.exports = {
     // 今日巡园重点
     todayPatrolFocus: {
-        url: config.base_dev_url + "container_phenology_interaction/todayPatrolFocus",
+        url: config.base_dev_url + "container_phenology_interaction/todayFocus",
         type: "get",
     },
     // 待执行农事

+ 15 - 9
src/components/popup/agriExecutePopup.vue

@@ -1,15 +1,18 @@
 <template>
     <popup v-model:show="showValue" round class="agri-execute-popup" :z-index="zIndex" teleport="body">
         <div class="popup-content">
-            <div class="popup-tips">为了处方体系更加适应您当前的果园管理</div>
             <!-- 头部区域 -->
             <div class="popup-header">
-                <img class="expert-logo" :src="popupData?.expertAvatar" alt="" />
+                <img class="expert-logo" src="@/assets/img/home/bird.png" alt="" />
+                <!-- <img class="expert-logo" :src="popupData?.expertAvatar" alt="" /> -->
                 <div class="expert-info">
-                    <span>{{ popupData?.expertName || "韦帮稳" }}专家</span>
+                    <!-- <span>{{ popupData?.expertName || "韦帮稳" }}专家</span> -->
+                    <span>飞鸟</span>
                     <span class="invite-text">邀请您进行农情互动</span>
                 </div>
             </div>
+            <div class="popup-tips">为了更好校准您的农事执行时间</div>
+
 
             <!-- 标题 -->
             <div class="popup-title">{{ popupData.subjectName }}</div>
@@ -102,7 +105,8 @@ defineExpose({
     }
 
     .popup-tips {
-        color: rgba(93, 93, 93, 0.8);
+        color: #000;
+        font-size: 16px;
         margin-bottom: 5px;
     }
 
@@ -113,24 +117,26 @@ defineExpose({
         gap: 6px;
 
         .expert-logo {
-            width: 26px;
-            height: 26px;
+            width: 22px;
+            height: 22px;
             border-radius: 50%;
             object-fit: cover;
         }
 
         .expert-info {
-            font-size: 16px;
+            font-size: 12px;
+            color: #000;
 
             .invite-text {
                 margin-left: 6px;
+                color: rgba(0, 0, 0, 0.4);
             }
         }
     }
 
     .popup-title {
         font-size: 26px;
-        margin-bottom: 14px;
+        // margin-bottom: 14px;
         font-family: "PangMenZhengDao";
         color: #0785E8;
     }
@@ -142,7 +148,7 @@ defineExpose({
         padding: 3px 9px 9px;
         border-radius: 8px;
         position: relative;
-        margin-top: 5px;
+        margin-top: 15px;
 
         // 三角形小尖尖
         &::before {

+ 13 - 7
src/components/popup/startInteractPopup.vue

@@ -7,16 +7,19 @@
         z-index="9999"
     >
         <div class="popup-content">
-            <div class="popup-tips">为了处方体系更加适应您当前的果园管理</div>
             <!-- 头部区域 -->
             <div class="popup-header">
-                <img class="expert-logo" :src="popupData?.expertAvatar" alt="" />
+                <img class="expert-logo" src="@/assets/img/home/bird.png" alt="" />
+                <!-- <img class="expert-logo" :src="popupData?.expertAvatar" alt="" /> -->
                 <!-- <el-avatar :size="26" :src="popupData?.expertAvatar" /> -->
                 <div class="expert-info">
-                    <span>{{ popupData?.expertName || "韦帮稳" }}专家</span>
+                    <!-- <span>{{ popupData?.expertName || "韦帮稳" }}专家</span> -->
+                    <span>飞鸟</span>
                     <span class="invite-text">邀请您进行农情互动</span>
                 </div>
             </div>
+            <div class="popup-tips">为了将农事方案与您的品种匹配,请您录入品种信息</div>
+
 
             <!-- 标题 -->
             <div class="popup-title">农情互动</div>
@@ -87,7 +90,8 @@ defineExpose({
     }
 
     .popup-tips{
-        color: rgba(93, 93, 93, 0.8);
+        color: #000;
+        font-size: 16px;
         margin-bottom: 5px;
     }
 
@@ -97,16 +101,18 @@ defineExpose({
         align-items: center;
         gap: 6px;
         .expert-logo {
-            width: 26px;
-            height: 26px;
+            width: 22px;
+            height: 22px;
             border-radius: 50%;
             object-fit: cover;
         }
 
         .expert-info {
-            font-size: 16px;
+            font-size: 12px;
+            color: #000;
             .invite-text {
                 margin-left: 6px;
+                color: rgba(0, 0, 0, 0.4);
             }
         }
     }

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

@@ -32,7 +32,7 @@
                 <img class="example-img" src="@/assets/img/monitor/example.png" alt="">
             </template>
             <div class="archives-time-line-content">
-                <archives-farm-time-line :farmId="farmIdData" :problemZoneId="currentVariety?.id" :regionId="regionData" :containerId="containerData"
+                <archives-farm-time-line :farmId="farmIdData" :problemZoneId="currentVariety?.problemZoneTypeId" :regionId="regionData" :containerId="containerData"
                     pageType="agri_record" :typeId="currentVariety?.typeId"></archives-farm-time-line>
             </div>
         </div>

+ 19 - 7
src/views/old_mini/growth_report/index.vue

@@ -36,7 +36,7 @@
                                         v-for="(card, cardI) in todayPatrolFocus"
                                         :key="cardI"
                                         class="status-card"
-                                        :class="card.type"
+                                        :class="'today-'+card.color"
                                         @click="handleTodayPatrolFocusClick(card)"
                                         >
                                         <!-- <badge class="status-badge" dot 
@@ -202,7 +202,7 @@ const handleMaskClick = () => {
 
 const currentFarmName = ref('');
 // 切换农场时,更新报告数据
-const changeGarden = ({ id, name }) => {
+const changeGarden = async ({ id, name }) => {
     if (!id) return;
     currentFarmName.value = name;
     swipeRef.value && swipeRef.value.swipeTo(0, {immediate:true});
@@ -213,10 +213,7 @@ const changeGarden = ({ id, name }) => {
     };
     // 初始化品种/大物候期转换
     startInteractPopupRef.value.getPhenologyInitOrConfirmStatus();
-    getRegions();
-    if(regionsData.value.length && !route.query.hideInteraction) {
-        agriExecutePopupRef.value.showPopup(regionsData.value[currentIndex.value].farmId);
-    }
+    await getRegions();
 };
 
 onActivated(() => {
@@ -286,7 +283,8 @@ const handlePendingFarmWorkClick = (card) => {
 }
 // 点击今日巡园重点
 const handleTodayPatrolFocusClick = (card) => {
-    router.push(`/interaction_list?farmId=${paramsPage.value.farmId}&regionId=${paramsPage.value.regionId}&interactionTypeId=${card.interactionTypeId || 1}`);
+    if (!card.interactionTypeId) return;
+    router.push(`/interaction_list?farmId=${paramsPage.value.farmId}&regionId=${paramsPage.value.regionId}&interactionTypeId=${card.interactionTypeId}`);
 }
 
 const getTodayPatrolFocus = () => {
@@ -342,6 +340,12 @@ const getRegions = async () => {
                 localStorage.setItem(guideKey, "1");
             }
             hasReport.value = true;
+
+            // 如果不是点击农情报告已生成弹窗过来的,则显示农情互动弹窗
+            if(!route.query.hideInteraction) {
+                agriExecutePopupRef.value.showPopup(regionsData.value[currentIndex.value].farmId);
+            }
+
             paramsPage.value = {
                 ...(paramsPage.value || {}),
                 farmId: regionsData.value[currentIndex.value].farmId,
@@ -785,6 +789,14 @@ linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2));
                     align-items: center;
                     justify-content: center;
 
+                    &.today-red {
+                        background: #FF6A6A;
+                        color: #fff;
+                        .status-sub {
+                            color: #fff;
+                        }
+                    }
+
                     &.pending-card {
                         color: #fff;
                         position: relative;

+ 42 - 7
src/views/old_mini/interaction/index.vue

@@ -44,7 +44,8 @@
                     <div class="field-row">
                         <div class="field-label">当下物候期</div>
                         <div class="field-value">
-                            <el-select v-model="region.phenologyId" class="select-input" placeholder="选择物候期">
+                            <el-select
+                            v-model="region.phenologyId" @change="handlePhenologyChange(crop, region)" class="select-input" placeholder="选择物候期">
                                 <el-option v-for="(item, index) in crop.phenologyOptions" :key="index"
                                     :label="item.phenologyName" :value="item.phenologyId" />
                             </el-select>
@@ -54,10 +55,17 @@
                     <div class="field-row" v-if="region.phenologyId">
                         <div class="field-label">{{ getPhenologyLabel(crop, region.phenologyId) }}</div>
                         <div class="field-value">
-                            <el-date-picker :editable="false" style="width: 100%" v-model="region.phenologyStartDate"
-                                class="date-picker" type="date" placeholder="选择时间" format="YYYY-MM-DD"
+                            <el-date-picker
+                                :editable="false"
+                                style="width: 100%"
+                                v-model="region.phenologyStartDate"
+                                class="date-picker"
+                                type="date"
+                                placeholder="选择时间"
+                                format="YYYY-MM-DD"
                                 value-format="YYYY-MM-DD"
-                                :disabled-date="disabledFutureDate" />
+                                :disabled-date="(time) => disabledFutureDate(time, crop, region)"
+                            />
                         </div>
                     </div>
                 </div>
@@ -202,11 +210,38 @@ const getPhenologyLabel = (farm, phenologyId) => {
     return found?.startDateLabel || "选择时间";
 };
 
-// 禁用今天之后的日期:只能选择今天及之前
-const disabledFutureDate = (time) => {
+const getStartDate = (farm, phenologyId) => {
+    if (!farm?.phenologyOptions) return "";
+    const found = farm.phenologyOptions.find(
+        (item) => item.id === phenologyId || item.phenologyId === phenologyId
+    );
+    return found?.startDate || "";
+};
+
+const handlePhenologyChange = (crop, region) => {
+    region.phenologyStartDate = getStartDate(crop, region.phenologyId);
+};
+
+// 禁用今天之后的日期;最早只能选到「该物候期默认开始时间」的前 3 个月
+// 如果没有物候期开始时间,则基于今天往前 3 个月
+const disabledFutureDate = (time, crop, region) => {
     const today = new Date();
     today.setHours(0, 0, 0, 0);
-    return time.getTime() > today.getTime();
+
+    // 基准开始时间:物候期默认开始日期
+    const baseStartStr = getStartDate(crop, region.phenologyId);
+    const baseStart = baseStartStr ? new Date(baseStartStr) : null;
+
+    // 选择基准日期:有物候期开始时间则用它,否则用今天
+    const base = !baseStart || isNaN(baseStart.getTime()) ? new Date(today) : new Date(baseStart);
+    base.setHours(0, 0, 0, 0);
+
+    // 三个月前的同一天(基于 base)
+    const threeMonthsAgo = new Date(base);
+    threeMonthsAgo.setMonth(threeMonthsAgo.getMonth() - 3);
+
+    const t = time.getTime();
+    return t > today.getTime() || t < threeMonthsAgo.getTime();
 };
 
 const showTipPopup = ref(false);

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

@@ -68,12 +68,22 @@
                         <div class="reason-text">上传照片({{ item.imagePaths.length }}张)</div>
                         <!-- 图片展示 -->
                         <div class="uploaded-images">
-                            <div class="uploaded-img-wrap" v-for="(image, imgIndex) in item.imagePaths" :key="image"
+                            <!-- <div class="uploaded-img-wrap" v-for="(image, imgIndex) in item.imagePaths" :key="image"
                                 @click="showExample(item, imgIndex, { hideLabel: true })">
                                 <img class="uploaded-img" :src="base_img_url2 + image" alt="" />
                                 <span v-show="item.questionStatus === 3" class="uploaded-img-remove"
                                     @click.stop="removeUploadedImage(item, imgIndex)">×</span>
-                            </div>
+                            </div> -->
+
+                            <photo-provider :photo-closable="true">
+                                <photo-consumer v-for="(image, imgIndex) in item.imagePaths" :key="imgIndex" :src="base_img_url2 + image">
+                                <div class="uploaded-img-wrap">
+                                    <img :src="base_img_url2 + image" class="uploaded-img">
+                                    <span v-show="item.questionStatus === 3" class="uploaded-img-remove"
+                                        @click.stop="removeUploadedImage(item, imgIndex)">×</span>
+                                </div>
+                                </photo-consumer>
+                            </photo-provider>
                         </div>
                         <uploader v-show="item.questionStatus === 3" class="upload-wrap continue-upload-btn"
                             @click="handleUploadClick(item)" multiple :max-count="10" :after-read="afterReadUpload">