2023-12-24 02:19:29 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<view class="form-area">
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<h4>类型名称</h4>
|
|
|
|
|
|
<span>{{ upperInfo.typeName }}</span>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<h4>规格型号</h4>
|
|
|
|
|
|
<span>{{ upperInfo.typeCode }}</span>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<h4>待入库数量</h4>
|
|
|
|
|
|
<span>{{ upperInfo.num }}</span>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<h4>合格数量</h4>
|
|
|
|
|
|
<uni-easyinput type="number" v-model="lowerIpt.passedNum" placeholder="请输入数量"></uni-easyinput>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
2023-12-24 14:19:53 +08:00
|
|
|
|
<h4>待修数量</h4>
|
2023-12-24 02:19:29 +08:00
|
|
|
|
<uni-easyinput type="number" v-model="lowerIpt.waitRepairNum" placeholder="请输入数量"></uni-easyinput>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<h4>待报废数量</h4>
|
|
|
|
|
|
<uni-easyinput type="number" v-model="lowerIpt.waitCrashNum" placeholder="请输入数量"></uni-easyinput>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2024-06-20 09:13:53 +08:00
|
|
|
|
<view class="sub-btn" @click="subForm" :disabled="btnDisabled">
|
2023-12-24 02:19:29 +08:00
|
|
|
|
确认
|
|
|
|
|
|
</view>
|
2024-06-20 09:13:53 +08:00
|
|
|
|
<u-loading-page :loading="showLoading" color="#000" loading-text="表单提交中,请稍后..."></u-loading-page>
|
2023-12-24 02:19:29 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
upperInfo: {
|
|
|
|
|
|
parentId: '',
|
|
|
|
|
|
typeName: '',
|
|
|
|
|
|
typeCode: '',
|
|
|
|
|
|
num: ''
|
|
|
|
|
|
},
|
|
|
|
|
|
lowerIpt: {
|
|
|
|
|
|
passedNum: '',
|
|
|
|
|
|
waitRepairNum: '',
|
|
|
|
|
|
waitCrashNum: ''
|
|
|
|
|
|
},
|
2024-06-20 09:13:53 +08:00
|
|
|
|
totalNum: 0,
|
|
|
|
|
|
showLoading: false,
|
|
|
|
|
|
btnDisabled: false
|
2023-12-24 02:19:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2023-12-24 14:19:53 +08:00
|
|
|
|
subForm() {
|
|
|
|
|
|
//三个数量之和小于等于10 才可提交
|
|
|
|
|
|
// "taskId": "294",
|
|
|
|
|
|
// {
|
|
|
|
|
|
// "parentId": 34,
|
|
|
|
|
|
// "typeId": "5",
|
|
|
|
|
|
// "backNum": "1",
|
|
|
|
|
|
// "backStatus":: "3",//合格为 1 待修2 待报废2
|
|
|
|
|
|
// "manageType": "1",
|
|
|
|
|
|
// "createBy": "1"
|
|
|
|
|
|
// }
|
2023-12-24 02:19:29 +08:00
|
|
|
|
let that = this
|
2024-06-20 09:13:53 +08:00
|
|
|
|
that.showLoading = true
|
|
|
|
|
|
that.btnDisabled = true
|
2023-12-24 14:19:53 +08:00
|
|
|
|
if (!this.lowerIpt.passedNum && !this.lowerIpt.waitRepairNum && !this.lowerIpt.waitCrashNum) {
|
2024-06-20 09:13:53 +08:00
|
|
|
|
that.showLoading = false
|
|
|
|
|
|
that.btnDisabled = false
|
2023-12-24 14:19:53 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
2024-03-13 17:55:34 +08:00
|
|
|
|
title: '请至少填写一个数据!'
|
2023-12-24 14:19:53 +08:00
|
|
|
|
})
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
that.totalNum = Number(that.lowerIpt.passedNum) + Number(that.lowerIpt.waitRepairNum) + Number(that
|
|
|
|
|
|
.lowerIpt.waitCrashNum)
|
2023-12-24 02:19:29 +08:00
|
|
|
|
console.log(that.totalNum);
|
|
|
|
|
|
if (that.totalNum > that.upperInfo.num) {
|
2024-06-20 09:13:53 +08:00
|
|
|
|
that.showLoading = false
|
|
|
|
|
|
that.btnDisabled = false
|
2023-12-24 02:19:29 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '接收总量不能大于退库数量!'
|
|
|
|
|
|
})
|
2024-03-13 17:55:34 +08:00
|
|
|
|
} else if (that.totalNum == 0) {
|
2024-06-20 09:13:53 +08:00
|
|
|
|
that.showLoading = false
|
|
|
|
|
|
that.btnDisabled = false
|
2024-03-13 17:55:34 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '请确保退料总量不为0!'
|
|
|
|
|
|
})
|
2023-12-24 02:19:29 +08:00
|
|
|
|
} else {
|
2024-04-08 17:28:48 +08:00
|
|
|
|
console.log(this.handleSubmitData());
|
2023-12-24 14:19:53 +08:00
|
|
|
|
that.$api.backMaterialReceive.backMaterialSetNumBack({
|
|
|
|
|
|
taskId: this.upperInfo.taskId,
|
|
|
|
|
|
arr: this.handleSubmitData()
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
console.log("res===", res)
|
2024-06-20 09:13:53 +08:00
|
|
|
|
that.showLoading = false
|
|
|
|
|
|
that.btnDisabled = false
|
2023-12-24 14:19:53 +08:00
|
|
|
|
uni.showToast({
|
|
|
|
|
|
icon: 'none',
|
|
|
|
|
|
title: '接收成功'
|
|
|
|
|
|
})
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
|
},
|
|
|
|
|
|
300)
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
handleSubmitData() {
|
|
|
|
|
|
let list = []
|
|
|
|
|
|
const baseInfo = {
|
|
|
|
|
|
parentId: this.upperInfo.id,
|
2024-04-10 13:52:16 +08:00
|
|
|
|
typeId: this.upperInfo.modelId,
|
2023-12-24 14:19:53 +08:00
|
|
|
|
manageType: this.upperInfo.manageType,
|
|
|
|
|
|
createBy: this.upperInfo.userId
|
2023-12-24 02:19:29 +08:00
|
|
|
|
}
|
2023-12-24 14:19:53 +08:00
|
|
|
|
let passInfo = {
|
|
|
|
|
|
backStatus: 1,
|
|
|
|
|
|
backNum: this.lowerIpt.passedNum
|
|
|
|
|
|
}
|
|
|
|
|
|
let repairInfo = {
|
|
|
|
|
|
backStatus: 2,
|
|
|
|
|
|
backNum: this.lowerIpt.waitRepairNum
|
|
|
|
|
|
}
|
|
|
|
|
|
let crashInfo = {
|
|
|
|
|
|
backStatus: 3,
|
|
|
|
|
|
backNum: this.lowerIpt.waitCrashNum
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (this.lowerIpt.passedNum) {
|
|
|
|
|
|
let info = {
|
|
|
|
|
|
...baseInfo,
|
|
|
|
|
|
...passInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
list.push(info)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.lowerIpt.waitRepairNum) {
|
|
|
|
|
|
let info = {
|
|
|
|
|
|
...baseInfo,
|
|
|
|
|
|
...repairInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
list.push(info)
|
|
|
|
|
|
}
|
|
|
|
|
|
if (this.lowerIpt.waitCrashNum) {
|
|
|
|
|
|
let info = {
|
|
|
|
|
|
...baseInfo,
|
|
|
|
|
|
...crashInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
list.push(info)
|
|
|
|
|
|
}
|
|
|
|
|
|
return list
|
2023-12-24 02:19:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onLoad(params) {
|
2023-12-24 14:19:53 +08:00
|
|
|
|
console.log("ev", params);
|
2023-12-24 02:19:29 +08:00
|
|
|
|
this.upperInfo = params
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
2023-12-24 14:19:53 +08:00
|
|
|
|
.form-area {
|
2023-12-24 02:19:29 +08:00
|
|
|
|
width: 90%;
|
|
|
|
|
|
margin: 40rpx auto;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2023-12-24 14:19:53 +08:00
|
|
|
|
|
|
|
|
|
|
view {
|
2023-12-24 02:19:29 +08:00
|
|
|
|
width: 100%;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
margin-bottom: 25rpx;
|
2023-12-24 14:19:53 +08:00
|
|
|
|
|
|
|
|
|
|
h4 {
|
2023-12-24 02:19:29 +08:00
|
|
|
|
width: 35%;
|
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
}
|
2023-12-24 14:19:53 +08:00
|
|
|
|
|
|
|
|
|
|
span {
|
2023-12-24 02:19:29 +08:00
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-24 14:19:53 +08:00
|
|
|
|
|
|
|
|
|
|
view:last-child {
|
2023-12-24 02:19:29 +08:00
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-24 14:19:53 +08:00
|
|
|
|
|
|
|
|
|
|
.sub-btn {
|
2023-12-24 02:19:29 +08:00
|
|
|
|
width: 80%;
|
|
|
|
|
|
margin: 20vh auto;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
padding: 15rpx 0;
|
|
|
|
|
|
background-color: #3788FF;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
2023-12-24 14:19:53 +08:00
|
|
|
|
</style>
|