From b1f06ebe214f31815a25cd29a726ab72ab4dc002 Mon Sep 17 00:00:00 2001 From: xxssyyyyssxx Date: Tue, 23 Nov 2021 19:31:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E9=87=8F=E5=8F=AA=E4=BF=9D=E7=95=99?= =?UTF-8?q?=E6=95=B4=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/static/assets/js/project_common.js | 12 ++++++++++-- .../templates/admin/project_budget_edit.ftl | 6 +++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/main/resources/static/assets/js/project_common.js b/src/main/resources/static/assets/js/project_common.js index 5af16c7..58c0abc 100644 --- a/src/main/resources/static/assets/js/project_common.js +++ b/src/main/resources/static/assets/js/project_common.js @@ -56,15 +56,23 @@ function bindNumberInput() { var value = $(this).val(); - var reg = new RegExp("^[0-9]+(.[0-9]{2})?$"); + var reg = new RegExp("^[0-9]+(.[0-9]{1,2})?$"); if (reg.test(value)) { - $(this).val(Number(value).toFixed(2)); + //是数字就是数字,可以两位或者不带小数 + $(this).val(value); } else { $(this).val(""); } }); } +/** + * 保留整数 + */ +function integerNumber(input) { + input.value=input.value.replace(/[^\d]/g,'').replace(/^0{1,}/g,''); +} + function postAjax(url, data, callback) { $.ajax({ diff --git a/src/main/resources/templates/admin/project_budget_edit.ftl b/src/main/resources/templates/admin/project_budget_edit.ftl index bedecd2..57a44d9 100644 --- a/src/main/resources/templates/admin/project_budget_edit.ftl +++ b/src/main/resources/templates/admin/project_budget_edit.ftl @@ -442,7 +442,7 @@ - + @@ -510,7 +510,7 @@ - + @@ -564,7 +564,7 @@ readonly> - +