Browse Source

Merge branch 'feature_20260330_拜访连拍速度优化' into master-20260422

# Conflicts:
#	src/views/deviceOutside/suishenbangOutstoreVisit.vue
#	src/views/deviceWithin/storeVisit.vue
zhujindu 1 day ago
parent
commit
9523b50afa

+ 9 - 0
src/api/index.js

@@ -1160,3 +1160,12 @@ export function getVisitsDetailPerfectStore(query) {
     params: query,
   });
 }
+
+// 获取陈列奖励案入库标识接口
+export function getCljlaToDBLabel(query) {
+  return request({
+    url: 'mobile/storeGroup/getCljlaToDBLabel',
+    method: 'get',
+    params: query,
+  });
+}

+ 23 - 45
src/components/deleteUploadImgTaskPhoto.vue

@@ -224,55 +224,33 @@ export default {
             };
           }),
         );
-        this.$nextTick(() => {
-          this.syncUpload(localIds, startIndex);
-        });
+        // this.$nextTick(() => {
+        //   this.syncUpload(localIds, startIndex);
+        // });
       } else {
         this.$emit('upDataDetail');
       }
-      // if (this.isIOS()) {
-      //   this.imgArr = this.imgArr.concat([...localIds]);
-      //   // 解决ios微信localId无法直接使用的问题,获取base64后再上传
-      //   // this.setIosImg(localIds);
-      // } else {
-      //   this.imgArr = this.imgArr.concat([...localIds]);
-      // }
-      // this.$emit('upDataDetail');
-    },
-    syncUpload(localIds, baseIndex = 0, callback) {
-      if (!localIds.length) {
-        this.isUploadImg = true;
-        callback && callback();
-        return;
-      } else {
-        var localId = localIds.pop();
-        wx.uploadImage({
-          localId: localId,
-          isShowProgressTips: 0, // 默认为1,显示进度提示
-          success: (res) => {
-            const index = baseIndex + localIds.length;
-            if (this.imgArr[index]) {
-              this.imgArr[index].mediaId = res.serverId;
-            }
-            this.syncUpload(localIds, baseIndex, callback);
-          },
-        });
-      }
-    },
-    isIOS() {
-      return /iPhone|iPad|iPod/i.test(navigator.userAgent);
-    },
-    setIosImg(localIds) {
-      localIds.forEach((localId) => {
-        this.wx.getLocalImgData({
-          localId: localId, // 图片的localID
-          success: (res) => {
-            console.log(res.localData);
-            // this.imgArr.push(res.localData);
-          },
-        });
-      });
     },
+    // syncUpload(localIds, baseIndex = 0, callback) {
+    //   if (!localIds.length) {
+    //     this.isUploadImg = true;
+    //     callback && callback();
+    //     return;
+    //   } else {
+    //     var localId = localIds.pop();
+    //     wx.uploadImage({
+    //       localId: localId,
+    //       isShowProgressTips: 0, // 默认为1,显示进度提示
+    //       success: (res) => {
+    //         const index = baseIndex + localIds.length;
+    //         if (this.imgArr[index]) {
+    //           this.imgArr[index].mediaId = res.serverId;
+    //         }
+    //         this.syncUpload(localIds, baseIndex, callback);
+    //       },
+    //     });
+    //   }
+    // },
   },
 };
 </script>

+ 7 - 1
src/components/uploadVNormalTaskPhoto.vue

@@ -89,6 +89,12 @@ export default {
       type: [String, Number],
       default: '',
     },
+    formData: {
+      type: Object,
+      default() {
+        return {};
+      },
+    },
   },
   computed: {
     ...mapState({
@@ -207,7 +213,7 @@ export default {
               let count = 1;
               // 1:店招内容识别(不能连拍和多选),3:调色机识别(不能连拍和多选) 需要实时识别的不支持连拍和多选
               if (that.photoIdentifyType != 1 && that.photoIdentifyType != 3) {
-                count = that.continuousShoot == '1' ? 5 : 1; //是否允许连拍/相册多选 最多5张
+                count = that.continuousShoot == '1' ? 20 : 1; //是否允许连拍/相册多选 最多5张
               }
               wx.chooseImage({
                 count: count,

+ 18 - 11
src/views/deviceOutside/suishenbangOutstoreVisit.vue

@@ -160,6 +160,7 @@ import {
   buryingPoint,
   getMaterialHistory,
   getVisitTasks,
+  getCljlaToDBLabel,
 } from '@/api/index';
 import axios from 'axios';
 import { saveVisitsParams, getOrderUrlByStoreId } from '@/api/inventory';
@@ -629,17 +630,23 @@ export default {
       localStorage.setItem('getRequestFlage', 'false');
       console.log(this.visitId);
       if (val.taskType == '5') {
-        this.$router.push({
-          path: '/taskPhotoTaking',
-          query: {
-            storeCode: this.urlParameter.storeCode,
-            visitsId: this.visitId,
-            taskIds: val.taskIds.join(','),
-            storeGroupId: this.storeGroupId,
-            photoType: val.photoType,
-            insert: true,
-            storeId: this.storeId,
-          },
+        getCljlaToDBLabel({ visitsId: this.visitId }).then((res) => {
+          if (res.code == 200) {
+            this.$router.push({
+              path: '/taskPhotoTaking',
+              query: {
+                storeCode: this.urlParameter.storeCode,
+                visitsId: this.visitId,
+                taskIds: val.taskIds.join(','),
+                storeGroupId: this.storeGroupId,
+                photoType: val.photoType,
+                insert: true,
+                storeId: this.storeId,
+              },
+            });
+          } else {
+            this.$toast(res.msg);
+          }
         });
       } else {
         this.$router.push({

+ 18 - 11
src/views/deviceWithin/storeVisit.vue

@@ -174,6 +174,7 @@ import {
   buryingPoint,
   getMaterialHistory,
   getVisitTasks,
+  getCljlaToDBLabel,
 } from '@/api/index';
 import axios from 'axios';
 import sp from './../../assets/sp.png';
@@ -790,17 +791,23 @@ export default {
         }, 2000);
         localStorage.setItem('getRequestFlage', 'false');
         if (val.taskType == '5') {
-          this.$router.push({
-            path: '/taskPhotoTaking',
-            query: {
-              storeCode: this.urlParameter.storeCode,
-              visitsId: this.visitId,
-              taskIds: val.taskIds.join(','),
-              storeGroupId: this.storeGroupId,
-              photoType: val.photoType,
-              insert: this.insert,
-              storeId: this.storeId,
-            },
+          getCljlaToDBLabel({ visitsId: this.visitId }).then((res) => {
+            if (res.code == 200) {
+              this.$router.push({
+                path: '/taskPhotoTaking',
+                query: {
+                  storeCode: this.urlParameter.storeCode,
+                  visitsId: this.visitId,
+                  taskIds: val.taskIds.join(','),
+                  storeGroupId: this.storeGroupId,
+                  photoType: val.photoType,
+                  insert: true,
+                  storeId: this.storeId,
+                },
+              });
+            } else {
+              this.$toast(res.msg);
+            }
           });
         } else {
           this.$router.push({

+ 57 - 45
src/views/deviceWithin/taskPhotoTaking.vue

@@ -153,6 +153,7 @@ export default {
       spanArr: [],
       pos: 0,
       mediaIds: [],
+      mediaInfos: [],
     };
   },
   activated() {
@@ -161,6 +162,8 @@ export default {
     this.storeGroupId = this.$route.query.storeGroupId || '';
     this.objectType = this.$route.query.photoType || '';
     this.insert = this.$route.query.insert;
+    // 授权
+    // getTicketFun(['uploadImage']).then(() => {});
     if (this.$route.query.source == 'historicalDetails') {
       this.getVisitsDetailFun();
     } else {
@@ -243,53 +246,62 @@ export default {
         this.taskPhotoRecognitionResult = item.taskPhotoRecognitionResult;
       });
     },
-    waitUploadReady(interval = 1000) {
-      return new Promise((resolve) => {
-        const intervalId = setInterval(() => {
-          const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
-          if (taskPhoto && taskPhoto.isUploadImg) {
-            clearInterval(intervalId);
-            resolve();
-          }
-        }, interval);
-      });
-    },
-    async onSubmit() {
+    onSubmit() {
       this.toastLoading(0, '提交中,请稍候...', true);
-      try {
-        const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
-        if (taskPhoto && !taskPhoto.isUploadImg) {
-          await this.waitUploadReady(1000);
-        }
-
-        let formData = {
-          storeId: this.$route.query.storeId,
-          storeCode: this.$route.query.storeCode,
-          storeGroupId: this.$route.query.storeGroupId,
-          visitsId: this.visitsId,
-          taskList: this.taskIds.split(',').map((val) => Number(val)),
-          insert: true,
-          collectionAnswers: [],
-          checkUnManage: 'N',
-          deviceCode: '',
-          putInCode: '',
-          equipmentCode: '',
-          collectionItemId: taskPhoto ? taskPhoto.collectionItemId : '',
-          objectType: this.$route.query.photoType,
-          locationRemark: taskPhoto ? taskPhoto.locationRemark : '',
-          mediaInfos: [],
-          isH5: this.userInfo.photoMethod == '1',
-        };
-        if (this.userInfo.photoMethod == '1') {
-          formData.mediaInfos = [];
-        } else if (taskPhoto) {
-          formData.mediaInfos = taskPhoto.imgArr;
+      const taskPhoto = this.$refs.taskPhoto && this.$refs.taskPhoto[0];
+      let formData = {
+        storeId: this.$route.query.storeId,
+        storeCode: this.$route.query.storeCode,
+        storeGroupId: this.$route.query.storeGroupId,
+        visitsId: this.visitsId,
+        taskList: this.taskIds.split(',').map((val) => Number(val)),
+        insert: true,
+        collectionAnswers: [],
+        checkUnManage: 'N',
+        deviceCode: '',
+        putInCode: '',
+        equipmentCode: '',
+        collectionItemId: taskPhoto ? taskPhoto.collectionItemId : '',
+        objectType: this.$route.query.photoType,
+        locationRemark: taskPhoto ? taskPhoto.locationRemark : '',
+        mediaInfos: [],
+        isH5: this.userInfo.photoMethod == '1',
+      };
+      if (this.userInfo.photoMethod == '1') {
+        formData.mediaInfos = [];
+        this.addCollection(formData);
+      } else {
+        this.mediaInfos = [];
+        let imgArr = JSON.parse(JSON.stringify(taskPhoto.imgArr));
+        this.syncUpload(imgArr, () => {
+          this.toastLoading().clear();
+          formData.mediaInfos = this.mediaInfos;
+          this.addCollection(formData);
+        });
+      }
+    },
+    syncUpload(imgArr, callback) {
+      if (!imgArr.length) {
+        callback && callback();
+        return;
+      } else {
+        var item = imgArr.pop();
+        if (!item.mediaId) {
+          wx.uploadImage({
+            localId: item.mediaFileUrl,
+            isShowProgressTips: 0, // 默认为1,显示进度提示
+            success: (res) => {
+              this.mediaInfos.push({
+                mediaId: res.serverId,
+                mediaFileUrl: item.mediaFileUrl,
+              });
+              this.syncUpload(imgArr, callback);
+            },
+          });
+        } else {
+          this.mediaInfos.push(item);
+          this.syncUpload(imgArr, callback);
         }
-        await this.addCollection(formData);
-      } catch (err) {
-        this.$toast(err.message || '提交失败,请稍后再试');
-      } finally {
-        this.toastLoading().clear();
       }
     },
     addCollection(formData) {