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,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const tb_custom_editor = {
|
||||||
return editor;
|
return editor;
|
||||||
},
|
},
|
||||||
|
|
||||||
upper: function(cell, onRendered, success, cancel) {
|
upper: function (cell, onRendered, success, cancel) {
|
||||||
// input 요소 생성
|
// input 요소 생성
|
||||||
var input = document.createElement("input");
|
var input = document.createElement("input");
|
||||||
input.setAttribute("type", "text");
|
input.setAttribute("type", "text");
|
||||||
|
|
@ -68,87 +68,85 @@ const tb_custom_editor = {
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
|
|
||||||
onlyNumber: function(cell, onRendered, success, cancel){
|
onlyNumber: function (cell, onRendered, success, cancel) {
|
||||||
// 입력 요소 생성
|
// 입력 요소 생성
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
input.setAttribute("type", "text");
|
input.setAttribute("type", "text");
|
||||||
input.style.width = "100%";
|
input.style.width = "100%";
|
||||||
input.value = cell.getValue() ? cell.getValue() : "";
|
input.value = cell.getValue() ? cell.getValue() : "";
|
||||||
|
|
||||||
onRendered(function(){
|
onRendered(function () {
|
||||||
input.focus();
|
input.focus();
|
||||||
input.style.height = "100%";
|
input.style.height = "100%";
|
||||||
});
|
});
|
||||||
|
|
||||||
function onChange(){
|
function onChange() {
|
||||||
if(input.value.match(/^\d*$/)){ // 숫자만 허용
|
if (input.value.match(/^\d*$/)) {
|
||||||
success(input.value);
|
// 숫자만 허용
|
||||||
}else{
|
success(input.value);
|
||||||
input.value = input.value.replace(/[^0-9]/g, '');
|
} else {
|
||||||
}
|
input.value = input.value.replace(/[^0-9]/g, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
input.addEventListener("blur", onChange);
|
input.addEventListener("blur", onChange);
|
||||||
input.addEventListener("keydown", function(e){
|
input.addEventListener("keydown", function (e) {
|
||||||
if(e.keyCode == 13){
|
if (e.keyCode == 13) {
|
||||||
onChange();
|
onChange();
|
||||||
}
|
}
|
||||||
if(e.keyCode == 27){
|
if (e.keyCode == 27) {
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
},
|
},
|
||||||
|
|
||||||
time: function(cell, onRendered, success, cancel){
|
time: function (cell, onRendered, success, cancel) {
|
||||||
// 입력 요소 생성
|
// 입력 요소 생성
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
input.setAttribute("type", "text");
|
input.setAttribute("type", "text");
|
||||||
input.style.width = "100%";
|
input.style.width = "100%";
|
||||||
input.value = cell.getValue() ? cell.getValue() : "";
|
input.value = cell.getValue() ? cell.getValue() : "";
|
||||||
|
|
||||||
onRendered(function(){
|
onRendered(function () {
|
||||||
input.focus();
|
input.focus();
|
||||||
input.select();
|
input.select();
|
||||||
input.style.height = "100%";
|
input.style.height = "100%";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 변경사항이 완료되면 호출될 함수
|
||||||
// 변경사항이 완료되면 호출될 함수
|
function onChange() {
|
||||||
function onChange(){
|
if (input.value.length === 5) {
|
||||||
if (input.value.length === 5) { // 'HH:mm' 형식 확인
|
// 'HH:mm' 형식 확인
|
||||||
success(input.value);
|
success(input.value);
|
||||||
console.log(cell.getValue())
|
console.log(cell.getValue());
|
||||||
} else {
|
} else {
|
||||||
cancel();
|
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("keydown", function(e){
|
|
||||||
if(e.keyCode == 13){
|
|
||||||
onChange();
|
|
||||||
}
|
}
|
||||||
if(e.keyCode == 27){
|
});
|
||||||
cancel();
|
input.addEventListener("blur", onChange);
|
||||||
|
input.addEventListener("keydown", function (e) {
|
||||||
|
if (e.keyCode == 13) {
|
||||||
|
onChange();
|
||||||
}
|
}
|
||||||
});
|
if (e.keyCode == 27) {
|
||||||
|
cancel();
|
||||||
return input;
|
}
|
||||||
},
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return input;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const tb_custom_formatter = {
|
const tb_custom_formatter = {
|
||||||
|
|
@ -161,11 +159,14 @@ const tb_custom_formatter = {
|
||||||
return tgt.getValue();
|
return tgt.getValue();
|
||||||
},
|
},
|
||||||
|
|
||||||
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) {
|
||||||
let startTime = cell.getRow().getCell("OPER_ST_TM").getValue();
|
let startTime = cell.getRow().getCell("OPER_ST_TM").getValue();
|
||||||
let endTime = cell.getRow().getCell("OPER_ED_TM").getValue();
|
let endTime = cell.getRow().getCell("OPER_ED_TM").getValue();
|
||||||
if (startTime && endTime) {
|
if (startTime && endTime) {
|
||||||
|
|
@ -173,69 +174,74 @@ const tb_custom_formatter = {
|
||||||
let end = luxon.DateTime.fromFormat(endTime, "HH:mm");
|
let end = luxon.DateTime.fromFormat(endTime, "HH:mm");
|
||||||
// 날짜가 반전되는 경우를 처리 (예: 밤샘)
|
// 날짜가 반전되는 경우를 처리 (예: 밤샘)
|
||||||
if (end < start) {
|
if (end < start) {
|
||||||
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]+$/;
|
||||||
|
|
||||||
return regex.test(value);
|
return regex.test(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
onlyEnglish: function(cell, value, parameters){
|
onlyEnglish: function (cell, value, parameters) {
|
||||||
const regex = /^[A-Za-z\s]+$/;
|
const regex = /^[A-Za-z\s]+$/;
|
||||||
|
|
||||||
return regex.test(value);
|
return regex.test(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
stringNumeric: function(cell, value, parameters){
|
stringNumeric: function (cell, value, parameters) {
|
||||||
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