Prechádzať zdrojové kódy

feat:对接农情互动页面接口

wangsisi 10 hodín pred
rodič
commit
7f9c9ffac4

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

@@ -28,7 +28,7 @@ module.exports = {
     },
     //统计农场的过往农事服务成本
     getFarmPastServiceCost: {
-        url: config.base_dev_url + "z_farm_work_record_cost/statistics",
+        url: config.base_dev_url + "z_farm_work_record/statistics",
         type: "get",
     },
     //农资查询服务农场的最新广播

+ 66 - 20
src/components/pageComponents/AgriculturalInteractionCard.vue

@@ -9,12 +9,14 @@
             <div class="timeline-right">
                 <div class="date">
                     <span class="work-name">{{ timelineItem.farmWorkName }}</span>
-                    <span v-show="timelineItem.expectedRisk">({{ timelineItem.expectedRisk }})</span>
-                    <span class="ignore-btn" @click="handleIgnore(timelineItem)"> 忽略 </span>
+                    <!-- <span v-show="timelineItem.expectedRisk">({{ timelineItem.expectedRisk }})</span> -->
+                    <span class="ignore-btn" @click="handleIgnore(item,timelineItem)"> 忽略 </span>
                 </div>
                 <div class="text">
                     预计报价<span class="price">{{ timelineItem.estimatedCost }}元</span>
-                    <span class="action-detail" @click="showPriceSheetPopup(timelineItem.farmWorkId, item)">查看报价单</span>
+                    <span class="action-detail" @click="showPriceSheetPopup(timelineItem.farmWorkId, item)"
+                        >查看报价单</span
+                    >
                 </div>
             </div>
             <div class="timeline-action" @click="handleTimelineAction(timelineItem, item.farmId)">转入农事任务</div>
@@ -25,13 +27,25 @@
 
     <!-- 服务报价单 -->
     <price-sheet-popup ref="priceSheetPopupRef"></price-sheet-popup>
+
+    <popup v-model:show="showTaskPopup" round class="task-tips-popup">
+        <img class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
+        <div class="create-farm-text">
+            <div>
+                您确认忽略 <span class="main-text">{{ currentTask?.farmName }}</span> 的
+                <span class="main-text">{{ currentTask?.farmWorkName }}</span> 农事吗
+            </div>
+        </div>
+        <div class="create-farm-btn" @click="handlePopupBtn">确认忽略</div>
+    </popup>
 </template>
 
 <script setup>
+import { Popup } from "vant";
 import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import { computed, onMounted, ref } from "vue";
-import { ElMessage, ElMessageBox } from "element-plus";
+import { ElMessage } from "element-plus";
 
 const props = defineProps({
     item: {
@@ -92,26 +106,26 @@ const handleUploadSuccess = async () => {
 };
 
 // 忽略农事库
-const handleIgnore = ({ farmWorkId }) => {
-    ElMessageBox.confirm("确认忽略该农事吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-    })
-        .then(() => {
-            VE_API.home.ignoreFarmWorkLib({ farmWorkLibId: farmWorkId }).then(({ code }) => {
-                if (code === 0) {
-                    ElMessage.success("忽略成功");
-                    handleUploadSuccess()
-                }
-            });
-        })
-        .catch(() => {});
+const currentTask = ref(null);
+const showTaskPopup = ref(false);
+const handleIgnore = (item, timelineItem) => {
+    currentTask.value = { ...item, ...timelineItem };
+    showTaskPopup.value = true;
+};
+
+const handlePopupBtn = () => {
+    VE_API.home.ignoreFarmWorkLib({ farmWorkLibId: currentTask.value.farmWorkId }).then(({ code }) => {
+        if (code === 0) {
+            showTaskPopup.value = false;
+            ElMessage.success("忽略成功");
+            handleUploadSuccess();
+        }
+    });
 };
 
 const priceSheetPopupRef = ref(null);
 const showPriceSheetPopup = (id, item) => {
-    priceSheetPopupRef.value.handleShowPopup({id, farmId: item.farmId, agriculturalId: item.agriculturalStoreId})
+    priceSheetPopupRef.value.handleShowPopup({ id, farmId: item.farmId, agriculturalId: item.agriculturalStoreId });
 };
 </script>
 
@@ -189,4 +203,36 @@ const showPriceSheetPopup = (id, item) => {
         }
     }
 }
+.task-tips-popup {
+    width: 90%;
+    padding: 28px 28px 20px;
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+    justify-content: center;
+    .create-farm-icon {
+        width: 52px;
+        height: 52px;
+        margin-bottom: 12px;
+    }
+    .create-farm-text {
+        font-size: 19px;
+        font-weight: 500;
+        margin-bottom: 32px;
+        text-align: center;
+    }
+    .main-text {
+        color: #2199f8;
+    }
+    .create-farm-btn {
+        width: 100%;
+        box-sizing: border-box;
+        padding: 8px;
+        border-radius: 25px;
+        font-size: 16px;
+        background: #2199f8;
+        color: #fff;
+        text-align: center;
+    }
+}
 </style>

+ 16 - 11
src/components/pageComponents/FarmWorkPlanTimeline.vue

@@ -31,9 +31,7 @@
                         {{ r.name }}
                         <div class="arranges">
                             <div
-                                v-for="(fw, aIdx) in Array.isArray(r.farmWorkArrangeList)
-                                    ? r.farmWorkArrangeList
-                                    : []"
+                                v-for="(fw, aIdx) in Array.isArray(r.farmWorkArrangeList) ? r.farmWorkArrangeList : []"
                                 :key="fw.id ?? aIdx"
                                 class="arrange-card"
                                 :class="getArrangeStatusClass(fw)"
@@ -47,8 +45,10 @@
                                     <div class="header-right">托管农事</div>
                                 </div>
                                 <div class="card-content">
-                                    <span>{{ fw.warmReminder || "暂无提示" }}</span>
-                                    <span v-if="!disableClick" class="edit-link" @click.stop="handleEdit(fw)">点击编辑</span>
+                                    <span>{{ fw.interactionQuestion || "暂无提示" }}</span>
+                                    <span v-if="!disableClick" class="edit-link" @click.stop="handleEdit(fw)"
+                                        >点击编辑</span
+                                    >
                                 </div>
                                 <div
                                     v-if="
@@ -79,10 +79,16 @@
             </div>
         </div>
     </div>
+    <!-- 互动设置弹窗 -->
+    <interact-popup
+        ref="interactPopupRef"
+        @handleSaveSuccess="getFarmWorkPlan"
+    ></interact-popup>
 </template>
 
 <script setup>
 import { ref, computed, nextTick, watch } from "vue";
+import interactPopup from "@/components/popup/interactPopup.vue";
 import { ElMessage } from "element-plus";
 
 const props = defineProps({
@@ -107,9 +113,7 @@ const props = defineProps({
     },
 });
 
-const emits = defineEmits(["row-click", "edit"]);
-
-
+const emits = defineEmits(["row-click"]);
 
 const solarTerms = ref([]);
 const phenologyList = ref([]);
@@ -305,9 +309,12 @@ const handleRowClick = (item) => {
     emits("row-click", item);
 };
 
+const interactPopupRef = ref(null);
 const handleEdit = (item) => {
     if (props.disableClick) return;
-    emits("edit", item);
+    if (interactPopupRef.value) {
+        interactPopupRef.value.showPopup(item);
+    }
 };
 
 const containerIdData = ref(null);
@@ -579,5 +586,3 @@ watch(
     }
 }
 </style>
-
-

+ 6 - 30
src/components/popup/interactPopup.vue

@@ -51,7 +51,7 @@
             </div>
         </div>
         <div class="interact-buttons">
-            <div class="btn-delete" @click="handleDeleteInteract">删除互动</div>
+            <div class="btn-delete" @click="handleCancelInteract">取消修改</div>
             <div class="btn-save" :class="{ disabled: isSaving }" @click="handleSaveInteract">
                 {{ saveButtonText }}
             </div>
@@ -65,7 +65,7 @@ import { ref, computed } from "vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 
 // Emits
-const emit = defineEmits(["handleSaveSuccess", "handleDeleteInteract"]);
+const emit = defineEmits(["handleSaveSuccess"]);
 
 // 响应式数据
 const show = ref(false);
@@ -146,20 +146,8 @@ const showPopup = async (data) => {
 };
 
 // 事件处理函数
-const handleDeleteInteract = () => {
-    ElMessageBox.confirm("确定要删除该互动设置吗?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-    })
-        .then(() => {
-            emit("handleDeleteInteract", { arrangeId: arrangeId.value });
-            show.value = false;
-            ElMessage.success("删除成功");
-        })
-        .catch(() => {
-            // 用户取消,不做任何操作
-        });
+const handleCancelInteract = () => {
+    show.value = false;
 };
 
 function formatDate(date) {
@@ -319,24 +307,12 @@ defineExpose({
             border-radius: 25px;
             font-size: 16px;
             text-align: center;
-            cursor: pointer;
-            transition: all 0.3s;
-            user-select: none;
         }
 
         .btn-delete {
             background: #ffffff;
-            border: 1px solid #ff4d4f;
-            color: #ff4d4f;
-
-            &:hover {
-                background: #fff5f5;
-            }
-
-            &:active {
-                opacity: 0.8;
-                transform: scale(0.98);
-            }
+            border: 1px solid rgba(153, 153, 153, 0.5);
+            color: #666666;
         }
 
         .btn-save {

+ 31 - 39
src/components/recordItem.vue

@@ -32,26 +32,18 @@
                 <div class="info-line">
                     药物处方:<span class="info-val">{{ getPrescriptionInfo(recordItemData) }}</span>
                 </div>
-                <div class="review-title info-line">
-                    复核成效
-                    <div class="info-val">
-                        {{
-                            recordItemData.reCheckText ||
-                            "--"
-                        }}
-                    </div>
-                </div>
-                <div class="review-image" v-if="showFarmImage">
-                    <div class="image-wrapper" v-if="currentImageUrl">
-                        <span class="image-label">农事前</span>
+                <div class="review-image" v-if="showFarmImage && recordItemData.executeEvidence.length">
+                    <!-- <div class="image-wrapper" v-if="currentImageUrl">
+                        <span class="image-label">执行照片</span>
                         <img :src="currentImageUrl" alt="" />
+                    </div> -->
+                    <div class="image-wrapper">
+                        <span class="image-label">执行照片</span>
+                        <img :src="base_img_url2 + recordItemData.executeEvidence[0]" alt="" />
                     </div>
-                    <div class="image-wrapper" v-if="recordItemData.reviewImage && recordItemData.reviewImage.length">
-                        <span class="image-label">农事后</span>
-                        <img
-                            :src="base_img_url2 + recordItemData.reviewImage[recordItemData.reviewImage.length - 1]"
-                            alt=""
-                        />
+                    <div class="image-wrapper">
+                        <span class="image-label">执行照片</span>
+                        <img :src="base_img_url2 + recordItemData.executeEvidence[1]" alt="" />
                     </div>
                 </div>
             </div>
@@ -256,29 +248,29 @@ const fetchImageUrl = (id) => {
 };
 
 // 计算属性:根据 recordItemData.id 获取图片 URL(响应式)
-const currentImageUrl = computed(() => {
-    const id = props.recordItemData?.id;
-    if (id) {
-        // 触发获取图片 URL(如果还没有获取过)
-        fetchImageUrl(id);
-        // 直接返回响应式数据,Vue 会自动追踪变化
-        return imageUrlMap.value[id] || "";
-    }
-    return "";
-});
+// const currentImageUrl = computed(() => {
+//     const id = props.recordItemData?.id;
+//     if (id) {
+//         // 触发获取图片 URL(如果还没有获取过)
+//         fetchImageUrl(id);
+//         // 直接返回响应式数据,Vue 会自动追踪变化
+//         return imageUrlMap.value[id] || "";
+//     }
+//     return "";
+// });
 
 // 监听 recordItemData.id 的变化,确保 ID 变化时重新获取
-watch(
-    () => props.recordItemData?.id,
-    (newId) => {
-        if (props.showFarmImage) {
-            if (newId && !imageUrlMap.value[newId] && !loadingIds.value.has(newId)) {
-                fetchImageUrl(newId);
-            }
-        }
-    },
-    { immediate: true }
-);
+// watch(
+//     () => props.recordItemData?.id,
+//     (newId) => {
+//         if (props.showFarmImage) {
+//             if (newId && !imageUrlMap.value[newId] && !loadingIds.value.has(newId)) {
+//                 fetchImageUrl(newId);
+//             }
+//         }
+//     },
+//     { immediate: true }
+// );
 
 const handleTitleRightClick = (recordItemData) => {
     emit("titleRightClick", recordItemData);

+ 2 - 3
src/views/old_mini/farm_manage/map/index.js

@@ -67,8 +67,7 @@ class IndexMap {
         });
         let style3 = new Style({
           text: new Text({
-            // text: '2.18 农事1',
-            text: feature.get('mapInfo'),
+            text: feature.get('farmName'),
             offsetX: 0,
             offsetY: -30,
             font: "bold 12px sans-serif",
@@ -217,7 +216,7 @@ class IndexMap {
     if (taskList.length > 0) {  // 如果任务列表不为空,则添加任务点
       for (let item of taskList) {
         item.mapInfo = label ? item[label] : (item.executeDeadlineDate || item.executeDate)?.replace(/^\d{4}-(\d{2})-(\d{2})$/, '$1.$2') + '  ' + item.farmWorkName
-        this.gardenPointLayer.source.addFeature(newPoint(item, "point", "myGarden"))
+        this.gardenPointLayer.source.addFeature(newPoint(item, "farmPoint", "myGarden"))
       }
       this.kmap.getView().fit(this.gardenPointLayer.source.getExtent(), { padding: [42, 20, 30, 20] });
       const finalZoom = this.kmap.getView().getZoom();

+ 2 - 2
src/views/old_mini/mine/pages/serviceDetail.vue

@@ -93,7 +93,7 @@ const getFarmPastServiceCost = () => {
     VE_API.user.getFarmPastServiceCost({ farmId: farmIdVal.value }).then(({ data }) => {
         serviceStatsData.value = [
             { value: data?.totalCost, unit: "元", desc: "总收益" },
-            { value: data?.totalCost, unit: "元", desc: "投入成本" },
+            { value: data?.privateCost, unit: "元", desc: "投入成本" },
             { value: data?.serviceCount, unit: "次", desc: "服务次数" },
         ];
     });
@@ -105,7 +105,7 @@ const getDetailList = () => {
         farmId: farmIdVal.value,
         limit: 99,
         page: 1,
-        flowStatus: "4,5",
+        flowStatus: "5",
     };
     VE_API.user.getDetailList(params).then(({ data }) => {
         detailList.value = data || [];

+ 1 - 0
src/views/old_mini/mine/pages/serviceRecords.vue

@@ -41,6 +41,7 @@ const getSimpleList = async () => {
         role: localStorage.getItem("SET_USER_CUR_ROLE"),
         includePrescription: true,
         isServiceRecord: true,
+        flowStatus: "5",
     });
     if (data.length > 0) {
         recordList.value = data;

+ 0 - 21
src/views/old_mini/monitor/subPages/plan.vue

@@ -30,7 +30,6 @@
                 :farmId="route.query.farmId"
                 :containerId="containerIdData"
                 @row-click="handleRowClick"
-                @edit="handleEdit"
                 :disableClick="!hasPlanPermission"
             />
         </div>
@@ -46,13 +45,6 @@
     </div>
     <!-- 农事信息弹窗 -->
     <detail-dialog ref="detailDialogRef" @triggerFarmWork="triggerFarmWork"></detail-dialog>
-    <!-- 互动设置弹窗 -->
-    <interact-popup
-        ref="interactPopupRef"
-        @handleSaveSuccess="getFarmWorkPlanForPhenology"
-        @handleDeleteInteract="handleDeleteInteract"
-    ></interact-popup>
-
     <!-- 复制方案弹窗 -->
     <Popup v-model:show="showCopyPlan" class="copy-plan-popup" round closeable :close-on-click-overlay="false">
         <div class="copy-plan-content">
@@ -109,7 +101,6 @@ import FarmWorkPlanTimeline from "@/components/pageComponents/FarmWorkPlanTimeli
 import { useRouter, useRoute } from "vue-router";
 import detailDialog from "@/components/detailDialog.vue";
 import eventBus from "@/api/eventBus";
-import interactPopup from "@/components/popup/interactPopup.vue";
 import { ElMessage,ElMessageBox } from "element-plus";
 const router = useRouter();
 const route = useRoute();
@@ -331,18 +322,6 @@ const handleRowClick = (item) => {
         },
     });
 };
-
-const interactPopupRef = ref(null);
-
-const handleEdit = (item) => {
-    if (interactPopupRef.value) {
-        interactPopupRef.value.showPopup(item);
-    }
-};
-
-const handleDeleteInteract = (params) => {
-    getFarmWorkPlanForPhenology();
-};
 </script>
 
 <style scoped lang="scss">

+ 170 - 414
src/views/old_mini/task_condition/components/interact.vue

@@ -15,7 +15,7 @@
                     待提醒({{ taskCounts[3] || 0 }})
                 </div>
             </div> -->
-            <div class="select-group">
+            <!-- <div class="select-group">
                 <el-select
                     class="select-item"
                     v-model="selectParma.farmWorkTypeId"
@@ -32,100 +32,73 @@
                 >
                     <el-option v-for="item in districtList" :key="item.code" :label="item.name" :value="item.code" />
                 </el-select>
-            </div>
-            <!-- <div class="task-content-loading" v-if="loading && noData" v-loading="loading">
             </div> -->
-            <div class="task-content" v-loading="loading">
-                <div class="task-item" v-for="(item, index) in taskList" :key="index">
-                    <div class="img-text-wrap" @click.stop="toDetail(item)">
-                        <div class="left-wrap">
-                            <div class="left-img">
-                                <img src="@/assets/img/home/farm.png" alt="" />
-                            </div>
-                            <div class="right-text">
-                                <div class="farm-info">
-                                    {{ item?.farmName }}
-                                    <div class="info-tag-wrap">
-                                        <div class="tag-item primary">
-                                            {{ item?.typeName }}
+            <van-list
+                v-model:loading="loadingMore"
+                :finished="finished"
+                finished-text="没有更多了"
+                @load="onLoad"
+                :immediate-check="false"
+            >
+                <div class="task-content" v-loading="loading && taskList.length === 0">
+                    <div class="task-item" v-for="(item, index) in taskList" :key="item.id || index">
+                        <div class="img-text-wrap" @click.stop="toDetail(item)">
+                            <div class="left-wrap">
+                                <div class="left-img">
+                                    <img src="@/assets/img/home/farm.png" alt="" />
+                                </div>
+                                <div class="right-text">
+                                    <div class="farm-info">
+                                        {{ item?.farmName }}
+                                        <div class="info-tag-wrap">
+                                            <div class="tag-item primary">
+                                                {{ item?.typeName }}
+                                            </div>
+                                            <div class="tag-item second">托管客户</div>
                                         </div>
-                                        <div class="tag-item second">托管客户</div>
                                     </div>
+                                    <div class="farm-addr">{{ item?.address }}</div>
                                 </div>
-                                <div class="farm-addr">{{ item?.address }}</div>
                             </div>
+                            <div class="right-wrap" @click.stop="handleRemindCustomer(item)">提醒客户</div>
                         </div>
-                        <div class="right-wrap" @click.stop="handleRemindCustomer(item)">提醒客户</div>
-                    </div>
-                    <div class="item-bottom">
-                        <div class="bottom-tag">
-                            <div class="tag-card active">
-                                <div class="card-content">
-                                    <div class="card-main-text">花芽分化</div>
-                                    <div class="card-sub-text">
-                                        当前物候期
-                                        <span class="card-icon" @click="handleSelectCurrentPhenology(item)">
-                                            <el-icon><Edit /></el-icon>
-                                        </span>
+                        <div class="item-bottom">
+                            <div class="bottom-tag">
+                                <div class="tag-card active">
+                                    <div class="card-content">
+                                        <div class="card-main-text">{{ item.sourceData?.currentPhenologyName || '--' }}</div>
+                                        <div class="card-sub-text">
+                                            当前物候期
+                                            <span class="card-icon" @click="handleSelectCurrentPhenology(item)">
+                                                <el-icon><Edit /></el-icon>
+                                            </span>
+                                        </div>
                                     </div>
                                 </div>
-                            </div>
-                            <div class="tag-card">
-                                <div class="card-content">
-                                    <div class="card-main-text">蒂蛀虫</div>
-                                    <div class="card-sub-text">预计风险</div>
-                                </div>
-                            </div>
-                            <div class="tag-card">
-                                <div class="card-content">
-                                    <div class="card-main-text">5天</div>
-                                    <div class="card-sub-text">预计下次物候</div>
-                                </div>
-                            </div>
-                        </div>
-
-                        <div class="timeline">
-                            <div class="timeline-item" v-for="item in timelineList" :key="item.id">
-                                <div class="timeline-left">
-                                    <div class="dot"></div>
-                                    <div class="line"></div>
+                                <div class="tag-card">
+                                    <div class="card-content">
+                                        <div class="card-main-text">冲梢风险</div>
+                                        <div class="card-sub-text">预计风险</div>
+                                    </div>
                                 </div>
-                                <div class="timeline-right">
-                                    <div class="date">预计{{ item.date }}天后触发<span class="work-name">{{ item.workName }}</span></div>
-                                    <div class="text">
-                                        预计报价<span class="price">{{ item.price }}元</span>
-                                        <span @click.stop="showPriceSheetPopup(item)" class="action-detail">查看报价单</span>
+                                <div class="tag-card">
+                                    <div class="card-content">
+                                        <div class="card-main-text">{{ item.sourceData?.daysUntilNext || '--' }}天</div>
+                                        <div class="card-sub-text">预计下次物候</div>
                                     </div>
                                 </div>
-                                <div class="timeline-action" @click="handleTimelineAction(item)">转入农事任务</div>
                             </div>
+
+                            <!-- 时间轴组件 -->
+                            <AgriculturalInteractionCard :item="item" @updateList="resetAndLoad" />
                         </div>
                     </div>
+                    <div class="empty-data" v-if="!loading && taskList.length === 0">暂无数据</div>
                 </div>
-                <div class="empty-data" v-if="noData">暂无数据</div>
-            </div>
+            </van-list>
         </div>
     </div>
     <upload-execute ref="uploadExecuteRef" :onlyShare="onlyShare" @uploadSuccess="handleUploadSuccess" />
-
-    <popup v-model:show="showTaskPopup" round class="task-tips-popup">
-        <template v-if="taskPopupType === 'warning'">
-            <img class="create-farm-icon" src="@/assets/img/home/create-farm-icon.png" alt="" />
-            <div class="create-farm-text">
-                <div>
-                    您确认忽略 <span class="main-text">{{ currentTask?.farmName }}</span> 的
-                    <span class="main-text">{{ currentTask?.farmWorkName }}</span> 农事吗
-                </div>
-            </div>
-        </template>
-        <template v-else>
-            <img class="farm-check-icon" src="@/assets/img/home/right.png" alt="" />
-            <div class="create-farm-text success-text">农事已下发成功</div>
-        </template>
-        <div class="create-farm-btn" @click="handlePopupBtn">
-            {{ taskPopupType === "warning" ? "确认忽略" : "我知道了" }}
-        </div>
-    </popup>
     <!-- 服务报价单 -->
     <price-sheet-popup :key="activeIndex" ref="priceSheetPopupRef"></price-sheet-popup>
     <!-- 新增:激活上传弹窗 -->
@@ -133,16 +106,16 @@
 </template>
 
 <script setup>
-import eventBus from "@/api/eventBus";
 import { computed, nextTick, onMounted, ref, watch } from "vue";
 import { useStore } from "vuex";
-import { Popup } from "vant";
+import { List as VanList } from "vant";
 import IndexMap from "../../farm_manage/map/index";
 import { useRouter } from "vue-router";
 import uploadExecute from "./uploadExecute.vue";
 import priceSheetPopup from "@/components/popup/priceSheetPopup.vue";
 import { ElMessage } from "element-plus";
 import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
+import AgriculturalInteractionCard from "@/components/pageComponents/AgriculturalInteractionCard.vue";
 
 const store = useStore();
 const router = useRouter();
@@ -164,70 +137,22 @@ const taskCounts = ref([0, 0, 0]);
 const activeIndex = ref(2);
 const noData = ref(false);
 const loading = ref(false);
-
-const showTaskPopup = ref(false);
-const taskPopupType = ref("warning");
-
-// 根据 activeIndex 计算 startFlowStatus
-const getStartFlowStatus = (index) => {
-    const statusMap = {
-        1: 4, // 待完成
-        2: 4, // 待完成
-        3: 5, // 已完成
-    };
-    return statusMap[index] ?? 0;
+// 分页相关
+const page = ref(0);
+const limit = ref(10);
+const loadingMore = ref(false);
+const finished = ref(false);
+
+// 查询未来农事预警
+const getFutureFarmWorkWarning = async (item) => {
+    const res = await VE_API.home.listFutureFarmWorkWarning({ farmId: item.farmId });
+    item.timelineList = res.data || [];
 };
 
-const timelineList = ref([
-    {
-        date: "3",
-        workName: "梢期杀虫",
-        price: "1258"
-    },
-    {
-        date: "5",
-        workName: "梢期营养",
-        price: "1758"
-    },
-])
-
-// 获取单个状态的任务数量
-function getTaskCount(flowStatus, index, needReview) {
-    const location = store.state.home.miniUserLocationPoint;
-    return VE_API.z_farm_work_record
-        .getSimpleList({ role: 2, location, flowStatus, needReview })
-        .then(({ data }) => {
-            if (Array.isArray(data)) {
-                taskCounts.value[index] = data.length;
-
-                if (index === 2) {
-                    indexMap.initData(data);
-                }
-            } else if (data?.total !== undefined) {
-                taskCounts.value[index] = data.total;
-            } else {
-                taskCounts.value[index] = 0;
-            }
-        })
-        .catch((error) => {
-            console.error(`获取状态${index}任务数量失败:`, error);
-            taskCounts.value[index] = 0;
-        });
-}
-
 const taskItemRefs = ref([]);
-const setTaskItemRef = (el, index) => {
-    if (el) {
-        taskItemRefs.value[index] = el;
-    }
-};
-
 const handleUploadSuccess = async () => {
-    // 先保存当前需要更新的 item id
-    const currentItemIds = taskList.value.map((item) => item.id || item.workRecordId);
-
     // 刷新列表
-    await getSimpleList();
+    await resetAndLoad();
 
     // 等待 DOM 更新完成,refs 被重新收集
     await nextTick();
@@ -250,7 +175,7 @@ function getDistrictListByCity() {
         cityCode.value = "";
         districtList.value.unshift({ code: cityCode.value, name: "全部" });
         selectParma.value.districtCode = cityCode.value;
-        getSimpleList();
+        resetAndLoad();
     });
 }
 
@@ -263,26 +188,12 @@ function getFarmWorkTypeList() {
     });
 }
 
-// 初始化时获取所有状态的任务数量
-function initTaskCounts() {
-    const location = store.state.home.miniUserLocationPoint;
-    // 并行请求三个状态的数量
-    Promise.all([
-        getTaskCount(4, 1), // 待确认
-        getTaskCount(5, 2), // 待完成
-        getTaskCount(5, 3, true), // 已完成
-    ]);
-}
 const mapPoint = ref(null);
 
 onMounted(() => {
     mapPoint.value = store.state.home.miniUserLocationPoint;
-
-    // 初始化时获取所有状态的数量
-    initTaskCounts();
-    // 加载当前选中状态的数据列表
-    getSimpleList();
-    getDistrictListByCity();
+    // getDistrictListByCity();
+    resetAndLoad();
     getFarmWorkTypeList();
     nextTick(() => {
         indexMap.initMap(mapPoint.value, mapContainer.value, true);
@@ -291,87 +202,113 @@ onMounted(() => {
 
 // 监听 activeIndex 变化,重新加载数据
 watch(activeIndex, () => {
-    getSimpleList();
+    resetAndLoad();
 });
 
-function getSimpleList() {
-    loading.value = true;
-    noData.value = false;
-    // 清空refs数组,避免索引错乱
-    taskItemRefs.value = [];
-    const startFlowStatus = getStartFlowStatus(activeIndex.value);
-    const needReview = activeIndex.value === 2 ? true : false;
+// 加载列表数据(支持分页)
+async function getSimpleList(isLoadMore = false) {
+    if (!isLoadMore) {
+        // 重置分页
+        page.value = 0;
+        finished.value = false;
+        taskList.value = [];
+        taskItemRefs.value = [];
+        loading.value = true;
+    } else {
+        loadingMore.value = true;
+    }
+
     const params = {
         ...selectParma.value,
-        role: 2,
-        location: mapPoint.value,
-        flowStatus: startFlowStatus,
-        farmWorkTypeId: selectParma.value.farmWorkTypeId || null,
-        needReview: needReview,
+        page: page.value,
+        limit: limit.value,
+        flowStatus: 5,
     };
 
-    return VE_API.z_farm_work_record
-        .getSimpleList(params)
-        .then(({ data }) => {
+    try {
+        const { data } = await VE_API.home.listUnansweredFarms(params);
+        
+        if (!isLoadMore) {
             loading.value = false;
-            // 假设返回的数据结构是 { list: [], total: 0 } 或者直接是数组
-            let filteredData = data;
+        } else {
+            loadingMore.value = false;
+        }
 
-            // 如果是"待确认"状态,过滤掉 isIgnored 为 1 的数据
-            if (activeIndex.value === 0 && Array.isArray(data)) {
-                filteredData = data.filter((item) => item.isIgnored !== 1);
+        if (data && data.length > 0) {
+            // 为每个item初始化timelineList
+            const newItems = data.map((item) => {
+                let sourceData = item?.latestPhenologyProgressBroadcast?.sourceData;
+                if (sourceData) {
+                    try {
+                        sourceData = JSON.parse(sourceData);
+                    } catch (e) {
+                        console.error("解析sourceData失败:", e);
+                        sourceData = null;
+                    }
+                }
+                return {
+                    ...item,
+                    sourceData,
+                    timelineList: [],
+                };
+            });
+
+            // 串行请求,为每个农场获取时间轴数据
+            for (let i = 0; i < newItems.length; i++) {
+                await getFutureFarmWorkWarning(newItems[i]);
             }
 
-            if (Array.isArray(filteredData) && filteredData.length > 0) {
-                taskList.value = filteredData;
-                // 更新当前状态的数量
-                taskCounts.value[activeIndex.value] = filteredData.length;
-                if (activeIndex.value === 2) {
-                    // 地图使用筛选后的数据
-                    indexMap.initData(taskList.value);
-                }
-            } else {
+            // 追加数据
+            taskList.value = [...taskList.value, ...newItems];
+            
+            // 更新分页
+            page.value += 1;
+            
+            // 判断是否还有更多数据
+            if (data.length < limit.value) {
+                finished.value = true;
+            }
+
+            // 更新地图数据
+            indexMap.initData(taskList.value);
+        } else {
+            finished.value = true;
+            if (taskList.value.length === 0) {
                 noData.value = true;
-                taskList.value = [];
-                taskCounts.value[activeIndex.value] = 0;
             }
-        })
-        .catch((error) => {
-            console.error("获取任务列表失败:", error);
+        }
+    } catch (error) {
+        console.error("获取任务列表失败:", error);
+        if (!isLoadMore) {
             loading.value = false;
-            taskList.value = [];
-            taskCounts.value[activeIndex.value] = 0;
-            if (activeIndex.value === 2) {
-                indexMap.initData(taskList.value);
-            }
+        } else {
+            loadingMore.value = false;
+        }
+        finished.value = true;
+        if (taskList.value.length === 0) {
             noData.value = true;
-        });
+        }
+    }
 }
 
+// 滚动加载更多
+const onLoad = () => {
+    if (!finished.value && !loadingMore.value) {
+        getSimpleList(true);
+    }
+};
+
+// 重置并重新加载
+const resetAndLoad = () => {
+    getSimpleList(false);
+};
+
 function handleActiveFilter(i) {
     activeIndex.value = i;
     selectParma.value.districtCode = cityCode.value;
     selectParma.value.farmWorkTypeId = null;
 }
 
-function toPage(item) {
-    // router.push("/servicZes_agri")
-    // if (activeIndex.value === 2) {
-    // } else {
-    //     // 下发农事请求
-    //     const data = {
-    //         id: item.id,
-    //     };
-    //     VE_API.z_farm_work_record.issueFarmWorkRecord(data).then((res) => {
-    //         if (res.code === 0) {
-    //             taskPopupType.value = "success";
-    //             showTaskPopup.value = true;
-    //             getSimpleList();
-    //         }
-    //     });
-    // }
-}
-
 const showUploadExecutePopup = (item) => {
     if (item?.executeEvidence.length) {
         onlyShare.value = true;
@@ -397,98 +334,28 @@ function toDetail(item) {
     });
 }
 
-const priceSheetPopupRef = ref(null);
-const showPriceSheetPopup = (item) => {
-    console.log('item', item)
-    VE_API.z_farm_work_record.getDetail({ id: item.id }).then(({ data }) => {
-        const res = data[0];
-        priceSheetPopupRef.value.handleShowPopup(res);
-    });
-};
-
 const onlyShare = ref(false);
-const currentTask = ref(null);
-function handleAction(item) {
-    if (activeIndex.value === 0) {
-        taskPopupType.value = "warning";
-        showTaskPopup.value = true;
-        currentTask.value = item;
-    } else {
-        onlyShare.value = true;
-        setTimeout(() => {
-            uploadExecuteRef.value.showPopup(item, "share-sheet");
-        }, 10);
-    }
-}
-
-function handlePopupBtn() {
-    showTaskPopup.value = false;
-    if (taskPopupType.value === "warning") {
-        // 确认忽略
-        VE_API.z_farm_work_record.ignoreFarmWorkRecord({ farmWorkRecordId: currentTask.value.id }).then((res) => {
-            if (res.code === 0) {
-                ElMessage.success("操作成功");
-                getSimpleList();
-            }
-        });
-    }
-}
-
-function handleForward(item) {
-    if (item.quoteCount && item.quoteCount != 0) {
-        onlyShare.value = true;
-        setTimeout(() => {
-            uploadExecuteRef.value.showPopup(
-                { ...item, type: "quotation", farmWorkOrderId: item.orderId },
-                "share-sheet"
-            );
-        }, 10);
-    } else {
-        ElMessage.warning("暂无报价数据,无法分享");
-        return;
-    }
-}
-
-const executorList = ref([{
-    id: 1,
-    name: "张三",
-    phone: "13800138000",
-}, {
-    id: 2,
-    name: "李四",
-    phone: "13800138001",
-}])
-
-function handleTimelineAction(item) {
-    // activeUploadPopupRef.value.triggerFarmWork({
-    //     farmId: item.farmId,
-    //     workName: item.workName,
-    // });
-    eventBus.emit("activeUpload:show", {
-        gardenIdVal: item.farmId,
-        needExecutorVal: true,
-        problemTitleVal: '请选择 ' + item.workName + ' 执行截止时间',
-        imgDescVal: '请上传凭证(转入农事任务凭证)',
-        arrangeIdVal: item.farmWorkArrangeId,
-        executorListVal: executorList.value,
-    });
-}
+const phenologyList = ref([
+    {
+        id: 1,
+        name: "花芽分化",
+    },
+    {
+        id: 2,
+        name: "开花",
+    },
+    {
+        id: 3,
+        name: "成熟",
+    },
+]);
 
-const phenologyList = ref([{
-    id: 1,
-    name: "花芽分化",
-}, {
-    id: 2,
-    name: "开花",
-}, {
-    id: 3,
-    name: "成熟",
-}]);
+const activeUploadPopupRef = ref(null);
 function handleSelectCurrentPhenology(item) {
-    eventBus.emit("activeUpload:show", {
+    activeUploadPopupRef.value.showPopup({
         gardenIdVal: item.farmId,
-        problemTitleVal: '进入 物候期 的时间',
-        imgDescVal: '请上传凭证(转入农事任务凭证)',
+        problemTitleVal: "进入 物候期 的时间",
+        imgDescVal: "请上传凭证(转入农事任务凭证)",
         arrangeIdVal: item.farmWorkArrangeId,
         selectCurrentPhenologyVal: true,
         phenologyListVal: phenologyList.value,
@@ -498,7 +365,7 @@ function handleSelectCurrentPhenology(item) {
 function handleRemindCustomer(item) {
     router.push({
         path: "/remind_customer",
-        query: { id: item.id },
+        query: { farmId: item.farmId },
     });
 }
 </script>
@@ -560,7 +427,6 @@ function handleRemindCustomer(item) {
     }
 
     .task-content {
-        border-top: 1px solid rgba(0, 0, 0, 0.1);
         min-height: 80px;
     }
 
@@ -735,73 +601,6 @@ function handleRemindCustomer(item) {
                 }
             }
         }
-        .timeline {
-                padding-top: 10px;
-                .timeline-item {
-                    display: flex;
-                    align-items: flex-start;
-                    font-size: 14px;
-                    color: #ffffff;
-                    line-height: 22px;
-                    & + .timeline-item {
-                        margin-top: 10px;
-                    }
-                    .timeline-left {
-                        width: 22px;
-                        display: flex;
-                        flex-direction: column;
-                        align-items: center;
-                        .dot {
-                            width: 6px;
-                            height: 6px;
-                            border-radius: 50%;
-                            background: #A2D5FD;
-                            margin-top: 6px;
-                        }
-                        .line {
-                            border-left: 1px dashed #A2D5FD;
-                            margin-top: 4px;
-                            height: 28px;
-                        }
-                    }
-                    .timeline-right {
-                        padding-left: 5px;
-                        flex: 1;
-                        .date {
-                            color: #1D2129;
-                            font-weight: 500;
-                            font-size: 14px;
-                            line-height: 22px;
-                        }
-                        .text {
-                            font-size: 12px;
-                            color: #d7d7d7;
-                            .price {
-                                padding-left: 4px;
-                            }
-                            .action-detail {
-                                margin-left: 6px;
-                                color: #2199F8;
-                                border-bottom: 1px solid;
-                            }
-                        }
-                        .work-name {
-                            padding-left: 4px;
-                        }
-                    }
-                    .timeline-action {
-                        align-self: center;
-                        height: 28px;
-                        line-height: 28px;
-                        flex: none;
-                        background: rgba(33, 153, 248, 0.1);
-                        color: #2199F8;
-                        font-size: 12px;
-                        padding: 0px 11px;
-                        border-radius: 20px;
-                    }
-                }
-            }
     }
 
     .item-footer {
@@ -880,47 +679,4 @@ function handleRemindCustomer(item) {
         }
     }
 }
-
-.task-tips-popup {
-    width: 75%;
-    padding: 28px 28px 20px;
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    .create-farm-icon {
-        width: 40px;
-        height: 40px;
-        margin-bottom: 12px;
-    }
-    .farm-check-icon {
-        width: 68px;
-        height: 68px;
-        margin-bottom: 12px;
-    }
-    .create-farm-text {
-        font-size: 20px;
-        font-weight: 500;
-        line-height: 40px;
-        margin-bottom: 32px;
-        text-align: center;
-        &.success-text {
-            font-size: 23px;
-            font-weight: 400;
-        }
-    }
-    .main-text {
-        color: #2199f8;
-    }
-    .create-farm-btn {
-        width: 100%;
-        box-sizing: border-box;
-        padding: 8px;
-        border-radius: 25px;
-        font-size: 16px;
-        background: #2199f8;
-        color: #fff;
-        text-align: center;
-    }
-}
 </style>