Quellcode durchsuchen

fix: 筛选已完成

lxf vor 2 Tagen
Ursprung
Commit
1eaa3282b4

+ 4 - 0
src/api/modules/z_farm_work_record.js

@@ -71,4 +71,8 @@ module.exports = {
         url: url + "/ignoreFarmWorkRecord",
         type: "get",
     },
+    addExecuteImgAndComplete: {
+        url: url + "/addExecuteImgAndComplete",
+        type: "post",
+    },
 }

+ 21 - 3
src/views/old_mini/agri_work/components/priceTable.vue

@@ -24,7 +24,7 @@
                             <div class="title-3">{{ subP.brand }}</div>
                             <div class="title-4">{{ subP.price }}</div>
                             <div class="title-5">{{ subP.dosage }}</div>
-                            <div class="title-6">{{ subP.total }}元</div>
+                            <div class="title-6">{{ getTotal(subP) }}元</div>
                         </div>
                     </div>
                 </div>
@@ -38,10 +38,28 @@
 <script setup>
 const props = defineProps({
     prescriptionData: {
-        default: () => {}
-    }
+        default: () => ({}),
+    },
+    // 面积(亩数),用于计算总价:单价 * 用量 * 面积
+    area: {
+        type: [Number, String],
+        default: null,
+    },
 });
 
+// 计算单个药肥的总价:单价 * 用量 * 面积
+const getTotal = (item) => {
+    const price = Number(item?.price ?? 0);
+    const dosage = Number(item?.dosage ?? 0);
+    const area = props.area != null ? Number(props.area) : Number(item?.area ?? 0);
+
+    // 如果有现成的 total 字段且无法计算,则退回使用 total
+    if (!price || !dosage || !area) {
+        return item?.total ?? "--";
+    }
+
+    return (price * dosage * area).toFixed(2);
+};
 </script>
 
 <style lang="scss" scoped>

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

@@ -51,7 +51,7 @@
                                 <span class="action-detail">查看报价单</span>
                             </div>
                         </div>
-                        <div class="timeline-action" @click="handleTimelineAction(timelineItem)">转入农事任务</div>
+                        <div class="timeline-action" @click="handleTimelineAction(timelineItem, item.farmId)">转入农事任务</div>
                     </div>
                 </div>
             </div>
@@ -59,12 +59,16 @@
         </div>
     </div>
     <offer-popup ref="offerPopupRef"></offer-popup>
+    <!-- 新增:激活上传弹窗 -->
+    <active-upload-popup ref="activeUploadPopupRef" @handleUploadSuccess="handleUploadSuccess"></active-upload-popup>
 </template>
 
 <script setup>
 import router from "@/router";
 import { ref, onMounted } from "vue";
 import offerPopup from "@/components/popup/offerPopup.vue";
+import eventBus from "@/api/eventBus";
+import activeUploadPopup from "@/components/popup/activeUploadPopup.vue";
 // 任务列表数据
 const taskList = ref([
     { id: 1, title: "梢期杀虫", executionTime: "2025.05.06", status: "pending" },
@@ -100,9 +104,34 @@ const handleTaskAction = (item) => {
     offerPopupRef.value.openPopup(data);
 };
 
-const handleTimelineAction = (item) => {
+// 查询当前农资店的成员列表(只保留有“任务接单”权限的成员)
+const getManagerList = async () => {
+    const { data } = await VE_API.mine.listManagerList();
+    if (data && data.length > 0) {
+        // 过滤 permissionList 中包含“任务接单”的成员
+        executorList.value = data.filter((item) => {
+            const list = item.permissionList || [];
+            return Array.isArray(list) && list.includes("任务接单");
+        });
+    }
+};
+
+const executorList = ref([])
+const handleTimelineAction = (item, farmId) => {
     // 处理转入农事任务逻辑
-    console.log("转入农事任务", item);
+    eventBus.emit("activeUpload:show", {
+        gardenIdVal: farmId,
+        needExecutorVal: true,
+        problemTitleVal: '请选择 ' + item.farmWorkName + ' 执行截止时间',
+        imgDescVal: '请上传凭证(转入农事任务凭证)',
+        arrangeIdVal: item.arrangeId,
+        executorListVal: executorList.value,
+    });
+};
+
+
+const handleUploadSuccess = async () => {
+    await getUnansweredFarms();
 };
 
 const handleRemind = (item) => {
@@ -111,6 +140,7 @@ const handleRemind = (item) => {
 
 onMounted(() => {
     getUnansweredFarms();
+    getManagerList()
 });
 
 //农情互动的农场列表接口(分页)

+ 2 - 2
src/views/old_mini/modify_work/completedWork.vue

@@ -313,9 +313,9 @@
                 <div class="fixed-btn" @click="showPriceSheetPopup">确认并报价</div>
             </div>
             <!-- 农资,步骤:农资已执行,请求确认 -->
-            <!-- <div class="fixed-btn-wrap center" v-if="curRole == 2 && currentStep == 2">
+            <div class="fixed-btn-wrap center" v-if="curRole == 2 && currentStep == 2">
                 <div class="fixed-btn orange" @click="selectExecuteTime">确认执行时间</div>
-            </div> -->
+            </div>
 
 
             <!-- 农资,步骤:农事已确认 -->

+ 72 - 19
src/views/old_mini/modify_work/modify.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="new-farming-page">
+    <div class="new-farming-page" ref="pageRef">
         <custom-header :name="isEdit ? '编辑方案' : '查看详情'"></custom-header>
         <div class="new-farming-content">
             <el-form
@@ -439,23 +439,20 @@
                             <div class="info-title-wrap">
                                 <div class="sub-title font-bold">药肥费用</div>
                                 <div class="info-more">
-                                    {{ quotationData?.pesticideFertilizerCost ? formatArea(quotationData.pesticideFertilizerCost) : "--" }}<span class="unit-text">元</span>
+                                    {{ pesticideCostTotal ? formatArea(pesticideCostTotal) : "--" }}<span class="unit-text">元</span>
                                 </div>
                             </div>
                         </div>
                         <div class="info-content-wrap">
-                            <price-table :prescriptionData="dynamicValidateForm.prescription">
+                            <price-table :prescriptionData="dynamicValidateForm.prescription" :area="detailData?.farm?.mianji">
                                 <template #bottomContent>
                                     <div class="price-bottom">
                                         <div class="info-title-wrap">
                                             <div class="sub-title font-bold">服务费用</div>
                                             <div class="info-more">
                                                 {{
-                                                    quotationData?.farmWorkServiceCost
-                                                        ? getServiceCost(
-                                                              quotationData.farmWorkServiceCost,
-                                                              quotationData.farm?.mianji
-                                                          )
+                                                    quotationData?.serviceMuPrice
+                                                        ? getServiceTotal()
                                                         : "--"
                                                 }}<span class="unit-text">元</span>
                                             </div>
@@ -481,7 +478,7 @@
                                         </div>
                                         <div class="price-total">
                                             报价合计:<span class="main-val">{{
-                                                quotationData?.totalCost ? formatArea(quotationData.totalCost) : "--"
+                                                totalCost ? formatArea(totalCost) : "--"
                                             }}</span
                                             >元
                                         </div>
@@ -511,7 +508,7 @@
 </template>
 
 <script setup>
-import { onActivated, ref, reactive, onDeactivated, onBeforeUnmount, computed, onMounted } from "vue";
+import { onActivated, ref, reactive, onDeactivated, onBeforeUnmount, computed, onMounted, nextTick } from "vue";
 import { useRouter, useRoute } from "vue-router";
 import { ElMessage, ElMessageBox } from "element-plus";
 import customHeader from "@/components/customHeader.vue";
@@ -523,6 +520,7 @@ import priceTable from "../agri_work/components/priceTable.vue";
 
 import dayjs from "dayjs";
 const store = useStore();
+const pageRef = ref(null);
 const router = useRouter();
 const route = useRoute();
 
@@ -542,14 +540,20 @@ const interactFormData = ref({
 });
 const phenologyList = ref([]);
 
-const isEdit = ref(true);
+const isEdit = ref(false);
 
 onActivated(() => {
-    // isEdit.value = route.query.isEdit ? true : false;
+    isEdit.value = route.query.isEdit ? true : false;
     if (route.query.farmWorkId) {
         getDetail();
     }
-    window.scrollTo(0, 0);
+    nextTick(() => {
+        if (pageRef.value) {
+            pageRef.value.scrollTop = 0;
+        } else {
+            window.scrollTo(0, 0);
+        }
+    });
     // 初始化 prescription 对象
     if (!route.query.farmWorkId) {
         dynamicValidateForm.prescription = {
@@ -618,11 +622,17 @@ const getPriceList = async (schemeId, pesticideFertilizerCodes) => {
     });
 
     quotationData.value = {...detailData.value, ...dynamicValidateForm};
-    console.log('quotationData.value', quotationData.value)
 };
 
 const toEditPrescription = () => {
     isEdit.value = true;
+    nextTick(() => {
+        if (pageRef.value) {
+            pageRef.value.scrollTo({ top: 0, behavior: "auto" });
+        } else {
+            window.scrollTo(0, 0);
+        }
+    });
 };
 
 const quotationData = ref({});
@@ -702,6 +712,13 @@ const cancelEdit = () => {
     })
         .then(() => {
             isEdit.value = false;
+            nextTick(() => {
+                if (pageRef.value) {
+                    pageRef.value.scrollTop = 0;
+                } else {
+                    window.scrollTo(0, 0);
+                }
+            });
         })
         .catch(() => {
             console.log("取消编辑");
@@ -859,15 +876,44 @@ const resetItemForm = (index) => {
 
 const servicePricePerMu = ref(null);
 
-// 计算服务费用总计:亩单价 * 亩数
-const getServiceTotal = () => {
+// 服务费用总计(数值):亩单价 * 亩数
+const serviceCostTotal = computed(() => {
     const price = Number(servicePricePerMu.value || 0);
     const area = Number(detailData.value?.farm?.mianji || detailData.value?.area || 0);
-    if (!price || !area) return "--";
-    const total = (price * area).toFixed(2);
-    return total;
+    if (!price || !area) return 0;
+    return Number((price * area).toFixed(2));
+});
+
+// 显示用的服务费用(字符串或 "--")
+const getServiceTotal = () => {
+    const total = serviceCostTotal.value;
+    return total ? total.toFixed(2) : "--";
 };
 
+// 药肥费用总计:∑(单价 * 单亩用量 * 亩数)
+const pesticideCostTotal = computed(() => {
+    const list = dynamicValidateForm.prescription?.pesticideFertilizerList || [];
+    const area = Number(detailData.value?.farm?.mianji || detailData.value?.area || 0);
+    if (!list.length || !area) return 0;
+
+    const sum = list.reduce((acc, item) => {
+        const price = Number(item?.price || 0);
+        const dosage = Number(item?.dosage || 0);
+        if (!price || !dosage) return acc;
+        return acc + price * dosage * area;
+    }, 0);
+
+    return Number(sum.toFixed(2));
+});
+
+// 报价合计 = 药肥费用 + 服务费用
+const totalCost = computed(() => {
+    const pesticide = Number(pesticideCostTotal.value || 0);
+    const service = Number(serviceCostTotal.value || 0);
+    if (!pesticide && !service) return 0;
+    return Number((pesticide + service).toFixed(2));
+});
+
 const submitForm = (formEl) => {
     if (!formEl) return;
     formEl.validate(async (valid) => {
@@ -969,6 +1015,13 @@ const submit = () => {
             await getDetail();
             ElMessage.success("保存成功");
             isEdit.value = false;
+            nextTick(() => {
+                if (pageRef.value) {
+                    pageRef.value.scrollTop = 0;
+                } else {
+                    window.scrollTo(0, 0);
+                }
+            });
         }
     });
 

+ 10 - 56
src/views/old_mini/task_condition/components/interact.vue

@@ -94,7 +94,7 @@
                                     <div class="date">预计{{ item.date }}天后触发<span class="work-name">{{ item.workName }}</span></div>
                                     <div class="text">
                                         预计报价<span class="price">{{ item.price }}元</span>
-                                        <span class="action-detail">查看报价单</span>
+                                        <span @click.stop="showPriceSheetPopup(item)" class="action-detail">查看报价单</span>
                                     </div>
                                 </div>
                                 <div class="timeline-action" @click="handleTimelineAction(item)">转入农事任务</div>
@@ -171,8 +171,7 @@ const taskPopupType = ref("warning");
 // 根据 activeIndex 计算 startFlowStatus
 const getStartFlowStatus = (index) => {
     const statusMap = {
-        0: 0, // 待确认
-        1: "1,2,3", // 待完成
+        1: 4, // 待完成
         2: 4, // 待完成
         3: 5, // 已完成
     };
@@ -193,58 +192,11 @@ const timelineList = ref([
 ])
 
 // 获取单个状态的任务数量
-function getTaskCount(flowStatus, index) {
+function getTaskCount(flowStatus, index, needReview) {
     const location = store.state.home.miniUserLocationPoint;
     return VE_API.z_farm_work_record
-        .getSimpleList({ role: 2, location, flowStatus })
+        .getSimpleList({ role: 2, location, flowStatus, needReview })
         .then(({ data }) => {
-            data = [
-                ...data,
-                {
-                    address: "深圳世界之窗",
-                    executeDate: "2025-12-29",
-                    executeEvidence: "",
-                    farmArea: "40.100412863459745",
-                    farmId: 93651,
-                    farmMiniUserId: 91344,
-                    farmMiniUserName: "舒浩农资",
-                    farmName: "世界之窗荔枝农场",
-                    farmWorkArrangeId: null,
-                    farmWorkLibId: "756894717878210560",
-                    farmWorkName: "二梢营养",
-                    id: "276563",
-                    isFollow: null,
-                    isIgnored: 0,
-                    isPublic: 0,
-                    orderId: "778920749103583232",
-                    point: "POINT(113.96804666992188 22.537601205078126)",
-                    quoteCount: "0",
-                    typeId: "2",
-                    typeName: "糯米糍",
-                },
-                {
-                    address: "汕尾市海丰县赤坑镇S241妙荔现代农业园",
-                    executeDate: "2025-12-27",
-                    executeEvidence: "",
-                    farmArea: "",
-                    farmId: 43318,
-                    farmMiniUserId: 81818,
-                    farmMiniUserName: "",
-                    farmName: "汕尾妙荔果园",
-                    farmWorkArrangeId: null,
-                    farmWorkLibId: "708734452137725956",
-                    farmWorkName: "杀梢",
-                    id: "277160",
-                    isFollow: null,
-                    isIgnored: 0,
-                    isPublic: 0,
-                    orderId: "781556915820826624",
-                    point: "POINT(115.455766 22.883073)",
-                    quoteCount: "0",
-                    typeId: "4",
-                    typeName: "仙进奉",
-                },
-            ];
             if (Array.isArray(data)) {
                 taskCounts.value[index] = data.length;
 
@@ -316,10 +268,9 @@ function initTaskCounts() {
     const location = store.state.home.miniUserLocationPoint;
     // 并行请求三个状态的数量
     Promise.all([
-        getTaskCount(0, 0), // 待确认
-        getTaskCount("1,2,3", 1), // 待确认
-        getTaskCount(4, 2), // 待完成
-        getTaskCount(5, 3), // 已完成
+        getTaskCount(4, 1), // 待确认
+        getTaskCount(5, 2), // 待完成
+        getTaskCount(5, 3, true), // 已完成
     ]);
 }
 const mapPoint = ref(null);
@@ -349,12 +300,14 @@ function getSimpleList() {
     // 清空refs数组,避免索引错乱
     taskItemRefs.value = [];
     const startFlowStatus = getStartFlowStatus(activeIndex.value);
+    const needReview = activeIndex.value === 2 ? true : false;
     const params = {
         ...selectParma.value,
         role: 2,
         location: mapPoint.value,
         flowStatus: startFlowStatus,
         farmWorkTypeId: selectParma.value.farmWorkTypeId || null,
+        needReview: needReview,
     };
 
     return VE_API.z_farm_work_record
@@ -446,6 +399,7 @@ 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);

+ 10 - 8
src/views/old_mini/task_condition/components/task.vue

@@ -124,18 +124,18 @@ const loading = ref(false);
 // 根据 activeIndex 计算 startFlowStatus
 const getStartFlowStatus = (index) => {
     const statusMap = {
-        1: "0,1,2,3", // 待完成
-        2: '4', // 待完成
-        3: 5, // 已完成
+        1: 4, // 待完成
+        2: 5, // 已完成
+        3: 5, // 待复核
     };
     return statusMap[index] ?? 4;
 };
 
 // 获取单个状态的任务数量
-function getTaskCount(flowStatus, index) {
+function getTaskCount(flowStatus, index, needReview) {
     const location = store.state.home.miniUserLocationPoint;
     return VE_API.z_farm_work_record
-        .getSimpleList({ role: 2, location, flowStatus })
+        .getSimpleList({ role: 2, location, flowStatus, needReview })
         .then(({ data }) => {
             if (Array.isArray(data)) {
                 taskCounts.value[index] = data.length;
@@ -210,9 +210,9 @@ function initTaskCounts() {
     const location = store.state.home.miniUserLocationPoint;
     // 并行请求状态的数量
     Promise.all([
-        getTaskCount("1,2,3", 1), // 已确认
-        getTaskCount(4, 2), // 待完成
-        getTaskCount(5, 3), // 已完成
+        getTaskCount(4, 1), // 已确认
+        getTaskCount(5, 2), // 待完成
+        getTaskCount(5, 3, true), // 已完成
     ]);
 }
 const mapPoint = ref(null);
@@ -257,12 +257,14 @@ function getSimpleList() {
     // 清空refs数组,避免索引错乱
     taskItemRefs.value = [];
     const startFlowStatus = getStartFlowStatus(activeIndex.value);
+    const needReview = activeIndex.value === 2 ? true : false;
     const params = {
         ...selectParma.value,
         role: 2,
         location: mapPoint.value,
         flowStatus: startFlowStatus,
         farmWorkTypeId: selectParma.value.farmWorkTypeId || null,
+        needReview: needReview,
     };
 
     return VE_API.z_farm_work_record