wujianwei
2025-12-29 371d568cc984422607bbcfd699c1716f5df6a898
ui/car_wx_app/pages/examine/index.vue
@@ -352,6 +352,8 @@
</template>
<script>
import {uploadImage} from "@/common/upload";
function groupBy(array, key){
  return array.reduce((acc, item) => {
    const groupKey = String(item[key]);
@@ -430,7 +432,7 @@
      },
      mapList: {},
      activeActive: {},
      isHk:false,
    };
  },
@@ -445,6 +447,7 @@
    this.amapPlugin = new amap.AMapWX({
      key: this.mapApiKey
    });
    // 获取 URL 参数
    if (options.id) {
      //this.getList();
@@ -453,6 +456,8 @@
      this.form.tripTime = this.getCurrentDateTime();
    }
    this.getLocation();
  },
  created() {
    // this.getList();
@@ -669,7 +674,14 @@
      this.amapPlugin.getRegeo({
        location:`${longitude},${latitude}`,
        success: (data) => {
          this.form.address  = data[0].name;
          let datum = data[0];
          if (datum.regeocodeData){
            if (datum.regeocodeData.addressComponent){
              let province = datum.regeocodeData.addressComponent.province;
              this.isHk = province.indexOf("香港") != -1;
            }
          }
          this.form.address  = datum.name;
        },
        fail: (err) => {
          console.error("SDK调用失败:", err);
@@ -788,26 +800,31 @@
    // 新增图片
    async afterRead(event) {
      // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
      let lists = [].concat(event.file)
      let fileListLen = this.fileList.length
      lists.map((item) => {
        this.fileList.push({
          ...item,
          status: 'success',
          message: '上传中'
        })
      uploadImage(event.file[0].url,this.isHk).then(res=>{
        console.log(res)
        this.fileList.push(res);
      })
      for (let i = 0; i < lists.length; i++) {
        const result = await this.uploadFilePromise(lists[i].url)
        let item = this.fileList[fileListLen]
        this.fileList.splice(fileListLen, 1, Object.assign(item, {
          status: result.status,
          message: result.status == 'success' ? '上传成功' : '上传失败',
          urls: result.url
        }))
        fileListLen++
      }
      // let lists = [].concat(event.file)
      // let fileListLen = this.fileList.length
      // lists.map((item) => {
      //   this.fileList.push({
      //     ...item,
      //     status: 'success',
      //     message: '上传中'
      //   })
      // })
      // for (let i = 0; i < lists.length; i++) {
      //
      //   const result = await this.uploadFilePromise(lists[i].url)
      //   let item = this.fileList[fileListLen]
      //   this.fileList.splice(fileListLen, 1, Object.assign(item, {
      //     status: result.status,
      //     message: result.status == 'success' ? '上传成功' : '上传失败',
      //     urls: result.url
      //   }))
      //   fileListLen++
      // }
    },
    uploadFilePromise(url) {
@@ -893,10 +910,15 @@
        sizeType: ['original', 'compressed'],
        sourceType: ['album', 'camera'],
        success: (res) => {
          const tempFilePaths = res.tempFilePaths;
          const imgUrl = tempFilePaths[0];
          uploadImage(imgUrl,this.isHk).then(res2=>{
            this.uploadAreas[index].imageUrl = res2.url;
            // const tempFilePath = res.tempFilePaths[0];
            // // 上传图片到服务器
            // this.uploadAreaPic(tempFilePath, index);
          })
          const tempFilePath = res.tempFilePaths[0];
          // 上传图片到服务器
          this.uploadAreaPic(tempFilePath, index);
        }
      });
    },
@@ -1020,7 +1042,7 @@
        this.$refs.uForm.validate().then(res => {
          if (res) {
            var urls = this.fileList.map(item => item.urls).join(',');
            var urls = this.fileList.map(item => item.url).join(',');
            this.form.feeVoucherUrl = urls
            this.form.dispatchOrderId = this.newForm.dispatchId
            this.form.driverId = this.newForm.driverId