ソースを参照

Merge branch 'feature_20260115_直发类色卡销售发放时必须拍照' into release

# Conflicts:
#	src/views/historicalVisit/historicalDetails.vue
zhujindu 4 日 前
コミット
f95ab703b1

+ 217 - 0
src/components/uploadWLImg.vue

@@ -0,0 +1,217 @@
+<template>
+  <div class="questionNamep">
+    <div class="cameraDivp" @click="uploadImg">
+      <van-icon class="photo" name="photograph" size="22px" color="#969696" />
+    </div>
+    <div id="allmap"></div>
+  </div>
+</template>
+
+<script>
+import { addstorePhoto } from '@/api/index';
+import axios from 'axios';
+
+export default {
+  name: 'uploadImg',
+  props: {
+    shouws: {
+      type: Boolean,
+      default: false,
+    },
+    uploadid: {
+      type: String,
+      default: '',
+    },
+    storeGroupId: {
+      type: String,
+      default: '',
+    },
+    visitsId: {
+      type: String,
+      default: '',
+    },
+    taskId: {
+      type: String,
+      default: '',
+    },
+    collectionId: {
+      type: String,
+      default: '',
+    },
+    objectType: {
+      type: String,
+      default: 'rw-ycbf',
+    },
+    visitModel: {
+      type: String,
+      default: '3',
+    },
+  },
+  methods: {
+    uploadImg() {
+      let url = window.location.href;
+      let that = this;
+      let wx = this.wx;
+      let qiyeData;
+      let addressesRemark = '';
+      var map = new TMap.Map('allmap', {
+        zoom: 14,
+        center: new TMap.LatLng(39.986785, 116.301012),
+      });
+
+      var geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类
+      var markers = new TMap.MultiMarker({
+        map: map,
+        geometries: [],
+      });
+      markers.setGeometries([]);
+      const instance = axios.create();
+      instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
+      instance
+        .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
+          params: {
+            url: url,
+          },
+        })
+        .then((response) => {
+          if (response.status == 200) {
+            qiyeData = response.data.data;
+            wx.config({
+              beta: true, // 必须这么写,否则wx.invoke调用形式的jsapi会有问题
+              debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+              appId: qiyeData.appId, // 必填,企业微信的corpID
+              timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
+              nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
+              signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
+              jsApiList: ['ready', 'chooseImage', 'uploadImage', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
+            });
+            wx.ready(function () {
+              wx.getLocation({
+                type: 'gcj02',
+                success: function (res) {
+                  var location = new TMap.LatLng(res.latitude, res.longitude);
+                  map.setCenter(location);
+                  markers.updateGeometries([
+                    {
+                      id: 'main', // 点标注数据数组
+                      position: location,
+                    },
+                  ]);
+                  geocoder.getAddress({ location: location }).then(
+                    function (result) {
+                      var addresses = result.result.formatted_addresses;
+                      addressesRemark = addresses.recommend;
+                    },
+                    function (err) {
+                      addressesRemark = '';
+                    },
+                  );
+                },
+                fail: function () {
+                  that.$dialog.alert({
+                    message: 'GPS未开启',
+                  });
+                },
+              });
+              wx.chooseImage({
+                count: 1,
+                sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
+                sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
+                defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
+                isSaveToAlbum: 0,
+                success: function (res) {
+                  var localIds = '';
+                  if (res.localIds != undefined) {
+                    localIds = res.localIds[0];
+                  } else {
+                    localIds = res.localId;
+                  }
+                  // andriod中localId可以作为img标签的src属性显示图片;
+                  // iOS应当使用 getLocalImgData 获取图片base64数据,从而用于img标签的显示(在img标签内使用 wx.chooseImage 的 localid 显示可能会不成功)
+                  wx.uploadImage({
+                    localId: localIds, // 需要上传的图片的本地ID,由chooseImage接口获得
+                    isShowProgressTips: 1, // 默认为1,显示进度提示
+                    success: function (res) {
+                      that.uploadImagev(res.serverId, addressesRemark);
+                    },
+                  });
+                },
+              });
+            });
+          }
+        });
+    },
+    uploadImagev(meidaId, addressesRemark) {
+      var that = this;
+      var form = {
+        mediaIds: [meidaId],
+        collectionItemId: that.collectionId,
+        objectType: that.objectType,
+        storeGroupId: that.storeGroupId,
+        taskId: that.taskId,
+        visitsId: localStorage.getItem('visitId'),
+        visitModel: that.visitModel,
+        visitSource: '1',
+        locationRemark: addressesRemark,
+      };
+      var loind1 = that.$toast.loading({
+        duration: 0,
+        message: '上传中...',
+        forbidClick: true,
+      });
+      addstorePhoto(form).then((res) => {
+        if (res.code == 200) {
+          loind1.clear();
+          that.$toast('上传成功!');
+          that.$emit('uploadWLImgClick', {
+            fileUrl: res.data[0].url,
+            id: res.data[0].fileId,
+            type: 2,
+          });
+        } else {
+          that.$toast('上传失败!');
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.questionNamep {
+  font-size: 16px;
+  color: #484848;
+  line-height: 40px;
+  padding: 0 15px;
+  box-sizing: border-box;
+  position: relative;
+
+  .cameraDivp {
+    flex: 1;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+
+    .photo {
+      /*margin-top: 9px;*/
+      float: right;
+    }
+
+    .camera {
+      width: 60px;
+      height: 100%;
+      position: absolute;
+      right: 0;
+      top: 0;
+      opacity: 0;
+      z-index: 89;
+    }
+  }
+}
+#allmap {
+  width: 10px;
+  height: 10px;
+  left: -1000px;
+  position: relative;
+}
+</style>

ファイルの差分が大きいため隠しています
+ 6670 - 0
src/views/deviceWithin/addStoreVisit copy.vue


ファイルの差分が大きいため隠しています
+ 206 - 163
src/views/deviceWithin/addStoreVisit.vue


+ 2 - 2
src/views/historicalVisit/historicalDetails.vue

@@ -322,7 +322,7 @@ export default {
     formatter(value) {
       return value.replace(
         /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
-        ''
+        '',
       );
     },
     editorFn() {
@@ -475,7 +475,7 @@ export default {
       } else {
         this.$router.push({
           path: '/historiStoreVisit',
-          query: { visitId: this.visitsId, ids: index, taskType: val.taskType },
+          query: { visitId: this.visitsId, ids: index, taskType: val.taskType, taskId: val.taskId },
         });
       }
       sessionStorage.setItem('collectionItemList', JSON.stringify(val.collectionItemList));

+ 18 - 10
src/views/historicalVisit/hisvistdeils.vue

@@ -50,6 +50,9 @@
           </template>
         </el-table-column>
       </el-table>
+      <div class="wuliaoPhotoImg" style="padding-top: 10px; width: 94% !important; margin: 0 auto">
+        <deleteUploadImg :imgs="wuliaoPhotoImg"></deleteUploadImg>
+      </div>
     </div>
     <div
       class="container containert"
@@ -356,6 +359,8 @@ export default {
       equipmentCode: '',
       taskPhotoRecognitionResult: null,
       yfNumFlage: false,
+      wuliaoPhotoImg: [], //任务包含的图片信息(只针对于物料任务)
+      activatedSfaTask: null,
     };
   },
   activated() {
@@ -427,21 +432,23 @@ export default {
       getVisitsDetail({ visitsId: this.visitId }).then((res) => {
         this.toastLoading().clear();
         this.infoData = res.data;
-        this.taskPhotoRecognitionResult =
-          res.data.sfaTaskList[this.$route.query.ids].taskPhotoRecognitionResult;
-        var collectionItemLists = res.data.sfaTaskList[this.$route.query.ids].collectionItemList;
-        if (res.data.sfaTaskList[this.$route.query.ids].checkUnManage == 'Y') {
+        let filterSfaTask = res.data.sfaTaskList.filter((val) => val.taskId == this.taskId);
+        this.activatedSfaTask = filterSfaTask.length ? filterSfaTask[0] : null;
+        if (!this.activatedSfaTask) return false;
+        this.taskPhotoRecognitionResult = this.activatedSfaTask.taskPhotoRecognitionResult;
+        var collectionItemLists = this.activatedSfaTask.collectionItemList;
+        if (this.activatedSfaTask.checkUnManage == 'Y') {
           this.checkShow = true;
         } else {
           this.checkShow = false;
         }
         // this.deviceCode=res.data.deviceCode;
         // this.putInCode=res.data.putInCode;
-        this.deviceCode = res.data.sfaTaskList[this.$route.query.ids].deviceCode || ''; // 设备编号
-        this.putInCode = res.data.sfaTaskList[this.$route.query.ids].putInCode || ''; // 投放编号
-        this.equipmentCode = res.data.sfaTaskList[this.$route.query.ids].equipmentCode || ''; // 机资产编号
-        this.inspectionType = res.data.sfaTaskList[this.$route.query.ids].inspectionType;
-        // if (res.data.sfaTaskList[this.$route.query.ids].inspectionType == 'buy') {
+        this.deviceCode = this.activatedSfaTask.deviceCode || ''; // 设备编号
+        this.putInCode = this.activatedSfaTask.putInCode || ''; // 投放编号
+        this.equipmentCode = this.activatedSfaTask.equipmentCode || ''; // 机资产编号
+        this.inspectionType = this.activatedSfaTask.inspectionType;
+        // if (this.activatedSfaTask.inspectionType == 'buy') {
         //   this.showCode = true;
         // } else {
         //   this.showCode = false;
@@ -493,7 +500,7 @@ export default {
               for (var qq = 0; qq < collectionItemLists[q].collectionOptionList.length; qq++) {
                 if (collectionItemLists[q].collectionOptionList[qq].isCheck == 1) {
                   collectionItemLists[q].answerValue.push(
-                    collectionItemLists[q].collectionOptionList[qq].collectionOptionId
+                    collectionItemLists[q].collectionOptionList[qq].collectionOptionId,
                   );
                   collectionItemLists[q].collectionOptionList[qq].code =
                     collectionItemLists[q].collectionCode;
@@ -522,6 +529,7 @@ export default {
               }
             }
           }
+          this.wuliaoPhotoImg = this.activatedSfaTask.fileInfoList;
           this.tableData1 = collectionItemLists;
           let yfNumArr = this.tableData1.filter((val) => val.yfNum);
           this.yfNumFlage = yfNumArr.length ? true : false;