Procházet zdrojové kódy

feat:对接上传复核照片功能

wangsisi před 2 dny
rodič
revize
c5d759c370

+ 5 - 0
src/api/modules/monitor.js

@@ -23,4 +23,9 @@ module.exports = {
         url: config.base_dev_url + "container_farm_work_arrange/triggerFarmWorkByArrangeId",
         type: "post",
     },
+    //添加复核照片
+    addReviewImg: {
+        url: config.base_dev_url + "z_farm_work_record/addReviewImg",
+        type: "post",
+    },
 }

+ 1 - 1
src/components/chatWindow.vue

@@ -330,7 +330,7 @@ watch(
                         const imgArr = JSON.parse(params.executeEvidence);
                         message.coverUrl = imgArr[imgArr.length - 1];
                     }
-                    if(params.imageList.length) {
+                    if(params.imageList && params.imageList.length) {
                         message.coverUrl = params.imageList[params.imageList.length - 1].cloudFilename;
                     }
                     

+ 6 - 10
src/components/recordItem.vue

@@ -33,18 +33,14 @@
                     </div>
                 </div>
                 <div class="review-image">
-                    <!-- <div class="image-wrapper" v-if="recordItemData.beforeImage">
-                        <span class="image-label">农事前</span>
-                        <img :src="recordItemData.beforeImage" alt="" />
-                    </div> -->
-                    <div class="image-wrapper">
+                    <div class="image-wrapper" v-if="currentImageUrl">
                         <span class="image-label">农事前</span>
                         <img :src="currentImageUrl" alt="" />
                     </div>
-                    <!-- <div class="image-wrapper" v-if="recordItemData.afterImage">
+                    <div class="image-wrapper" v-if="recordItemData.reviewImage.length">
                         <span class="image-label">农事后</span>
-                        <img :src="recordItemData.afterImage" alt="" />
-                    </div> -->
+                        <img :src="base_img_url2 + recordItemData.reviewImage[recordItemData.reviewImage.length - 1]" alt="" />
+                    </div>
                 </div>
             </div>
         </div>
@@ -421,8 +417,8 @@ watch(() => props.recordItemData?.id, (newId) => {
                     }
                     .image-label {
                         position: absolute;
-                        top: 4px;
-                        left: 4px;
+                        top: 0;
+                        left: 0;
                         padding: 4px 10px;
                         background: rgba(54, 52, 52, 0.6);
                         color: #fff;

+ 39 - 17
src/views/old_mini/monitor/subPages/reviewResults.vue

@@ -17,7 +17,7 @@
                             @click="handleClick(section, index)"
                         >
                             <template #footer>
-                                <div class="action-group" v-if="index === 0 || index === 2">
+                                <div class="action-group" v-if="!section.reviewImage.length">
                                     <div class="action-l">查看详情</div>
                                     <div class="action-r">
                                         <div
@@ -27,7 +27,7 @@
                                         >
                                             {{ section.hasApplied ? "已发起需求" : "发起需求" }}
                                         </div>
-                                        <div class="action-item primary-item" @click.stop="handleUploadPhoto">
+                                        <div class="action-item primary-item" @click.stop="handleUploadPhoto(section)">
                                             上传照片
                                         </div>
                                     </div>
@@ -55,9 +55,11 @@
     <!-- 上传照片弹窗 -->
     <popup v-model:show="showUpload" closeable :close-on-click-overlay="false" class="upload-popup">
         <div class="upload-content">
-            <div class="upload-title">上传照片</div>
-            <div class="upload-tips"><span class="required">*</span>请上传执行照片</div>
-            <upload :textShow="true"> </upload>
+            <div class="upload-tips"><span class="required">*</span>请上传复核照片</div>
+            <upload exampleImg class="upload-wrap" @handleUpload="handleUpload">
+                <img class="example" src="@/assets/img/home/example-4.png" alt="" />
+                <img class="example" src="@/assets/img/home/plus.png" alt="" />
+            </upload>
             <div class="upload-footer">
                 <div class="btn" @click="handleUploadConfirm">确认上传</div>
             </div>
@@ -72,21 +74,37 @@ import customHeader from "@/components/customHeader.vue";
 import { useRouter, useRoute } from "vue-router";
 import upload from "@/components/upload";
 import { Empty } from "vant";
+import { ElMessage } from "element-plus";
 
 const showApplyPopup = ref(false);
 const showUpload = ref(false);
 const router = useRouter();
 const route = useRoute();
+const sectionId = ref(null);
 // 上传照片处理函数
-const handleUploadPhoto = () => {
+const handleUploadPhoto = ({id}) => {
     showUpload.value = true;
+    sectionId.value = id;
 };
 
+const images = ref([]);
+function handleUpload({imgArr}) {
+    images.value = imgArr;
+}
+
 // 确认上传处理函数
 const handleUploadConfirm = () => {
-    // 这里可以添加上传逻辑
-    console.log("确认上传");
-    showUpload.value = false;
+    const params = {
+        recordId: sectionId.value,
+        executeEvidence: images.value,
+    };
+    VE_API.monitor.addReviewImg(params).then((res) => {
+        if (res.code === 0) {
+            ElMessage.success('上传成功');
+            showUpload.value = false;
+            getContentData();
+        }
+    });
 };
 
 const handleApply = (section, index) => {
@@ -259,22 +277,26 @@ const handleClick = (section, index) => {
     border-radius: 10px;
 
     .upload-content {
-        .upload-title {
-            font-size: 18px;
-            font-weight: 500;
-            text-align: center;
-            margin-bottom: 12px;
-        }
-        .upload-tips{
+        .upload-tips {
             font-size: 16px;
             font-weight: 500;
             color: #000;
             margin-bottom: 8px;
-            .required{
+            .required {
                 color: #ff4d4f;
                 margin-right: 4px;
             }
         }
+        .upload-wrap {
+            margin: 12px 0 24px;
+            .example {
+                width: 80px;
+                height: 80px;
+            }
+            .example + .example {
+                margin-left: 12px;
+            }
+        }
         .upload-footer {
             margin-top: 20px;
             display: flex;

+ 7 - 7
src/views/old_mini/task_condition/components/uploadExecute.vue

@@ -159,13 +159,13 @@ defineExpose({
     }
     .upload-wrap {
         margin: 12px 0 24px;
-    }
-    .example {
-        width: 80px;
-        height: 80px;
-    }
-    .example + .example {
-        margin-left: 12px;
+        .example {
+            width: 80px;
+            height: 80px;
+        }
+        .example + .example {
+            margin-left: 12px;
+        }
     }
 }