From b1a29e56aac59d8c7d6d586034aebc9ae771d867 Mon Sep 17 00:00:00 2001 From: hanbo <2608504783@qq.com> Date: Tue, 19 Apr 2022 11:18:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=93=E7=94=A8=E6=80=A7=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/admin/project_estimate_edit.ftl | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/resources/templates/admin/project_estimate_edit.ftl b/src/main/resources/templates/admin/project_estimate_edit.ftl index 27527ce..cc318f2 100644 --- a/src/main/resources/templates/admin/project_estimate_edit.ftl +++ b/src/main/resources/templates/admin/project_estimate_edit.ftl @@ -582,43 +582,44 @@ return; } - if (incomeDeviceTaxInclude < incomeDeviceTaxExclude) { + f2() + if (changeToNumber(incomeDeviceTaxInclude) < changeToNumber(incomeDeviceTaxExclude)) { window.confirm('设备类收入含税金额应小于不含税金额'); check = 1; return; } - if (incomeEngineerTaxInclude < incomeEngineerTaxExclude) { + if (changeToNumber(incomeEngineerTaxInclude) < changeToNumber(incomeEngineerTaxExclude)) { window.confirm('工程类收入含税金额应小于不含税金额'); check = 1; return; } - if (incomeServiceTaxInclude < incomeServiceTaxExclude) { + if (changeToNumber(incomeServiceTaxInclude) < changeToNumber(incomeServiceTaxExclude)) { window.confirm('服务类收入含税金额应小于不含税金额'); check = 1; return; } - if (costPurchaseDeviceTaxInclude < costPurchaseDeviceTaxExclude) { + if (changeToNumber(costPurchaseDeviceTaxInclude) < changeToNumber(costPurchaseDeviceTaxExclude)) { window.confirm('设备类采购成本含税金额应小于不含税金额'); check = 1; return; } - if (costPurchaseBuildTaxInclude < costPurchaseBuildTaxExclude) { + if (changeToNumber(costPurchaseBuildTaxInclude) < changeToNumber(costPurchaseBuildTaxExclude)) { window.confirm('施工类采购成本含税金额应小于不含税金额'); check = 1; return; } - if (costPurchaseServiceTaxInclude < costPurchaseServiceTaxExclude) { + if (changeToNumber(costPurchaseServiceTaxInclude) < changeToNumber(costPurchaseServiceTaxExclude)) { window.confirm('服务类采购成本含税金额应小于不含税金额'); check = 1; return; } - if (costPurchaseOtherTaxInclude < costPurchaseOtherTaxExclude) { + if (changeToNumber(costPurchaseOtherTaxInclude) < changeToNumber(costPurchaseOtherTaxExclude)) { window.confirm('其他类采购成本含税金额应小于不含税金额'); check = 1; return; @@ -639,6 +640,12 @@ } }); }; + + function changeToNumber(value) { + value = value.replace(/[^\-\d.]/g, ""); //清除“-”、“数字”和“.”以外的字符 + value = value.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的 + return value; + }