diff --git a/src/main/java/geoinfo/regi/manageList/ManageExcelUploadProc03Controller.java b/src/main/java/geoinfo/regi/manageList/ManageExcelUploadProc03Controller.java index 261b276a..a6380f24 100644 --- a/src/main/java/geoinfo/regi/manageList/ManageExcelUploadProc03Controller.java +++ b/src/main/java/geoinfo/regi/manageList/ManageExcelUploadProc03Controller.java @@ -6477,25 +6477,25 @@ public class ManageExcelUploadProc03Controller { List> list = new ArrayList>(); int excelWpLength = excelWp.getLength(); for(int i=1; i < excelWpLength; i++) { - if(!StringUtil.containsCharOnly(excelWp.get("col0",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col0",i).trim(),"0123456789.-")){ resultMsg = String.format(fmtMsg, i + "번째 심도(from)는 실수만 입력이 가능합니다."); } - if(!StringUtil.containsCharOnly(excelWp.get("col1",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col1",i).trim(),"0123456789.-")){ resultMsg += String.format(fmtMsg, i + "번째 심도(to)는 실수만 입력이 가능합니다."); } - if(!StringUtil.containsCharOnly(excelWp.get("col4",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col4",i).trim(),"0123456789.-")){ resultMsg = String.format(fmtMsg, i + "번째 함수비(%)는 실수만 입력이 가능합니다."); } - if(!StringUtil.containsCharOnly(excelWp.get("col5",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col5",i).trim(),"0123456789.-")){ resultMsg += String.format(fmtMsg, i + "번째 비중은 실수만 입력이 가능합니다."); } - if(!StringUtil.containsCharOnly(excelWp.get("col6",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col6",i).trim(),"0123456789.-")){ resultMsg = String.format(fmtMsg, i + "번째 액성한계(%)는 실수만 입력이 가능합니다."); } - if(!StringUtil.containsCharOnly(excelWp.get("col7",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col7",i).trim(),"0123456789.-")){ resultMsg += String.format(fmtMsg, i + "번째 소성지수는 실수만 입력이 가능합니다."); } - if(!StringUtil.containsCharOnly(excelWp.get("col9",i).trim(),"0123456789.")){ + if(!StringUtil.containsCharOnly(excelWp.get("col9",i).trim(),"0123456789.-")){ resultMsg += String.format(fmtMsg, i + "번째 단위중량(KN/㎥)은 실수만 입력이 가능합니다."); } diff --git a/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp b/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp index dba75a13..e59bf943 100644 --- a/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp +++ b/src/main/webapp/WEB-INF/views/web/input/sampleInfo.jsp @@ -164,17 +164,17 @@ function fn_save(rUrl){ }else if(keys[k] == "sampleDepthTo"){ change_data += "<" + keys[k] + ">" + row.sampleDepthTo + "\r\n"; }else if(keys[k] == "sampleLl"){ - change_data += "<" + keys[k] + ">" + row.sampleLl + "\r\n"; + change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleLl) + "\r\n"; }else if(keys[k] == "sampleDesc"){ change_data += "<" + keys[k] + ">" + row.sampleDesc + "\r\n"; }else if(keys[k] == "sampleWc"){ - change_data += "<" + keys[k] + ">" + row.sampleWc + "\r\n"; + change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleWc) + "\r\n"; }else if(keys[k] == "datetime"){ change_data += "<" + keys[k] + ">" + row.datetime + "\r\n"; }else if(keys[k] == "sampleGs"){ - change_data += "<" + keys[k] + ">" + row.sampleGs + "\r\n"; + change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleGs) + "\r\n"; }else if(keys[k] == "samplePi"){ - change_data += "<" + keys[k] + ">" + row.samplePi + "\r\n"; + change_data += "<" + keys[k] + ">" + getNoDataValue(row.samplePi) + "\r\n"; }else if(keys[k] == "sampleNumber"){ change_data += "<" + keys[k] + ">" + row.sampleNumber + "\r\n"; }else if(keys[k] == "sampleShape"){ @@ -184,7 +184,7 @@ function fn_save(rUrl){ }else if(keys[k] == "projectCode"){ change_data += "<" + keys[k] + ">" + row.projectCode + "\r\n"; }else if(keys[k] == "sampleRd"){ - change_data += "<" + keys[k] + ">" + row.sampleRd + "\r\n"; + change_data += "<" + keys[k] + ">" + getNoDataValue(row.sampleRd) + "\r\n"; }else if(keys[k] == "sampleDepthFrom"){ change_data += "<" + keys[k] + ">" + row.sampleDepthFrom + "\r\n"; } @@ -373,12 +373,12 @@ function fn_add(){ "sampleDepthTo" : "0", "sampleSamplingMethod" : "", "sampleShape" : "", - "sampleWc" : "0", - "sampleGs" : "0", - "sampleLl" : "0", - "samplePi" : "0", + "sampleWc" : "-", + "sampleGs" : "-", + "sampleLl" : "-", + "samplePi" : "-", "sampleDesc" : "-", - "sampleRd" : "0", + "sampleRd" : "-", "sampleUscs" : "", "sampleCode" : "", }; @@ -759,7 +759,8 @@ function fn_grid_refresh(){ var nullTypeString = 'test'; if( gridData.length == 1 && gridData[0].sampleNumber == '-999' ) { - gridData = undefined; + // gridData = undefined; + gridData = '-'; // table-top-control 클래스를 가진 첫 번째 요소 찾기 var tableTopControlElement = document.getElementsByClassName('table-top-control')[0]; @@ -800,12 +801,12 @@ function fn_grid_refresh(){ sampleDepthTo: { type: "number" }, sampleSamplingMethod: { type: "string" }, sampleShape: { type: "string" }, - sampleWc: { type: "number",}, - sampleGs: { type: "number" }, - sampleLl: { type: "number" }, - samplePi: { type: "number" }, + sampleWc: { type: "number", defaultValue: "-"}, + sampleGs: { type: "number", defaultValue: "-"}, + sampleLl: { type: "number", defaultValue: "-" }, + samplePi: { type: "number", defaultValue: "-" }, sampleDesc: { type: "string" }, - sampleRd: { type: "number" }, + sampleRd: { type: "number", defaultValue: "-" }, sampleUscs: { type: "string" }, sampleCode: { type: "string", editable: false }, } @@ -857,44 +858,46 @@ function fn_grid_refresh(){ editor: comboEditor2, template: "#=getTeacherName2((sampleShape == null) ? ' ' : sampleShape)#", }, - { field: "sampleGs", title: "함수비(%)
값 없을 시
-999 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, + { field: "sampleGs", + title: "함수비(%)
값 없을 시
- 입력
", + editor: chooseEditor, + width:100, + attributes: { style:"text-align: right" }, format:"{0:n2}", template: function (dataItem) { - if (dataItem.sampleGs == null) - dataItem._set("sampleGs", "0"); - else - return dataItem.sampleGs; + if (dataItem.sampleGs == null || dataItem.sampleGs == -999) return "-"; + return kendo.toString(dataItem.sampleGs, "n2"); } }, - { field: "sampleWc", title: "비중
값 없을 시
-999 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, + { field: "sampleWc", title: "비중
값 없을 시
- 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: function (dataItem) { - if (dataItem.sampleWc == null) - dataItem._set("sampleWc", "0"); + if (dataItem.sampleWc == null || dataItem.sampleWc == -999) + return "-"; else return dataItem.sampleWc; } }, - { field: "sampleLl", title: "액성한계(%)
값 없을 시
-999 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, + { field: "sampleLl", title: "액성한계(%)
값 없을 시
- 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: function (dataItem) { - if (dataItem.sampleLl == null) - dataItem._set("sampleLl", "0"); + if (dataItem.sampleLl == null || dataItem.sampleLl == -999) + return "-"; else return dataItem.sampleLl; } }, - { field: "samplePi", title: "소성지수
값 없을 시
-999 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, + { field: "samplePi", title: "소성지수
값 없을 시
- 입력
", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: function (dataItem) { - if (dataItem.samplePi == null) - dataItem._set("samplePi", "0"); + if (dataItem.samplePi == null || dataItem.samplePi == -999) + return "-"; else return dataItem.samplePi; } }, { field: "sampleDesc", title: "비고", width:100, attributes: { style:"text-align: left" }, template: "
#= (sampleDesc == null) ? '0' : sampleDesc #
" }, - { field: "sampleRd", title: "단위중량(${sampleUnit})
값 없을 시
-999 입력
", editor: chooseEditor, width:140, attributes: { style:"text-align: right" }, + { field: "sampleRd", title: "단위중량(${sampleUnit})
값 없을 시
- 입력
", editor: chooseEditor, width:140, attributes: { style:"text-align: right" }, template: function (dataItem) { - if (dataItem.sampleRd == null) - dataItem._set("sampleRd", "0"); + if (dataItem.sampleRd == null || dataItem.sampleRd == -999) + return "-"; else return dataItem.sampleRd; } @@ -1060,7 +1063,8 @@ function fn_grid_refresh(){ switch (options.model.COLUMN) { default: - numericEditor(container, options); +// numericEditor(container, options); + numericEditor2(container, options); break; } } diff --git a/src/main/webapp/kendo-ui/js/common.js b/src/main/webapp/kendo-ui/js/common.js index 973e4891..243295c6 100644 --- a/src/main/webapp/kendo-ui/js/common.js +++ b/src/main/webapp/kendo-ui/js/common.js @@ -46,6 +46,61 @@ function numericEditor(container, options, isHyphenAllowed = false) { } +function numericEditor2(container, options, isHyphenAllowed = false) { + var input = kendoJQuery(''); + + input.appendTo(container) + .val(options.model[options.field]) + + // 1. 입력 제한 (숫자 + 하이픈) + .on("input", function () { + let val = this.value; + + // 허용: "-", "-숫자", "숫자", "소수" + if (!/^[-]?\d*\.?\d*$/.test(val)) { + this.value = val.slice(0, -1); + } + }) + + // 2. ↑ ↓ 키로 값 증가/감소 + .on("keydown", function (e) { + if (e.key === "ArrowUp" || e.key === "ArrowDown") { + e.preventDefault(); + + let val = this.value.trim(); + + // "-" 단독이면 0 기준 시작 + if (val === "-" || val === "") { + val = 0; + } + + let num = parseFloat(val); + if (isNaN(num)) num = 0; + + if (e.key === "ArrowUp") { + num += 1; + } else { + num -= 1; + } + + this.value = num; + } + }) + + // 3. blur 시 모델 반영 + .on("blur", function () { + let val = this.value.trim(); + + if (val === "-") { + options.model.set(options.field, null); + } else { + let num = parseFloat(val); + options.model.set(options.field, isNaN(num) ? null : num); + } + }); +} + + //입력 type number로 변경 그러나 hyphen 입력 허용 function numericEditorAllowHyphen(container, options, isHyphenAllowed = false) { kendoJQuery('') diff --git a/src/main/webapp/web/js/common.js b/src/main/webapp/web/js/common.js index b083e879..0b2b7dd1 100644 --- a/src/main/webapp/web/js/common.js +++ b/src/main/webapp/web/js/common.js @@ -2077,4 +2077,29 @@ function projNmDuplChkResult( projectNameInput, projectCode) { } }); return result; +} + +/** + * 기업사용자 입력시스템 > 기본물성시험정보 -999값 처리 + * 값 없음 처리는 '-' 입력으로 한다. + * @caller /views/web/input/sampleInfo.jsp + * @param val + * @returns + */ +function getNoDataValue(val) { + return (val === null || val === undefined || val === "" || val === "-") ? -999 : val; +} + + +/** + * 기업사용자 입력시스템 > 기본물성시험정보 -999값 처리 + * 값 없음 처리는 '-' 입력으로 한다. + * @param val + * @returns + */ +function setNoDataValue(val) { + if (val == -999) { + return '-'; + } + return val; } \ No newline at end of file