diff --git a/pages/inspect/coms/inspectEdit.vue b/pages/inspect/coms/inspectEdit.vue index 378fb009..cd085c67 100644 --- a/pages/inspect/coms/inspectEdit.vue +++ b/pages/inspect/coms/inspectEdit.vue @@ -17,7 +17,7 @@ 不合格数量 - + @@ -25,7 +25,7 @@ 报废数量 - + @@ -68,9 +68,13 @@ } from '@/common/directory.js'; import { - deepCopyData + deepCopyData, } from '@/common/basic.js'; + import { + calc, + } from '@/common/calc.js'; + import { uploadFile, getFileList, @@ -94,7 +98,8 @@ failedReasonArray: [], dataContent: {}, inspectResultArray: [], - picInfoList: [] + picInfoList: [], + maxlength: 10 } }, props: { @@ -110,6 +115,20 @@ }, methods: { + checkNum(e) { + let value = e.detail.value; + let dot = value.indexOf('.'); //包含小数点 + let reg = /^[0-9]+$/; //正整数 + if (dot > -1) { + this.maxlength = dot + 7; //长度是小数点后两位 + if (value.length > dot + 7) { + + } + } + if (reg.test(value)) { //如果是正整数不包含小数点 + this.maxlength = 10; + } + }, openEditPopup(item) { this.failedReasonArray = getInspectFailedReasonList(); this.inspectResultArray =getInspectResultList() @@ -222,8 +241,8 @@ var failedQty = Number(this.dataContent.failedQty); var crackQty = Number(this.dataContent.crackQty); var qty = Number(this.dataContent.qty); - if (crackQty + failedQty > qty) { - var total = crackQty + failedQty; + if (calc.add(crackQty,failedQty)> qty) { + var total = calc.add(crackQty,failedQty) this.showMessage("不合格数[" + failedQty + "]+报废数量[" + crackQty + "]等于[" + total + "]大于收货数量[" + qty + "]") return @@ -242,7 +261,8 @@ this.dataContent.failedQty = failedQty; this.dataContent.crackQty = crackQty - this.dataContent.goodQty = this.dataContent.handleQty - failedQty - crackQty + var temp=calc.sub(this.dataContent.handleQty,failedQty); + this.dataContent.goodQty =calc.sub(temp,failedQty,crackQty); this.afterSave()