ソースを参照

发票金额录入修改

user5 3 年 前
コミット
a70eb287a6

+ 9 - 1
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllForm.jsp

@@ -646,6 +646,14 @@
 				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
 			}
 		}
+
+		function num(obj){
+			obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
+			obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
+			obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
+			obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
+			obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
+		}
 	</script>
 </head>
 <body>
@@ -828,7 +836,7 @@
 					<label class="layui-form-label double-line"><span class="require-item">*</span>发票金额(元):</label>
 					<div class="layui-input-block">
 							<%--<form:input id=""  path="money" htmlEscape="false" class="form-control number judgment layui-input"/>--%>
-						<input name="money" htmlEscape="false" placeholder="请输入发票金额" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+						<input name="money" htmlEscape="false" onkeyup="num(this)" maxlength="12" placeholder="请输入发票金额" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 8 - 1
src/main/webapp/webpage/modules/workinvoice/workInvoiceAllTwoForm.jsp

@@ -619,6 +619,13 @@
 				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
 			}
 		}
+		function num(obj){
+			obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
+			obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
+			obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
+			obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
+			obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
+		}
 	</script>
 </head>
 <body>
@@ -798,7 +805,7 @@
 					<label class="layui-form-label double-line"><span class="require-item">*</span>发票金额(元):</label>
 					<div class="layui-input-block">
 							<%--<form:input id=""  path="money" htmlEscape="false" class="form-control number judgment layui-input"/>--%>
-						<input name="money" htmlEscape="false" placeholder="请输入发票金额" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+						<input name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 9 - 1
src/main/webapp/webpage/modules/workinvoice/workInvoiceForm.jsp

@@ -614,6 +614,14 @@
 				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
 			}
 		}
+
+		function num(obj){
+			obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
+			obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
+			obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
+			obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
+			obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
+		}
 	</script>
 </head>
 <body>
@@ -792,7 +800,7 @@
 					<label class="layui-form-label double-line"><span class="require-item">*</span>发票金额(元):</label>
 					<div class="layui-input-block">
 							<%--<form:input id=""  path="money" htmlEscape="false" class="form-control number judgment layui-input"/>--%>
-						<input name="money" htmlEscape="false" placeholder="请输入发票金额" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+						<input name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">

+ 9 - 1
src/main/webapp/webpage/modules/workinvoice/workInvoiceTwoForm.jsp

@@ -645,6 +645,14 @@
 				multipartUploadWithStsCollection(storeAs, file, attachmentId, attachmentFlag, uploadPath, divId, size);
 			}
 		}
+
+		function num(obj){
+			obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符
+			obj.value = obj.value.replace(/^\./g,""); //验证第一个字符是数字
+			obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个, 清除多余的
+			obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
+			obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3'); //只能输入两个小数
+		}
 	</script>
 </head>
 <body>
@@ -828,7 +836,7 @@
 					<label class="layui-form-label double-line"><span class="require-item">*</span>发票金额(元):</label>
 					<div class="layui-input-block">
 							<%--<form:input id=""  path="money" htmlEscape="false" class="form-control number judgment layui-input"/>--%>
-						<input name="money" htmlEscape="false" placeholder="请输入发票金额" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
+						<input name="money" htmlEscape="false" placeholder="请输入发票金额" maxlength="12" onkeyup="num(this)" value="${workInvoice.money}" class="form-control judgment number layui-input"/>
 					</div>
 				</div>
 				<div class="layui-item layui-col-sm12 with-textarea">