diff --git a/src/views/modules/qc/IQCResultEntry.vue b/src/views/modules/qc/IQCResultEntry.vue index b52a5e7..ec36d94 100644 --- a/src/views/modules/qc/IQCResultEntry.vue +++ b/src/views/modules/qc/IQCResultEntry.vue @@ -230,24 +230,28 @@ - + - + - - + + - + - - + + + + + + - + @@ -832,22 +836,28 @@ } }, watch: { - detailData: { - deep: true, - handler: function (newV, oldV) { - this.detailData.notPassQty = this.detailData.samplingQty - this.detailData.passQty - if (this.detailData.inspectionResult === '不合格') { - if (this.detailData.disposalMeasures === '让步接收') { + detailData: { + deep: true, + handler: function (newV, oldV) { + const samplingQty = Number(this.detailData.samplingQty) + const passQty = Number(this.detailData.passQty) + if (!Number.isNaN(samplingQty) && !Number.isNaN(passQty) && passQty > samplingQty) { + this.$set(this.detailData, 'passQty', samplingQty) + return + } + this.detailData.notPassQty = this.detailData.samplingQty - this.detailData.passQty + if (this.detailData.inspectionResult === '不合格') { + if (this.detailData.disposalMeasures === '让步接收') { + this.detailData.batchQualifiedQty = this.detailData.rollQty + } else if (this.detailData.disposalMeasures === '返工返修' || this.detailData.disposalMeasures === '拒收退回') { + this.detailData.batchQualifiedQty = 0 + } else if (this.detailData.disposalMeasures === '挑选使用') { + this.detailData.batchQualifiedQty = this.detailData.rollQty - this.detailData.notPassQty + } + } else if (this.detailData.inspectionResult === '合格'){ this.detailData.batchQualifiedQty = this.detailData.rollQty - } else if (this.detailData.disposalMeasures === '返工返修' || this.detailData.disposalMeasures === '拒收退回') { - this.detailData.batchQualifiedQty = 0 - } else if (this.detailData.disposalMeasures === '挑选使用') { - this.detailData.batchQualifiedQty = this.detailData.rollQty - this.detailData.notPassQty } - } else { - this.detailData.batchQualifiedQty = this.detailData.rollQty } - } }, detailList: { deep: true, @@ -1807,7 +1817,8 @@ state: '', passQty: '', notPassQty: '', - batchQualifiedQty: '' + batchQualifiedQty: '', + noBatchQualifiedQty:'', }, detailInformationFlag: false, iqcRecordOverFlag: false, @@ -2720,6 +2731,7 @@ this.detailData.responsiblePersonName = row.responsiblePersonName this.detailData.invdefinetype = row.invdefinetype this.detailData.state = row.state + // if (row.state === '待检验') { // this.detailData.passQty = row.samplingQty // } else { @@ -2729,6 +2741,7 @@ //2025/9/8 海波更改 合格数量 不合格数量 this.detailData.passQty = row.passQty this.detailData.notPassQty = row.notPassQty + this.detailData.noBatchQualifiedQty = this.detailData.samplingQty - this.detailData.passQty this.detailData.batchQualifiedQty = row.batchQualifiedQty this.getInspectionFormData() this.inspectorSearch() @@ -3463,6 +3476,56 @@ this.authFile = !fileFlag this.authCancelCheck = !cancelCheckFlag }, + noUnqualifiedQtyChange(){ + if (this.detailData.unqualifiedQty > this.detailData.rollCount) { + // 恢复原值 + this.$set(this.detailData, 'unqualifiedQty', parseInt(this.detailData.rollCount)) + this.$message.warning('不合格项目数量不能大于送检数量!') + } + }, + noRollCountChange(){ + if (parseInt(this.detailData.rollCount) > parseInt(this.detailData.rollQty)) { + // 恢复原值 + this.$set(this.detailData, 'rollCount', parseInt(this.detailData.rollQty)) + this.$message.warning('送检数量不能大于到货数量!') + } + this.noSamplingQtyChange() + this.noPassQtyChange() + }, + noSamplingQtyChange(){ + const samplingQty = Number(this.detailData.samplingQty) + const rollCount = Number(this.detailData.rollCount) + if (!Number.isNaN(samplingQty) && !Number.isNaN(rollCount) && samplingQty > rollCount) { + // 恢复原值 + this.$set(this.detailData, 'samplingQty', rollCount) + this.$message.warning('抽检数量不能大于送检数量!') + } + this.noPassQtyChange() + }, + noPassQtyChange(){ + const passQty = Number(this.detailData.passQty) + const samplingQty = Number(this.detailData.samplingQty) + if (Number.isNaN(passQty) || Number.isNaN(samplingQty)) { + return + } + if (passQty > samplingQty) { + this.$message.warning('合格数量不能大于送检数量!') + // 延后一帧回写,避免被 input-number 本次输入流程覆盖 + this.$nextTick(() => { + this.$set(this.detailData, 'passQty', samplingQty) + }) + } + }, + noBatchQualifiedQtyChange(){ + if (this.detailData.noBatchQualifiedQty > this.detailData.rollQty) { + // 恢复原值 + this.detailData.noBatchQualifiedQty = this.detailData.rollQty - this.detailData.batchQualifiedQty + this.$message.warning('批次不合格数量不能大于到货数量!') + } + // 给合格数量赋值 + let newValue = this.detailData.rollQty - this.detailData.noBatchQualifiedQty + this.$set(this.detailData, 'batchQualifiedQty', newValue) + }, } }