From fc3ebb90899444ea2a1a6028206e8eb3ee5b5efb Mon Sep 17 00:00:00 2001 From: bb_pan Date: Wed, 23 Jul 2025 18:25:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../picking/apply/component/AddPicking.vue | 104 ++++++++++-------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/sgzb-ui/src/views/claimAndreturn/picking/apply/component/AddPicking.vue b/sgzb-ui/src/views/claimAndreturn/picking/apply/component/AddPicking.vue index 834ecdd4..6401b078 100644 --- a/sgzb-ui/src/views/claimAndreturn/picking/apply/component/AddPicking.vue +++ b/sgzb-ui/src/views/claimAndreturn/picking/apply/component/AddPicking.vue @@ -756,56 +756,62 @@ export default { this.queryParams.createBy = this.user.userName // this.queryParams.companyId = this.user.companyId this.queryParams.userId = this.user.userId - let res - - if (this.taskId) { - this.leaseApplyInfoList.forEach((v) => { - v = Object.assign( - v, - this.queryParams.leaseApplyInfo, + try { + let res + + if (this.taskId) { + this.leaseApplyInfoList.forEach((v) => { + v = Object.assign( + v, + this.queryParams.leaseApplyInfo, + ) + this.$set( + v, + 'leaseApplyDetails', + this.queryParams.leaseApplyDetails, + ) + }) + // 当领料任务被驳回后重新提交时,判断当前状态,如为100 则表示为内部驳回 需要增加参数 souceByRefuse为1 + if (this.rejectTaskStatus == 100) { + this.queryParams.souceByRefuse = 1 + } + this.submitLoading = true + const params = { + ...this.queryParams, + taskId: this.taskId, + leaseApplyInfoList: this.leaseApplyInfoList, + } + res = await editLeaseApply(params) + } else { + // console.log(this.queryParams) + let isNum = this.queryParams.leaseApplyDetails.every( + (e) => e.num != 0, ) - this.$set( - v, - 'leaseApplyDetails', - this.queryParams.leaseApplyDetails, - ) - }) - // 当领料任务被驳回后重新提交时,判断当前状态,如为100 则表示为内部驳回 需要增加参数 souceByRefuse为1 - if (this.rejectTaskStatus == 100) { - this.queryParams.souceByRefuse = 1 + + if (!isNum) { + this.$message.error('机具类型库存量为零无法领料') + return + } + + this.submitLoading = true + res = await submitLeaseApply(this.queryParams) } - this.submitLoading = true - const params = { - ...this.queryParams, - taskId: this.taskId, - leaseApplyInfoList: this.leaseApplyInfoList, + if (res.code == 200) { + this.$message({ + type: 'success', + message: res.msg, + }) + this.submitLoading = false + // this.$tab.closeOpenPage({ + // path: '/claimAndRefund/receive/receiveApply', + // }) + this.$emit('goBackPage') + } else { + this.submitLoading = false } - res = await editLeaseApply(params) - } else { - // console.log(this.queryParams) - let isNum = this.queryParams.leaseApplyDetails.every( - (e) => e.num != 0, - ) - - if (!isNum) { - this.$message.error('机具类型库存量为零无法领料') - return - } - - this.submitLoading = true - res = await submitLeaseApply(this.queryParams) - } - if (res.code == 200) { - this.$message({ - type: 'success', - message: res.msg, - }) + } catch (error) { this.submitLoading = false - // this.$tab.closeOpenPage({ - // path: '/claimAndRefund/receive/receiveApply', - // }) - this.$emit('goBackPage') - } else { + } finally { this.submitLoading = false } } @@ -836,8 +842,10 @@ export default { let maxNum = row.num if (row.preNum <= 1) { row.preNum = 1 - } else if (row.preNum >= maxNum) { - row.preNum = maxNum + } else if (row.preNum > maxNum) { + // row.preNum = maxNum + // 提示: 预领数量不能大于库存数量 + this.$message.error(`该设备的库存为${maxNum},预领数量不可超过此库存,请重新填写!`) } }, /////// 设备类型树 切换