lxf 3 дней назад
Родитель
Сommit
08524d1b3e

+ 7 - 3
src/components/popup/priceSheetPopup.vue

@@ -26,6 +26,10 @@
                             <span class="info-label">报价农事</span>
                             <span class="info-value">{{ quotationData?.farmWorkName || '--' }}</span>
                         </div>
+                        <div class="info-item">
+                            <span class="info-label">执行时间</span>
+                            <span class="info-value">{{ quotationData?.executeDate || '--' }}</span>
+                        </div>
                         <div class="info-item catalog-label">
                             <span class="info-label">报价目录</span>
                         </div>
@@ -213,7 +217,7 @@ const handleWechat = () => {
     //     path: "/completed_work",
     //     query: { id: quotationData.value.id, farmWorkOrderId: quotationData.value.orderId, isAssign: true },
     // });
-    const query = { id: quotationData.value.id, farmWorkOrderId: quotationData.value.orderId, isAssign: true }
+    const query = { shareText: "向您发送了一张 服务报价单", id: quotationData.value.id, farmWorkOrderId: quotationData.value.orderId, isAssign: true }
 
     wx.miniProgram.navigateTo({
         url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify(query)}&type=priceSheet`,
@@ -245,7 +249,7 @@ defineExpose({
 <style lang="scss" scoped>
 .price-sheet-popup {
     width: 90%;
-    max-height: 95vh;
+    max-height: 82vh;
     background: none;
     border-radius: 12px;
     overflow: hidden;
@@ -266,7 +270,7 @@ defineExpose({
 .price-sheet-content {
     display: flex;
     flex-direction: column;
-    max-height: 94vh;
+    max-height: 82vh;
     // height: 95vh;
     .price-sheet-content-inner {
         background: #fff;

+ 171 - 10
src/components/taskItem.vue

@@ -5,7 +5,7 @@
                 <div class="item-name">{{ itemData?.farmWorkName }}</div>
                 <div class="item-time">{{ itemData?.executeDate }}</div>
             </div>
-            <div class="top-r">{{ status === 0 ? "查看处方" : "查看详情" }}</div>
+            <div class="top-r" @click="toDetail(status, itemData.id)">{{ status === 0 ? "查看处方" : "查看详情" }}</div>
         </div>
         <div class="item-box" v-if="status === 0">
             <!-- <div class="title-wrap">
@@ -52,7 +52,7 @@
                         <div class="farm-info">
                             {{ itemData?.farmName }}
                             <div class="info-tag-wrap">
-                                <div class="tag-item second" v-if="itemData?.farmArea">{{ itemData?.farmArea }}亩</div>
+                                <div class="tag-item second" v-if="itemData?.farmArea">{{ formatArea(itemData?.farmArea) }}亩</div>
                                 <div class="tag-item primary">{{ itemData?.typeName }}</div>
                             </div>
                         </div>
@@ -68,7 +68,7 @@
                 <div class="desc-info">
                     <div class="desc-info-item">
                         <span>药物处方:</span>
-                        <span class="value">1000倍国光乙烯利</span>
+                        <span class="value">{{ prescriptionText }}</span>
                     </div>
                 </div>
                 <div class="desc-info two-text" v-if="!expiredDay">
@@ -85,12 +85,15 @@
                             alt=""
                         />
                     </div>
-                    <div class="review-image-item">
+                    <div class="review-image-item" v-if="detailItem?.executeEvidence?.length">
                         <div class="review-image-item-title">农事后</div>
-                        <img
-                            src="@/assets/img/monitor/aaa.png"
-                            alt=""
-                        />
+                        <photo-provider :photo-closable="true">
+                                <photo-consumer v-for="src in [detailItem.executeEvidence[detailItem.executeEvidence.length - 1]]" intro="执行照片" :key="src" :src="base_img_url2 + src">
+                                    <div class="img-item">
+                                        <img :src="base_img_url2 + src" class="view-box">
+                                    </div>
+                                </photo-consumer>
+                        </photo-provider>
                     </div>
                 </div>
 
@@ -112,13 +115,30 @@
             </div>
             
             <slot name="footer"></slot>
+
+            
+            <div class="item-footer" v-if="status === 1">
+                <div class="footer-l farm-name-text">
+                    来自<span class="name-text">{{ itemData.farmName || '未知农场' }}</span>
+                </div>
+                <div class="footer-r">
+                    <div class="btn warning" @click="shareResult">
+                        分享成果
+                    </div>
+                    <!-- <div class="btn secondary-text">
+                        提醒用户拍照
+                    </div> -->
+                </div>
+            </div>
         </div>
     </div>
 </template>
 
 <script setup>
-import { ref } from 'vue';
+import { onMounted, ref } from 'vue';
 import { useRouter } from "vue-router";
+import { base_img_url2 } from "@/api/config";
+import wx from 'weixin-js-sdk';
 
 const props = defineProps({
     status: {
@@ -141,6 +161,67 @@ const router = useRouter();
 const toPage = () => {
     router.push("/report_detail")
 }
+
+const shareResult = () => {
+    if (detailItem.value?.executeEvidence?.length) {
+        wx.miniProgram.navigateTo({
+            url: `/pages/subPages/share_page/index?pageParams=${JSON.stringify({ shareText: "向您分享了农事执行成果", id: detailItem.value.id })}&type=reviewWork`,
+        });
+    }
+}
+
+onMounted(async () => {
+    // 若已带处方列表,直接生成;否则在需要时拉取详情后生成
+    if (props.itemData && Array.isArray(props.itemData.prescriptionList)) {
+        prescriptionText.value = buildPrescriptionText(props.itemData.prescriptionList);
+    } else if (props.status === 1 && props.itemData?.id) {
+        await getItemDetail(props.itemData.id);
+        if (Array.isArray(detailItem.value?.prescriptionList)) {
+            prescriptionText.value = buildPrescriptionText(detailItem.value.prescriptionList);
+        }
+    }
+})
+
+const detailItem = ref({});
+const prescriptionText = ref('');
+function buildPrescriptionText(list) {
+    try {
+        return list
+            .map(group => (group.pesticideFertilizerList || [])
+                .map(p => p.defaultName || p.pesticideFertilizerName || '')
+                .filter(Boolean)
+                .join('+')
+            )
+            .filter(Boolean)
+            .join('+');
+    } catch {
+        return '';
+    }
+}
+async function getItemDetail(id) {
+    const { data } = await VE_API.z_farm_work_record.getDetail({ id });
+    detailItem.value = data[0];
+    console.log('dddd', detailItem.value)
+}
+
+// 保留方法名以兼容,但同步返回已生成的文案
+const getPrescriptionInfo = () => prescriptionText.value;
+
+function formatArea(val) {
+    const num = typeof val === 'number' ? val : parseFloat(val);
+    if (Number.isNaN(num)) return val;
+    return Number.isInteger(num) ? num : num.toFixed(2);
+}
+
+const toDetail = (status, id) => {
+    if (status === 1) {
+        // 复核成效
+        router.push({
+            path: "/review_work",
+            query: { json: JSON.stringify({ id }) }
+        });
+    }
+}
 </script>
 
 <style lang="scss" scoped>
@@ -203,7 +284,81 @@ const toPage = () => {
         border: 1px solid rgba(183, 183, 183, 0.1);
         padding: 10px 12px;
     }
-
+.item-footer {
+        margin-top: 10px;
+        padding-top: 11px;
+        border-top: 1px solid rgba(0, 0, 0, 0.1);
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        font-size: 12px;
+        .footer-l {
+            color: #8B8B8B;
+            font-size: 12px;
+            &.primary-btn {
+                display: inline-flex;
+                align-items: center;
+                border: 1px solid #2199F8;
+                background: rgba(33, 153, 248, 0.1);
+                padding: 0 12px;
+                height: 32px;
+                box-sizing: border-box;
+                display: flex;
+                align-items: center;
+                border-radius: 20px;
+                color: #2199F8;
+                .share-icon {
+                    width: 12px;
+                    padding-right: 4px;
+                }
+            }
+            &.farm-name-text {
+                font-size: 14px;
+                color: #6F7274;
+                .name-text {
+                    padding-left: 4px;
+                }
+            }
+        }
+        .footer-r {
+            display: flex;
+            align-items: center;
+            .btn {
+                height: 32px;
+                line-height: 32px;
+                padding: 0 12px;
+                border-radius: 20px;
+                display: flex;
+                align-items: center;
+                box-sizing: border-box;
+                &.second {
+                    // border: 1px solid #8B8B8B;
+                    // color: #8B8B8B;
+                    color: #2199F8;
+                    background: rgba(33, 153, 248, 0.1);
+                }
+                &.primary {
+                    background: #2199F8;
+                    color: #fff;
+                }
+                .btn-icon {
+                    padding-right: 4px;
+                }
+                &.warning {
+                    color: #FF953D;
+                    background: #fff;
+                    border: 1px solid #FF953D;
+                }
+                &.secondary-text {
+                    color: #2199F8;
+                    border: 1px solid #2199F8;
+                }
+            }
+            .btn + .btn {
+                margin-left: 8px;
+            }
+        }
+    }
     .farm-text {
         margin-bottom: 10px;
         background: rgba(183, 183, 183, 0.1);
@@ -367,6 +522,12 @@ const toPage = () => {
                     font-size: 12px;
                     color: #fff;
                 }
+                ::v-deep {
+                    .PhotoConsumer {
+                        width: 100%;
+                        height: 100%;
+                    }
+                }
             }
             img {
                 width: 100%;

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

@@ -100,7 +100,7 @@
                 </div>
             </div>
             <div class="work-wrap info-wrap">
-                <div class="box-wrap farm-photo farm-info" v-if="((curRole == 2 && currentStep == 2) || (curRole == 0 && detailData?.flowStatus === 4)) && detailData?.executeEvidence">
+                <div class="box-wrap farm-photo farm-info" v-if="(curRole == 2 && currentStep == 2 && detailData?.executeEvidence?.length) || (curRole == 0 && detailData?.flowStatus === 4 && detailData?.executeEvidence?.length)">
                     <div class="info-title">
                         <div class="card-title">执行照片</div>
                         <div class="info-more">
@@ -390,7 +390,7 @@ const handlePopupBtn = () => {
             router.replace({
                 path: "/review_work",
                 query: {
-                    id: query.id,
+                    json: JSON.stringify({ id: query.id })
                 },
             });
         }

+ 8 - 6
src/views/old_mini/modify_work/reviewWork.vue

@@ -103,7 +103,7 @@
                                     }"
                                 ></album-carousel7d>
                             </div> -->
-                            <div class="img-list" v-if="!workItem.reviewImage.length && workItem.activeStatus === 0">
+                            <div class="img-list">
                                 <div
                                     class="recheck-text-wrap no-events"
                                     :class="{
@@ -146,7 +146,7 @@
                                                 class="recheck-desc"
                                                 v-show="curRole === '2' && diffInDays(workItem.reviewDate) != 0"
                                             >
-                                                (已逾期{{ diffInDays(workItem.reviewDate, "add") }}天)
+                                                <!-- (已逾期{{ diffInDays(workItem.reviewDate, "add") }}天) -->
                                             </div>
                                         </template>
                                         <template v-else>
@@ -217,7 +217,7 @@
                                                 class="recheck-desc"
                                                 v-show="curRole === '2' && diffInDays(workItem.reviewDate2) != 0"
                                             >
-                                                (已逾期{{ diffInDays(workItem.reviewDate2, "add") }}天)
+                                                <!-- (已逾期{{ diffInDays(workItem.reviewDate2, "add") }}天) -->
                                             </div>
                                         </template>
                                         <template v-else>
@@ -345,6 +345,7 @@ const libId = ref(null);
 const uniqueId = ref(null);
 // 农事规划页面-显示上传农事凭证按钮
 const isPlan = ref(false);
+const id = route.query.json ? JSON.parse(route.query.json).id : null;
 
 const diffInDays = (date, type = "minus") => {
     const targetDate = new Date(date);
@@ -359,7 +360,7 @@ const diffInDays = (date, type = "minus") => {
     return day + 1 >= 0 ? day + 1 : null;
 };
 
-onActivated(() => {
+onMounted(() => {
     window.scrollTo(0, 0);
     curRole.value = localStorage.getItem("SET_USER_CUR_ROLE");
     farmId.value = route.query.farmId;
@@ -367,7 +368,7 @@ onActivated(() => {
     uniqueId.value = route.query.id;
     isPlan.value = route.query.isPlan ? true : false;
 
-    // getDetail(true);
+    getDetail(true);
 
     eventBus.on("confirm:callback", confirmCallback);
 });
@@ -386,7 +387,8 @@ const handleConversion = (data) => {
 
 const defaultWorkData = ref({});
 const getDetail = (isUpdate) => {
-    VE_API.farm.fetchFarmWorkList({ farmId: farmId.value, libId: libId.value, id: uniqueId.value }).then(({ data }) => {
+    if (!id) return;
+    VE_API.z_farm_work_record.getDetail({ id }).then(({ data }) => {
         workItem.value = data[0];
         defaultWorkData.value = deepClone(data[0]);
         if (isUpdate) {

+ 2 - 3
src/views/old_mini/monitor/subPages/plan copy.vue

@@ -584,7 +584,7 @@ const handleRowClick = (item) => {
         router.push({
             path: "/review_work",
             query: {
-                id: item.id,
+                json: JSON.stringify({ id: item.id })
             },
         });
     } else if (item.type !== "term" && item.status === "default") {
@@ -593,8 +593,7 @@ const handleRowClick = (item) => {
         router.push({
             path: "/completed_work",
             query: {
-                id: item.id,
-                status: item.status,
+                json: JSON.stringify({ id: item.id })
             },
         });
         // router.push({

+ 1 - 1
src/views/old_mini/monitor/subPages/plan.vue

@@ -199,7 +199,7 @@ const handleRowClick = (item) => {
         router.push({
             path: "/review_work",
             query: {
-                id: item.farmWorkRecordId,
+                json: JSON.stringify({ id: item.farmWorkRecordId }),
             },
         });
     } else if (item.flowStatus === null) {

+ 1 - 1
src/views/old_mini/monitor/subPages/reviewResults.vue

@@ -155,7 +155,7 @@ const handleClick = (section, index) => {
     router.push({
         path: "/review_work",
         query: {
-            id: section.id,
+            json: JSON.stringify({ id: section.id }),
         },
     });
 };

+ 4 - 4
src/views/old_mini/task_condition/components/calendar.vue

@@ -2,17 +2,17 @@
     <div class="calendar">
         <div class="header-wrap">
             <div class="header-l">
-                <div class="top-l" v-if="expiredCounts">
+                <div class="top-l">
                     <el-icon class="icon icon-l" color="#999999" size="11" @click="prevPeriod"><ArrowLeftBold /></el-icon>
-                    <span class="top-tag red">{{ expiredCounts }}过期</span>
+                    <!-- <span class="top-tag red" v-if="expiredCounts">{{ expiredCounts }}过期</span> -->
                 </div>
                 <div class="top-c">
                     <span class="header-text">
                         {{ dateRange.start }} <span class="center-line">-</span> {{ dateRange.end }}
                     </span>
                 </div>
-                <div class="top-r" v-if="completedCounts">
-                    <span class="top-tag orange">{{ completedCounts }}待完成</span>
+                <div class="top-r">
+                    <span class="top-tag orange" v-if="completedCounts">{{ completedCounts }}待完成</span>
                     <el-icon class="icon icon-r" color="#999999" size="11" @click="nextPeriod"><ArrowRightBold /></el-icon>
                 </div>
 

+ 2 - 15
src/views/old_mini/task_condition/components/task.vue

@@ -64,19 +64,6 @@
                                     </div>
                                 </div>
                             </div>
-                            <div class="item-footer" v-else>
-                                <div class="footer-l farm-name-text">
-                                    来自<span class="name-text">{{ item.farmName || '未知农场' }}</span>
-                                </div>
-                                <div class="footer-r">
-                                    <!-- <div class="btn warning">
-                                        分享成果
-                                    </div> -->
-                                    <div class="btn secondary-text">
-                                        提醒用户拍照
-                                    </div>
-                                </div>
-                            </div>
                         </template>
                     </task-item>
                 </div>
@@ -172,7 +159,7 @@ function getTaskCount(flowStatus, index) {
             taskCounts.value[index] = data.length;
             calendarRef.value && calendarRef.value.setCounts(index, taskCounts.value[index])
             
-            if (index === 1) {
+            if (index === 2) {
                 calendarRef.value && calendarRef.value.setSolarTerm(data)
                 indexMap.initData(data)
             }
@@ -233,8 +220,8 @@ function getSimpleList() {
             }
         } else {
             taskList.value = [];
+            taskCounts.value[activeIndex.value] = 0;
             if (activeIndex.value === 2) {
-                taskCounts.value[activeIndex.value] = 0;
                 indexMap.initData(taskList.value)
                 calendarRef.value && calendarRef.value.setSolarTerm(taskList.value)
             }