bug修复

This commit is contained in:
hongchao 2025-07-28 13:55:30 +08:00
parent 98c5c238f2
commit 7e2502e6cd
4 changed files with 158 additions and 29 deletions

View File

@ -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>

View File

@ -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' })
}

View File

@ -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' })
// }
// })
// })
// }
// })
}
//

View File

@ -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>