feat: 토사시헙 > 압밀시험에서 체적압축계수 앞 뒤공백이 존재할 경우 제거

main
thkim 2026-03-17 13:49:35 +09:00
parent ab91d39ac4
commit a64c495f5b
2 changed files with 84 additions and 22 deletions

View File

@ -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 {

View File

@ -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) + "</" + keys2[k] + ">\r\n";
// row2.CONSOL_MV 값을 가져올 때 모든 공백을 제거
var cleanVal = String(isNumNull(row2.CONSOL_MV)).replace(/\s+/g, '');
strData2 += "<" + keys2[k] + ">" + cleanVal + "</" + keys2[k] + ">\r\n";
}else if(keys2[k] == "CONSOL_P"){
strData2 += "<" + keys2[k] + ">" + isNumNull(row2.CONSOL_P) + "</" + keys2[k] + ">\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: "<div class='td-data'>#= (CONSOL_P == null) ? '0' : CONSOL_P #</div>" },
{ field: "CONSOL_SETTLEMENT", title: "침하량(cm)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_SETTLEMENT == null) ? '0' : CONSOL_SETTLEMENT #</div>" },
{ field: "CONSOL_T90", title: "시간계수(sec)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_T90 == null) ? '0' : CONSOL_T90 #</div>" },
{ field: "CONSOL_E", title: "공극비(e)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_E == null) ? '0' : CONSOL_E #</div>" },
{ field: "CONSOL_P", title: "하중(${consolP})", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_P == null) ? '0' : String(CONSOL_P).trim() #</div>" },
{ field: "CONSOL_SETTLEMENT", title: "침하량(cm)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_SETTLEMENT == null) ? '0' : String(CONSOL_SETTLEMENT).trim() #</div>" },
{ field: "CONSOL_T90", title: "시간계수(sec)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_T90 == null) ? '0' : String(CONSOL_T90).trim() #</div>" },
{ field: "CONSOL_E", title: "공극비(e)", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_E == null) ? '0' : String(CONSOL_E).trim() #</div>" },
/* { 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: "<div class='td-data'>#= (CONSOL_TWOHA == null) ? '0' : CONSOL_TWOHA #</div>" },
{ field: "CONSOL_AV", title: "압축계수(av,${consolAv})", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_AV == null) ? '0' : CONSOL_AV #</div>" },
{ field: "CONSOL_TWOHA", title: "변화된시료높이(cm)", editor: chooseEditor, width:200, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_TWOHA == null) ? '0' : String(CONSOL_TWOHA).trim() #</div>" },
{ field: "CONSOL_AV", title: "압축계수(av,${consolAv})", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_AV == null) ? '0' : String(CONSOL_AV).trim() #</div>" },
/* { 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: "<div class='td-data'>#= (CONSOL_CV == null) ? '0' : CONSOL_CV #</div>" },
{ field: "CONSOL_MV", title: "체적압축계수(Mv,${consolMv})", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_MV == null) ? '0' : CONSOL_MV #</div>" },
{ field: "CONSOL_K", title: "투수계수(K,cm/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_K == null) ? '0' : CONSOL_K #</div>" },
{ field: "CONSOL_RP", title: "1차압밀비", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_RP == null) ? '0' : CONSOL_RP #</div>" },
{ field: "CONSOL_CV", title: "압밀계수(Cv,㎠/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_CV == null) ? '0' : String(CONSOL_CV).trim() #</div>" },
{ field: "CONSOL_MV", title: "체적압축계수(Mv,${consolMv})", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_MV == null) ? '0' : Number(String(CONSOL_MV).trim()) #</div>" },
{ field: "CONSOL_K", title: "투수계수(K,cm/sec)", width:"auto", attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_K == null) ? '0' : String(CONSOL_K).trim() #</div>" },
{ field: "CONSOL_RP", title: "1차압밀비", editor: chooseEditor, width:100, attributes: { style:"text-align: right" }, template: "<div class='td-data'>#= (CONSOL_RP == null) ? '0' : String(CONSOL_RP).trim() #</div>" },
{ 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: "등록된데이터가 없습니다."
},