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'); + }); //------------------------------------------------------------------------- }