Selaa lähdekoodia

feat:对接农事成效图片显示

wangsisi 2 päivää sitten
vanhempi
commit
0928536247

+ 8 - 56
src/components/album_compoents/albumCarousel.vue

@@ -1,71 +1,23 @@
 <template>
-    <album-carousel-item v-if="images" :farmId="farmId" :images="images" :lock="lock"></album-carousel-item>
+    <album-carousel-item v-if="images" :labelText="labelText" :images="images"></album-carousel-item>
 </template>
 
 <script setup>
-import { ref, computed, onMounted, onUnmounted, watch } from "vue";
+import { toRefs } from "vue";
 import "./cacheImg.js"
 import AlbumCarouselItem from "./albumCarouselItem";
-import {dateFormat} from "@/utils/date_util.js"
-import eventBus from "@/api/eventBus.js";
 
 const props =defineProps({
-  sampleId:{
-    type: [Number, String],
-    required: false
+  images:{
+    type: Array,
+    default: () => [],
   },
-  farmId:{
-    type: [Number, String],
-    required: true
-  },
-  blueGeoHash:{
+  labelText:{
     type: String,
-    required: false
-  },
-  farmWork:{
-    type: Object,
-    required: false
+    default: '',
   },
-  lock:{
-    type: Boolean,
-    default: true
-  }
 })
-const images = ref(null);
-onMounted(() => {
-  getList()
-});
-
-watch(()=>props.farmId,(newValue,oldValue) =>{
-  if(newValue){
-    getList()
-  }
-})
-
-const getList = () =>{
-  if(!props.farmId) return
-  let params = {farmId: props.farmId}
-  if(props.blueGeoHash){
-    params.blueZone = props.blueGeoHash
-  }
-  if(props.sampleId){
-    params.sampleId = props.sampleId
-  }
-  if(props.farmWork?.executeDate){
-    let execcuteDate = new Date(props.farmWork.executeDate)
-    let beforeExecuteDate = new Date(props.farmWork.beforeExecuteDate)
-    const pastDate = new Date(beforeExecuteDate);
-    const futureDate = new Date(execcuteDate);
-    params.startDate = dateFormat(pastDate, "YY-mm-dd");
-    params.endDate = dateFormat(futureDate, "YY-mm-dd");
-  }
-  // VE_API.image.list(params).then(res => {
-  // if(res.code === 0){
-  //     images.value = res.data
-  //     eventBus.emit('image:resultNum',res.data.length)
-  //   }
-  // })
-}
+const { images } = toRefs(props);
 
 </script>
 

+ 28 - 28
src/components/album_compoents/albumCarouselItem.vue

@@ -4,24 +4,16 @@
         <div class="carousel-wrapper" :style="carouselStyle">
             <photo-provider v-if="images" :photo-closable="true" @visibleChange="handleVisibleChange">
                 <template v-for="(photo, index) in images" :key="photo.id">
-                    <album-draw-box
-                        :isShowNum="isShowNum"
-                        :farmId="farmId"
-                        :photo="photo"
-                        :current="currentIndex"
+                    <div class="label-text">{{ labelText }}</div>
+                    <img
+                        class="carousel-img"
                         :index="index"
-                        :length="images.length"
-                    ></album-draw-box>
+                        :src="base_img_url2 + (photo.cloudFilename ? photo.cloudFilename : photo)"
+                        alt=""
+                    />
                 </template>
             </photo-provider>
         </div>
-        <div class="blur-bg" v-if="lock && currentIndex !== 0">
-            <div class="blur-content">
-                <div class="blur-img">
-                    <img src="@/assets/img/gallery/camera-icon.png" />
-                </div>
-            </div>
-        </div>
 
         <!-- 左右箭头 -->
         <div @click.stop="prev" v-if="currentIndex !== 0" class="arrow left-arrow">
@@ -34,29 +26,20 @@
 </template>
 
 <script setup>
-import eventBus from "@/api/eventBus";
 import { toRefs, ref, computed, onMounted, onUnmounted } from "vue";
-import AlbumDrawBox from "./albumDrawBox";
+import { base_img_url2 } from "@/api/config";
 import "./cacheImg.js";
 const props = defineProps({
     images: {
         type: Array,
         required: true,
     },
-    farmId: {
-        type: [Number, String],
-        required: true,
-    },
-    lock: {
-        type: Boolean,
-        default: true,
-    },
-    isShowNum: {
-        type: Boolean,
-        default: true,
+    labelText: {
+        type: String,
+        default: "",
     },
 });
-const { images } = toRefs(props);
+const { images, labelText } = toRefs(props);
 let timer = null;
 const currentIndex = ref(0);
 
@@ -133,6 +116,23 @@ const clearAndRestartTimer = () => {
         display: flex;
         transition: transform 0.5s ease;
         width: 100%;
+        .carousel-img {
+            width: 100%;
+            min-width: 312px;
+            height: 255px;
+            object-fit: cover;
+        }
+        .label-text {
+            position: absolute;
+            top: 0;
+            left: 0;
+            padding: 4px 10px;
+            background: rgba(54, 52, 52, 0.8);
+            color: #fff;
+            font-size: 12px;
+            border-radius: 8px 0 8px 0;
+            z-index: 1;
+        }
     }
     .blur-bg {
         position: absolute;

+ 2 - 2
src/components/weatherInfo.vue

@@ -207,7 +207,7 @@ const currentDateText = computed(() => {
                         color: #000000;
                         span {
                             width: fit-content;
-                            max-width: 100%;
+                            max-width: 95%;
                             margin-right: 4px;
                         }
 
@@ -310,7 +310,7 @@ const currentDateText = computed(() => {
     overflow-y: auto;
     &.el-dropdown__popper {
         .el-dropdown__list {
-            max-width: 160px;
+            max-width: 220px;
         }
         .el-dropdown-menu__item{
             background-color: transparent !important;

+ 3 - 3
src/views/old_mini/agri_services/components/farmDynamics.vue

@@ -93,6 +93,7 @@ const filterType = ref([{
 const activePlanIndex = ref(4);
 const handlePlanClick = (value) => {
     activePlanIndex.value = value;
+    getContentData()
 };
 
 onMounted(() => {
@@ -103,7 +104,7 @@ const contentData = ref([]);
 const getContentData = () => {
     VE_API.z_farm_work_record.getSimpleList({
         role: localStorage.getItem("SET_USER_CUR_ROLE"),
-        // status: activePlanIndex.value,
+        status: activePlanIndex.value,
     }).then((res) => {
         contentData.value = res.data;
     });
@@ -142,13 +143,12 @@ const hasUploadedPhotos = (section) => {
     background: #f5f7fb;
     .task-content {
         display: flex;
-        padding: 12px;
         height: calc(100% - 140px);
         .expert-content {
             width: 100%;
             height: 100%;
             overflow: auto;
-            padding-bottom: 10px;
+            padding: 10px;
             box-sizing: border-box;
             .content-section {
                 position: relative;

+ 24 - 158
src/views/old_mini/modify_work/reviewWork.vue

@@ -91,90 +91,15 @@
                             距离农事执行已 15 天,请抓紧时间上传照片!系统为您生成农事成效分析!
                         </div> -->
                     </div>
-                    <div class="recheck-box" v-if="workItem?.farmId">
+                    <div class="recheck-box">
                         <div class="recheck-ablum">
-                            <!-- <div class="img-list over-img-box">
-                                <album-carousel7d
-                                    :key="1"
-                                    :farmId="workItem.farmId"
-                                    :farmWork="{
-                                        beforeExecuteDate: workItem.beforeExecuteDate,
-                                        executeDate: workItem.executeDate,
-                                    }"
-                                ></album-carousel7d>
-                            </div> -->
-                            <div class="img-list">
-                                <div
-                                    class="recheck-text-wrap no-events"
-                                    :class="{
-                                        active: !diffInDays(workItem.reviewDate) > 0 && curRole === '0',
-                                        'yse-events': curRole === '0' && !diffInDays(workItem.reviewDate) > 0,
-                                        'center-wrap': !imageArr.length,
-                                    }"
-                                >
-                                    <div class="date" v-show="workItem.reviewDate">{{ workItem.reviewDate }}</div>
-                                    <upload
-                                        exampleImg
-                                        @handleUpload="handleUpload"
-                                        class="upload-wrap"
-                                        :style="{
-                                            height:
-                                                imageArr.length && !diffInDays(workItem.reviewDate) > 0
-                                                    ? 'auto'
-                                                    : '254px',
-                                        }"
-                                    >
-                                        <template
-                                            v-if="
-                                                diffInDays(workItem.reviewDate) == 0 ||
-                                                diffInDays(workItem.reviewDate) == null
-                                            "
-                                        >
-                                            <img
-                                                class="img-icon"
-                                                :src="
-                                                    require(`@/assets/img/gallery/img-icon${
-                                                        curRole === '0' ? '-act' : ''
-                                                    }.png`)
-                                                "
-                                                alt=""
-                                            />
-                                            <div class="recheck-text">
-                                                {{ curRole === "2" ? "等待农户上传" : "点击上传照片" }}
-                                            </div>
-                                            <div
-                                                class="recheck-desc"
-                                                v-show="curRole === '2' && diffInDays(workItem.reviewDate) != 0"
-                                            >
-                                                <!-- (已逾期{{ diffInDays(workItem.reviewDate, "add") }}天) -->
-                                            </div>
-                                        </template>
-                                        <template v-else>
-                                            <img class="img-icon" src="@/assets/img/gallery/img-icon.png" alt="" />
-                                            <div class="recheck-text">等待复核</div>
-                                            <div class="recheck-desc">
-                                                (剩余{{ diffInDays(workItem.reviewDate) }}天)
-                                            </div>
-                                        </template>
-                                    </upload>
-                                    <div
-                                        class="submit"
-                                        v-show="imageArr.length && !diffInDays(workItem.reviewDate) > 0"
-                                        @click="handleSubmit('reviewImage')"
-                                    >
-                                        确认上传
-                                    </div>
-                                </div>
+                            <div class="img-list over-img-box">
+                                <album-carousel :key="1" labelText="农事前" :images="triggerImg"></album-carousel>
                             </div>
-                            <div class="img-list over-img-box" v-if="workItem.reviewImage.length">
-                                <album-carousel
-                                    :key="2"
-                                    :farmId="workItem.farmId"
-                                    :lock="false"
-                                    :images="handleConversion(workItem.reviewImage)"
-                                ></album-carousel>
+                            <div class="img-list over-img-box" v-if="workItem.reviewImage && workItem.reviewImage.length">
+                                <album-carousel :key="2" labelText="农事后" :images="workItem.reviewImage"></album-carousel>
                             </div>
-                            <div class="img-list" v-if="!workItem.reviewImage2.length && workItem.activeStatus === 0">
+                            <div class="img-list" v-if="false">
                                 <div
                                     class="recheck-text-wrap no-events"
                                     :class="{
@@ -237,14 +162,6 @@
                                     </div>
                                 </div>
                             </div>
-                            <div class="img-list over-img-box" v-if="workItem.reviewImage2.length">
-                                <album-carousel
-                                    :key="2"
-                                    :farmId="workItem.farmId"
-                                    :lock="false"
-                                    :images="handleConversion(workItem.reviewImage2)"
-                                ></album-carousel>
-                            </div>
                         </div>
                     </div>
                 </div>
@@ -260,14 +177,6 @@
                     >
                         提醒农户拍照
                     </div>
-                    <div
-                        class="up-btn orange"
-                        @click="toUpload"
-                        :class="{ btn: workItem.reviewImage && workItem.reviewImage.length }"
-                        v-show="workItem.executeEvidence && !workItem.executeEvidence.length"
-                    >
-                        上传农事凭证
-                    </div>
                 </template>
                 <template v-else>
                     <div
@@ -288,10 +197,9 @@
 <script setup>
 import { Tab, Tabs } from "vant";
 import customHeader from "@/components/customHeader.vue";
-import { onMounted, ref, onDeactivated,onActivated } from "vue";
+import { onMounted, ref, onDeactivated, onActivated } from "vue";
 import { useRoute, useRouter } from "vue-router";
 import upload from "@/components/upload";
-import AlbumCarousel7d from "@/components/album_compoents/albumCarousel7d";
 import AlbumCarousel from "@/components/album_compoents/albumCarousel";
 import eventBus from "@/api/eventBus";
 import { ElMessage } from "element-plus";
@@ -299,50 +207,9 @@ import uploadPopup from "@/components/popup/uploadPopup.vue";
 import { deepClone } from "@/common/commonFun";
 const route = useRoute();
 
-const workItem = ref({
-    farmName: "测试农场",
-    farmWorkName: "测试农事",
-    executeDate:'2025-09-01',
-    farmWorkTypeName: "测试农事类型",
-    condition: "测试农事类型",
-    farmWorkType: "叶面施",
-    prescriptionList: [
-        {
-            defaultName: "营养",
-            pesticideFertilizerList: [
-                {
-                    defaultName: "尿素",
-                },
-            ],
-        },
-    ],
-    executeMain: "叶面施",
-    serviceMain: "广州泽秾丰农资有限公司",
-    expertName: "测试专家",
-    expertIcon: "https://birdseye-img.sysuimars.com/birdseye-look-mini/Group%201321316260.png",
-    cost: {
-        pesticideFertilizerCost: 1125,
-        farmWorkServiceCost: 35,
-    },
-    reviewImage: [],
-    reviewImage2: [],
-    reviewDate: "2025-09-01",
-    reviewDate2: "2025-09-01",
-    activeStatus: 0,
-    executeEvidence: [],
-    farmId: 1,
-    libId: 1,
-    uniqueId: 1,
-    isPlan: false,
-    curRole: "",
-    farmId: 766,
-    libId: 1,
-    uniqueId: null,
-});
+const workItem = ref({});
 const curRole = ref("");
 const farmId = ref(null);
-const libId = ref(null);
-const uniqueId = ref(null);
 // 农事规划页面-显示上传农事凭证按钮
 const isPlan = ref(false);
 const id = route.query.json ? JSON.parse(route.query.json).id : null;
@@ -360,15 +227,13 @@ const diffInDays = (date, type = "minus") => {
     return day + 1 >= 0 ? day + 1 : null;
 };
 
+const paramsPage = ref({});
 onMounted(() => {
     window.scrollTo(0, 0);
     curRole.value = localStorage.getItem("SET_USER_CUR_ROLE");
-    farmId.value = route.query.farmId;
-    libId.value = route.query.libId;
-    uniqueId.value = route.query.id;
-    isPlan.value = route.query.isPlan ? true : false;
-
-    getDetail(true);
+    paramsPage.value = route.query.json ? JSON.parse(route.query.json) : {};
+    farmId.value = paramsPage.value.farmId;
+    getDetail();
 
     eventBus.on("confirm:callback", confirmCallback);
 });
@@ -386,14 +251,19 @@ const handleConversion = (data) => {
 };
 
 const defaultWorkData = ref({});
-const getDetail = (isUpdate) => {
+const getDetail = () => {
     if (!id) return;
     VE_API.z_farm_work_record.getDetail({ id }).then(({ data }) => {
         workItem.value = data[0];
         defaultWorkData.value = deepClone(data[0]);
-        if (isUpdate) {
-            eventBus.emit("chart:updateOption", "");
-        }
+        getTriggerImg(workItem.value.id);
+    });
+};
+
+const triggerImg = ref([]);
+const getTriggerImg = (farmWorkRecordId) => {
+    VE_API.z_farm_work_record.getTriggerImg({ farmWorkRecordId }).then(({ data }) => {
+        triggerImg.value = data || [];
     });
 };
 
@@ -451,11 +321,6 @@ const handleUpload2 = ({ imgArr }) => {
 };
 
 const router = useRouter();
-
-// 上传照片
-function toUpload() {
-    eventBus.emit("uploadUopup:show", { isPlanVal: true });
-}
 </script>
 
 <style lang="scss" scoped>
@@ -756,9 +621,10 @@ function toUpload() {
                 font-size: 12px;
                 color: #666666;
                 line-height: 18px;
+                padding-bottom: 12px;
             }
-            .time-text{
-                color: #FF953D;
+            .time-text {
+                color: #ff953d;
                 padding: 4px 12px;
                 border-radius: 5px;
                 background: rgba(255, 149, 61, 0.1);

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

@@ -38,7 +38,7 @@
                 </template>
                 <empty
                     v-else
-                    image="https://fastly.jsdelivr.net/npm/@vant/assets/custom-empty-image.png"
+                    image="https://birdseye-img.sysuimars.com/birdseye-look-mini/custom-empty-image.png"
                     image-size="80"
                     description="暂无数据"
                 />