diff --git a/src/main/webapp/WEB-INF/views/web/input/projectInfo.jsp b/src/main/webapp/WEB-INF/views/web/input/projectInfo.jsp index a7e47123..2892c3c0 100644 --- a/src/main/webapp/WEB-INF/views/web/input/projectInfo.jsp +++ b/src/main/webapp/WEB-INF/views/web/input/projectInfo.jsp @@ -101,10 +101,10 @@ //발주처 1depth 선택시 function fn_onSelChangeGDisInit(num) { - if (document.getElementById("PROJECT_MASTER_COMPANY_O_CODE").value == "선택") { //직접입력 + if (document.getElementById("PROJECT_MASTER_COMPANY_O_CODE").value == "00") { //직접입력 document.getElementById("PROJECT_MASTER_COMPANY_NAME").disabled = true;// 발주처 셀렉트 박스 선택시 입력창 비활성화 $("select[id='PROJECT_MASTER_COMPANY_TW_CODE'] option").remove(); - } else if (document.getElementById("PROJECT_MASTER_COMPANY_O_CODE").value == "직접입력") { //직접입력 + } else if (document.getElementById("PROJECT_MASTER_COMPANY_O_CODE").value == "06") { //직접입력 document.getElementById("PROJECT_MASTER_COMPANY_NAME").disabled = false;// 발주처 셀렉트 박스 선택시 입력창 비활성화 $("select[id='PROJECT_MASTER_COMPANY_TW_CODE'] option").remove(); } else { diff --git a/src/main/webapp/WEB-INF/views/web/input/sand/consolidation.jsp b/src/main/webapp/WEB-INF/views/web/input/sand/consolidation.jsp index bcc0f00c..4cbaaf15 100644 --- a/src/main/webapp/WEB-INF/views/web/input/sand/consolidation.jsp +++ b/src/main/webapp/WEB-INF/views/web/input/sand/consolidation.jsp @@ -370,7 +370,9 @@ function fn_save(rUrl){ keys2[k] == "CONSOL_T90")) continue; if(keys2[k] == "CONSOL_MV"){ - strData2 += "<" + keys2[k] + ">" + isNumNull(row2.CONSOL_MV) + "\r\n"; + // row2.CONSOL_MV 값을 가져올 때 모든 공백을 제거 + var cleanVal = String(isNumNull(row2.CONSOL_MV)).replace(/\s+/g, ''); + strData2 += "<" + keys2[k] + ">" + cleanVal + "\r\n"; }else if(keys2[k] == "CONSOL_P"){ strData2 += "<" + keys2[k] + ">" + isNumNull(row2.CONSOL_P) + "\r\n"; @@ -812,6 +814,24 @@ function fn_grid_refresh(){ var kictDataSource = new kendo.data.DataSource ({ data: gridData2, schema: { + parse: function(response) { // 데이터가 모델에 담기기 전에 전처리 + var fields = [ + "CONSOL_P", "CONSOL_SETTLEMENT", "CONSOL_T90", "CONSOL_E", + "CONSOL_TWOHA", "CONSOL_AV", "CONSOL_CV", "CONSOL_MV", + "CONSOL_K", "CONSOL_RP" + ]; + + for (var i = 0; i < response.length; i++) { + var item = response[i]; + fields.forEach(function(field) { + if (item[field] != null && typeof item[field] === "string") { + // 앞뒤 공백 제거 및 보이지 않는 특수문자 제거 + item[field] = item[field].trim().replace(/[\x00-\x1F\x7F-\x9F]/g, ""); + } + }); + } + return response; + }, model: { fields: { CONSOL_P: { type: "number" }, @@ -838,18 +858,18 @@ function fn_grid_refresh(){ kendoJQuery("#kictGrid2").kendoGrid({ dataSource: kictDataSource, columns: [ - { field: "CONSOL_P", title: "하중(${consolP})", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_P == null) ? '0' : CONSOL_P #
" }, - { field: "CONSOL_SETTLEMENT", title: "침하량(cm)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_SETTLEMENT == null) ? '0' : CONSOL_SETTLEMENT #
" }, - { field: "CONSOL_T90", title: "시간계수(sec)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_T90 == null) ? '0' : CONSOL_T90 #
" }, - { field: "CONSOL_E", title: "공극비(e)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_E == null) ? '0' : CONSOL_E #
" }, + { field: "CONSOL_P", title: "하중(${consolP})", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_P == null) ? '0' : String(CONSOL_P).trim() #
" }, + { field: "CONSOL_SETTLEMENT", title: "침하량(cm)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_SETTLEMENT == null) ? '0' : String(CONSOL_SETTLEMENT).trim() #
" }, + { field: "CONSOL_T90", title: "시간계수(sec)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_T90 == null) ? '0' : String(CONSOL_T90).trim() #
" }, + { field: "CONSOL_E", title: "공극비(e)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_E == null) ? '0' : String(CONSOL_E).trim() #
" }, /* { field: "CONSOL_TWOHA", title: "변화된시료높이(cm)", editor: chooseEditor, width:200, attributes: { style:"text-align: right" }, template: "#: kendo.toString(kendo.parseFloat(get('CONSOL_TWOHA')), 'n10') #" }, */ - { field: "CONSOL_TWOHA", title: "변화된시료높이(cm)", editor: chooseEditor, width:200, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_TWOHA == null) ? '0' : CONSOL_TWOHA #
" }, - { field: "CONSOL_AV", title: "압축계수(av,${consolAv})", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_AV == null) ? '0' : CONSOL_AV #
" }, + { field: "CONSOL_TWOHA", title: "변화된시료높이(cm)", editor: chooseEditor, width:200, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_TWOHA == null) ? '0' : String(CONSOL_TWOHA).trim() #
" }, + { field: "CONSOL_AV", title: "압축계수(av,${consolAv})", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_AV == null) ? '0' : String(CONSOL_AV).trim() #
" }, /* { field: "CONSOL_AV", title: "압축계수(av,㎡/kN)", editor: chooseEditor, width:200, attributes: { style:"text-align: right" }, template: "#= CONSOL_AV.toFixed(20) #" }, */ - { field: "CONSOL_CV", title: "압밀계수(Cv,㎠/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_CV == null) ? '0' : CONSOL_CV #
" }, - { field: "CONSOL_MV", title: "체적압축계수(Mv,${consolMv})", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_MV == null) ? '0' : CONSOL_MV #
" }, - { field: "CONSOL_K", title: "투수계수(K,cm/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_K == null) ? '0' : CONSOL_K #
" }, - { field: "CONSOL_RP", title: "1차압밀비", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_RP == null) ? '0' : CONSOL_RP #
" }, + { field: "CONSOL_CV", title: "압밀계수(Cv,㎠/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_CV == null) ? '0' : String(CONSOL_CV).trim() #
" }, + { field: "CONSOL_MV", title: "체적압축계수(Mv,${consolMv})", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_MV == null) ? '0' : Number(String(CONSOL_MV).trim()) #
" }, + { field: "CONSOL_K", title: "투수계수(K,cm/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "
#= (CONSOL_K == null) ? '0' : String(CONSOL_K).trim() #
" }, + { field: "CONSOL_RP", title: "1차압밀비", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "
#= (CONSOL_RP == null) ? '0' : String(CONSOL_RP).trim() #
" }, { field: "idx", hidden: true }, { field: "SAMPLE_CODE", hidden: true}, @@ -863,15 +883,57 @@ function fn_grid_refresh(){ mode: "incell", // 에디트모드 포커스줄수있는 옵션 createAt: "bottom", // row 아래부터 추가,삭제 옵션 }, - edit: function (e) { - // input focus select 옵션 - var input = e.container.find("input"); - input.focus(function (e) { - setTimeout(function () { - input.select(); - }); - }); - }, + save: function(e) { + if (e.values) { + for (var field in e.values) { + var value = e.values[field]; + if (value !== null && value !== undefined) { + // 1. 문자열로 변환 후 앞뒤 공백 및 보이지 않는 문자 제거 + var cleanedValue = String(value).trim().replace(/[\x00-\x1F\x7F-\x9F]/g, ""); + + // 2. 만약 해당 필드가 숫자 타입이어야 한다면 숫자로 재변환 + // fields 설정에서 'number'인 항목들 처리 + var numericFields = ["CONSOL_P", "CONSOL_SETTLEMENT", "CONSOL_T90", "CONSOL_E", "CONSOL_TWOHA", "CONSOL_RP"]; + if (numericFields.includes(field)) { + e.values[field] = Number(cleanedValue) || 0; + } else { + e.values[field] = cleanedValue; + } + } + } + } + }, + edit: function (e) { + var input = e.container.find("input"); + var grid = this; + // e.field가 undefined일 경우를 대비해 컬럼 정보를 직접 가져옵니다. + var fieldName = grid.columns[e.container.index()].field; + + // 1. NumericTextBox 인스턴스가 있는 경우 (숫자 필드) + var numeric = input.data("kendoNumericTextBox"); + if (numeric) { + numeric.bind("change", function() { + var rawVal = numeric.value(); + // 모든 공백 제거 (문자열 변환 후 처리) + var cleanVal = String(rawVal).replace(/\s+/g, ''); + var finalNum = Number(cleanVal); + + // 모델에 직접 반영 (fieldName 사용) + e.model.set(fieldName, isNaN(finalNum) ? 0 : finalNum); + }); + } else { + // 2. 일반 텍스트 필드 (비고 등) + input.on("blur", function() { + var cleanVal = this.value.replace(/\s+/g, ''); + e.model.set(fieldName, cleanVal); + }); + } + + // 포커스 시 전체 선택 로직 유지 + input.focus(function () { + setTimeout(function () { input.select(); }); + }); + }, noRecords: { template: "등록된데이터가 없습니다." },