forked from HANYANG/HANYANG_MES
1026 lines
43 KiB
JavaScript
1026 lines
43 KiB
JavaScript
FilePond.registerPlugin(FilePondPluginFileValidateSize);
|
|
|
|
//Grid용 클래스. 블록 처리용
|
|
class Tb_class_Order {
|
|
constructor(){
|
|
let _this = this;
|
|
_this.tblList = "";
|
|
_this.ajax_url = "./registration.ajax.php";
|
|
_this.clickData = null;
|
|
}
|
|
|
|
//리스트 로드
|
|
getMainList (sdata) {
|
|
let _this = this;
|
|
|
|
let talert = window.setTimeout(function () { _this.tblList.alert("Loading ...") }, 1000); //1초 이상 지연되면 로딩 출력
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: {
|
|
mode: 'getOrderList',
|
|
BP_CD: sdata?.BP_CD||'',
|
|
SO_DT_ST: sdata?.SO_DT_ST||'',
|
|
SO_DT_ED: sdata?.SO_DT_ED||'',
|
|
MNG_NO: sdata?.MNG_NO||'',
|
|
SALES_GRP: sdata?.SALES_GRP||'',
|
|
SO_TYPE_I: (document.getElementById("S_SO_TYPE_I").checked?"I":""),
|
|
SO_TYPE_E: (document.getElementById("S_SO_TYPE_E").checked?"E":""),
|
|
OFLD: sdata?.OFLD||'',
|
|
OASC: sdata?.OASC||'',
|
|
LINE_NUM: sdata?.LINE_NUM||'',
|
|
NOW_PAGE: sdata?.NOW_PAGE||'',
|
|
},
|
|
success: function (data) {
|
|
if (data.code) {
|
|
_this.tblList.setData(data.data);
|
|
|
|
_this.tblList.getRows().forEach(row=>row.getData()['DTL_CNT'] && row.getCell('CHECK').getElement().querySelector('input').setAttribute('disabled',true)); //진행된 수주현항 선택 못하도록 처리
|
|
|
|
//page
|
|
putPagiNation({
|
|
...sdata,
|
|
TARGET: ".tabulator-footer-contents",
|
|
PREB_PAGE: data?.data[0]?.PREB_PAGE,
|
|
NEXB_PAGE: data?.data[0]?.NEXB_PAGE,
|
|
LAST_PAGE: data?.data[0]?.LAST_PAGE,
|
|
PAGE_LISTS: data?.data[0]?.PAGE_LISTS?.split('|'),
|
|
callback: (conf)=>{
|
|
_this.getMainList({
|
|
BP_CD: conf?.BP_CD||'',
|
|
SO_DT_ST: conf?.SO_DT_ST||'',
|
|
SO_DT_ED: conf?.SO_DT_ED||'',
|
|
MNG_NO: conf?.MNG_NO||'',
|
|
SALES_GRP: conf?.SALES_GRP||'',
|
|
SO_TYPE_I: conf?.SO_TYPE_I||'',
|
|
SO_TYPE_E: conf?.SO_TYPE_E||'',
|
|
OFLD: conf?.OFLD||'',
|
|
OASC: conf?.OASC||'',
|
|
LINE_NUM: conf?.LINE_NUM||'',
|
|
NOW_PAGE: conf?.NOW_PAGE||'',
|
|
});
|
|
}
|
|
});
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {
|
|
window.clearTimeout(talert);
|
|
_this.tblList.clearAlert();
|
|
Tb_funcs_Order.setFilter();
|
|
}
|
|
});
|
|
return true;
|
|
};
|
|
|
|
//Row 클릭 콜백
|
|
rowClick (e, tgt){
|
|
let _this = this;
|
|
let rowData = tgt.getData();
|
|
_this.clickData = rowData;
|
|
|
|
Tb_funcs_Detail.getMainList(rowData);
|
|
Tb_funcs_Att.getMainList(rowData);
|
|
jQuery(tgt.getElement()).siblings().removeClass("user-checked");
|
|
tgt.getElement().classList.add("user-checked");
|
|
|
|
if( rowData.SO_NO ){
|
|
$("#btnCopyDetail").attr("disabled", false);
|
|
$("#btnAddDetail" ).attr("disabled", false);
|
|
$("#btnDelDetail" ).attr("disabled", false);
|
|
$("#btnPutDetail" ).attr("disabled", false);
|
|
|
|
$("#btnAddFile").attr("disabled", false);
|
|
$("#btnDelFile").attr("disabled", false);
|
|
$("#btnPutFile").attr("disabled", false);
|
|
}else{
|
|
$("#btnCopyDetail").attr("disabled", true);
|
|
$("#btnPasteDetail").attr("disabled", true);
|
|
$("#btnAddDetail" ).attr("disabled", true);
|
|
$("#btnDelDetail" ).attr("disabled", true);
|
|
$("#btnPutDetail" ).attr("disabled", true);
|
|
|
|
$("#btnAddFile").attr("disabled", true);
|
|
$("#btnDelFile").attr("disabled", true);
|
|
$("#btnPutFile").attr("disabled", true);
|
|
}
|
|
};
|
|
|
|
setFilter () {
|
|
return false;
|
|
|
|
let _this = this;
|
|
let stdate = document.getElementById("S_SO_DT_ST").value;
|
|
let endate = document.getElementById("S_SO_DT_ED").value;
|
|
let stI = document.getElementById("S_SO_TYPE_I").checked?"I":"";
|
|
let stO = document.getElementById("S_SO_TYPE_E").checked?"E":"";
|
|
|
|
_this.tblList.setFilter(function(data){ //필터링
|
|
return (
|
|
true
|
|
&& ( !document.getElementById("S_BP_NM") || ( (data.ORDR_BP_CD+"|"+data.ORDR_BP_NM).search(document.getElementById("S_BP_NM").value) !== -1 ) )
|
|
&& ( !document.getElementById("S_SO_NO") || ( (data.SO_NO).search(document.getElementById("S_SO_NO").value) !== -1 ) )
|
|
&& ( !document.getElementById("S_SALES_GRP") || ( (data.SALES_GRP).search(document.getElementById("S_SALES_GRP").value) !== -1 ) )
|
|
&& ( (!stdate || stdate <= data['SO_DT']) && (!endate || endate >= data['SO_DT']) )
|
|
&& (( stI == data['SO_TYPE'] ) || ( stO == data['SO_TYPE'] ) )
|
|
)
|
|
}, '=', true);
|
|
};
|
|
|
|
//Row 추가
|
|
addRow(){
|
|
let _this = this;
|
|
_this.tblList.addRow({SO_TYPE:'I',_STATUS_:'I'},true);
|
|
}
|
|
|
|
//Cell 클릭 콜백
|
|
cellClick (e, tgt){
|
|
let _this = this;
|
|
_this.tgt = tgt;
|
|
|
|
switch( tgt.getField() ){
|
|
case "ORDR_BP_NM":
|
|
popPartnerList({tgt_id:'ORDR_BP_CD', tgt_name:'ORDR_BP_NM', tgt_currency:'CURRENCY_CD', tgt_chname:'CUST_PRSN_NM', tgt_chmail:'CUST_EMAIL', tgt_chtel:'CUST_TEL_NO', tgt_chcell:'CUST_CELL_NO', tgt_chfax:'CUST_FAX_NO', tgt_filter:'#sgrp', txt_filter:tgt.getData()['SALES_GRP']}, tgt.getRow()._row);
|
|
break;
|
|
case "DLVY_BP_NM":
|
|
popPartnerList({tgt_id:'DLVY_BP_CD', tgt_name:'DLVY_BP_NM'}, tgt.getRow()._row);
|
|
break;
|
|
case "TRANS_FEE":
|
|
case "CUSTOM_FEE":
|
|
tgt.setValue( tgt.getValue() == "Y"?"N":"Y" );
|
|
break;
|
|
case "SO_TYPE":
|
|
break;
|
|
}
|
|
};
|
|
|
|
//Cell 변경 콜백
|
|
cellEdited (cell){
|
|
let _this = this;
|
|
cell.getData()._STATUS_ = cell.getData()._STATUS_||'U';
|
|
};
|
|
|
|
//sort
|
|
columnSort(e,tgt) {
|
|
let _this = this;
|
|
let sorters = tgt.getTable().getSorters()[0];
|
|
_this.getMainList({..._this.searchData,OFLD:sorters?.field,OASC:sorters?.dir});
|
|
};
|
|
|
|
popBP () {
|
|
let _this = this;
|
|
|
|
popPartnerList({tgt_id:'#S_BP_CD',tgt_name:'#S_BP_NM'});
|
|
};
|
|
|
|
// 스펙정보 등록
|
|
putOrder (){
|
|
let _this = this;
|
|
let postdata = {
|
|
'mode': 'putOrderList',
|
|
'reqdata': JSON.stringify(_this.tblList.getData().filter(row=> row._STATUS_)),
|
|
};
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: postdata,
|
|
success: function (data) {
|
|
if (data.code) {
|
|
kuls_success("저장되었습니다.");
|
|
_this.getMainList();
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {
|
|
}
|
|
});
|
|
return true;
|
|
};
|
|
|
|
delOrder (){
|
|
let _this = this;
|
|
_this.tblList.getSelectedRows().forEach(row => {
|
|
row.update({_STATUS_:'D'});
|
|
row.getElement().classList.add("del-row");
|
|
});
|
|
};
|
|
|
|
//시작 실행
|
|
init () {
|
|
let _this = this;
|
|
let currow = Object.keys(varsCurrency).reduce( (param,key) => {param[key] = `${key} (${varsCurrency[key]})`; return param;}, {});
|
|
|
|
const fields = [
|
|
{ field: "CHECK",formatter:"rowSelection", titleFormatter: "rowSelection", title: "No", width: "4%", noxls:true },
|
|
{ field: "SO_NO", title: "관리번호", width: "10%", headerFilterPlaceholder:"자동채번", headerSort: true, formatter: (cell)=>{ return cell.getValue()||"<span class='text-secondary'>자동채번</span>" }},
|
|
{ field: "SO_DT", title: "수주일", width: "7%", editor:'date', editorParams: {max:'9999-12-31'}, headerSort: true, },
|
|
{ field: "ORDR_BP_NM", title: "거래처", width: "10%", editor:'input', headerSort: true, },
|
|
{ field: "SO_NET_AMT", title: "수주금액", width: "8%", formatter: "money", formatterParams:{precision:false},},
|
|
{ field: "SO_NET_AMT_LOC", title: "수주금액<br>(원화)", width: "8%", formatter: "money", formatterParams:{precision:false}, },
|
|
{ field: "SALES_GRP", title: "영업구분", width: "7%", editor:'list', cssClass:"user-list", editorParams: {values: varsSALES_GRP,},
|
|
formatter: tb_common_funtions.formatterSelect, formatterParams: {values: varsSALES_GRP,}, },
|
|
{ field: "SO_TYPE", title: "내수/수출", width: "10%", cssClass:'user-editable', formatter: tb_common_funtions.formatterMultiCheckBox, formatterParams: {class:'', type:'radio', default:'I', inputs:[
|
|
{title:' 내수', name:'SO_TYPE', value:'I', class:'form_checkbox_before', },
|
|
{title:' 수출', name:'SO_TYPE', value:'E', class:'green form_checkbox_before ml-2', }
|
|
]}},
|
|
{ field: "DEAL_TYPE", title: "가격조건", width: "6%", editor:'list', cssClass:"user-list", editorParams: {values: varsDEAL_TYPE,},
|
|
formatter: tb_common_funtions.formatterSelect, formatterParams: {values: varsDEAL_TYPE,}, },
|
|
{ field: "PAY_METH", title: "결제방법", width: "6%", editor:'list', cssClass:"user-list", editorParams: {values: varsPAY_METH,},
|
|
formatter: tb_common_funtions.formatterSelect, formatterParams: {values: varsPAY_METH,}, },
|
|
{ field: "", title: "결제조건", width: "20%",
|
|
columns:[
|
|
{ field:"PAY_TERM_DOWN", title:"선금", hozAlign:"center", width:"6%", editor:'input', formatter:"money", formatterParams:{precision:false}, },
|
|
{ field:"PAY_TERM_INTR1", title:"중도금1", hozAlign:"center", width:"6%", editor:'input', formatter:"money", formatterParams:{precision:false}, },
|
|
{ field:"PAY_TERM_INTR2", title:"중도금2", hozAlign:"center", width:"6%", editor:'input', formatter:"money", formatterParams:{precision:false}, },
|
|
{ field:"PAY_TERM_REMD", title:"잔금", hozAlign:"center", width:"6%", editor:'input', formatter:"money", formatterParams:{precision:false}, },
|
|
],
|
|
},
|
|
{ field: "CURRENCY_CD", title: "화폐", width: "7%", editor:'list', cssClass:"user-list", editorParams:{ values: currow },
|
|
formatter: tb_common_funtions.formatterSelect, formatterParams: { values: currow }, },
|
|
{ field: "", title: "추가비용", width: "10%",
|
|
columns:[
|
|
{ field:"TRANS_FEE", title:"운송비", hozAlign:"center", width:"5%", cssClass:'user-editable', formatter: tb_common_funtions.formatterToggleboxGreenIcon, formatterParams: {checkval:'Y'}, },
|
|
{ field:"CUSTOM_FEE", title:"관세", hozAlign:"center", width:"5%", cssClass:'user-editable', formatter: tb_common_funtions.formatterToggleboxGreenIcon, formatterParams: {checkval:'Y'}, },
|
|
],
|
|
},
|
|
{ field: "SPECFIC_DOC", title: "시방서", width: "10%", editor:'input', },
|
|
{ field: "DLVY_BP_NM", title: "납품처", width: "10%", editor:'input', },
|
|
{ field: "", title: "거래처연락처", width: "30%",
|
|
columns:[
|
|
{ field:"CUST_PRSN_NM", title:"담당자", hozAlign:"center", width:"6%", editor:'input', },
|
|
{ field:"CUST_EMAIL", title:"이메일", hozAlign:"center", width:"6%", editor:'input', },
|
|
{ field:"CUST_TEL_NO", title:"전화번호", hozAlign:"center", width:"6%", editor:'input', },
|
|
{ field:"CUST_CELL_NO", title:"휴대폰", hozAlign:"center", width:"6%", editor:'input', },
|
|
{ field:"CUST_FAX_NO", title:"FAX", hozAlign:"center", width:"6%", editor:'input', },
|
|
],
|
|
},
|
|
{ field: "CUST_PO_NO", title: "고객 PO NO", width: "10%", editor:'input', },
|
|
{ field: "ESTM_NO", title: "견적번호", width: "10%", },
|
|
{ field: "REMK", title: "비고", width: "10%", editor:'input', },
|
|
];
|
|
|
|
_this.tblList = new Tabulator("#tblOrderList",{
|
|
layout: "fitColumns",
|
|
height: "100%",
|
|
data: [], //기본 데이터
|
|
columns: fields, //컬럼 설정
|
|
columnDefaults: { //컬럼 공통 규칙
|
|
sorter:()=>{},
|
|
headerSort: false,
|
|
vertAlign: "middle",
|
|
hozAlign: "center",
|
|
resizable: "header",//Resize 는 헤더에서만 가능
|
|
headerHozAlign: "center", //헤더 정렬
|
|
headerSortTristate: true, //데이터 정렬 => 정/역/초기화
|
|
},
|
|
footerElement:'<ul class="pagination justify-content-center align-items-center mb-1"><li><a class="pn_link npage btn btn-light"><span class="f_page">1</span></a></li></ul>',
|
|
headerSortElement: "<i class='bi'></i>", //정렬 아이콘
|
|
});
|
|
|
|
_this.tblList.on("tableBuilt", () => { //Tabulator 초기 데이터 불러오기 이벤트
|
|
_this.getMainList({SO_TYPE_I:'I',SO_TYPE_E:'E'});
|
|
});
|
|
_this.tblList.on("rowClick", (e,tgt) => { //Tabulator Row Click
|
|
_this.rowClick && _this.rowClick(e,tgt);
|
|
});
|
|
_this.tblList.on("cellClick", (e,tgt) => { //Tabulator cell Click
|
|
_this.cellClick && _this.cellClick(e,tgt);
|
|
});
|
|
_this.tblList.on("cellEdited", (cell) => { //Tabulator cell Edited
|
|
_this.cellEdited && _this.cellEdited(cell);
|
|
});
|
|
_this.tblList.on("headerClick", (e,tgt) => { //Tabulator cell Edited
|
|
_this.columnSort && _this.columnSort(e,tgt);
|
|
});
|
|
_this.tblList.on("rowSelected", (row) => { //Tabulator cell Deslected
|
|
if( row.getData()['DTL_CNT'] ){
|
|
row.getTable().deselectRow(row);
|
|
}
|
|
});
|
|
|
|
['click','keypress'].forEach(evt => document.querySelector("#bntListSearch").addEventListener(evt,()=>{
|
|
_this.searchData = {
|
|
BP_CD: document.querySelector('#S_BP_CD').value||'',
|
|
SO_DT_ST: document.querySelector('#S_SO_DT_ST').value||'',
|
|
SO_DT_ED: document.querySelector('#S_SO_DT_ED').value||'',
|
|
MNG_NO: document.querySelector('#S_MNG_NO').value||'',
|
|
SALES_GRP: document.querySelector('#S_SALES_GRP').value||'',
|
|
SO_TYPE_I: document.querySelector('#S_SO_TYPE_I').checked?'I':'',
|
|
SO_TYPE_E: document.querySelector('#S_SO_TYPE_E').checked?'E':'',
|
|
LINE_NUM: document.querySelector('#S_LINE_NUM').value||'',
|
|
NOW_PAGE: 1,
|
|
}
|
|
|
|
_this.getMainList(_this.searchData)
|
|
}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnAddOrder").addEventListener(evt,()=>{_this.addRow()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnDelOrder").addEventListener(evt,()=>{_this.delOrder()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnPutOrder").addEventListener(evt,()=>{_this.putOrder()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnExcelDown").addEventListener(evt,()=>{_this.excelDataLoad(_this.tblList,'수주현황')}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnObDown").addEventListener(evt,()=>{_this.excelDataLoad(_this.tblList,'수주대장', 'ob')}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#S_BP_NM").addEventListener(evt,()=>{_this.popBP()}));
|
|
['change','keydown','keyup'].forEach(evt => document.querySelectorAll("#S_BP_NM, #S_SO_DT_ST, #S_SO_DT_ED, #S_SO_NO, #S_SALES_GRP, #S_SO_TYPE_I, #S_SO_TYPE_E").forEach(tgt=>tgt.addEventListener(evt,()=>{Tb_funcs_Order.setFilter()})));
|
|
};
|
|
|
|
excelDataLoad(table_block, title, docType = 'list') { //페이징 처리된 리스트에서 엑셀 전체 다운
|
|
let _this = this;
|
|
let sdata = _this.searchData;
|
|
let filename = title + "_"+luxon.DateTime.now().toFormat('yyyyMMdd');
|
|
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: {
|
|
mode: 'getOrderList',
|
|
BP_CD: sdata?.BP_CD||'',
|
|
SO_DT_ST: sdata?.SO_DT_ST||'',
|
|
SO_DT_ED: sdata?.SO_DT_ED||'',
|
|
MNG_NO: sdata?.MNG_NO||'',
|
|
SALES_GRP: sdata?.SALES_GRP||'',
|
|
SO_TYPE_I: (document.getElementById("S_SO_TYPE_I").checked?"I":""),
|
|
SO_TYPE_E: (document.getElementById("S_SO_TYPE_E").checked?"E":""),
|
|
OFLD: sdata?.OFLD||'',
|
|
OASC: sdata?.OASC||'',
|
|
LINE_NUM: 999999999,
|
|
NOW_PAGE: sdata?.NOW_PAGE||'',
|
|
},
|
|
success: function (data) {
|
|
if (data.code) {
|
|
if (docType === 'list') {
|
|
tb_common_funtions.tabu2xls(table_block, filename, title, data.data);
|
|
} else if (docType === 'ob') {
|
|
if (!_this.clickData) {
|
|
return false;
|
|
} else {
|
|
makeSoBook(_this.clickData, filename, Tb_funcs_Detail.tblList.getData());
|
|
}
|
|
}
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {}
|
|
});
|
|
};
|
|
|
|
excelDataSuju(title){
|
|
let _this = this;
|
|
let sdata = _this.searchData;
|
|
let filename = title+"_"+luxon.DateTime.now().toFormat('yyyyMMdd');
|
|
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: {
|
|
mode: 'getOrderDetailList',
|
|
BP_CD: sdata?.BP_CD||'',
|
|
SO_DT_ST: sdata?.SO_DT_ST||'',
|
|
SO_DT_ED: sdata?.SO_DT_ED||'',
|
|
MNG_NO: sdata?.MNG_NO||'',
|
|
SALES_GRP: sdata?.SALES_GRP||'',
|
|
SO_TYPE_I: (document.getElementById("S_SO_TYPE_I").checked?"I":""),
|
|
SO_TYPE_E: (document.getElementById("S_SO_TYPE_E").checked?"E":""),
|
|
},
|
|
success: function (data) {
|
|
if (data.code) {
|
|
let excelHeader = [
|
|
{ key: 'SO_DT', width: 10, title: '일 자', },
|
|
{ key: 'MNG_NO', width: 20, title: '수주번호', },
|
|
{ key: 'SPEC', width: 25, title: '규 격', },
|
|
{ key: 'SO_QTY', width: 10, title: '수량', },
|
|
{ key: 'UNIT_WGT', width: 12, title: '분철단중', },
|
|
{ key: 'PWR_WGT', width: 12, title: '분철중량', },
|
|
{ key: 'SO_PRICE_LOC', width: 15, title: '발주단가', },
|
|
{ key: 'SO_NET_AMT_LOC', width: 15, title: '발주금액', },
|
|
{ key: 'UNIT_DAN', width: 15, title: '분철단가', },
|
|
{ key: 'PWR_DAN', width: 10, title: '단중단가', },
|
|
{ key: 'REQ_DLVY_DT', width: 10, title: '납기', },
|
|
{ key: 'REMK', width: 20, title: '비고', },
|
|
];
|
|
let excelData = data.data.map( v => { return {
|
|
SO_DT: v.SO_DT,
|
|
MNG_NO: v.MNG_NO,
|
|
SPEC: Math.ceil(v.OUT_DIA) +' x '+ Math.ceil(v.IN_DIA) +' x '+ Math.ceil(v.THICK),
|
|
SO_QTY: Math.ceil(v.SO_QTY),
|
|
UNIT_WGT: Math.ceil(v.UNIT_WGT*10)/10,
|
|
PWR_WGT: Math.ceil(v.PWR_WGT*10)/10,
|
|
SO_PRICE_LOC: Math.ceil(v.SO_PRICE_LOC),
|
|
SO_NET_AMT_LOC: Math.ceil(v.SO_NET_AMT_LOC),
|
|
UNIT_DAN: v.PWR_WGT?(Math.ceil(v.SO_PRICE_LOC*100/v.PWR_WGT)/100):0,
|
|
PWR_DAN: v.UNIT_WGT?(Math.ceil(v.SO_PRICE_LOC*100/v.UNIT_WGT)/100):0,
|
|
REQ_DLVY_DT: v.REQ_DLVY_DT,
|
|
REMK: v.REMK,
|
|
}} );
|
|
|
|
json2xls(filename, title, excelHeader, excelData);
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {}
|
|
});
|
|
}
|
|
}
|
|
|
|
//Grid용 클래스. 블록 처리용
|
|
class Tb_class_Detail {
|
|
constructor(){
|
|
let _this = this;
|
|
_this.tblList = "";
|
|
_this.drawModal = "";
|
|
_this.ajax_url = "./registration.ajax.php";
|
|
_this.hdr = {};
|
|
}
|
|
|
|
//리스트 로드
|
|
getMainList (hdr) {
|
|
let _this = this;
|
|
if( hdr ) _this.hdr = hdr;
|
|
|
|
let talert = window.setTimeout(function () { _this.tblList.alert("Loading ...") }, 1000); //1초 이상 지연되면 로딩 출력
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: { mode: 'getDetailList', SO_NO: _this.hdr.SO_NO },
|
|
success: function (data) {
|
|
if (data.code) {
|
|
console.log(data.data)
|
|
_this.tblList.setData(data.data);
|
|
_this.tblList.getRows().forEach(row=>row.getData()['MST_CNT'] && row.getCell('CHECK').getElement().querySelector('input').setAttribute('disabled',true)); //진행된 수주상세 선택 못하도록 처리
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {
|
|
window.clearTimeout(talert);
|
|
_this.tblList.clearAlert();
|
|
}
|
|
});
|
|
return true;
|
|
};
|
|
|
|
//Row 추가
|
|
addRow(){
|
|
let _this = this;
|
|
if( _this.hdr ){
|
|
_this.tblList.addRow({_STATUS_:'I', SO_NO:_this.hdr.SO_NO, CURRENCY_CD:_this.hdr.CURRENCY_CD, DLVY_BP_CD:_this.hdr.DLVY_BP_CD||_this.hdr.ORDR_BP_CD, DLVY_BP_NM:_this.hdr.DLVY_BP_NM||_this.hdr.ORDR_BP_NM},true);
|
|
}else{
|
|
kuls_alert("저장된 수주를 선택하거나, <br/>새로운 수주를 저장한뒤 수주상세를 등록할 수 있습니다.");
|
|
}
|
|
}
|
|
|
|
copyRow() {
|
|
let _this = this;
|
|
let spos = _this.tblList.getRows().filter( row => row.getElement().classList.contains('user-checked') )[0]?._row.position;
|
|
if( !spos ){
|
|
kuls_alert("복사할 행을 선택해야 합니다."); return;
|
|
}
|
|
let crow = _this.tblList.getRowFromPosition(spos);
|
|
_this.cdata = crow.getData();
|
|
delete _this.cdata.SO_NO;
|
|
delete _this.cdata.MNG_NO;
|
|
delete _this.cdata.SO_SEQ;
|
|
delete _this.cdata.MNG_NO_OLD;
|
|
delete _this.cdata.ASS_DRAW;
|
|
delete _this.cdata.ASS_FILE;
|
|
delete _this.cdata.MAKE_TM;
|
|
delete _this.cdata.MAKE_USER_ID;
|
|
delete _this.cdata.EDIT_TM;
|
|
delete _this.cdata.EDIT_USER_ID;
|
|
kuls_success("복사 되었습니다.");
|
|
|
|
$("#btnPasteDetail").attr("disabled", false);
|
|
};
|
|
|
|
pasteRow(){
|
|
let _this = this;
|
|
|
|
let spos = _this.tblList.getRows().filter( row => row.getElement().classList.contains('user-checked') )[0]?._row.position;
|
|
if( !spos ){
|
|
kuls_alert("붙여넣을 행을 선택해야 합니다."); return;
|
|
}
|
|
if( !_this.cdata ){
|
|
kuls_alert("붙여넣을 내용이 없습니다. 복사를 먼저 해주세요."); return;
|
|
}
|
|
let prow = _this.tblList.getRowFromPosition(spos);
|
|
prow.update({..._this.cdata,});
|
|
kuls_success("붙여넣기 되었습니다.");
|
|
}
|
|
|
|
//Row 클릭 콜백
|
|
rowClick (e, tgt){
|
|
let _this = this;
|
|
if( e.target.classList.contains("btnfile") //첨부파일시 Row클릭금지
|
|
|| e.target.classList.contains("toggle-switchy") //일품번호기준 Row클릭금지
|
|
|| e.target.classList.contains("toggle") //일품번호기준 Row클릭금지
|
|
|| e.target.classList.contains("switch") //일품번호기준 Row클릭금지
|
|
){
|
|
return;
|
|
}
|
|
|
|
jQuery(tgt.getElement()).siblings().removeClass("user-checked");
|
|
tgt.getElement().classList.add("user-checked");
|
|
};
|
|
|
|
//Cell 클릭 콜백
|
|
cellClick (e, tgt){
|
|
let _this = this;
|
|
_this.tgt = tgt;
|
|
|
|
switch( tgt.getField() ){
|
|
case "DLVY_BP_NM":
|
|
popPartnerList({tgt_id:'DLVY_BP_CD', tgt_name:'DLVY_BP_NM', tgt_currency:'CURRENCY_CD'}, tgt.getRow()._row);
|
|
break;
|
|
case "ASS_FILE":
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
break;
|
|
case "RMK1":
|
|
case "RMK2":
|
|
case "RMK3":
|
|
case "RMK4":
|
|
tgt.setValue( tgt.getValue() == "Y"?"N":"Y" );
|
|
break;
|
|
}
|
|
};
|
|
|
|
//Cell 변경 콜백
|
|
cellEdited (cell){
|
|
let _this = this;
|
|
let rowData = cell.getData();
|
|
rowData['_STATUS_'] = rowData['_STATUS_']||'U';
|
|
|
|
switch ( cell.getField() ){
|
|
case "SO_PRICE":
|
|
case "SO_QTY":
|
|
case "XCH_RATE":
|
|
if( rowData['CURRENCY_CD'] != "KRW" ){ //원화가 아닐때만
|
|
if( rowData['SO_QTY'] && rowData['SO_PRICE'] ){
|
|
cell.getRow().update({SO_NET_AMT:rowData['SO_QTY']*rowData['SO_PRICE']});
|
|
}
|
|
if( rowData['XCH_RATE'] ){
|
|
cell.getRow().update({SO_PRICE_LOC:rowData['SO_PRICE']*rowData['XCH_RATE'], SO_NET_AMT_LOC:rowData['SO_PRICE']*rowData['SO_QTY']*rowData['XCH_RATE']});
|
|
}
|
|
}
|
|
break;
|
|
|
|
case "ITEM_CD":
|
|
let dval = varsSHAPE_GRP[cell.getValue()].children;
|
|
cell.getRow().update({SHAPE_TYPE:Object.keys(dval)[0]});
|
|
break;
|
|
}
|
|
|
|
if( cell.getField() == "SO_PRICE_LOC" || cell.getField() == "SO_QTY" ){
|
|
if( rowData['SO_QTY'] && rowData['SO_PRICE_LOC'] && rowData['CURRENCY_CD'] == "KRW" ){
|
|
cell.getRow().update({SO_NET_AMT_LOC:rowData['SO_QTY']*rowData['SO_PRICE_LOC']});
|
|
}
|
|
}
|
|
};
|
|
|
|
// 수주상세 등록
|
|
putDetail (){
|
|
let _this = this;
|
|
let pdata = _this.tblList.getData();
|
|
let dupdata = pdata.map( data => data.MNG_NO ).filter( data => data );
|
|
if( dupdata.filter( (data,idx) => dupdata.indexOf(data) !== idx ).length > 0 ){
|
|
kuls_alert("수주번호가 중복됩니다.");
|
|
return false;
|
|
}
|
|
let postdata = {
|
|
'mode': 'putDetailList',
|
|
'reqdata': JSON.stringify(_this.tblList.getData().filter(row=> row._STATUS_)),
|
|
};
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: postdata,
|
|
success: function (data) {
|
|
if (data.code) {
|
|
kuls_success("저장되었습니다.");
|
|
Tb_funcs_Order.getMainList();
|
|
_this.getMainList();
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {
|
|
}
|
|
});
|
|
return true;
|
|
};
|
|
|
|
delDetail (){
|
|
let _this = this;
|
|
_this.tblList.getSelectedRows().forEach(row => {
|
|
row.update({_STATUS_:'D'});
|
|
row.getElement().classList.add("del-row");
|
|
});
|
|
};
|
|
|
|
popDrawList ( cell ){
|
|
let _this = this;
|
|
//팝업 템플릿 로드 후 모달 출력
|
|
Tb_funcs_draw.init(cell.getComponent().getRow());
|
|
};
|
|
|
|
shGEdParams ( cell ) {
|
|
let _this = this;
|
|
return Object.keys(varsSHAPE_GRP).reduce( (ret, key) => { ret[varsSHAPE_GRP[key].Code_Uid] = varsSHAPE_GRP[key].Code_Exp; return ret; }, {})
|
|
};
|
|
|
|
|
|
shEdParams ( cell ) {
|
|
let _this = this;
|
|
return varsSHAPE_GRP[cell.getData()['ITEM_CD']].children;
|
|
};
|
|
|
|
shGFormatter ( cell ) {
|
|
let _this = this;
|
|
return varsSHAPE_GRP[cell.getValue()]?.Code_Exp;
|
|
};
|
|
|
|
shFormatter ( cell ) {
|
|
let _this = this;
|
|
return varsSHAPE_TYPE[cell.getValue()];
|
|
};
|
|
|
|
stFmtParams( cell ){
|
|
let _this = this;
|
|
return tb_common_funtions.precs(cell.getData()['ITEM_CD'] === "F", 3,1);
|
|
}
|
|
|
|
init () {
|
|
let _this = this;
|
|
let currow = Object.keys(varsCurrency).reduce( (param,key) => {param[key] = `${key} (${varsCurrency[key]})`; return param;}, {});
|
|
|
|
const fields = [
|
|
{ field: "CHECK", formatter:"rowSelection", titleFormatter: "rowSelection", title: "No", width: "4%", noxls:true, },
|
|
{ field: "MNG_NO", title: "수주번호", width: "10%", editor:'input', visible: false, },
|
|
{ field: "MNG_NO_P", title: "수주번호", width: "10%", editor:'input', },
|
|
{ field: "DTL_SEQ", title: "순번", width: "6%", maxWidth:200, editor:'input', },
|
|
{ field: "ITEM_CD", title: "품명", width: "8%", editor:'list', cssClass:"user-list", editorParams:{ valuesLookup: _this.shGEdParams }, formatter:_this.shGFormatter, },
|
|
{ field: "SHAPE_TYPE", title: "형태(형상)", width: "8%", editor:'list', cssClass:"user-list", editorParams:{ valuesLookup: _this.shEdParams }, formatter:_this.shFormatter, },
|
|
{ field: "", title: "규격", width: "20%",
|
|
columns:[
|
|
{ field:"OUT_DIA", title:"OD", width:"5%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: _this.stFmtParams, },
|
|
{ field:"IN_DIA", title:"ID", width:"5%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: _this.stFmtParams, },
|
|
{ field:"THICK", title:"TH", width:"5%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: _this.stFmtParams, },
|
|
{ field:"WIDTH", title:"W", width:"5%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: _this.stFmtParams, },
|
|
{ field:"LENGTH", title:"L", width:"5%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: _this.stFmtParams, },
|
|
],
|
|
},
|
|
{ field: "MATR_TYPE", title: "재질", width: "8%", editor:'input', },
|
|
{ field: "", title: "도면", width: "12%",
|
|
columns:[
|
|
{ field:"ASS_DRAW", title:"도면번호", width:"10%", },
|
|
{ field:"ASS_FILE", title:"<i class='fa-solid fa-compass-drafting'></i>", width:"2%", noxls:true,
|
|
formatter: tb_common_funtions.formatterButton,
|
|
formatterParams:{
|
|
btnTitle:'',
|
|
btnClass:'btn btn-sm btn-nobd fa-regular fa-image btnfile',
|
|
cfunc: (cell)=> { _this.popDrawList(cell) },
|
|
event: ['click', 'keyup'],
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{ field: "REQ_DLVY_DT", title: "납기요청일", width: "7%", editor:'date', editorParams: {max:'9999-12-31'}, },
|
|
{ field: "DLVY_BP_NM", title: "납품처", width: "8%", editor:'input', },
|
|
{ field: "ITEM_NRULE", title: "일품번호기준", width: "8%", cssClass:'user-editable', formatter: tb_common_funtions.formatterMultiCheckBox, formatterParams: {class:'', type:'radio', default:'', inputs:[
|
|
{title:' 수량', name:'ITEM_NRULE', value:'', class:'form_checkbox_before', },
|
|
{title:' 번호', name:'ITEM_NRULE', value:'Y', class:'green form_checkbox_before ml-2', }
|
|
], }, visible:false, },
|
|
//{ field: "ITEM_NRULE", title: "일품번호<br>기준", width: "5%", formatter: tb_common_funtions.formatterToggleboxText, formatterParams: { checkval:'Y', onval:'번호', offval:'수량', } },
|
|
{ field: "SO_QTY", title: "수량", width: "5%", editor:'input', },
|
|
{ field: "SO_UNIT", title: "단위", width: "6%", editor:'list', cssClass:"user-list", editorParams:{ values: varsUNIT },
|
|
formatter: tb_common_funtions.formatterSelect, formatterParams: { values: varsUNIT }, },
|
|
{ field: "CURRENCY_CD", title: "화폐", width: "6%", editor:'list', cssClass:"user-list", editorParams:{ values: currow },
|
|
formatter: tb_common_funtions.formatterSelect, formatterParams: { values: currow }, },
|
|
{ field: "", title: "원화",
|
|
columns: [
|
|
{ field: "SO_PRICE_LOC", title: "단가", width: "10%", editor:'input', formatter:"money", formatterParams:{precision:false}, },
|
|
{ field: "SO_NET_AMT_LOC", title: "금액", width: "10%", formatter:"money", formatterParams:{precision:false}, },
|
|
]
|
|
},
|
|
{ field: "", title: "외화",
|
|
columns: [
|
|
{ field: "SO_PRICE", title: "단가", width: "10%", editor:'input', formatter:"money", },
|
|
{ field: "SO_NET_AMT", title: "금액", width: "10%", formatter:"money", },
|
|
{ field: "XCH_RATE", title: "환율", width: "10%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: function() { return {'precision':2}; }, },
|
|
]
|
|
},
|
|
{ field: "PWR_WGT", title: "분철", width: "10%", editor:'input', },
|
|
{ field: "UNIT_WGT", title: "단중", width: "10%", editor:'input', formatter: tb_common_funtions.formatterNumber, formatterParams: function() { return {'precision':2}; }, },
|
|
{ field: "RMK1", title: "특1", width: "5%", cssClass:'user-editable', formatter: tb_common_funtions.formatterCheckboxIconYn,},
|
|
{ field: "RMK2", title: "특2", width: "5%", cssClass:'user-editable', formatter: tb_common_funtions.formatterCheckboxIconYn,},
|
|
{ field: "RMK3", title: "특3", width: "5%", cssClass:'user-editable', formatter: tb_common_funtions.formatterCheckboxIconYn,},
|
|
{ field: "RMK4", title: "특4", width: "5%", cssClass:'user-editable', formatter: tb_common_funtions.formatterCheckboxIconYn,},
|
|
{ field: "RMK_ETC", title: "특 기타", width: "20%", editor:'input', },
|
|
{ field: "REMK", title: "비고", width: "10%", editor:'input', },
|
|
{ field: "REVNO", title: "변경이력", width: "13%", editor:'input', },
|
|
{ field: "CPRNO", title: "협조전번호", width: "13%", editor:'input', },
|
|
{ field: "CHANGE_DATE", title: "변경일자", width: "13%", editor:'date', editorParams: {max:'9999-12-31'},},
|
|
{ field: "CHANGE_DTL", title: "변경내용", width: "13%", editor:'input', },
|
|
{ field: "MNG_GRD", title: "관리등급", width: "13%", editor:'input', },
|
|
{ field: "PROC_GRD", title: "가공등급", width: "13%", editor:'input', },
|
|
{ field: "CLASSIFICATION", title: "선급", width: "13%", editor:'input', },
|
|
{ field: "PRESENCE", title: "입회", width: "13%", editor:'input', },
|
|
{ field: "HEAT_TREATMENT", title: "열처리", width: "13%", editor:'input', },
|
|
{ field: "APPROVAL", title: "승인도", width: "13%", editor:'input', },
|
|
];
|
|
|
|
_this.tblList = new Tabulator("#tblDetailList",{
|
|
layout: "fitColumns",
|
|
height: "100%",
|
|
maxHeight: "100%",
|
|
data: [], //기본 데이터
|
|
columns: fields, //컬럼 설정
|
|
columnDefaults: { //컬럼 공통 규칙
|
|
vertAlign: "middle",
|
|
hozAlign: "center",
|
|
resizable: "header",//Resize 는 헤더에서만 가능
|
|
headerHozAlign: "center", //헤더 정렬
|
|
headerSortTristate: true, //데이터 정렬 => 정/역/초기화
|
|
},
|
|
headerSortElement: "<i class='bi'></i>", //정렬 아이콘
|
|
});
|
|
|
|
_this.tblList.on("rowClick", (e,tgt) => { //Tabulator cell Click
|
|
_this.rowClick && Tb_funcs_Detail.rowClick(e,tgt);
|
|
});
|
|
_this.tblList.on("cellClick", (e,tgt) => { //Tabulator cell Click
|
|
_this.cellClick && Tb_funcs_Detail.cellClick(e,tgt);
|
|
});
|
|
_this.tblList.on("cellEdited", (cell) => { //Tabulator cell Edited
|
|
_this.cellEdited && Tb_funcs_Detail.cellEdited(cell);
|
|
});
|
|
_this.tblList.on("rowSelected", (row) => { //Tabulator cell Deslected
|
|
if( row.getData()['MST_CNT'] ){
|
|
row.getTable().deselectRow(row);
|
|
}
|
|
});
|
|
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnAddDetail").addEventListener(evt,()=>{_this.addRow()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnCopyDetail").addEventListener(evt,()=>{_this.copyRow()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnPasteDetail").addEventListener(evt,()=>{_this.pasteRow()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnDelDetail").addEventListener(evt,()=>{_this.delDetail()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnPutDetail").addEventListener(evt,()=>{_this.putDetail()}));
|
|
};
|
|
}
|
|
|
|
|
|
class Tb_class_Att {
|
|
constructor(){
|
|
let _this = this;
|
|
_this.tblList = "";
|
|
_this.ajax_url = "./attfile.ajax.php";
|
|
_this.upload_ajax_url = "./attfile.ajax.php";
|
|
_this.download_url = "/include/getFile.php";
|
|
_this.hdr = {};
|
|
}
|
|
|
|
//리스트 로드
|
|
getMainList (hdr) {
|
|
let _this = this;
|
|
if( hdr ) _this.hdr = hdr;
|
|
|
|
let talert = window.setTimeout(function () { _this.tblList.alert("Loading ...") }, 1000); //1초 이상 지연되면 로딩 출력
|
|
ajax_json({
|
|
url: _this.ajax_url,
|
|
data: { mode: 'getAttList', nid: _this.hdr.SO_NO },
|
|
success: function (data) {
|
|
if (data.code) {
|
|
_this.tblList.setData(data.data.map(sd=>{return {...sd,_OLD_STATUS_:sd._STATUS_};}));
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {
|
|
window.clearTimeout(talert);
|
|
_this.tblList.clearAlert();
|
|
|
|
//멀티파일 업로더
|
|
if (!_this.uploader) {
|
|
_this.uploader = FilePond.create(document.getElementById("attfilepond"), {
|
|
...filepond_ko_KR,
|
|
name: 'upfile',
|
|
allowMultiple: true,
|
|
maxParallelUploads: 3,
|
|
allowProcess: false,
|
|
instantUpload: true,
|
|
server: {
|
|
url: _this.upload_ajax_url + "?mode=putTempFile",
|
|
process: {
|
|
onload: function (data) {
|
|
data = JSON.parse(data);
|
|
let fdata = data.data;
|
|
let file_name = fdata['file_name'];
|
|
let tmp_name = fdata['tmp_name'];
|
|
let file_size = fdata['file_size'];
|
|
let file_type = fdata['file_type'];
|
|
|
|
_this.tblList.addRow({
|
|
_STATUS_: 'I',
|
|
nid: _this.hdr.SO_NO,
|
|
file_name,
|
|
tmp_name,
|
|
file_size,
|
|
file_type,
|
|
gubun: 'temp'
|
|
},true);
|
|
},
|
|
},
|
|
},
|
|
allowFileSizeValidation: true,
|
|
maxFileSize: 100000000,
|
|
credits: {},
|
|
});
|
|
|
|
// document.addEventListener('FilePond:processfile', (e)=>{
|
|
// let data = e.detail.file;
|
|
// let name = data.filename;
|
|
// let ext = data.fileExtension;
|
|
// let size = data.fileSize;
|
|
// let type = data.fileType;
|
|
// let file_url = _this.download_url+"?gubun=temp&tmp_name="+1+"&name="+name+"&size="+size;
|
|
//
|
|
// _this.tblList.addRow({_STATUS_:'I', file_name:name, url:file_url},true);
|
|
// });
|
|
|
|
document.getElementById("attfilepond").addEventListener('FilePond:addfilestart', (e) => {
|
|
_this.tblList.alert("미리보기 작성중...");
|
|
document.querySelector("#btnPutFile").disabled = true;
|
|
});
|
|
document.getElementById("attfilepond").addEventListener('FilePond:processfiles', (e) => {
|
|
_this.tblList.clearAlert();
|
|
document.querySelector("#btnPutFile").disabled = false;
|
|
});
|
|
}
|
|
}
|
|
});
|
|
return true;
|
|
};
|
|
|
|
setFilter () {
|
|
let _this = this;
|
|
};
|
|
|
|
//등록
|
|
uploadFile (){
|
|
let _this = this;
|
|
|
|
_this.uploader.browse();
|
|
};
|
|
|
|
//등록
|
|
putAtt (){
|
|
let _this = this;
|
|
/* 삭제를 토글로 처리시, 복구를 위해 DEL_FLG가 추가될 경우에 사용.
|
|
let rowData = _this.tblList.getData().map( row => {
|
|
if( row['DEL_FLG'] === "Y" ){
|
|
row['_STATUS_'] = "D";
|
|
}
|
|
return row;
|
|
}).filter(row => row['_STATUS_'] && (row['_STATUS_'] !== "D" || row['file_id']) );
|
|
*/
|
|
let rowData = _this.tblList.getData().filter(row => row['_STATUS_']);
|
|
|
|
ajax_json({
|
|
url: _this.upload_ajax_url,
|
|
data: { mode: 'putAtt', reqdata: JSON.stringify(rowData) },
|
|
success: function (data) {
|
|
if (data.code) {
|
|
kuls_success("저장되었습니다.");
|
|
//Tb_funcs_Detail.drawModal.delete();
|
|
_this.getMainList();
|
|
}else{
|
|
kuls_alert(data.mesg);
|
|
}
|
|
},
|
|
error: function (request, status, error) {
|
|
kuls_alert(error.message);
|
|
},
|
|
complete: function () {
|
|
}
|
|
});
|
|
};
|
|
|
|
//Cell 클릭 콜백
|
|
cellClick (e, tgt){
|
|
let _this = this;
|
|
let rowData = tgt.getData();
|
|
switch( tgt.getField() ){
|
|
case "file_url":
|
|
let file_url = _this.download_url+"?gubun="+rowData['gubun']+"&nid="+rowData['nid']+"&sid="+rowData['sid']+"&file_id="+rowData['file_id']+"&tmp_name="+rowData['tmp_name']+"&name="+rowData['file_name']+"&size="+rowData['file_size'];
|
|
|
|
pop_filedown(file_url, rowData['file_name'].split(".").pop());
|
|
break;
|
|
|
|
case "DEL_FLG":
|
|
tgt.setValue( tgt.getValue() == "Y"?"N":"Y" );
|
|
break;
|
|
}
|
|
};
|
|
|
|
//Cell 변경 콜백
|
|
cellEdited (cell){
|
|
let _this = this;
|
|
cell.getData()._STATUS_ = cell.getData()._STATUS_||'U';
|
|
};
|
|
|
|
/*
|
|
//Row 선택 콜백
|
|
rowSelected (row){
|
|
let _this = this;
|
|
row.getData().DEL_FLG = "Y";
|
|
};
|
|
//Row 선택 콜백
|
|
rowDeSelected (row){
|
|
let _this = this;
|
|
let rowData = row.getData();
|
|
|
|
row.getData().DEL_FLG = "";
|
|
};*/
|
|
|
|
//Row 삭제처리
|
|
rowDelete (){
|
|
let _this = this;
|
|
_this.tblList.getSelectedRows().forEach( row => {
|
|
row.getData()['_STATUS_'] = 'D';
|
|
row.getElement().classList.add("del-row");
|
|
} );
|
|
};
|
|
|
|
revokeData(row){
|
|
let _this = this;
|
|
row.update({_STATUS_:row.getData()['_OLD_STATUS_']});
|
|
row.getElement().classList.remove("del-row");
|
|
};
|
|
|
|
init () {
|
|
let _this = this;
|
|
|
|
const fields = [
|
|
{ formatter:"rowSelection", title: "No", width: "10%", headerSort: false, },
|
|
{ field: "file_name", title: "파일명", width: "40%", minWidth:200, },
|
|
{ field: "file_exp", title: "비 고", width: "40%", minWidth:200, editor:"input" },
|
|
{ field: "file_url", title: "<i class='fa-solid fa-folder-closed'></i>", width: "10%", minWidth:80, formatter: ()=>'<i class="fa-solid fa-download"></i>', },
|
|
];
|
|
|
|
_this.tblList = new Tabulator("#tblFileList",{
|
|
layout: "fitColumns",
|
|
height: "calc(100% - 20px)",
|
|
data: [], //기본 데이터
|
|
columns: fields, //컬럼 설정
|
|
columnDefaults: { //컬럼 공통 규칙
|
|
vertAlign: "middle",
|
|
hozAlign: "center",
|
|
resizable: "header",//Resize 는 헤더에서만 가능
|
|
headerHozAlign: "center", //헤더 정렬
|
|
headerSortTristate: true, //데이터 정렬 => 정/역/초기화
|
|
},
|
|
headerSortElement: "<i class='bi'></i>", //정렬 아이콘
|
|
});
|
|
|
|
_this.tblList.on("cellClick", (e,tgt) => { //Tabulator cell Click
|
|
_this.cellClick && _this.cellClick(e,tgt);
|
|
});
|
|
_this.tblList.on("cellEdited", (cell) => { //Tabulator cell Edited
|
|
_this.cellEdited && _this.cellEdited(cell);
|
|
});
|
|
_this.tblList.on("rowDeselected", (row) => { //Tabulator cell Deslected
|
|
_this.revokeData && _this.revokeData(row);
|
|
});
|
|
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnAddFile").addEventListener(evt,()=>{_this.uploadFile()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnDelFile").addEventListener(evt,()=>{_this.rowDelete()}));
|
|
['click','keypress'].forEach(evt => document.querySelector("#btnPutFile").addEventListener(evt,()=>{_this.putAtt()}));
|
|
};
|
|
}
|
|
|
|
const Tb_funcs_Order = new Tb_class_Order();
|
|
const Tb_funcs_Detail = new Tb_class_Detail();
|
|
const Tb_funcs_Att = new Tb_class_Att();
|
|
const Tb_funcs_draw = new drawManager();
|
|
Tb_funcs_Order.init();
|
|
Tb_funcs_Detail.init();
|
|
Tb_funcs_Att.init();
|
|
|