bug修复
This commit is contained in:
		
							parent
							
								
									98c5c238f2
								
							
						
					
					
						commit
						7e2502e6cd
					
				| 
						 | 
				
			
			@ -209,7 +209,7 @@ onLoad((options) => {
 | 
			
		|||
    getUnit()
 | 
			
		||||
    getProject()
 | 
			
		||||
    // formData.value = JSON.parse(options.item)
 | 
			
		||||
    backPerson.value = memberStore.userInfo.nickName
 | 
			
		||||
    // backPerson.value = memberStore.userInfo.nickName
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,14 +9,14 @@
 | 
			
		|||
      @clickLeft="leftClick"
 | 
			
		||||
  >
 | 
			
		||||
    <!-- 使用右侧插槽自定义提交按钮 -->
 | 
			
		||||
    <template #right>
 | 
			
		||||
    <!-- <template #right>
 | 
			
		||||
      <button
 | 
			
		||||
          class="submit-btn"
 | 
			
		||||
          @click="submitCode"
 | 
			
		||||
      >
 | 
			
		||||
        确定
 | 
			
		||||
      </button>
 | 
			
		||||
    </template>
 | 
			
		||||
    </template> -->
 | 
			
		||||
  </uni-nav-bar>
 | 
			
		||||
    <view class="accept page-common">
 | 
			
		||||
        <div class="card top-content" :class="{'is-expanded': isExpanded}">
 | 
			
		||||
| 
						 | 
				
			
			@ -61,6 +61,9 @@
 | 
			
		|||
                <uni-col :span="6">
 | 
			
		||||
                    <view class="coding-btn" @click="scanStart">二维码识别</view>
 | 
			
		||||
                </uni-col>
 | 
			
		||||
                <uni-col :span="6">
 | 
			
		||||
                    <view class="coding-btn" @click="moveNum">转至数量</view>
 | 
			
		||||
                </uni-col>
 | 
			
		||||
            </uni-row>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -131,10 +134,11 @@
 | 
			
		|||
            </uni-row>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <!-- <div class="btn">
 | 
			
		||||
        <div class="btn">
 | 
			
		||||
            <button class="btn-cont" @click="submitCode">确认</button>
 | 
			
		||||
        </div> -->
 | 
			
		||||
        </div>
 | 
			
		||||
    </view>
 | 
			
		||||
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup>
 | 
			
		||||
| 
						 | 
				
			
			@ -317,6 +321,10 @@ const handleScanError = (error) => {
 | 
			
		|||
    uni.showToast({ title: error.message, icon: 'none' })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const moveNum = () => {
 | 
			
		||||
    uni.navigateTo({ url: `/pages/back/backNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const getMaInfoScan = () => {
 | 
			
		||||
    let param = {
 | 
			
		||||
        qrCode: qrCode.value,
 | 
			
		||||
| 
						 | 
				
			
			@ -324,8 +332,13 @@ const getMaInfoScan = () => {
 | 
			
		|||
        proId: taskInfo.value.proId,
 | 
			
		||||
        id: taskInfo.value.id,
 | 
			
		||||
    }
 | 
			
		||||
    getMachine(param)
 | 
			
		||||
        .then((res) => {
 | 
			
		||||
    uni.request({
 | 
			
		||||
    url: '/material/back_apply_info/getMachine',
 | 
			
		||||
    method: 'get',
 | 
			
		||||
    data: param,
 | 
			
		||||
    success: (res) => {
 | 
			
		||||
        console.log(res)
 | 
			
		||||
        if (res.code == 200) {
 | 
			
		||||
            console.log(res)
 | 
			
		||||
            console.log(res.data[0])
 | 
			
		||||
            maCode.value = res.data[0].maCode
 | 
			
		||||
| 
						 | 
				
			
			@ -334,10 +347,46 @@ const getMaInfoScan = () => {
 | 
			
		|||
            maStatusName.value = res.data[0].maStatusName
 | 
			
		||||
            maId.value = res.data[0].maId
 | 
			
		||||
            typeId.value = res.data[0].typeId
 | 
			
		||||
        }else{
 | 
			
		||||
            uni.showModal({
 | 
			
		||||
                title: '错误提示',
 | 
			
		||||
                content: res.data.msg,
 | 
			
		||||
                showCancel: false, // 不显示取消按钮
 | 
			
		||||
                confirmText: '关闭',
 | 
			
		||||
                success: (res) => {
 | 
			
		||||
                    // if (res.confirm) {
 | 
			
		||||
                    //     console.log('用户点击关闭')
 | 
			
		||||
                    // }
 | 
			
		||||
                }
 | 
			
		||||
            })
 | 
			
		||||
        .catch((error) => {
 | 
			
		||||
            console.log(error)
 | 
			
		||||
        })
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
    // getMachine(param)
 | 
			
		||||
    //     .then((res) => {
 | 
			
		||||
    //         console.log(res)
 | 
			
		||||
    //         console.log(res.data[0])
 | 
			
		||||
    //         maCode.value = res.data[0].maCode
 | 
			
		||||
    //         typeName.value = res.data[0].typeName
 | 
			
		||||
    //         materialName.value = res.data[0].typeModelName
 | 
			
		||||
    //         maStatusName.value = res.data[0].maStatusName
 | 
			
		||||
    //         maId.value = res.data[0].maId
 | 
			
		||||
    //         typeId.value = res.data[0].typeId
 | 
			
		||||
    //     })
 | 
			
		||||
    //     .catch((error) => {
 | 
			
		||||
    //         uni.showModal({
 | 
			
		||||
    //             title: '错误提示',
 | 
			
		||||
    //             content: error.data.msg,
 | 
			
		||||
    //             showCancel: false, // 不显示取消按钮
 | 
			
		||||
    //             confirmText: '关闭',
 | 
			
		||||
    //             success: (res) => {
 | 
			
		||||
    //                 // if (res.confirm) {
 | 
			
		||||
    //                 //     console.log('用户点击关闭')
 | 
			
		||||
    //                 // }
 | 
			
		||||
    //             }
 | 
			
		||||
    //         })
 | 
			
		||||
    //     })
 | 
			
		||||
}
 | 
			
		||||
// // 扫码识别按钮
 | 
			
		||||
// const scanStart = () => {
 | 
			
		||||
| 
						 | 
				
			
			@ -424,6 +473,7 @@ const submitCode = () => {
 | 
			
		|||
                    // uni.navigateBack({
 | 
			
		||||
                    // 	delta: 1 // 返回到已存在的页面
 | 
			
		||||
                    // });
 | 
			
		||||
                    scanStart()
 | 
			
		||||
                } else {
 | 
			
		||||
                    uni.showToast({ title: res.msg, icon: 'none' })
 | 
			
		||||
                }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -242,9 +242,10 @@ const submitCode = () => {
 | 
			
		|||
          console.log(res)
 | 
			
		||||
          if (res.code == 200) {
 | 
			
		||||
            uni.showToast({ title: '新增成功', icon: 'none' })
 | 
			
		||||
            uni.navigateBack({
 | 
			
		||||
              delta: 1, // 返回到已存在的页面
 | 
			
		||||
            })
 | 
			
		||||
            uni.navigateTo({ url: `/pages/back/index` })
 | 
			
		||||
            // uni.navigateBack({
 | 
			
		||||
            //   delta: 1, // 返回到已存在的页面
 | 
			
		||||
            // })
 | 
			
		||||
          } else {
 | 
			
		||||
            uni.showToast({ title: res.msg, icon: 'none' })
 | 
			
		||||
          }
 | 
			
		||||
| 
						 | 
				
			
			@ -263,13 +264,53 @@ const deleteImage = (index) => {
 | 
			
		|||
//上传
 | 
			
		||||
const uploadImg = () => {
 | 
			
		||||
  const count = 3 - imgList.value.length // Calculate remaining slots
 | 
			
		||||
  uni.chooseImage({
 | 
			
		||||
    count: count, // Allow to select up to remaining slots
 | 
			
		||||
    sizeType: ['original', 'compressed'],
 | 
			
		||||
    sourceType: ['album', 'camera'],
 | 
			
		||||
  if (count <= 0) {
 | 
			
		||||
    uni.showToast({ title: '最多上传3张图片', icon: 'none' })
 | 
			
		||||
    return
 | 
			
		||||
  }else{
 | 
			
		||||
      uni.showActionSheet({
 | 
			
		||||
        itemList: ['拍照', '从相册选择'],
 | 
			
		||||
        success: (res) => {
 | 
			
		||||
      const tempFilePaths = res.tempFilePaths
 | 
			
		||||
      tempFilePaths.forEach((filePath, index) => {
 | 
			
		||||
          if (res.tapIndex === 0) {
 | 
			
		||||
            getCameraFj()
 | 
			
		||||
          } else if (res.tapIndex === 1) {
 | 
			
		||||
            // 从相册选择
 | 
			
		||||
            getPhotoFj()
 | 
			
		||||
          }
 | 
			
		||||
        },
 | 
			
		||||
        fail: (err) => {
 | 
			
		||||
          console.error('操作菜单选择失败:', err)
 | 
			
		||||
        },
 | 
			
		||||
      })
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
// 附件拍照
 | 
			
		||||
const getCameraFj = () => {
 | 
			
		||||
      navigator.camera.getPicture(onCameraSuccessFj, onCameraErrorFj, {
 | 
			
		||||
        quality: 50,
 | 
			
		||||
        destinationType: window.Camera.DestinationType.DATA_URL,
 | 
			
		||||
        sourceType: window.Camera.PictureSourceType.CAMERA,
 | 
			
		||||
      })
 | 
			
		||||
}
 | 
			
		||||
// 附件从相册选择
 | 
			
		||||
const getPhotoFj = () => {
 | 
			
		||||
      navigator.camera.getPicture(onCameraSuccessFj, onCameraErrorFj, {
 | 
			
		||||
        quality: 50,
 | 
			
		||||
        destinationType: window.Camera.DestinationType.DATA_URL,
 | 
			
		||||
        sourceType: window.Camera.PictureSourceType.SAVEDPHOTOALBUM,
 | 
			
		||||
      })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const onCameraErrorFj = (message) => {
 | 
			
		||||
      console.log(message)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const onCameraSuccessFj = (file) => {
 | 
			
		||||
      uploadSignUrlFj(file)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const uploadSignUrlFj = (file) => {
 | 
			
		||||
        const filePath = "data:image/jpeg;base64," + file;
 | 
			
		||||
        uni.uploadFile({
 | 
			
		||||
          url: '/file/upload',
 | 
			
		||||
          filePath: filePath,
 | 
			
		||||
| 
						 | 
				
			
			@ -286,9 +327,7 @@ const uploadImg = () => {
 | 
			
		|||
                url: uploadRes.data.url,
 | 
			
		||||
                taskType: '10'
 | 
			
		||||
              })
 | 
			
		||||
              if (index === tempFilePaths.length - 1) {
 | 
			
		||||
                uni.showToast({ title: '上传成功', icon: 'none' })
 | 
			
		||||
              }
 | 
			
		||||
            } else {
 | 
			
		||||
              uni.showToast({ title: '上传失败', icon: 'none' })
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -298,9 +337,49 @@ const uploadImg = () => {
 | 
			
		|||
            uni.showToast({ title: '上传失败', icon: 'none' })
 | 
			
		||||
          }
 | 
			
		||||
        })
 | 
			
		||||
      })
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // uni.chooseImage({
 | 
			
		||||
  //   count: count, // Allow to select up to remaining slots
 | 
			
		||||
  //   sizeType: ['original', 'compressed'],
 | 
			
		||||
  //   sourceType: ['album', 'camera'],
 | 
			
		||||
  //   success: (res) => {
 | 
			
		||||
  //     const tempFilePaths = res.tempFilePaths
 | 
			
		||||
  //     tempFilePaths.forEach((filePath, index) => {
 | 
			
		||||
  //       uni.uploadFile({
 | 
			
		||||
  //         url: '/file/upload',
 | 
			
		||||
  //         filePath: filePath,
 | 
			
		||||
  //         name: 'file',
 | 
			
		||||
  //         success: (uploadRes) => {
 | 
			
		||||
  //           uploadRes = JSON.parse(uploadRes.data)
 | 
			
		||||
  //           if (uploadRes.code && uploadRes.code == 200) {
 | 
			
		||||
  //             imgList.value.push({
 | 
			
		||||
  //               url: filePath, // Show local path first
 | 
			
		||||
  //               serverUrl: uploadRes.data.url // Store server URL
 | 
			
		||||
  //             })
 | 
			
		||||
  //             bmFileInfos.value.push({
 | 
			
		||||
  //               name: uploadRes.data.name,
 | 
			
		||||
  //               url: uploadRes.data.url,
 | 
			
		||||
  //               taskType: '10'
 | 
			
		||||
  //             })
 | 
			
		||||
  //             if (index === tempFilePaths.length - 1) {
 | 
			
		||||
  //               uni.showToast({ title: '上传成功', icon: 'none' })
 | 
			
		||||
  //             }
 | 
			
		||||
  //           } else {
 | 
			
		||||
  //             uni.showToast({ title: '上传失败', icon: 'none' })
 | 
			
		||||
  //           }
 | 
			
		||||
  //         },
 | 
			
		||||
  //         fail: (err) => {
 | 
			
		||||
  //           console.error('上传失败', err)
 | 
			
		||||
  //           uni.showToast({ title: '上传失败', icon: 'none' })
 | 
			
		||||
  //         }
 | 
			
		||||
  //       })
 | 
			
		||||
  //     })
 | 
			
		||||
  //   }
 | 
			
		||||
  // })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 处理扫描成功事件
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,14 +9,14 @@
 | 
			
		|||
      @clickLeft="leftClick"
 | 
			
		||||
  >
 | 
			
		||||
    <!-- 使用右侧插槽自定义提交按钮 -->
 | 
			
		||||
    <template #right>
 | 
			
		||||
    <!-- <template #right>
 | 
			
		||||
      <button
 | 
			
		||||
          class="submit-btn"
 | 
			
		||||
          @click="submitNum"
 | 
			
		||||
      >
 | 
			
		||||
        确定
 | 
			
		||||
      </button>
 | 
			
		||||
    </template>
 | 
			
		||||
    </template> -->
 | 
			
		||||
  </uni-nav-bar>
 | 
			
		||||
    <view class="accept page-common">
 | 
			
		||||
        <div class="card top-content" :class="{'is-expanded': isExpanded}">
 | 
			
		||||
| 
						 | 
				
			
			@ -154,9 +154,9 @@
 | 
			
		|||
                </uni-td>
 | 
			
		||||
            </uni-tr>
 | 
			
		||||
        </uni-table>
 | 
			
		||||
        <!-- <div class="footer-btn">
 | 
			
		||||
        <div class="footer-btn">
 | 
			
		||||
            <button class="btn-cont" @click="submitNum">确认</button>
 | 
			
		||||
        </div> -->
 | 
			
		||||
        </div>
 | 
			
		||||
    </view>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue