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> - +