forked from HANYANG/HANYANG_MES
fix: 검사실적 등록 필드값 변경
This commit is contained in:
parent
234cf697f2
commit
328d1b5f9c
|
|
@ -294,12 +294,13 @@ class Tb_facility_class {
|
||||||
{ formatter: "rownum", title: "NO", width: 50},
|
{ formatter: "rownum", title: "NO", width: 50},
|
||||||
{ field: "FACLT_NM", title: "설비", width: 150, editor: "input" , editable:(cell)=>{ let val = cell.getData(); return val._STATUS_ === 'I' },},
|
{ field: "FACLT_NM", title: "설비", width: 150, editor: "input" , editable:(cell)=>{ let val = cell.getData(); return val._STATUS_ === 'I' },},
|
||||||
{ field: "FACLT_CD", visible: false, width: 150},
|
{ field: "FACLT_CD", visible: false, width: 150},
|
||||||
{ field: "DEFECT_DT", title: "고장일자", width: 150,editor:'date', editorParams:{
|
{ field: "DEFECT_DT", title: "발생일", width: 150,editor:'date', editorParams:{
|
||||||
min:"01/01/2000", // the minimum allowed value for the date picker
|
min:"01/01/2000", // the minimum allowed value for the date picker
|
||||||
max:"02/12/9999", // the maximum allowed value for the date picker
|
max:"02/12/9999", // the maximum allowed value for the date picker
|
||||||
format:"yyyy-MM-dd", // the format of the date value stored in the cell
|
format:"yyyy-MM-dd", // the format of the date value stored in the cell
|
||||||
verticalNavigation:"table"}},
|
verticalNavigation:"table"}},
|
||||||
{ field: "DEFECT_CONTENT", title: "고장내역", width: 150, editor: "input"},
|
{ field: "DEF_TM", title: "발생시간", width: 150, editor: tb_custom_editor.time },
|
||||||
|
{ field: "DEFECT_CONTENT", title: "고장내역", width: 300, editor: "input"},
|
||||||
];
|
];
|
||||||
const commonFieldData = {
|
const commonFieldData = {
|
||||||
headerSort: true,
|
headerSort: true,
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,11 @@ const tb_custom_editor = {
|
||||||
});
|
});
|
||||||
|
|
||||||
function onChange() {
|
function onChange() {
|
||||||
if(input.value.match(/^\d*$/)){ // 숫자만 허용
|
if (input.value.match(/^\d*$/)) {
|
||||||
|
// 숫자만 허용
|
||||||
success(input.value);
|
success(input.value);
|
||||||
} else {
|
} else {
|
||||||
input.value = input.value.replace(/[^0-9]/g, '');
|
input.value = input.value.replace(/[^0-9]/g, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,12 +115,12 @@ time: function(cell, onRendered, success, cancel){
|
||||||
input.style.height = "100%";
|
input.style.height = "100%";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// 변경사항이 완료되면 호출될 함수
|
// 변경사항이 완료되면 호출될 함수
|
||||||
function onChange() {
|
function onChange() {
|
||||||
if (input.value.length === 5) { // 'HH:mm' 형식 확인
|
if (input.value.length === 5) {
|
||||||
|
// 'HH:mm' 형식 확인
|
||||||
success(input.value);
|
success(input.value);
|
||||||
console.log(cell.getValue())
|
console.log(cell.getValue());
|
||||||
} else {
|
} else {
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
|
|
@ -127,13 +128,12 @@ time: function(cell, onRendered, success, cancel){
|
||||||
|
|
||||||
// 입력 이벤트 처리
|
// 입력 이벤트 처리
|
||||||
input.addEventListener("input", function () {
|
input.addEventListener("input", function () {
|
||||||
var value = input.value.replace(/[^0-9]/g, ''); // 숫자만 입력 받음
|
var value = input.value.replace(/[^0-9]/g, ""); // 숫자만 입력 받음
|
||||||
|
|
||||||
if (value.length > 2) {
|
if (value.length > 2) {
|
||||||
value = value.substring(0, 4); // 최대 4자리
|
value = value.substring(0, 4); // 최대 4자리
|
||||||
input.value = value.replace(/(\d{2})(\d{1})/, '$1:$2');
|
input.value = value.replace(/(\d{2})(\d{1})/, "$1:$2");
|
||||||
};
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
input.addEventListener("blur", onChange);
|
input.addEventListener("blur", onChange);
|
||||||
input.addEventListener("keydown", function (e) {
|
input.addEventListener("keydown", function (e) {
|
||||||
|
|
@ -147,8 +147,6 @@ time: function(cell, onRendered, success, cancel){
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const tb_custom_formatter = {
|
const tb_custom_formatter = {
|
||||||
|
|
@ -162,7 +160,10 @@ const tb_custom_formatter = {
|
||||||
},
|
},
|
||||||
|
|
||||||
time: function (cell, formatterParams, onRendered) {
|
time: function (cell, formatterParams, onRendered) {
|
||||||
return cell.getValue().padStart(4, '0').replace(/(\d{2})(\d{2})/, '$1:$2');
|
return cell
|
||||||
|
.getValue()
|
||||||
|
.padStart(4, "0")
|
||||||
|
.replace(/(\d{2})(\d{2})/, "$1:$2");
|
||||||
},
|
},
|
||||||
|
|
||||||
diffTitme: function (cell, formatterParams, onRendered) {
|
diffTitme: function (cell, formatterParams, onRendered) {
|
||||||
|
|
@ -176,16 +177,15 @@ const tb_custom_formatter = {
|
||||||
end = end.plus({ days: 1 });
|
end = end.plus({ days: 1 });
|
||||||
}
|
}
|
||||||
// 시간 차이 계산
|
// 시간 차이 계산
|
||||||
let duration = end.diff(start, 'minutes');
|
let duration = end.diff(start, "minutes");
|
||||||
return duration.minutes; // 분 단위로 반환
|
return duration.minutes; // 분 단위로 반환
|
||||||
} else {
|
} else {
|
||||||
return ""; // Return empty string if either time is missing
|
return ""; // Return empty string if either time is missing
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const tb_custom_validator = {
|
const tb_custom_validator = {
|
||||||
|
|
||||||
onlyString: function (cell, value, parameters) {
|
onlyString: function (cell, value, parameters) {
|
||||||
const regex = /^[가-힣A-Za-z\s]+$/;
|
const regex = /^[가-힣A-Za-z\s]+$/;
|
||||||
|
|
||||||
|
|
@ -202,40 +202,46 @@ const tb_custom_validator = {
|
||||||
const regex = /^[가-힣ㄱ-ㅎㅏ-ㅣA-Za-z0-9\/\-\_\s]+$/;
|
const regex = /^[가-힣ㄱ-ㅎㅏ-ㅣA-Za-z0-9\/\-\_\s]+$/;
|
||||||
|
|
||||||
return regex.test(value);
|
return regex.test(value);
|
||||||
}
|
},
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const formFormat = {
|
const formFormat = {
|
||||||
telInput: function (input) {
|
telInput: function (input) {
|
||||||
let formattedNumber = input.value.replace(/[^0-9]/g, ''); // 숫자만 추출
|
let formattedNumber = input.value.replace(/[^0-9]/g, ""); // 숫자만 추출
|
||||||
// 자동 포맷팅 로직 구현 예시: "123-456-7890" 형식
|
// 자동 포맷팅 로직 구현 예시: "123-456-7890" 형식
|
||||||
if (formattedNumber.length > 10) {
|
if (formattedNumber.length > 10) {
|
||||||
formattedNumber = formattedNumber.slice(0, 3) + '-' + formattedNumber.slice(3, 7) + '-' + formattedNumber.slice(7);
|
formattedNumber =
|
||||||
|
formattedNumber.slice(0, 3) +
|
||||||
|
"-" +
|
||||||
|
formattedNumber.slice(3, 7) +
|
||||||
|
"-" +
|
||||||
|
formattedNumber.slice(7);
|
||||||
} else {
|
} else {
|
||||||
formattedNumber = formattedNumber.slice(0, 3) + '-' + formattedNumber.slice(3, 6) + '-' + formattedNumber.slice(6);
|
formattedNumber =
|
||||||
|
formattedNumber.slice(0, 3) +
|
||||||
|
"-" +
|
||||||
|
formattedNumber.slice(3, 6) +
|
||||||
|
"-" +
|
||||||
|
formattedNumber.slice(6);
|
||||||
}
|
}
|
||||||
input.value = formattedNumber; // 포맷팅된 번호를 입력 필드에 다시 설정
|
input.value = formattedNumber; // 포맷팅된 번호를 입력 필드에 다시 설정
|
||||||
},
|
},
|
||||||
|
|
||||||
inNumInput: function (input) {
|
inNumInput: function (input) {
|
||||||
let formattedNumber = input.value.replace(/[^0-9]/g, ''); // 숫자만 추출
|
let formattedNumber = input.value.replace(/[^0-9]/g, ""); // 숫자만 추출
|
||||||
// 자동 포맷팅 로직 구현 예시: "123-456-7890" 형식
|
// 자동 포맷팅 로직 구현 예시: "123-456-7890" 형식
|
||||||
formattedNumber = formattedNumber.slice(0, 6) + '-' + formattedNumber.slice(6,13);
|
formattedNumber =
|
||||||
|
formattedNumber.slice(0, 6) + "-" + formattedNumber.slice(6, 13);
|
||||||
input.value = formattedNumber; // 포맷팅된 번호를 입력 필드에 다시 설정
|
input.value = formattedNumber; // 포맷팅된 번호를 입력 필드에 다시 설정
|
||||||
},
|
},
|
||||||
|
|
||||||
alphanumeric: function (input) {
|
alphanumeric: function (input) {
|
||||||
input.value = input.value.toUpperCase().replace(/[^A-Z0-9]/g, '');
|
input.value = input.value.toUpperCase().replace(/[^A-Z0-9]/g, "");
|
||||||
},
|
},
|
||||||
|
|
||||||
submitValidate: function () {
|
submitValidate: function () {
|
||||||
let isValid = true;
|
let isValid = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return isValid;
|
return isValid;
|
||||||
}
|
},
|
||||||
|
};
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue