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() getUnit()
getProject() getProject()
// formData.value = JSON.parse(options.item) // formData.value = JSON.parse(options.item)
backPerson.value = memberStore.userInfo.nickName // backPerson.value = memberStore.userInfo.nickName
}) })
</script> </script>

View File

@ -9,14 +9,14 @@
@clickLeft="leftClick" @clickLeft="leftClick"
> >
<!-- 使用右侧插槽自定义提交按钮 --> <!-- 使用右侧插槽自定义提交按钮 -->
<template #right> <!-- <template #right>
<button <button
class="submit-btn" class="submit-btn"
@click="submitCode" @click="submitCode"
> >
确定 确定
</button> </button>
</template> </template> -->
</uni-nav-bar> </uni-nav-bar>
<view class="accept page-common"> <view class="accept page-common">
<div class="card top-content" :class="{'is-expanded': isExpanded}"> <div class="card top-content" :class="{'is-expanded': isExpanded}">
@ -61,6 +61,9 @@
<uni-col :span="6"> <uni-col :span="6">
<view class="coding-btn" @click="scanStart">二维码识别</view> <view class="coding-btn" @click="scanStart">二维码识别</view>
</uni-col> </uni-col>
<uni-col :span="6">
<view class="coding-btn" @click="moveNum">转至数量</view>
</uni-col>
</uni-row> </uni-row>
</div> </div>
@ -131,10 +134,11 @@
</uni-row> </uni-row>
</div> </div>
<!-- <div class="btn"> <div class="btn">
<button class="btn-cont" @click="submitCode">确认</button> <button class="btn-cont" @click="submitCode">确认</button>
</div> --> </div>
</view> </view>
</template> </template>
<script setup> <script setup>
@ -317,6 +321,10 @@ const handleScanError = (error) => {
uni.showToast({ title: error.message, icon: 'none' }) uni.showToast({ title: error.message, icon: 'none' })
} }
const moveNum = () => {
uni.navigateTo({ url: `/pages/back/backNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
}
const getMaInfoScan = () => { const getMaInfoScan = () => {
let param = { let param = {
qrCode: qrCode.value, qrCode: qrCode.value,
@ -324,8 +332,13 @@ const getMaInfoScan = () => {
proId: taskInfo.value.proId, proId: taskInfo.value.proId,
id: taskInfo.value.id, id: taskInfo.value.id,
} }
getMachine(param) uni.request({
.then((res) => { 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)
console.log(res.data[0]) console.log(res.data[0])
maCode.value = res.data[0].maCode maCode.value = res.data[0].maCode
@ -334,10 +347,46 @@ const getMaInfoScan = () => {
maStatusName.value = res.data[0].maStatusName maStatusName.value = res.data[0].maStatusName
maId.value = res.data[0].maId maId.value = res.data[0].maId
typeId.value = res.data[0].typeId typeId.value = res.data[0].typeId
}) }else{
.catch((error) => { uni.showModal({
console.log(error) title: '错误提示',
}) content: res.data.msg,
showCancel: false, //
confirmText: '关闭',
success: (res) => {
// if (res.confirm) {
// console.log('')
// }
}
})
}
},
})
// 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 = () => { // const scanStart = () => {
@ -424,6 +473,7 @@ const submitCode = () => {
// uni.navigateBack({ // uni.navigateBack({
// delta: 1 // // delta: 1 //
// }); // });
scanStart()
} else { } else {
uni.showToast({ title: res.msg, icon: 'none' }) uni.showToast({ title: res.msg, icon: 'none' })
} }

View File

@ -242,9 +242,10 @@ const submitCode = () => {
console.log(res) console.log(res)
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ title: '新增成功', icon: 'none' }) uni.showToast({ title: '新增成功', icon: 'none' })
uni.navigateBack({ uni.navigateTo({ url: `/pages/back/index` })
delta: 1, // // uni.navigateBack({
}) // delta: 1, //
// })
} else { } else {
uni.showToast({ title: res.msg, icon: 'none' }) uni.showToast({ title: res.msg, icon: 'none' })
} }
@ -263,13 +264,53 @@ const deleteImage = (index) => {
// //
const uploadImg = () => { const uploadImg = () => {
const count = 3 - imgList.value.length // Calculate remaining slots const count = 3 - imgList.value.length // Calculate remaining slots
uni.chooseImage({ if (count <= 0) {
count: count, // Allow to select up to remaining slots uni.showToast({ title: '最多上传3张图片', icon: 'none' })
sizeType: ['original', 'compressed'], return
sourceType: ['album', 'camera'], }else{
success: (res) => { uni.showActionSheet({
const tempFilePaths = res.tempFilePaths itemList: ['拍照', '从相册选择'],
tempFilePaths.forEach((filePath, index) => { success: (res) => {
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({ uni.uploadFile({
url: '/file/upload', url: '/file/upload',
filePath: filePath, filePath: filePath,
@ -286,9 +327,7 @@ const uploadImg = () => {
url: uploadRes.data.url, url: uploadRes.data.url,
taskType: '10' taskType: '10'
}) })
if (index === tempFilePaths.length - 1) {
uni.showToast({ title: '上传成功', icon: 'none' }) uni.showToast({ title: '上传成功', icon: 'none' })
}
} else { } else {
uni.showToast({ title: '上传失败', icon: 'none' }) uni.showToast({ title: '上传失败', icon: 'none' })
} }
@ -298,9 +337,49 @@ const uploadImg = () => {
uni.showToast({ title: '上传失败', icon: 'none' }) 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" @clickLeft="leftClick"
> >
<!-- 使用右侧插槽自定义提交按钮 --> <!-- 使用右侧插槽自定义提交按钮 -->
<template #right> <!-- <template #right>
<button <button
class="submit-btn" class="submit-btn"
@click="submitNum" @click="submitNum"
> >
确定 确定
</button> </button>
</template> </template> -->
</uni-nav-bar> </uni-nav-bar>
<view class="accept page-common"> <view class="accept page-common">
<div class="card top-content" :class="{'is-expanded': isExpanded}"> <div class="card top-content" :class="{'is-expanded': isExpanded}">
@ -154,9 +154,9 @@
</uni-td> </uni-td>
</uni-tr> </uni-tr>
</uni-table> </uni-table>
<!-- <div class="footer-btn"> <div class="footer-btn">
<button class="btn-cont" @click="submitNum">确认</button> <button class="btn-cont" @click="submitNum">确认</button>
</div> --> </div>
</view> </view>
</template> </template>