From db3f850b7b8f8dccaefbabbd5fcaef16723bd34f Mon Sep 17 00:00:00 2001 From: lijuncheng Date: Wed, 31 Jan 2024 15:36:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E6=A3=80=E6=95=B0=E9=87=8F=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9=E7=B2=BE=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/inspect/coms/inspectEdit.vue | 34 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) 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()