2 Commits 318cd49fc3 ... e4ab397e52

Author SHA1 Message Date
  lxf e4ab397e52 Merge branch 'farmer' of http://www.sysuimars.cn:3000/feiniao/feiniao-farm-h5 into farmer 3 days ago
  lxf c1cb0e7289 fix: 转发农事 3 days ago

+ 25 - 11
src/components/pageComponents/ArchivesFarmTimeLine.vue

@@ -566,7 +566,7 @@ const getArrangeStatusClass = (fw) => {
     const t = props.pageType === 'agri_record' ? fw?.flowStatus : fw?.sourceType;
     if (props.pageType === 'agri_record') {
         if (t == null || t == 0) return "status-default";
-        if (t ==3) return "status-complete";
+        if (t == 3) return "status-complete";
         return "status-act";
     } else {
         if (t == 10) return "status-complete";
@@ -825,16 +825,30 @@ watch(
 const handleStatusDetail = (fw) => {
     // 跳转前记录当前滚动位置
     saveTimelineScrollTop();
-    router.push({
-        path: props.pageType === 'agri_plan' ? "/agricultural_detail" : "/work_detail",
-        query: {
-            farmId: props.farmId,
-            regionId: props.regionId,
-            date: fw?.createTime?.slice(0,10),
-            farmWorkLibId: fw?.farmWorkLibId,
-            recordId: fw?.farmWorkRecordId,
-            typeId: props.typeId },
-    });
+    if (props.pageType === 'agri_plan') {
+        router.push({
+            path: "/agricultural_detail",
+            query: {
+                farmId: props.farmId,
+                regionId: props.regionId,
+                date: fw?.createTime?.slice(0, 10)
+            },
+        });
+    } else {
+        router.push({
+            path: "/work_detail",
+            query: {
+                miniJson: JSON.stringify({
+                    paramsPage: JSON.stringify({
+                        farmId: props.farmId,
+                        farmWorkLibId: fw?.farmWorkLibId,
+                        recordId: fw?.farmWorkRecordId,
+                        typeId: props.typeId
+                    }),
+                }),
+            },
+        });
+    }
 };
 
 // 格式化日期为 MM-DD 格式

+ 3 - 3
src/views/old_mini/monitor/subPages/darwArea.vue

@@ -259,9 +259,9 @@ const confirmArea = async () => {
     router.back();
 };
 
-const handleKnow = (isLast = false) => {
+const handleKnow = () => {
     showSuccessPopup.value = false;
-    if (route.query.showTipPopup && isLast) {
+    if (route.query.showTipPopup) {
         showTipPopup.value = true;
         return;
     }
@@ -290,7 +290,7 @@ const handleSelectNextVariety = () => {
         showSuccessPopup.value = false;
     } else {
         // 如果已经是最后一个品种,则直接返回上一页
-        handleKnow(true);
+        handleKnow();
     }
 };
 

+ 9 - 5
src/views/old_mini/work_detail/components/executePopup.vue

@@ -13,7 +13,7 @@
             </div>
             <div class="upload-wrap" :class="{ 'upload-cont': fileList.length }">
                 <div class="name">农事凭证</div>
-                <div class="sub-name">肥料使用照片或者执行照片</div>
+                <div class="sub-name">请上传农事执行现场照片及所用药肥凭证照片</div>
                 <div class="tips-text" v-if="failImgs">由于系统审核,您照片拍摄位置与农场相差超 3 公里,请在农场现场使用水印相机重新拍摄上传,谢谢配合</div>
                 <uploader class="uploader" v-model="fileList" multiple :max-count="5" :after-read="afterRead"
                     @click="handleClick('rg')">
@@ -53,9 +53,11 @@ import { ElMessage } from "element-plus";
 import { getFileExt } from "@/utils/util";
 import UploadFile from "@/utils/upliadFile";
 import { useStore } from "vuex";
+import { useRouter } from "vue-router";
 
 const store = useStore();
 const miniUserId = store.state.home.miniUserId;
+const router = useRouter();
 
 const props = defineProps({
     executionData: {
@@ -103,22 +105,24 @@ function closeTask() {
     if (!fileArr.value.length) return ElMessage.warning('请上传农事凭证')
     if (!executeTime.value) return ElMessage.warning('请选择实际执行时间')
     if (!serviceInput.value) return ElMessage.warning('请输入农资机构名称')
-    
+
     const params = {
         recordId: recordId.value,
         executorOrganizationName: serviceInput.value,
         executeDate: executeTime.value,
         executeEvidence: fileArr.value,
     }
-    console.log('params', params)
     VE_API.report.addExecuteImgAndComplete(params).then((res) => {
         if (res.code === 0) {
             ElMessage.success('操作成功')
+            setTimeout(() => {
+                showValue.value = false;
+                router.replace('/agri_record')
+            }, 800)
         } else {
             ElMessage.error(res.msg)
         }
     }).catch((err) => {
-        console.log('err', err)
         ElMessage.error('操作失败')
     })
 }
@@ -190,7 +194,7 @@ defineExpose({
     padding-bottom: 12px;
 }
 
-.tips-text{
+.tips-text {
     color: #FA7406;
     padding: 5px 10px;
     border: 1px solid #FA7406;

+ 21 - 52
src/views/old_mini/work_detail/index.vue

@@ -53,7 +53,7 @@
                                 <div class="item-text light-text area-text">
                                     {{ detail?.executionRegion?.regionName }}种植区域
                                     <div class="area-btn" v-if="detail?.executionRegion?.regionRange" @click="handleViewArea">查看区域</div>
-                                    <div class="area-btn area-btn-right" v-else @click="toDraw">建议勾选<el-icon><ArrowRight /></el-icon></div>
+                                    <div class="area-btn area-btn-right" @click="toDraw" v-if="!detail?.executionRegion?.regionRange && !miniJson?.hideDraw">建议勾选<el-icon><ArrowRight /></el-icon></div>
                                 </div>
                             </div>
                             <div class="form-item">
@@ -135,7 +135,7 @@
                     </div>
                 </div>
 
-                <div class="fixed-btn-wrap execute-action" v-if="info?.appType === 1 && detail?.flowStatus === null">
+                <div class="fixed-btn-wrap execute-action" v-if="info?.appType === 1 && detail?.flowStatus === 3">
                     <div class="action-item second" @click="handleConvert">转发农事</div>
                     <div class="action-item primary" @click="handleExecute">溯源认证</div>
                 </div>
@@ -212,45 +212,6 @@ const normalizeCropAlbum = (album) => {
         .filter(Boolean);
 };
 
-/**
- * prescriptionList.pesticideFertilizerList → 含 params 三行执行方式
- */
-const mapFertilizerToPesticideItem = (f) => {
-    if (!f || typeof f !== "object") return null;
-    return {
-        code: f.pesticideFertilizerCode || f.code,
-        name: f.pesticideFertilizerName || f.defaultName || f.name || "",
-        typeName: f.typeName || "",
-        brand: f.brand || "",
-        unit: f.unit,
-        params: [
-            {
-                dosage:
-                    f.muUsage != null && f.muUsage !== ""
-                        ? String(f.muUsage)
-                        : "",
-                executionMethod: 1,
-                ratio:
-                    f.ratio != null && f.ratio !== "" ? String(f.ratio) : "",
-                remark: f.remark || "",
-            },
-            {
-                dosage:
-                    f.muUsage2 != null && f.muUsage2 !== ""
-                        ? String(f.muUsage2)
-                        : "",
-                executionMethod: 2,
-                ratio:
-                    f.ratio2 != null && f.ratio2 !== ""
-                        ? String(f.ratio2)
-                        : "",
-                remark: "",
-            },
-            { dosage: "", executionMethod: 3, ratio: "", remark: "" },
-        ],
-    };
-};
-
 
 const maybeShowUploadTips = () => {
     if (detail.value?.flowStatus !== 1) return;
@@ -265,14 +226,22 @@ onMounted(() => {
     maybeShowUploadTips();
 });
 
+const miniJson = ref(null);
 onActivated(() => {
+    if (route.query?.miniJson) {
+        const miniJsonObj = JSON.parse(route.query.miniJson);
+        miniJson.value = JSON.parse(miniJsonObj.paramsPage);
+    } else {
+        miniJson.value = null;
+    }
     getDetail();
 });
 
 const getDetail = () => {
-    const { farmWorkLibId, farmId, regionId } = route.query;
+    if (!miniJson.value) return;
+    const { farmWorkLibId, farmId, recordId } = miniJson.value;
     VE_API.z_farm_work_record
-        .getDetailById({ farmWorkLibId, farmId, regionId })
+        .getDetailById({ farmWorkLibId, farmId, farmWorkRecordId: recordId })
         .then(({ data }) => {
             const inner =
                 data?.detail && typeof data.detail === "object"
@@ -333,7 +302,6 @@ const triggerDateText = computed(() => {
  */
 const stageList = computed(() => {
     const d = detail.value;
-    console.log("d", d);
     if (!d) return [];
 
     if (Array.isArray(d.pesticideList) && d.pesticideList.length) {
@@ -377,7 +345,7 @@ const handleExecute = () => {
     // wx.miniProgram.navigateTo({
     //     url: `/pages/subPages/location_check/index?lng=113.264435&lat=23.129163`,
     // });
-    executePopupRef.value.openPopup(route.query.recordId);
+    executePopupRef.value.openPopup(miniJson.value.recordId);
 };
 
 
@@ -392,7 +360,7 @@ const toDraw = () => {
         path: "/draw_area",
         query: {
             subjectId: localStorage.getItem('selectedFarmId'),
-            varietyId: route.query.typeId,
+            varietyId: miniJson.value.typeId,
         },
     });
 }
@@ -402,11 +370,12 @@ const handleBack = () => {
 };
 
 const handleConvert = () => {
+    console.log('miniJson.value', miniJson.value);
     const query = {
         askInfo: { title: "农情互动", content: "是否分享该互动给好友" },
         shareText: '邀请您农情互动,精准匹配种植方案',
         targetUrl: `work_detail`,
-        paramsPage: JSON.stringify({ id: detail.value.id }),
+        paramsPage: JSON.stringify({...miniJson.value, hideDraw: true}),
         imageUrl: 'https://birdseye-img.sysuimars.com/birdseye-look-mini/work_img.png',
     };
     wx.miniProgram.navigateTo({
@@ -477,23 +446,23 @@ const changeExecutionMethod = (stageIndex, value) => {
 
     &.status-0 {
         &::after {
-            background: #FF4F4F;
+            background: #C7C7C7;
         }
     }
 
-    &.status-1 {
+    &.status-3 {
         &::after {
             background: #FF953D;
         }
     }
 
-    &.status-2 {
+    &.status--1 {
         &::after {
-            background: #C7C7C7;
+            background: #FF4F4F;
         }
     }
 
-    &.status-3 {
+    &.status-5 {
         padding-top: 30px;
 
         &::after {