/** * @type : function * @access : public * @desc : PBF 공통 코드 박스
*

 * Pbf Common Code Box

 * 
* @param : * @author : PBF */ (function() { DU.namespace('DU.widget.pbf'); DU.widget.LPbfCommBox = function(p_oElement, p_oAttributes) { this.id = p_oElement; this.type = p_oAttributes.type; if(DU.isUndefined(p_oAttributes.popup)) p_oAttributes.popup = true; this.popup = p_oAttributes.popup; if(DU.isUndefined(p_oAttributes.grid)) p_oAttributes.grid = false; this.grid = p_oAttributes.grid; this.codeGroup = p_oAttributes.codeGroup; this.objCnt = this.id.substring(this.type.length, this.id.length); this.commBtn; }; DU.widget.LPbfCommBox.prototype = { id: null, el : null, bodyEl : null, getId : function() { return this.id; }, getEl : function(){ return this.el; }, getBodyEl : function(){ return this.bodyEl; }, render : function() { var renderEl = DU.get(this.id); this.createContainer(renderEl); this.doRender(renderEl); this.createEvent(renderEl); }, createContainer : function(renderEl) { var viewId = renderEl.id; var colName_fu = cfToFirstUpper(viewId); var src = '
'; src += ''; src += ''; if(this.popup) { src += '
'; src += '
'; } src += '
'; renderEl.html(src); this.el = renderEl; this.bodyEl = renderEl.select('#' + viewId + 'Body').getAt(0); }, createEvent : function(renderEl) { }, doRender : function(renderEl) { }, getCode : function() { return DU.get('query' + cfToFirstUpper(this.id) + 'Code' + this.objCnt); }, getValue : function() { return DU.get('query' + cfToFirstUpper(this.id) + 'Code' + this.objCnt).getValue(); }, getName : function() { return DU.get('query' + cfToFirstUpper(this.id) + 'Name' + this.objCnt).getValue(); }, setValue : function(val) { DU.get('query' + cfToFirstUpper(this.id) + 'Code' + this.objCnt).setValue(val); var p_oAtt = this; p_oAtt.codeValue = val; p_oAtt.codeName = ''; this.setName(''); cfGetCommVal(p_oAtt); }, setName : function(val) { DU.get('query' + cfToFirstUpper(this.id) + 'Name' + this.objCnt).setValue(val); }, getCommBtn : function() { return this.commBtn; } }; })(); DU.widget.LPbfCommCodeBox = function(p_oElement, p_oAttributes) { DU.widget.LPbfCommCodeBox.superclass.constructor.call(this, p_oElement, p_oAttributes); }; DU.extend(DU.widget.LPbfCommCodeBox, DU.widget.LPbfCommBox, { createEvent : function(renderEl) { var colName_fu = cfToFirstUpper(this.id); if(this.popup) { this.commBtn = new DU.widget.LButton(this.id + 'Btn' + this.objCnt); } var p_oAtt = this; DU.get('query'+colName_fu+'Code' + p_oAtt.objCnt).on('change', function(e) { p_oAtt.codeValue = e.target.value; cfGetCommVal(p_oAtt); }); DU.get('query'+colName_fu+'Code' + p_oAtt.objCnt).on('blur', function(e) { if (DU.isEmpty(e.target.value)) { DU.get('query'+colName_fu+'Name' + p_oAtt.objCnt).setValue(''); } else { p_oAtt.codeValue = e.target.value; cfGetCommVal(p_oAtt); } }); DU.get('query'+colName_fu+'Name' + p_oAtt.objCnt).on('keydown', function(e) { if(typeof(e) != "undefined"){ result=e.which; if(result=="13"){ DU.get('query'+colName_fu+'Code' + p_oAtt.objCnt).setValue(''); p_oAtt.codeValue = ''; p_oAtt.codeName = e.target.value; cfGetCommVal(p_oAtt); } } else{ if(event.keyCode=="13"){ DU.get('query'+colName_fu+'Code' + p_oAtt.objCnt).setValue(''); p_oAtt.codeValue = ''; p_oAtt.codeName = e.target.value; cfGetCommVal(p_oAtt); } } }); } }); /** * @type : function * @access : public * @desc : PBF 팝업
*

 * Pbf Dialog Box

 * 
* @param : * @author : PBF */ DU.widget.LPbfDialog = function(p_oElement, p_oAttributes) { DU.widget.LPbfDialog.superclass.constructor.call(this, p_oElement, p_oAttributes); }; DU.extend(DU.widget.LPbfDialog, DU.widget.LDialog, { }); /** * @type : function * @access : public * @desc : PBF 공통 팝업
*

 * LPbfCommDialog

 * 
* @param : * @author : PBF */ DU.widget.LPbfCommDialog = function(p_oElement, p_oAttributes) { DU.widget.LPbfCommDialog.superclass.constructor.call(this, p_oElement, { width : 500, visible : false, postmethod:'async', buttons : [ { text:"Close", handler: function() { this.cancel(); } } ] }); var codeBoxId = p_oAttributes.codeBox.id; var colName_fu = cfToFirstUpper(codeBoxId); var objCnt = p_oElement.substring(p_oAttributes.type.length, p_oElement.length); p_oAttributes.objCnt = objCnt; if(DU.isUndefined(p_oAttributes.grid)) p_oAttributes.grid = false; else p_oAttributes.grid = true; p_oAttributes.codeObj = [ { src:'query'+colName_fu+'Code' + objCnt }, { target:'query'+colName_fu+'Name' + objCnt } ]; // 사용자 정의 컬럼!!! if(p_oAttributes.type == 'commPopup') { p_oAttributes.codeObj[0].srcId = 'codeId'; p_oAttributes.codeObj[0].srcName = '코드 ID'; p_oAttributes.codeObj[1].targetId = 'codeName'; p_oAttributes.codeObj[1].targetName = '코드 명'; p_oAttributes.codeGroup = p_oAttributes.codeGroup; } else if(p_oAttributes.type == 'userPopup') { p_oAttributes.codeObj[0].srcId = 'userId'; p_oAttributes.codeObj[0].srcName = '사용자 ID'; p_oAttributes.codeObj[1].targetId = 'userName'; p_oAttributes.codeObj[1].targetName = '사용자 명'; } else if(p_oAttributes.type == 'deptPopup') { p_oAttributes.codeObj[0].srcId = 'deptCode'; p_oAttributes.codeObj[0].srcName = '부서 코드'; p_oAttributes.codeObj[1].targetId = 'deptName'; p_oAttributes.codeObj[1].targetName = '부서 명'; } else if(p_oAttributes.type == 'menuPopup') { p_oAttributes.codeObj[0].srcId = 'menuCode'; p_oAttributes.codeObj[0].srcName = '메뉴 코드'; p_oAttributes.codeObj[1].targetId = 'menuName'; p_oAttributes.codeObj[1].targetName = '메뉴 명'; } else if(p_oAttributes.type == 'projectPopup') { p_oAttributes.codeObj[0].srcId = 'pjtCd'; p_oAttributes.codeObj[0].srcName = '프로젝트 코드'; p_oAttributes.codeObj[1].targetId = 'pjtNm'; p_oAttributes.codeObj[1].targetName = '프로젝트 명'; } p_oAttributes.dialog = this; this.makeCommBasic(p_oElement, p_oAttributes); this.bindCommBasic(p_oElement, p_oAttributes); }; DU.extend(DU.widget.LPbfCommDialog, DU.widget.LPbfDialog, { /** * @description PBF 공통 팝업 기본 호출 * @param p_oAttributes * 생성 변수 * @author PBF *

	 * 
*/ makeCommBasic : function(p_oElement, p_oAtt) { var srcName = p_oAtt.codeObj[0].srcName; var targetName = p_oAtt.codeObj[1].targetName; var commColumnModel; p_oAtt.dialog.commSet = new DU.data.LJsonDataSet({ id: p_oAtt.type + 'Set' + p_oAtt.objCnt, fields: [ { id:'devonindex', type: 'number' }, { id: p_oAtt.codeObj[0].srcId }, { id: p_oAtt.codeObj[1].targetId } ] }); commColumnModel = new DU.widget.LColumnModel({ columns: [ new DU.widget.LNumberColumn({width:45}), { field: p_oAtt.codeObj[0].srcId, label: srcName, align:'center', sortable: true, width: 150}, { field: p_oAtt.codeObj[1].targetId, label: targetName, width: 250, sortable: true, align: 'left'} ] }); p_oAtt.dialog.commGrid = new DU.widget.LEditGridPanel( { columnModel: commColumnModel, width:700, height:300, dataSet:p_oAtt.dialog.commSet }); p_oAtt.dialog.commGrid.render(p_oAtt.type + 'GridPanel' + p_oAtt.objCnt); }, bindCommBasic : function(p_oElement, p_oAtt) { var commRetrieveBtn = new DU.widget.LButton(p_oAtt.type + 'RetrieveBtn' + p_oAtt.objCnt); commRetrieveBtn.on('click', function(e) { var queryCodeId = 'query' + cfToFirstUpper(p_oAtt.codeObj[0].srcId); var queryCodeName = 'query' + cfToFirstUpper(p_oAtt.codeObj[1].targetId); var codeValue = ''; var codeName = ''; if(!DU.isUndefined(DU.get(queryCodeId + p_oAtt.objCnt).getValue())) codeValue = DU.get(queryCodeId + p_oAtt.objCnt).getValue(); if(!DU.isUndefined(DU.get(queryCodeName + p_oAtt.objCnt).getValue())) codeName = DU.get(queryCodeName + p_oAtt.objCnt).getValue(); var url; var params = {}; // 사용자 정의 컬럼!!! if(p_oAtt.type == 'commPopup') { params.queryCodeGroup = p_oAtt.codeGroup; params.queryCodeId = codeValue; params.queryCodeName = codeName; url = '/pbf/common/util/RetrieveCodeList.ajax'; } else if(p_oAtt.type == 'userPopup') { params.userId = codeValue; params.userName = codeName; url = '/pbf/system/user/RetrieveUserList.ajax?popup=true'; } else if(p_oAtt.type == 'deptPopup') { params.deptCode = codeValue; params.deptName = codeName; url = '/pbf/system/dept/RetrieveDeptList.ajax'; } else if(p_oAtt.type == 'menuPopup') { params.menuCode = codeValue; params.menuName = codeName; url = '/pbf/system/menu/RetrieveMenuList.ajax'; } else if(p_oAtt.type == 'projectPopup') { params.pjtCd = codeValue; params.pjtNm = codeName; url = '/pbf/ext/system/project/RetrieveProjectList.ajax'; } p_oAtt.dialog.commSet.load({ url : url, params : params }); }); p_oAtt.dialog.commRetrieveBtn = commRetrieveBtn; p_oAtt.dialog.commGrid.on("rowdblclick", function(e){ p_oAtt.fromEvent = true; cfSetCommVal(p_oAtt); }); p_oAtt.dialog.commGrid.on("keydown", function(e){ if(typeof(e) != "undefined"){ result=e.which; if(result=="13"){ p_oAtt.fromEvent = true; cfSetCommVal(p_oAtt); return false; } } else{ if(event.keyCode=="13"){ p_oAtt.fromEvent = true; cfSetCommVal(p_oAtt); return false; } } }); if( p_oAtt.grid == false ) { p_oAtt.codeBox.getCommBtn().on('click', function(e) { p_oAtt.dialog.clearInvalid(); p_oAtt.dialog.show(); commRetrieveBtn.click(); }); } }, click : function() { this.clearInvalid(); this.show(); this.commRetrieveBtn.click(); } }); function cfGetCommVal(p_oAtt) { if(DU.isUndefined(p_oAtt.codeValue) && DU.isUndefined(p_oAtt.codeName)) return; var colName_fu; if(p_oAtt.codeBox) { var codeBoxId = p_oAtt.codeBox.id; colName_fu = cfToFirstUpper(codeBoxId); } else { colName_fu = cfToFirstUpper(p_oAtt.id); } var value = ''; if(p_oAtt.fromEvent && p_oAtt.fromEvent == true) { var dd = p_oAtt.dialog.commSet; var row = dd.getAt(dd.getRow()); var record = dd.getAt(row); for(var i=1;i -1) value = value.substring(0, value.length - 1); } else { var queryId; var params = {}; var isEmpty = false; // 사용자 정의 컬럼!!! if(p_oAtt.type == 'commCodeBox' || p_oAtt.type == 'commPopup') { params.codeGroup = p_oAtt.codeGroup; params.messageTable = 'pbf_message_' + gJavaLocale; if(p_oAtt.codeValue) { params.codeId = p_oAtt.codeValue; } else { params.codeName = p_oAtt.codeName; } if(DU.isEmpty(params.codeId) && DU.isEmpty(params.codeName)) isEmpty = true; if(!isEmpty) { value = new DU.data.LPbfSDataSet().callUrl("/pbf/common/util/RetrieveCode.ajax", params, 'sync'); value = value.trim(); } if(p_oAtt.codeValue) { if(value == (params.codeId + ':(' + params.codeId + ')')) value = ''; } else { if(value == (params.codeName + ':(' + params.codeName + ')')) value = ''; } } else { if(p_oAtt.type == 'userCodeBox' || p_oAtt.type == 'userPopup') { if(p_oAtt.codeValue) { params.userId = p_oAtt.codeValue; } else { params.userName = p_oAtt.codeName; } if(DU.isEmpty(params.userId) && DU.isEmpty(params.userName)) isEmpty = true; queryId = '/select/pbf/common/srch/retrieveUserName'; } else if(p_oAtt.type == 'deptCodeBox' || p_oAtt.type == 'deptPopup') { if(p_oAtt.codeValue) { params.deptCode = p_oAtt.codeValue; } else { params.deptName = p_oAtt.codeName; } if(DU.isEmpty(params.deptCode) && DU.isEmpty(params.deptName)) isEmpty = true; queryId = '/select/pbf/common/srch/retrieveDeptName'; } else if(p_oAtt.type == 'menuCodeBox' || p_oAtt.type == 'menuPopup') { if(p_oAtt.codeValue) { params.menuCode = p_oAtt.codeValue; } else { params.menuName = p_oAtt.codeName; } if(DU.isEmpty(params.menuCode) && DU.isEmpty(params.menuName)) isEmpty = true; queryId = '/select/pbf/common/srch/retrieveMenuName'; } else if(p_oAtt.type == 'pjtCdBox' || p_oAtt.type == 'projectPopup') { if(p_oAtt.codeValue) { params.pjtCd = p_oAtt.codeValue; } else { params.pjtNm = p_oAtt.codeName; } if(DU.isEmpty(params.pjtCd) && DU.isEmpty(params.pjtNm)) isEmpty = true; queryId = '/select/pbf/common/srch/retrievePjtNm'; } if(!isEmpty) { value = new DU.data.LPbfSDataSet().getSingleData(queryId, params); value = value.trim(); } } } if (!DU.isEmpty(value)) { if( p_oAtt.grid == false ) { DU.get('query'+colName_fu+'Code' + p_oAtt.objCnt).setValue(value.split(':')[0]); DU.get('query'+colName_fu+'Name' + p_oAtt.objCnt).setValue(value.split(':')[1]); DU.get('query'+colName_fu+'Name' + p_oAtt.objCnt).focus(); } else { cfSetDataSet(p_oAtt.dialog.commSet, p_oAtt.codeBox); } } else { if(p_oAtt.popup ) { if(p_oAtt.codeValue) { p_oAtt.getCommBtn().click(); } } else { if( p_oAtt.grid == false ) { DU.get('query'+colName_fu+'Name' + p_oAtt.objCnt).setValue(''); } else { cfSetDataSet(p_oAtt.dialog.commSet, p_oAtt.codeBox); } } } } function cfSetCommVal(p_oAtt) { var codeBoxId = p_oAtt.codeBox.id; var colName_fu = cfToFirstUpper(codeBoxId); var ds = p_oAtt.dialog.commSet; var srcVal = ds.getValue(ds.getRow(), 1); if( p_oAtt.grid == false ) { DU.get('query'+colName_fu+'Code' + p_oAtt.objCnt).setValue(srcVal); } else { cfSetDataSet(ds, p_oAtt.codeBox); } if (!DU.isEmpty(srcVal)) { p_oAtt.codeValue = srcVal; cfGetCommVal(p_oAtt); } p_oAtt.dialog.hide(); if( p_oAtt.grid == false ) { DU.get('query'+colName_fu+'Name' + p_oAtt.objCnt).focus(); } else { cfSetDataSet(ds, p_oAtt.codeBox); } } function cfToFirstUpper(val) { return val.substring(0, 1).toUpperCase() + val.substring(1, val.length); } function cfSetDataSet(fromDs, toDs) { var row = fromDs.getAt(fromDs.getRow()); var record = fromDs.getAt(row); for(var i=1;i