Sfoglia il codice sorgente

feat:修改互动回答数值校验

wangsisi 5 giorni fa
parent
commit
9cee321cad

+ 6 - 4
src/components/pageComponents/ArchivesFarmTimeLine.vue

@@ -767,10 +767,12 @@ const handleStatusDetail = (fw) => {
     //     path: props.pageType === 'agri_plan' ? "/agricultural_detail" : "/status_detail",
     //     query: { miniJson: JSON.stringify({ id: fw.id }) },
     // });
-    router.push({
-        path: "/status_detail",
-        query: { miniJson: JSON.stringify({ id: fw.id }) },
-    });
+    if(props.pageType === 'agri_record'){
+        router.push({
+            path: "/status_detail",
+            query: { miniJson: JSON.stringify({ id: fw.id }) },
+        });
+    }
 };
 
 // 格式化日期为 MM-DD 格式

+ 4 - 4
src/views/old_mini/interactionList/components/morePopup.vue

@@ -2,7 +2,7 @@
     <popup v-model:show="showMore" class="more-popup" round>
         <div class="more-content">
             <!-- 搜索框 -->
-            <div class="search-bar">
+            <!-- <div class="search-bar">
                 <el-icon class="search-icon">
                     <Search />
                 </el-icon>
@@ -12,7 +12,7 @@
                     type="text"
                     placeholder="请输入病虫害名称"
                 />
-            </div>
+            </div> -->
 
             <!-- 类型切换 -->
             <!-- <div class="type-tabs">
@@ -48,7 +48,7 @@
                     @click="showExample(filteredList, item, key)"
                 >
                     <div class="thumb-wrap">
-                        <img class="thumb" :src="item" :alt="key" />
+                        <img class="thumb" :src="item.image" :alt="item.name" />
                     </div>
                     <div class="card-name">{{ item.name || "病害" }}</div>
                 </div>
@@ -60,7 +60,7 @@
     <!-- 示例照片轮播组件 -->
     <example-popup
         v-model:show="showExamplePopup"
-        :images="exampleList"
+        :images="exampleList.map(item => item.image)"
         :start-index="exampleStartIndex"
         :title="exampleTitle"
     />

+ 1 - 1
src/views/old_mini/interactionList/drawRegion.vue

@@ -65,7 +65,7 @@ onActivated(() => {
     if (rangeWkt) {
         const regions = JSON.parse(rangeWkt)?.geometryArr.map(item => ({
             geometry: item,
-            status: "resolved",
+            status: "unresolved",
             updatedTime: route.query.updatedTime,
         }));
         drawRegionMap.setStatusRegions(regions);

+ 27 - 23
src/views/old_mini/interactionList/index.vue

@@ -28,7 +28,7 @@
                         <div class="example-header">
                             <div>示例照片</div>
                             <div class="more" v-if="item.exampleImagesJson.length > 3"
-                                @click="openMorePopup(item.exampleImagesJson)">查看更多</div>
+                                @click="openMorePopup(item.exampleImagesJson,item)">查看更多</div>
                         </div>
                         <div class="example-list" v-if="item.exampleImagesJson.length > 0">
                             <div class="image-item-wrapper" v-for="(example, exIndex) in item.exampleImagesJson"
@@ -146,7 +146,7 @@
     <drone-consult-popup v-model:show="showDroneConsultPopup" @copy="onCopyWechatId" />
 
     <!-- 示例照片轮播组件 -->
-    <example-popup v-model:show="showExamplePopup" :images="exampleList" :tips="exampleTips" :start-index="exampleStartIndex" :title="exampleTitle"
+    <example-popup v-model:show="showExamplePopup" :images="exampleList" :tips="currentPhotData?.shootingMethod" :start-index="exampleStartIndex" :title="currentPhotData?.exampleImageAnnotation"
         :show-title-and-tips="exampleShowTitleAndTips" />
     <!-- 照片上传进度 -->
 
@@ -318,7 +318,7 @@ const renderRegionFromItemWkt = (item) => {
             .filter(wkt => wkt && typeof wkt === 'string' && wkt.trim().length > 10)
             .map(wkt => ({
                 geometry: wkt.trim(),
-                status: 'resolved' // 接口返回的区域默认显示为未解决状态
+                status: 'unresolved' // 接口返回的区域默认显示为未解决状态
             }));
         if (regions.length > 0) {
             drawRegionMap.setStatusRegions(regions);
@@ -451,13 +451,11 @@ const showExamplePopup = ref(false);
 const exampleList = ref([]);
 const exampleStartIndex = ref(0);
 const exampleShowTitleAndTips = ref(true);
-const exampleTitle = ref('')
-const exampleTips = ref('')
+const currentPhotData = ref({})
 const showExample = (item, list, index, options = {}) => {
-    exampleTitle.value = item.exampleImageAnnotation;
+    currentPhotData.value = item;
     exampleList.value = list || [];
     exampleStartIndex.value = index || 0;
-    exampleTips.value = item.shootingMethod;
     exampleShowTitleAndTips.value = options.hideLabel !== true;
     showExamplePopup.value = true;
 };
@@ -527,13 +525,13 @@ const handleConfirm = async (item, isConfirm) => {
     if (isConfirm) {
         const list = item.questionList || [];
         const needFill = list.length || 1;
-        const hasEmpty = Array.from({ length: needFill }, (_, i) => i).some(
-            (i) => item.answerValues[i] === '' || item.answerValues[i] === null || item.answerValues[i] === undefined
-        );
-        if (hasEmpty) {
-            ElMessage.warning("请填写当前果园比例");
-            return;
-        }
+        // const hasEmpty = Array.from({ length: needFill }, (_, i) => i).some(
+        //     (i) => item.answerValues[i] === '' || item.answerValues[i] === null || item.answerValues[i] === undefined
+        // );
+        // if (hasEmpty) {
+        //     ElMessage.warning("请填写当前果园比例");
+        //     return;
+        // }
         if (item.imagePaths.length === 0 && uploadData.value.length === 0) {
             ElMessage.warning("请上传图片");
             return;
@@ -568,13 +566,13 @@ const handleConfirmUpload = async () => {
     }
     const item = currentItem.value;
     const len = item?.questionList?.length || 1;
-    const hasEmpty = Array.from({ length: len }, (_, i) => i).some(
-        (i) => item.answerValues[i] === '' || item.answerValues[i] === null || item.answerValues[i] === undefined
-    );
-    if (hasEmpty) {
-        ElMessage.warning("请填写占比数值");
-        return;
-    }
+    // const hasEmpty = Array.from({ length: len }, (_, i) => i).some(
+    //     (i) => item.answerValues[i] === '' || item.answerValues[i] === null || item.answerValues[i] === undefined
+    // );
+    // if (hasEmpty) {
+    //     ElMessage.warning("请填写占比数值");
+    //     return;
+    // }
     const answerVals = (item.answerValues || []).slice(0, len);
     const parmas = {
         interactionId: item.id,
@@ -639,8 +637,14 @@ const handleUploadSuccess = (data) => {
     uploadedSuccessCount.value = len;
 };
 
-const openMorePopup = (images) => {
-    morePopupRef.value.setItems(images);
+const openMorePopup = (images, item) => {
+    const data = images.map(image => {
+        return {
+            name: item.exampleImageAnnotation,
+            image: image
+        }
+    })
+    morePopupRef.value.setItems(data);
     morePopupRef.value.openPopup();
 }