ソースを参照

feature_20260330_拜访连拍速度优化

zhujindu 2 週間 前
コミット
2f2675c183

+ 22 - 42
src/components/deleteUploadImgTaskPhoto.vue

@@ -4,7 +4,6 @@
       <van-col span="6" style="" v-if="insert == '1'">
         <div class="addImg">
           <uploadVNormalTaskPhoto
-            :imgArr="imgs"
             :shouws="true"
             :storeGroupId="storeGroupId"
             :taskList="taskIds.split(',')"
@@ -20,35 +19,19 @@
             ref="uploadVNormal" />
         </div>
       </van-col>
-      <van-col span="6" v-for="(urls, index) in imgs" :key="urls.id">
+      <van-col span="6" v-for="(id, index) in imgArr" :key="index">
         <div class="imgview">
-          <van-icon
-            v-if="(photoIdentifyType != 6 || photoIdentifyType != 7) && insert == '1'"
-            name="close"
-            size="16"
-            v-on:click="deleteImg(index, urls.fileIdSplicing)" />
-          <img
-            v-if="urls.type == '2'"
-            :src="urls.fileUrl"
-            width="100px"
-            height="100px"
-            @click="previewsImg(index)" />
-          <img
+          <van-icon v-if="insert == '1'" name="close" size="16" v-on:click="deleteImg(index)" />
+          <img :src="id" width="100px" height="100px" @click="previewsImg(index)" />
+          <!-- <img
             v-else
             :src="urls.fileUrl"
             width="100px"
             height="100px"
-            @click="previewsImg(index)" />
+            @click="previewsImg(index)" /> -->
         </div>
       </van-col>
     </van-row>
-    <!--  <div style="padding: 10px 16px 0;">-->
-    <!--    <div class="img-box" v-for="(urls, index) in imgs" :key="index">-->
-    <!--      <van-icon name="clear" v-on:click="deleteImg(index,urls.id)"/>-->
-    <!--      <img v-if="urls.type=='2'" :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
-    <!--      <img v-else :src="urls.fileUrl" width="100px" height="100px" @click="previewsImg(index)"/>-->
-    <!--    </div>-->
-    <!--  </div>-->
   </div>
 </template>
 
@@ -112,7 +95,9 @@ export default {
   },
   watch: {
     imgs: {
-      handler(val) {},
+      handler(val) {
+        this.imgArr = val;
+      },
       deep: true,
       immediate: true,
     },
@@ -123,31 +108,26 @@ export default {
     };
   },
   methods: {
-    deleteImg(index, fileIdList) {
-      removePhotoBatch({ fileIdList: fileIdList.split(',') }).then((res) => {
-        if (res.code == 200) {
-          this.$toast('删除成功!');
-          this.$emit('upDataDetail');
-        } else {
-          this.$toast('删除失败!');
-        }
-      });
+    deleteImg(index) {
+      this.imgArr.splice(index, 1);
+      // removePhotoBatch({ fileIdList: fileIdList.split(',') }).then((res) => {
+      //   if (res.code == 200) {
+      //     this.$toast('删除成功!');
+      //     this.$emit('upDataDetail');
+      //   } else {
+      //     this.$toast('删除失败!');
+      //   }
+      // });
     },
     previewsImg(index) {
-      var arrimg = [];
-      for (var imgi = 0; imgi < this.imgs.length; imgi++) {
-        arrimg.push(this.imgs[imgi].fileUrl);
-      }
       ImagePreview({
-        images: arrimg,
+        images: this.imgArr,
         startPosition: index,
-        onClose() {
-          // do something
-        },
       });
     },
-    newimgarr() {
-      this.$emit('upDataDetail');
+    newimgarr(localIds) {
+      this.imgArr = localIds;
+      // this.$emit('upDataDetail');
     },
   },
 };

+ 1 - 0
src/components/uploadVNormalTaskPhoto.vue

@@ -220,6 +220,7 @@ export default {
                   let localIds = res.localIds;
                   that.localIdsArr = [];
                   console.log('localIds', localIds);
+                  this.$emit('newimgarr', localIds);
                   // that.syncUpload(localIds);
                 },
               });

+ 4 - 4
src/views/deviceWithin/taskPhotoTaking.vue

@@ -41,7 +41,7 @@
                   </taskTips>
                 </template>
               </van-cell>
-              <deleteUploadImg
+              <deleteUploadImgTaskPhoto
                 :imgs="item.fileInfoList"
                 :storeGroupId="storeGroupId"
                 :taskIds="taskIds"
@@ -53,7 +53,7 @@
                 :pictureSource="item.pictureSource"
                 :continuousShoot="item.continuousShoot"
                 :insert="insert"
-                :objectType="objectType"></deleteUploadImg>
+                :objectType="objectType"></deleteUploadImgTaskPhoto>
             </div>
           </div>
         </van-form>
@@ -125,10 +125,10 @@
 <script>
 import { getCollectionInfosBatch, addCollectionAnswerBatch, getVisitsDetail } from '@/api/index';
 import taskTips from './taskTips';
-import deleteUploadImg from '@/components/deleteUploadImgTaskPhoto';
+import deleteUploadImgTaskPhoto from '@/components/deleteUploadImgTaskPhoto';
 export default {
   name: 'abnortaskPhotoTakingmalVisit',
-  components: { taskTips, deleteUploadImg },
+  components: { taskTips, deleteUploadImgTaskPhoto },
   data() {
     return {
       isEdit: true,