/**
* @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 = '
* 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