退料问题修复
This commit is contained in:
parent
5446d3028f
commit
f379b132c3
|
|
@ -266,6 +266,13 @@
|
|||
"navigationBarTitleText": "退料数量查看"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/back/backCodeQrScan",
|
||||
"style": {
|
||||
// "navigationBarTitleText": "二维码识别"
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
//配件-------------------------------
|
||||
{
|
||||
"path": "pages/part/part-lease/index",
|
||||
|
|
|
|||
|
|
@ -90,9 +90,9 @@
|
|||
<uni-col :span="6">
|
||||
<view class="coding-btn" @click="onCodeIdentify">编码识别</view>
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<!-- <uni-col :span="6">
|
||||
<view class="coding-btn" @click="scanStart">二维码识别</view>
|
||||
</uni-col>
|
||||
</uni-col> -->
|
||||
<uni-col :span="6">
|
||||
<view class="coding-btn" @click="moveNum">转至数量</view>
|
||||
</uni-col>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,715 @@
|
|||
<template>
|
||||
<uni-nav-bar
|
||||
status-bar
|
||||
leftIcon="left"
|
||||
title="退料编码"
|
||||
backgroundColor="#dcf4ff"
|
||||
:border="false"
|
||||
fixed
|
||||
@clickLeft="leftClick"
|
||||
>
|
||||
</uni-nav-bar>
|
||||
<view class="accept page-common">
|
||||
<div class="card top-content" :class="{ 'is-expanded': isExpanded }">
|
||||
<div class="card-header">
|
||||
<div class="title">
|
||||
<span class="title-line"></span> 任务信息 <span style="color: #8c8c8c"></span>
|
||||
</div>
|
||||
<button class="submit-btn" @click="scanStart">二维码识别</button>
|
||||
<uni-icons
|
||||
class="icon"
|
||||
type="down"
|
||||
size="19"
|
||||
:class="{ 'is-expanded': isExpanded }"
|
||||
@click="isExpanded = !isExpanded"
|
||||
></uni-icons>
|
||||
</div>
|
||||
<uni-forms :model="taskInfo" label-width="170rpx" :border="true">
|
||||
<uni-forms-item label="退料单位:" name="unitName">
|
||||
<span style="height: 100%; display: flex; align-items: center">{{
|
||||
taskInfo.unitName
|
||||
}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料工程:" name="proName">
|
||||
<span style="height: 100%; display: flex; align-items: center">{{
|
||||
taskInfo.proName
|
||||
}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料单号:" name="code">
|
||||
<span style="height: 100%; display: flex; align-items: center">{{
|
||||
taskInfo.code
|
||||
}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料人员:" name="backPerson">
|
||||
<span style="height: 100%; display: flex; align-items: center">{{
|
||||
taskInfo.backPerson
|
||||
}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="联系电话:" name="phone">
|
||||
<span style="height: 100%; display: flex; align-items: center">{{
|
||||
taskInfo.phone
|
||||
}}</span>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</div>
|
||||
|
||||
<ScanQrCode
|
||||
ref="scanQrCodeRef"
|
||||
@scanSuccess="handleScanSuccess"
|
||||
@scanError="handleScanError"
|
||||
/>
|
||||
|
||||
<div class="card" style="margin-top: 10px">
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">规格型号:</uni-col>
|
||||
<uni-col :span="16">
|
||||
{{ codeInfo.typeModelName }}
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">物资类型:</uni-col>
|
||||
<uni-col :span="16">
|
||||
{{ codeInfo.typeName }}
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">设备编码:</uni-col>
|
||||
<uni-col :span="18">
|
||||
{{ codeInfo.maCode }}
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">外观判定:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
|
||||
<radio-group @change="changeRadio">
|
||||
<radio value="完好" :checked="isRadioCheck" style="margin-right: 5px">完好</radio>
|
||||
<radio value="不合格" :checked="!isRadioCheck">不合格</radio>
|
||||
</radio-group>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="4">附件:</uni-col>
|
||||
<uni-col :span="20">
|
||||
<div class="upload-container">
|
||||
<div class="upload" @click="uploadImg" v-if="imgList.length < 3">+</div>
|
||||
<div class="image-preview" v-for="(img, index) in imgList" :key="index">
|
||||
<image :src="img.url" mode="aspectFill"></image>
|
||||
<view class="delete-btn" @click.stop="deleteImage(index)">×</view>
|
||||
<PreviewImg :imgUrl="img.url" />
|
||||
</div>
|
||||
</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row style="display: flex; align-items: center">
|
||||
<uni-col :span="4">备注:</uni-col>
|
||||
<uni-col :span="20">
|
||||
<uni-easyinput placeholder="请输入备注" v-model="remark" :clearable="false" />
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</div>
|
||||
|
||||
<div class="btn">
|
||||
<button class="btn-cont" @click="submitCode">确认</button>
|
||||
</div>
|
||||
</view>
|
||||
<PopupConfirm ref="popupConfirm" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import {
|
||||
getMachine,
|
||||
insertApp,
|
||||
} from '../../services/back.js'
|
||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
|
||||
//pages/materialsStation/toolsLease/components/eselect.vue
|
||||
import eselect from '@/components/tree-select/eselect.vue'
|
||||
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
|
||||
import PreviewImg from '@/components/PreviewImg/index.vue'
|
||||
import PopupConfirm from '@/components/PopupConfirm'
|
||||
|
||||
const taskInfo = ref({})
|
||||
const apDetection = ref('完好') //外观判定
|
||||
const imgList = ref([]) // 图片列表,用于回显
|
||||
const bmFileInfos = ref([]) // 上传后的图片信息
|
||||
const scanQrCodeRef = ref(null)
|
||||
const isExpanded = ref(false)
|
||||
const flag = ref(false)
|
||||
const remark = ref('')
|
||||
const isRadioCheck = ref(true)
|
||||
const popupConfirm = ref()
|
||||
const codeInfo = ref({})
|
||||
|
||||
const leftClick = () => {
|
||||
// 返回
|
||||
uni.navigateBack({
|
||||
delta: 1, // 返回到已存在的页面
|
||||
})
|
||||
}
|
||||
|
||||
const changeRadio = (e) => {
|
||||
console.log(e.detail.value)
|
||||
isRadioCheck.value = !isRadioCheck.value
|
||||
apDetection.value = e.detail.value
|
||||
}
|
||||
|
||||
const qrCode = ref('') //图片展示
|
||||
// 二维码扫码
|
||||
const scanStart = async () => {
|
||||
qrCode.value = ''
|
||||
if (scanQrCodeRef.value) {
|
||||
scanQrCodeRef.value.scanQrCode()
|
||||
}
|
||||
}
|
||||
|
||||
// 处理扫描成功事件
|
||||
const handleScanSuccess = (result) => {
|
||||
qrCode.value = result?.data?.split('?qrcode=')[1] || result?.data
|
||||
console.log("xxxxxxxxxxx",result)
|
||||
console.log("yyyyyyyyyyy",qrCode.value)
|
||||
if (qrCode.value == '') {
|
||||
uni.showToast({ title: '扫码识别失败', icon: 'none' })
|
||||
} else if(qrCode.value == '操作已取消'){
|
||||
qrCode.value = ''
|
||||
uni.showToast({ title: '操作已取消', icon: 'none' })
|
||||
}else {
|
||||
getMaInfoScan()
|
||||
}
|
||||
}
|
||||
|
||||
// 处理扫描失败事件
|
||||
const handleScanError = (error) => {
|
||||
console.error('扫描出错:', error.message)
|
||||
uni.showToast({ title: error.message, icon: 'none' })
|
||||
}
|
||||
|
||||
const getMaInfoScan = () => {
|
||||
let param = {
|
||||
qrCode: qrCode.value,
|
||||
unitId: taskInfo.value.unitId,
|
||||
proId: taskInfo.value.proId,
|
||||
id: taskInfo.value.id,
|
||||
}
|
||||
uni.request({
|
||||
url: '/material/back_apply_info/getMachine',
|
||||
method: 'get',
|
||||
data: param,
|
||||
success: async (res) => {
|
||||
console.log(res)
|
||||
if (!res.data.code) {
|
||||
res = JSON.parse(decryptWithSM4(res.data))
|
||||
} else {
|
||||
res = res.data
|
||||
}
|
||||
console.log('xxxxxxxxxxxxxxxx', res)
|
||||
if (res.code == 200) {
|
||||
codeInfo.value = res.data[0]
|
||||
flag.value = true
|
||||
} else {
|
||||
uni.showModal({
|
||||
title: '错误提示',
|
||||
content: res.msg,
|
||||
showCancel: false, // 不显示取消按钮
|
||||
confirmText: '关闭',
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
//提交
|
||||
const submitCode = async () => {
|
||||
console.log(taskInfo.value)
|
||||
if (!codeInfo.value.maCode) {
|
||||
uni.showToast({ title: '请添加退料设备!', icon: 'none' })
|
||||
} else if (apDetection.value == '不合格' && bmFileInfos.value.length == 0) {
|
||||
uni.showToast({ title: '请上传附件!', icon: 'none' })
|
||||
} else {
|
||||
const { data: confirm } = await popupConfirm.value.openPopup()
|
||||
if (!confirm) return
|
||||
let obj = {
|
||||
// maId: codeInfo.value.maId.value,
|
||||
// maCode: codeInfo.value.maCode.value,
|
||||
typeId: codeInfo.value.typeId,
|
||||
apDetection: apDetection.value,
|
||||
goodNum: apDetection.value == '完好' ? 1 : 0,
|
||||
badNum: apDetection.value == '不合格' ? 1 : 0,
|
||||
bmFileInfos: bmFileInfos.value,
|
||||
maVos: [{maId: codeInfo.value.maId,maCode: codeInfo.value.maCode,}],
|
||||
remark: remark.value,
|
||||
}
|
||||
let param = {
|
||||
backApplyInfo: taskInfo.value,
|
||||
backApplyDetails: obj,
|
||||
}
|
||||
if (param.backApplyInfo.signUrl) delete param.backApplyInfo.signUrl
|
||||
console.log("zzzzzzzzzzz", param)
|
||||
uni.showLoading({ title: '提交中...', mask: true })
|
||||
insertApp(param)
|
||||
.then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
uni.showToast({ title: '添加成功!', icon: 'none' })
|
||||
uni.hideLoading()
|
||||
codeInfo.value = {}
|
||||
apDetection.value = '完好'
|
||||
bmFileInfos.value = []
|
||||
imgList.value = []
|
||||
remark.value = ''
|
||||
isRadioCheck.value = true
|
||||
// uni.navigateBack({
|
||||
// delta: 1 // 返回到已存在的页面
|
||||
// });
|
||||
if (flag.value) {
|
||||
console.log("kkkkkkkkkkk",flag.value)
|
||||
scanStart()
|
||||
}
|
||||
} else {
|
||||
uni.showToast({ title: res.msg, icon: 'none' })
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error)
|
||||
uni.hideLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
//上传
|
||||
const uploadImg = () => {
|
||||
const count = 3 - imgList.value.length
|
||||
if (count <= 0) {
|
||||
uni.showToast({ title: '最多上传3张图片', icon: 'none' })
|
||||
return
|
||||
} else {
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
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 generateRandomString = (length) => {
|
||||
let result = ''
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||
const charactersLength = characters.length
|
||||
for (let i = 0; i < length; i++) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
const uploadSignUrlFj = (file) => {
|
||||
const base64Data = file
|
||||
|
||||
uni.request({
|
||||
url: '/file/uploadBase64',
|
||||
method: 'POST',
|
||||
data: {
|
||||
base64File: base64Data,
|
||||
fileName: `${generateRandomString(10)}_${Date.now()}.png`,
|
||||
fileType: 'image/png',
|
||||
},
|
||||
success: (uploadRes) => {
|
||||
if (!uploadRes.data.code) {
|
||||
uploadRes = JSON.parse(decryptWithSM4(uploadRes.data))
|
||||
} else {
|
||||
uploadRes = JSON.parse(uploadRes.data)
|
||||
}
|
||||
if (uploadRes.code && uploadRes.code == 200) {
|
||||
imgList.value.push({
|
||||
url: uploadRes.data.url, // Show local path first
|
||||
serverUrl: uploadRes.data.url, // Store server URL
|
||||
})
|
||||
bmFileInfos.value.push({
|
||||
name: uploadRes.data.name,
|
||||
url: uploadRes.data.url,
|
||||
taskType: '10',
|
||||
})
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败', err)
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 删除图片
|
||||
const deleteImage = (index) => {
|
||||
imgList.value.splice(index, 1)
|
||||
bmFileInfos.value.splice(index, 1)
|
||||
}
|
||||
|
||||
onLoad(async (options) => {
|
||||
console.log(options)
|
||||
taskInfo.value = JSON.parse(options.taskInfo)
|
||||
console.log(taskInfo.value)
|
||||
await scanStart()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.submit-btn {
|
||||
background-color: #007aff; /* 蓝色背景 */
|
||||
color: white; /* 白色文字 */
|
||||
border: none; /* 去掉边框 */
|
||||
border-radius: 5px; /* 圆角 */
|
||||
padding: 0 14px; /* 左右内边距 */
|
||||
height: 35px; /* 高度 */
|
||||
line-height: 35px; /* 垂直居中 */
|
||||
font-size: 15px; /* 字体放大 */
|
||||
margin-right: 23px; /* 与边缘间距 */
|
||||
}
|
||||
::v-deep .tree-item .head {
|
||||
/* justify-content: center !important; */
|
||||
}
|
||||
::v-deep .uni-easyinput__content {
|
||||
padding: 0 !important;
|
||||
}
|
||||
/* 在style部分添加 */
|
||||
.upload-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
position: relative;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-preview image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
color: white;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-bottom-left-radius: 12rpx;
|
||||
font-size: 32rpx;
|
||||
line-height: 32rpx;
|
||||
}
|
||||
|
||||
.uploading-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
::v-deep .uni-radio-input {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
.accept {
|
||||
padding: 24rpx;
|
||||
/* height: 95vh; */
|
||||
word-break: break-all;
|
||||
background-color: #f7f8fa;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh; // 关键,撑满整个视口高度
|
||||
|
||||
// 卡片样式
|
||||
.card {
|
||||
padding: 32rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
// 卡片标题
|
||||
/* > div:first-child {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #262626;
|
||||
margin-bottom: 24rpx;
|
||||
position: relative;
|
||||
padding-left: 24rpx;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 28rpx;
|
||||
background: #3784fb;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
} */
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
color: #262626;
|
||||
position: relative;
|
||||
padding-left: 24rpx;
|
||||
|
||||
.title-line {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 6rpx;
|
||||
height: 28rpx;
|
||||
background: #3784fb;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.icon {
|
||||
transition: transform 0.5s ease; /* 添加动画过渡 */
|
||||
transform: rotate(0deg);
|
||||
|
||||
&.is-expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 表单样式
|
||||
:deep(.uni-forms) {
|
||||
.uni-forms-item {
|
||||
padding: 24rpx 0;
|
||||
margin-bottom: 0;
|
||||
border-bottom: 2rpx solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.uni-forms-item__label {
|
||||
color: #8c8c8c;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #262626;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 扫码按钮样式
|
||||
.coding-btn {
|
||||
padding: 0 5px;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
|
||||
border-radius: 12rpx;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
|
||||
}
|
||||
|
||||
// 检索按钮样式
|
||||
&.search-btn {
|
||||
background: #fff7eb;
|
||||
color: #fa8c16;
|
||||
border: 2rpx solid #fa8c16;
|
||||
box-shadow: none;
|
||||
|
||||
&:active {
|
||||
background: #fff3e0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 信息展示行
|
||||
:deep(.uni-row) {
|
||||
/* margin-bottom: 24rpx; */
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.uni-col-6 {
|
||||
color: #8c8c8c;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.uni-col-16 {
|
||||
color: #262626;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
// 输入框样式
|
||||
.uni-easyinput__content {
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx solid #e8e8e8;
|
||||
border-radius: 12rpx;
|
||||
height: 75rpx;
|
||||
padding: 0 24rpx;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:focus-within {
|
||||
border-color: #3784fb;
|
||||
box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1);
|
||||
}
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
font-size: 28rpx;
|
||||
height: 75rpx;
|
||||
line-height: 75rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 上传区域样式
|
||||
.upload {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
background-color: #f7f8fa;
|
||||
border: 2rpx dashed #d9d9d9;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 48rpx;
|
||||
color: #bfbfbf;
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
background-color: #f0f0f0;
|
||||
border-color: #3784fb;
|
||||
}
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 12rpx;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 底部按钮
|
||||
.btn {
|
||||
margin-top: auto;
|
||||
padding: 32rpx;
|
||||
background: #fff;
|
||||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
||||
|
||||
.btn-cont {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
text-align: center;
|
||||
background: linear-gradient(135deg, #4b8eff 0%, #3784fb 100%);
|
||||
color: #fff;
|
||||
border-radius: 44rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:active {
|
||||
transform: scale(0.98);
|
||||
opacity: 0.9;
|
||||
box-shadow: 0 2rpx 8rpx rgba(55, 132, 251, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.top-content {
|
||||
height: 30px;
|
||||
overflow: hidden;
|
||||
transition: max-height 0.5s ease-out;
|
||||
|
||||
&.is-expanded {
|
||||
height: 700px !important;
|
||||
overflow: visible !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -78,21 +78,22 @@
|
|||
codeData?.maStatusName
|
||||
}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="外观判定:" name="apDetection">
|
||||
<uni-easyinput
|
||||
maxlength="30"
|
||||
v-model="apDetection"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||
<uni-col :span="6">外观判定:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<!-- <uni-easyinput placeholder="请输入内容" v-model="apDetection"/> -->
|
||||
<radio-group @change="changeRadio">
|
||||
<radio value="完好" :checked="isRadioCheck" style="margin-right: 5px">完好</radio>
|
||||
<radio value="不合格" :checked="!isRadioCheck">不合格</radio>
|
||||
</radio-group>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-forms-item label="附件:">
|
||||
<div class="upload" @click="uploadImg" v-if="imgUrl == ''">+</div>
|
||||
<div class="upload" @click="uploadImg" v-else>
|
||||
<image
|
||||
:src="imgUrl"
|
||||
style="width: 160rpx; height: 160rpx"
|
||||
mode=""
|
||||
></image>
|
||||
<div class="upload" @click="uploadImg" v-if="imgList.length < 3">+</div>
|
||||
<div class="image-preview" v-for="(img, index) in imgList" :key="index">
|
||||
<image :src="img.url" mode="aspectFill"></image>
|
||||
<view class="delete-btn" @click.stop="deleteImage(index)">×</view>
|
||||
<PreviewImg :imgUrl="img.url" />
|
||||
</div>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
|
|
@ -107,7 +108,9 @@
|
|||
|
||||
<script>
|
||||
import { decryptWithSM4, encryptWithSM4, hashWithSM3AndSalt } from '@/utils/sm'
|
||||
import PreviewImg from '@/components/PreviewImg/index.vue'
|
||||
export default {
|
||||
components: { PreviewImg },
|
||||
data() {
|
||||
return {
|
||||
livePusher: null,
|
||||
|
|
@ -119,9 +122,11 @@ export default {
|
|||
maCode: '',
|
||||
},
|
||||
codeData: {},
|
||||
apDetection: '',
|
||||
apDetection: '完好',
|
||||
bmFileInfos: [],
|
||||
imgUrl: '',
|
||||
isRadioCheck: true, // 初始状态为完好
|
||||
imgList: [],
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
|
|
@ -258,21 +263,26 @@ export default {
|
|||
},
|
||||
//上传
|
||||
uploadImg() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
success: (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
this.getCameraFj()
|
||||
} else if (res.tapIndex === 1) {
|
||||
// 从相册选择
|
||||
this.getPhotoFj()
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('操作菜单选择失败:', err)
|
||||
},
|
||||
})
|
||||
|
||||
const count = 3 - this.imgList.length
|
||||
if (count <= 0) {
|
||||
uni.showToast({ title: '最多上传3张图片', icon: 'none' })
|
||||
return
|
||||
} else {
|
||||
uni.showActionSheet({
|
||||
itemList: ['拍照', '从相册选择'],
|
||||
success: (res) => {
|
||||
if (res.tapIndex === 0) {
|
||||
this.getCameraFj()
|
||||
} else if (res.tapIndex === 1) {
|
||||
// 从相册选择
|
||||
this.getPhotoFj()
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('操作菜单选择失败:', err)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// uni.chooseImage({
|
||||
|
|
@ -368,21 +378,15 @@ export default {
|
|||
}
|
||||
|
||||
if (uploadRes.code && uploadRes.code == 200) {
|
||||
let obj = {
|
||||
this.imgList.push({
|
||||
url: uploadRes.data.url, // Show local path first
|
||||
serverUrl: uploadRes.data.url, // Store server URL
|
||||
})
|
||||
this.bmFileInfos.push({
|
||||
name: uploadRes.data.name,
|
||||
url: uploadRes.data.url,
|
||||
}
|
||||
this.bmFileInfos = [obj]
|
||||
this.imgUrl = uploadRes.data.url
|
||||
// imgList.value.push({
|
||||
// url: uploadRes.data.url, // Show local path first
|
||||
// serverUrl: uploadRes.data.url // Store server URL
|
||||
// })
|
||||
// bmFileInfos.value.push({
|
||||
// name: uploadRes.data.name,
|
||||
// url: uploadRes.data.url,
|
||||
// taskType: '10'
|
||||
// })
|
||||
taskType: '10',
|
||||
})
|
||||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||||
} else {
|
||||
uni.showToast({ title: '上传失败', icon: 'none' })
|
||||
|
|
@ -395,8 +399,20 @@ export default {
|
|||
})
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(index){
|
||||
this.imgList.splice(index, 1)
|
||||
this.bmFileInfos.splice(index, 1)
|
||||
},
|
||||
|
||||
|
||||
changeRadio(e) {
|
||||
console.log("kkkkkk",e)
|
||||
this.isRadioCheck = !this.isRadioCheck
|
||||
this.apDetection = e.detail.value
|
||||
console.log("xxxxx",this.apDetection)
|
||||
},
|
||||
|
||||
//确认按钮
|
||||
async onHandleConfirm() {
|
||||
console.log(this.codeData.maId)
|
||||
|
|
@ -405,12 +421,16 @@ export default {
|
|||
title: '请先识别编码!',
|
||||
icon: 'none',
|
||||
})
|
||||
} else if (this.apDetection == '不合格' && this.bmFileInfos.length == 0) {
|
||||
uni.showToast({ title: '请上传附件!', icon: 'none' })
|
||||
} else {
|
||||
let obj = {
|
||||
maId: this.codeData.maId,
|
||||
maCode: this.codeData.maCode,
|
||||
// maId: this.codeData.maId,
|
||||
// maCode: this.codeData.maCode,
|
||||
typeId: this.codeData.typeId,
|
||||
apDetection: this.apDetection,
|
||||
goodNum: this.apDetection == '完好' ? 1 : 0,
|
||||
badNum: this.apDetection == '不合格' ? 1 : 0,
|
||||
bmFileInfos: this.bmFileInfos,
|
||||
maVos:[{maId:this.codeData.maId,maCode:this.codeData.maCode}]
|
||||
}
|
||||
|
|
@ -435,6 +455,10 @@ export default {
|
|||
icon: 'none',
|
||||
})
|
||||
this.queryCodeParams.maCode = ''
|
||||
this.apDetection = '完好'
|
||||
this.imgList = []
|
||||
this.bmFileInfos = []
|
||||
this.isRadioCheck = true
|
||||
this.codeData = {}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -9,24 +9,32 @@
|
|||
@clickLeft="leftClick"
|
||||
>
|
||||
<!-- 使用右侧插槽自定义提交按钮 -->
|
||||
<template #right v-if="appTaskStatus != 1">
|
||||
<!-- <template #right v-if="appTaskStatus != 1">
|
||||
<button
|
||||
class="submit-btn"
|
||||
@click="submit"
|
||||
>
|
||||
提交
|
||||
</button>
|
||||
</template>
|
||||
</template> -->
|
||||
</uni-nav-bar>
|
||||
<view class="accept page-common">
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="5" v-if="appTaskStatus != 1">
|
||||
<view class="addBtn" @click="goCode">编码退料</view>
|
||||
</uni-col>
|
||||
<uni-col :span="5" v-if="appTaskStatus != 1" style="padding-right: 0;">
|
||||
<uni-col :span="5" v-if="appTaskStatus != 1" >
|
||||
<view class="addBtn" @click="goNum">数量退料</view>
|
||||
</uni-col>
|
||||
<uni-col :span="appTaskStatus != 1 ? 10 : 20" style="margin-left: 10px">
|
||||
<uni-col :span="5" v-if="appTaskStatus != 1" style="padding-right: 0;">
|
||||
<view class="addBtn" @click="scanStart">二维码识别</view>
|
||||
</uni-col>
|
||||
<uni-col :span="4" :offset="4" v-if="appTaskStatus != 1" style="padding-right: 0;">
|
||||
<view class="search" @click="submit">提交</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24" class="search-form">
|
||||
<uni-col :span="20" style="margin-left: 10px">
|
||||
<view><uni-easyinput placeholder="请输入内容" v-model="keyWord" maxlength="10"/></view>
|
||||
</uni-col>
|
||||
<uni-col :span="4">
|
||||
|
|
@ -158,6 +166,10 @@ const goCode = () => {
|
|||
const goNum = () => {
|
||||
uni.navigateTo({ url: `/pages/back/backNum?taskInfo=${JSON.stringify(taskInfo.value)}` })
|
||||
}
|
||||
//二维码识别
|
||||
const scanStart = () => {
|
||||
uni.navigateTo({ url: `/pages/back/backCodeQrScan?taskInfo=${JSON.stringify(taskInfo.value)}` })
|
||||
}
|
||||
const onClick = (e, item, itemIndex) => {
|
||||
item.appTaskStatus = appTaskStatus.value
|
||||
const { index } = e
|
||||
|
|
|
|||
|
|
@ -325,4 +325,13 @@ export const getMachineByIdListApi = (data) => {
|
|||
url: '/material/back_apply_info/selectMachineByIdList',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 根据id获取编码--二维码识别
|
||||
export const getMachineByIdListQrScanApi = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/back_apply_info/selectMachineByIdListQrScan',
|
||||
data,
|
||||
})
|
||||
}
|
||||
Loading…
Reference in New Issue