From 1cc52b674132cc9cdba36b19d4fed451cea19cfe Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Thu, 8 Aug 2024 18:09:24 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8B=A0=EC=B2=AD=EC=84=9C=EC=A0=91?= =?UTF-8?q?=EC=88=98=EC=8B=9C=20=ED=8F=90=EA=B8=B0=EC=88=98=EB=9F=89=20?= =?UTF-8?q?=EC=86=8C=EC=88=AB=EC=A0=90=20=EC=9E=85=EB=A0=A5=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsp/adds/nims/dsuseMgtReceipt-edit.jsp | 24 +++++++++++++------ .../jsp/adds/nims/dsuseMgtReceipt-info.jsp | 6 +++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp index b825d98..20340ae 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-edit.jsp @@ -187,12 +187,16 @@ const fnPrdChange = (e) => { - let key = e.target.closest('tr').dataset.key; + const key = e.target.closest('tr').dataset.key; + const name = e.target.name; let value = e.target.value; - let name = e.target.name; - //alert(JSON.stringify($P.productList.getData(key))); + + if(name === 'dsuseQy') { + let parts = value.replace(/[^0-9.]/g, '').split('.'); + value = parts.shift() + '.' + parts.join(''); + e.target.value = value; + } $P.productList.setValue(key, name, value); - //alert(JSON.stringify($P.productList.getData(key))); } const fnBarcodeSearch = (barcode) => { @@ -273,6 +277,9 @@ dialog.alert(obj.message); return false; } + // obj.data.forEach(item => { + // item.data.dsuseQy = parseFloat(item.data.dsuseQy.toFixed(2)).toString() + // }); return obj.data; } , infoSize: "xl" @@ -680,7 +687,10 @@ } }); - + // 숫자만 입력받도록 input 요소에 이벤트 리스너 추가 + $("input[name='dsuseQy']").on('change', function() { + this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1'); + }); //------------------------------------------------------------------------- } @@ -720,8 +730,8 @@ $P.productList.append(productInfo); $("#tbody--productList tr td input[type=text]").on('change', (e) => { - fnPrdChange(e); - }) + fnPrdChange(e); + }) }); diff --git a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp index f38fca0..05527b8 100644 --- a/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/adds/nims/dsuseMgtReceipt-info.jsp @@ -169,6 +169,7 @@ * script 진입 **************************************************************************/ $(document).ready(function() { + const fnBarcodeSearch = (barcode) => { ajax.get({ url : wctx.url("/adds/nims/getNimsPrdMnfSeqInfoOfBarcode.do") @@ -623,6 +624,11 @@ fnBarcodeSearch(barcode); } }); + + // 숫자만 입력받도록 input 요소에 이벤트 리스너 추가 + $("input[name='dsuseQy']").on('input', function() { + this.value = this.value.replace(/[^0-9.]/g, '').replace(/(\..*)\./g, '$1'); + }); //------------------------------------------------------------------------- }