Bläddra i källkod

feat:对接首页农情互动接口和修改种植方案操作按钮

wangsisi 6 dagar sedan
förälder
incheckning
b4b0306216

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

@@ -78,4 +78,9 @@ module.exports = {
         url: config.base_dev_url + "bbs_post/topicDetail",
         type: "get",
     },
+    //农情互动的农场列表接口(分页)
+    listUnansweredFarms:{
+        url: config.base_dev_url + "work_code/phenology/quest/listUnansweredFarms/{page}/{limit}",
+        type: "get",
+    }
 }

+ 29 - 24
src/components/popup/interactPopup.vue

@@ -1,11 +1,5 @@
 <template>
-    <popup
-        class="interact-popup"
-        v-model:show="show"
-        closeable
-        :close-on-click-overlay="false"
-        @closed="handleClosed"
-    >
+    <popup class="interact-popup" v-model:show="show" closeable :close-on-click-overlay="false" @closed="handleClosed">
         <div class="interact-header">
             <div class="interact-title">{{ interactTitle }}</div>
         </div>
@@ -16,14 +10,9 @@
                     请选择互动时间
                 </div>
                 <div class="form-input-wrapper">
-                    <el-date-picker
-                        v-model="interactTime"
-                        size="large"
-                        style="width: 100%"
-                        type="date"
-                        placeholder="请选择日期"
-                        :editable="false"
-                    />
+                    <el-select v-model="interactTime" size="large" placeholder="请选择物候期" :editable="false">
+                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
+                    </el-select>
                 </div>
             </div>
             <div class="form-item">
@@ -82,6 +71,29 @@ const interactTime = ref("");
 const forceTriggerTime = ref("");
 const interactQuestion = ref("");
 
+const options = [
+    {
+        value: "Option1",
+        label: "Option1",
+    },
+    {
+        value: "Option2",
+        label: "Option2",
+    },
+    {
+        value: "Option3",
+        label: "Option3",
+    },
+    {
+        value: "Option4",
+        label: "Option4",
+    },
+    {
+        value: "Option5",
+        label: "Option5",
+    },
+];
+
 // 计算属性
 const saveButtonText = computed(() => (isSaving.value ? "保存中..." : "保存修改"));
 
@@ -110,13 +122,7 @@ const validateInteractForm = () => {
 };
 
 // 显示弹窗方法
-const showPopup = ({
-    arrangeIdVal,
-    interactTitleVal,
-    interactTimeVal,
-    forceTriggerTimeVal,
-    interactQuestionVal,
-}) => {
+const showPopup = ({ arrangeIdVal, interactTitleVal, interactTimeVal, forceTriggerTimeVal, interactQuestionVal }) => {
     // 重置数据
     resetInteractData();
 
@@ -236,8 +242,8 @@ defineExpose({
             }
 
             .form-label {
-                font-size: 14px;
                 color: #000;
+                font-weight: 500;
                 margin-bottom: 12px;
                 display: flex;
                 align-items: center;
@@ -341,4 +347,3 @@ defineExpose({
     }
 }
 </style>
-

+ 58 - 33
src/views/old_mini/home/components/AgriculturalDynamics.vue

@@ -10,30 +10,29 @@
                     </div>
                     <div class="task-time">执行时间 {{ task.executionTime }}</div>
                 </div>
-                <div class="task-action">上传照片</div>
+                <div class="task-action" @click="handleTaskAction(task)" :class="{ orange: index === 1 }">
+                    {{ index === 0 ? "上传照片" : "确认执行时间" }}
+                </div>
             </div>
         </div>
 
         <div class="title">农情互动</div>
         <!-- 内容区域 -->
         <div class="agricultural-list">
-            <div class="agricultural-item">
+            <div class="agricultural-item" v-for="(item, index) in unansweredList" :key="index">
                 <!-- 头部区域 -->
                 <div class="header-section">
                     <div class="header-left">
-                        <div class="farm-name">水稻园</div>
+                        <div class="farm-name">{{ item.farmName }}</div>
                         <div class="tag-group">
-                            <div class="tag tag-blue">桂味</div>
+                            <div class="tag tag-blue">{{ item.typeName }}</div>
                             <div class="tag tag-orange">托管客户</div>
                         </div>
                     </div>
                     <div class="remind-btn" @click="handleRemind">提醒客户</div>
                 </div>
                 <!-- 警告通知块 -->
-                <div class="warning-block">
-                    当前处于<span class="highlight">梢期</span>,可能会有<span class="highlight">蒂蛀虫</span
-                    >风险,预计<span class="highlight">5天</span>后进入物候期
-                </div>
+                <div class="warning-block" v-html="item.latestPhenologyProgressBroadcast?.content"></div>
 
                 <div class="timeline">
                     <div class="timeline-item" v-for="item in timelineList" :key="item.id">
@@ -56,17 +55,13 @@
             </div>
         </div>
     </div>
+    <offer-popup ref="offerPopupRef"></offer-popup>
 </template>
 
 <script setup>
+import router from "@/router";
 import { ref, onMounted } from "vue";
-
-// 气象/农事预警数据
-const warningList = ref([]);
-
-// 专家问答数据
-const expertQAList = ref([]);
-
+import offerPopup from "@/components/popup/offerPopup.vue";
 // 任务列表数据
 const taskList = ref([
     { id: 1, title: "梢期杀虫", executionTime: "2025.05.06", status: "pending" },
@@ -86,33 +81,57 @@ const timelineList = ref([
     // },
 ]);
 
+const offerPopupRef = ref(null);
+const handleTaskAction = (item) => {
+    const data = {
+        address: "岭南印象园东南",
+        executeDate: "2025-11-19",
+        executeEvidence: '["birdseye-look-mini/91754/1763544788985.jpg"]',
+        farmArea: "50.089606952166854",
+        farmId: 93684,
+        farmMiniUserId: 91429,
+        farmMiniUserName: "丝丝1",
+        farmName: "17ss籼稻农场",
+        farmWorkArrangeId: "124",
+        farmWorkLibId: "2220005",
+        farmWorkName: "蘖末防治",
+        id: "276567",
+        isFollow: null,
+        isIgnored: 0,
+        isPublic: 0,
+        mapInfo: "11.19  蘖末防治",
+        orderId: "778948195706212352",
+        point: "POINT(113.407189 23.032344)",
+        quoteCount: "1",
+        solarTerm: null,
+        typeId: "223",
+        typeName: "丝苗米",
+    };
+    offerPopupRef.value.openPopup(data);
+};
+
 const handleTimelineAction = (item) => {
     // 处理转入农事任务逻辑
     console.log("转入农事任务", item);
 };
 
 const handleRemind = () => {
-    // 处理提醒客户逻辑
-    console.log("提醒客户");
+    router.push("/remind_customer");
 };
 
 onMounted(() => {
-    // getWarningList();
+    getUnansweredFarms();
 });
 
-const getWarningList = () => {
+const unansweredList = ref([]);
+const getUnansweredFarms = () => {
     const params = {
-        page: 1,
-        limit: 10,
-        topicId: 2,
+        page: 0,
+        limit: 3,
     };
-    // VE_API.home.warningPageList(params).then((res) => {
-    //     if (activeTab.value === 4) {
-    //         expertQAList.value = res.data || [];
-    //     } else {
-    //         warningList.value = res.data || [];
-    //     }
-    // });
+    VE_API.home.listUnansweredFarms(params).then((res) => {
+        unansweredList.value = res.data || [];
+    });
 };
 </script>
 
@@ -139,6 +158,7 @@ const getWarningList = () => {
                 right: 0;
                 width: 72px;
                 height: 72px;
+                pointer-events: none;
                 background: url("@/assets/img/home/task-icon.png") no-repeat center center / 100% 100%;
             }
 
@@ -176,6 +196,10 @@ const getWarningList = () => {
                 border-radius: 25px;
                 padding: 7px 14px;
                 font-size: 12px;
+                &.orange {
+                    color: #ff953d;
+                    background: rgba(255, 149, 61, 0.1);
+                }
             }
         }
     }
@@ -250,10 +274,11 @@ const getWarningList = () => {
                 margin: 8px 0;
                 font-size: 12px;
                 color: #252525;
-
-                .highlight {
-                    color: #2199f8;
-                    font-weight: 500;
+                ::v-deep{
+                    p{
+                        padding: 0;
+                        margin: 0;
+                    }
                 }
             }
 

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

@@ -52,8 +52,6 @@
         :text="farmPopupType === 'create' ? ['您当前还没有农场', '请先创建农场'] : '农场创建成功'"
         @confirm="handleBtn"
     />
-    <!-- 问题提醒 -->
-    <problem-reminder></problem-reminder>
 </template>
 
 <script setup>
@@ -63,8 +61,6 @@ import weatherInfo from "@/components/weatherInfo.vue";
 import AgriculturalDynamics from "./components/AgriculturalDynamics.vue";
 import { useRouter, useRoute } from "vue-router";
 import wx from "weixin-js-sdk";
-import problemReminder from "./components/problemReminder.vue";
-import { ElMessage } from "element-plus";
 import tipPopup from "@/components/popup/tipPopup.vue";
 
 const curRole = localStorage.getItem("SET_USER_CUR_ROLE");

+ 11 - 8
src/views/old_mini/monitor/subPages/plan.vue

@@ -85,14 +85,13 @@
                 </div>
             </div>
         </div>
-        <div class="custom-bottom-fixed-btns">
+        <div class="custom-bottom-fixed-btns" :class="{ 'center': pageType !== 'plant' }">
+            <div class="bottom-btn secondary-btn" v-if="pageType === 'plant'">{{ active === 1 ? '复制为新方案' : '编辑方案' }}</div>
             <div class="bottom-btn primary-btn" @click="addNewTask">新增农事</div>
         </div>
     </div>
     <!-- 农事信息弹窗 -->
     <detail-dialog ref="detailDialogRef" @triggerFarmWork="triggerFarmWork"></detail-dialog>
-    <!-- 新增:激活上传弹窗 -->
-    <active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="getFarmWorkPlan"></active-upload-popup>
     <!-- 互动设置弹窗 -->
     <interact-popup
         ref="interactPopupRef"
@@ -108,7 +107,6 @@ import tabList from "@/components/pageComponents/TabList.vue";
 import { useRouter, useRoute } from "vue-router";
 import detailDialog from "@/components/detailDialog.vue";
 import eventBus from "@/api/eventBus";
-import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
 import interactPopup from "@/components/popup/interactPopup.vue";
 import { ElMessage } from "element-plus";
 const router = useRouter();
@@ -252,7 +250,6 @@ const handleRowClick = (item) => {
     });
 };
 
-const activeUploadPopupRef = ref(null);
 const interactPopupRef = ref(null);
 
 const handleEdit = (item) => {
@@ -666,9 +663,15 @@ const getReproductiveItemHeight = (phenologyItem) => {
     }
     // 控制区域样式
     .custom-bottom-fixed-btns {
-        justify-content: center;
-        .primary-btn {
-            padding: 10px 50px;
+        .bottom-btn {
+            width: 124px;
+            padding: 10px 0;
+        }
+        &.center{
+            justify-content: center;
+            .bottom-btn {
+                padding: 10px 50px;
+            }
         }
     }
 }