166 lines
7.3 KiB
JavaScript
166 lines
7.3 KiB
JavaScript
|
|
|
|
var tableErrorData = [];
|
|
var tableErrorCheckData = [];
|
|
var addrMassDupliSaveList = null;
|
|
|
|
var gArrRestartIndex = 0; //배열 재시작카운드
|
|
var gNameList = []; //치환문자 이름
|
|
var gPhoneList = []; //받는사람
|
|
var gInfo1List = []; //치환문자1
|
|
var gInfo2List = []; //치환문자2
|
|
var gInfo3List = []; //치환문자3
|
|
var gInfo4List = []; //치환문자4
|
|
var gMemoList = []; //메모
|
|
|
|
|
|
var $tableExcel = null; //엑셀입력 탭
|
|
var $tableClip = null; //붙여넣기 탭
|
|
var $tableSelf = null; //붙여넣기 탭
|
|
|
|
var $tableError = null; //에러 팝업 영역
|
|
|
|
$(document).ready(function(){
|
|
|
|
//Tabulator AJAX Data Loading
|
|
$tableExcel = new Tabulator("#tabulator_excel", {
|
|
height:"255px",
|
|
width:"100%",
|
|
layout:"fitColumns",
|
|
autoColumns:false,
|
|
headerHozAlign:"center",
|
|
validationMode:"highlight",
|
|
clipboard:false,
|
|
clipboardCopySelector:"table",
|
|
clipboardPasteAction:"insert", // insert, update, replace
|
|
placeholder:"Excel 파일을 업로드 해주세요.", //fit columns to width of table (optional)
|
|
columns:[ //Define Table Columns
|
|
{formatter:"rowSelection", titleFormatter:"rowSelection",clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){
|
|
cell.getRow().toggleSelect();
|
|
}
|
|
},
|
|
{formatter:"rownum", align:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
{title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"D", field:"D", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"E", field:"E", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"F", field:"F", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"G", field:"G", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]}
|
|
],
|
|
validationFailed:function(cell, value, parameters){ // 유효성 체크 함수
|
|
var valid = cell.isValid();
|
|
if(!valid){
|
|
alert("양식에 맞지 않는 정보가 입력되었습니다.");
|
|
|
|
//해당 셀 데이터 삭제
|
|
cell.setValue("");
|
|
}
|
|
return value % parameters.phone;
|
|
},
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$tableClip = new Tabulator("#tabulator_clip", {
|
|
height:"255px",
|
|
width:"100%",
|
|
layout:"fitColumns",
|
|
editor:true,
|
|
headerHozAlign:"center",
|
|
validationMode:"highlight",
|
|
placeholder:"복사(Ctrl+C)한 내용을 여기에 붙여넣기(Ctrl+V) 해주세요.", //fit columns to width of table (optional)
|
|
clipboard:true, // 클립보드 기능 활성화
|
|
clipboardPasteAction:"update", // insert, update, replace
|
|
clipboardPasteParser: function(clipboard) {
|
|
/*console.log('clipboard: ', clipboard); // 클립보드의 원본 내용 확인
|
|
|
|
var rows = clipboard.split('\n').map(row => {
|
|
var cells = row.split(/[\t,]+/).map(cell => cell.trim());
|
|
return cells;
|
|
}).filter(row => Array.isArray(row) && row.some(cell => cell !== ""));
|
|
|
|
console.log('파싱된 rows: ', rows); // 파싱된 행 데이터 확인
|
|
|
|
var tableData = rows.map(row => {
|
|
return {
|
|
A: row[0] || "",
|
|
B: row[1] || "",
|
|
C: row[2] || "",
|
|
D: row[3] || "",
|
|
E: row[4] || "",
|
|
F: row[5] || "",
|
|
G: row[6] || ""
|
|
};
|
|
});
|
|
|
|
console.log('새로 추가될 데이터: ', tableData); // 추가될 데이터 확인
|
|
|
|
// 기존 테이블 데이터를 가져와서 병합
|
|
var existingData = $tableClip.getData(); // 기존 데이터를 가져옴
|
|
console.log('기존 : ', existingData);
|
|
var combinedData = existingData.concat(tableData); // 기존 데이터에 새로운 데이터 추가
|
|
console.log('병합 : ', combinedData);
|
|
|
|
return combinedData; // 병합된 데이터를 반환하여 기존 데이터 아래에 추가되도록 함
|
|
*/ },
|
|
columns: [
|
|
{formatter: "rowSelection", titleFormatter: "rowSelection", clipboard: false, hozAlign: "center", headerHozAlign: "center", headerSort: false, cellClick: function(e, cell) {
|
|
cell.getRow().toggleSelect();
|
|
}},
|
|
{formatter:"rownum", align:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
{title:"A", field:"A", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"B", field:"B", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"C", field:"C", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"D", field:"D", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"E", field:"E", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"F", field:"F", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
{title:"G", field:"G", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]}
|
|
],
|
|
validationFailed:function(cell, value, parameters){ // 유효성 체크 함수
|
|
var valid = cell.isValid();
|
|
if(!valid){
|
|
alert("양식에 맞지 않는 정보가 입력되었습니다.");
|
|
|
|
//해당 셀 데이터 삭제
|
|
cell.setValue("");
|
|
}
|
|
return value % parameters.phone;
|
|
},
|
|
});
|
|
|
|
|
|
//Tabulator AJAX Data Loading
|
|
$tableError = new Tabulator("#tabulator_error", {
|
|
height:"255px",
|
|
width:"100%",
|
|
layout:"fitColumns",
|
|
autoColumns:false,
|
|
headerHozAlign:"center",
|
|
validationMode:"highlight",
|
|
clipboard:false,
|
|
clipboardCopySelector:"table",
|
|
clipboardPasteAction:"insert", // insert, update, replace
|
|
placeholder:"Excel 파일을 업로드 해주세요.", //fit columns to width of table (optional)
|
|
columns:[ //Define Table Columns
|
|
// {formatter:"rowSelection", titleFormatter:"rowSelection",clipboard:false, hozAlign:"center", headerSort:false, cellClick:function(e, cell){
|
|
// cell.getRow().toggleSelect();
|
|
// }
|
|
// },
|
|
// {formatter:"rownum", align:"center" ,title:"No", hozAlign:"center", headerHozAlign:"center", width:40},
|
|
{title:"이름", field:"name", hozAlign:"center", headerHozAlign: "center", width:125},
|
|
{title:"휴대폰", field:"phone", hozAlign:"center", headerHozAlign: "center", width:158},
|
|
{title:"미등록 결과", field:"result", hozAlign:"center", headerHozAlign: "center", width:125}
|
|
// {title:"이름", field:"name", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
// {title:"휴대폰", field:"phone", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
// {title:"미등록 결과", field:"result", hozAlign:"center", headerHozAlign: "center", width:125, validator:["maxLength:100", "string"]},
|
|
]
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
});
|