/**
* Util
*
* @class UT
*/
var UT = {
/**
* 날짜 객체의 복사
* @method dateCopy
* @param {Date} dateInfo - 복사하려는 날짜 객체
* @returns {Date} 복사된 날짜 객체
*/
dateCopy : function(dateInfo) {
var newDate = new Date();
newDate.setTime(dateInfo.getTime());
return newDate;
},
/**
* 상위 노드에서 화면 삭제
*
* @method removeModule
* @param {object} parentNode 삭제할 객체의 상위 객체
* @param {object} event 이벤트 객체
* @example
* someFunction: function(e) {
* var me = this;
* UT.removeModule(me.$.pages, e);
* }
*/
removeModule: function(parentNode, event) {
Polymer.dom(parentNode).removeChild(event.currentTarget);
// 메모리 해제
event.currentTarget.destroy();
},
/**
* alert dialog
*
* @method alert
* @param {string} message 출력할 메시지
* @param {function} [okCallback] ok 버튼 클릭 후 콜백 함수
* @param {Boolean} 다국어 처리 여부 기본 false
* @async
* @example
* someFunction: function() {
* var me = this;
* UT.alert("Hello World!");
* }
*/
alert: function(message, okCallback, i18nDisabled) {
i18nDisabled = typeof i18nDisabled !== 'undefined' ? i18nDisabled : false;
SCAlert.show( i18nDisabled ? I18N.translate("STD.N1000") : "STD.N1000", message, function(btn) {
if (UT.isFunction(okCallback)) {
okCallback.call(this);
}
}, null, i18nDisabled);
},
/**
* confirm dialog
*
* @method confirm
* @param {string} message 출력할 메시지
* @param {function} [yesCallback] ok 버튼 클릭 후 콜백 함수
* @param {function} [noCallback] no 버튼 클릭 후 콜백 함수
* @param {Boolean} 다국어 처리 여부 기본 false
* @async
* @example
* someFunction: function() {
* var me = this;
* UT.confirm("Hello World!", function() {
* // yes
* ...
* }, function() {
* // no
* ...
* });
* }
*/
confirm: function(message, yesCallback, noCallback, i18nDisabled) {
i18nDisabled = typeof i18nDisabled !== 'undefined' ? i18nDisabled : false;
SCAlert.confirm( i18nDisabled ? I18N.translate("STD.N1100") : "STD.N1100", message, function(btn) {
if (btn === "yes") {
if (UT.isFunction(yesCallback)) {
yesCallback.call(this);
}
} else { // no
if (UT.isFunction(noCallback)) {
noCallback.call(this);
}
}
}, null, i18nDisabled);
},
alertClose: function(){
SCAlert._messagebox.close();
},
/**
* ajax 요청 (SCLoadMask 사용 및 에러 핸들링을 위함)
*
* @method request
* @param {object} ajax sc-ajax 객체
* @param {function}[responseCallback(res)] 삭제 완료 후 콜백 함수
* @param {object} responseCallback(res).res 처리 결과 정보
*
* <sc-ajax url="url" on-response="func"></sc_ajax>
* on-response 에 함수를 지정하지 않은 경우 : responseCallback 을 정의하여 response를 받을 수 있다
*
* @async
* @example
* someFunction: function() {
* var me = this;
* UT.request(me.$.findInfo);
* }
* someFunction: function() {
* var me = this;
* UT.request(me.$.findInfo, function(e, res) {
* ...
* });
* }
*/
_requestedCount : 0,
request: function(ajax, responseCallback) {
SCLoadMask.show();
UT._requestedCount++;
var listener = function(e) {
UT._requestedCount--;
if(UT._requestedCount === 0){
SCLoadMask.hide();
}
ajax.removeEventListener("response", listener);
ajax.removeEventListener("error", listener);
if (UT.isFunction(responseCallback)) {
var result;
if(e.detail.error){
result = e.detail;
}else{
result = e.detail.parseResponse();
}
responseCallback.call(this, e, {response: result});
}
};
ajax.addEventListener("response", listener);
ajax.addEventListener("error", listener);
ajax.generateRequest();
},
/**
* 서버로의 요청 결과에 대한 실패 메시지
*
* @method failureMessage
* @param {object} result 서버에서의 처리 결과
* @example
* someFunction: function() {
* var me = this;
* UT.completeRequest({
* result: result,
* ...
* failure: {
* message: UT.failureMessage(result)
* }
* });
* }
*/
failureMessage: function(result) {
var message = I18N.translate("STD.E9999"); // 오류가 발생하였습니다.\n관리자에게 문의하세요
if(UT.isNotEmpty(result)){
if (result.result_status === DEF.DUPLICATED) {
message += " - " + I18N.translate("STD.E9100"); // 중복 데이터
} else if (result.result_status === DEF.USED) {
message += " - " + I18N.translate("STD.E9200"); // 사용중 데이터
} else if (result.result_status === DEF.NOT_EXIST) {
message += " - " + I18N.translate("STD.E9300"); // 미존재
}
//해당 error에 대한 사유
if(UT.isNotEmpty(result.result_reject_message)){
message += "
" + result.result_reject_message;
}
//error 메세지 전체 처리
if(UT.isNotEmpty(result.result_message)){
message = "
" + result.result_message;
}
}
return function(){
this.i18nDisabled = true;
return message;
};
},
/**
* clone object
*
* @method copy
* @param {object} object 복사할 대상 object
* @return {object} new object
* @example
* someFunction: function(param) {
* var me = this;
* me.set("findInfo.param", UT.copy(param));
* }
*/
copy: function(object) {
if (!UT.isObject(object)) {
return object;
}
if (SCUtil.isDate(object)) {
var copy = new Date();
copy.setTime(object.getTime());
return copy;
}
if (Array.isArray(object)) {
var copy = new Array();
for(var ut_idx in object){
var ut_val = null;
if(UT.isObject(object[ut_idx])){
var ut_val = $.extend({}, object[ut_idx]);
}else{
ut_val = object[ut_idx];
}
copy.push(ut_val);
}
return copy;
// return object.concat();
}
var copy = {};
for (var key in object) {
if (object.hasOwnProperty(key)) {
copy[key] = UT.copy(object[key]);
}
}
return copy;
},
/**
* uuid 만들기
*
* @method generateUUID
* @return {string} uuid
* @example
* someFunction: function() {
* var me = this;
* ...
* var uuid = UT.generateUUID();
* ...
* }
*/
generateUUID: function() {
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0;
var v = (c === "x") ? r : (r & 3 | 8);
return v.toString(16);
});
},
/**
* 팝업
*
* 팝업의 close 이벤트는 기본적으로 설정된다.
*
* @method popup
* @param {string} popupTagName 팝업으로 사용할 tag name
* @param {object} element element
* @param {number} width 가로크기
* @param {number} height 세로크기
* @param {object} [events] 팝업에서 발생되는 event의 리스너 목록,
* @param {object} [options] 팝업 설정 옵션
* @param {object} [options.modal=true] 모달 여부
* @param {object} [options.maximizable=false] 최대화 여부
* @param {object} [options.draggable=true] 이동 여부
* @param {object} [options.resizable=false] 리사이징 여부
* @param {object} [options.collapsible=false] 접기/펴기 여부
* @example
* someFunction: function() {
* var me = this;
* ...
* UT.popup("ep-approval", me, 900, 800, {
* "attached": function(popup, e) {
* popup.getContent().setParam({
* app_id: param.app_id || "",
* aprv_id: param.aprv_id || "",
* aprv_typcd: param.aprv_typcd || ""
* });
* },
* "saved-approval": function(popup, e) {
* if (UT.isFunction(savedCallback)) {
* savedCallback.call(this, e.detail);
* }
* }
* }, {maximizable: true});
* }
*/
popup: function(popupTagName, element, width, height, events, options) {
options = options || {};
var modal = UT.isBoolean(options.modal) ? options.modal : true;
var maximizable = UT.isBoolean(options.maximizable) ? options.maximizable : false;
var draggable = UT.isBoolean(options.draggable) ? options.draggable : true;
var resizable = UT.isBoolean(options.resizable) ? options.resizable : true;
var closable = UT.isBoolean(options.closable) ? options.closable : true;
var collapsible = UT.isBoolean(options.collapsible) ? options.collapsible : false;
var title = UT.isString(options.title) ? options.title : "";
var i18nDisabled = UT.isString(options.i18nDisabled) ? options.i18nDisabled : false;
var resizeOnBrowserResize = UT.isBoolean(options.resizeOnBrowserResize) ? options.resizeOnBrowserResize : true;
var refitOnBrowserResize = UT.isBoolean(options.refitOnBrowserResize) ? options.refitOnBrowserResize : true;
var popup = SCPopupManager.popup(popupTagName, element, width, height, {
modal : modal,
closable : closable,
maximizable : maximizable,
draggable : draggable,
resizable : resizable,
collapsible : collapsible,
i18nDisabled : i18nDisabled,
resizeOnBrowserResize : resizeOnBrowserResize, //브라우저 리사이즈시 팝업 리사이즈
refitOnBrowserResize : refitOnBrowserResize //브라우저 리사이즈시 팝업 위치 변경
});
var content = popup.getWindowContent();
if(UT.isNotEmpty(title)){
popup.titleText = title;
}
else if(UT.isNotEmpty(content.titleText) && UT.isEmpty(popup.titleText)){
popup.titleText = content.titleText;
}
if (UT.isObject(events)) {
for (var eventName in events) {
if (UT.isFunction(events[eventName]) && eventName !== "close") { //close 이벤트는 별도로 제어
content.addEventListener(eventName, events[eventName].bind(null, popup));
}
}
}
//close 이벤트가 발생하면 팝업을 닫아줌
popup.addEventListener("close", function(e) {
popup.close();
if (UT.isObject(events)) {
if (UT.isFunction(events["close"])) {
events["close"].call(this, popup, e);
}
}
});
//팝업이 숨겨질 때 Reset을 호출
popup.addEventListener("sc-window-hided", function(e) {
if(content.reset)
content.reset();
});
return popup;
},
/**
* 팝업
*
* scpopup에 iframe을 이용하여 jsp, html등 파일을 호출한다.
* 호출된 jsp에서 팝업창을 제어할 수 있도록 closePopup 펑션 추가
*
* @method popupJsp
* @param {string} url 호출할 파일 url
* @param {object} element element
* @param {number} width 가로크기
* @param {number} height 세로크기
* @param {object} [events] 팝업에서 발생되는 event의 리스너 목록,
* @param {object} [options] 팝업 설정 옵션
* @param {object} [options.modal=true] 모달 여부
* @param {object} [options.maximizable=false] 최대화 여부
* @param {object} [options.draggable=true] 이동 여부
* @param {object} [options.resizable=false] 리사이징 여부
* @param {object} [options.collapsible=false] 접기/펴기 여부
* @example
* someFunction: function() {
* var me = this;
* ...
* UT.popupJsp("test.jsp", me, 900, 800, {maximizable: true});
* }
*/
popupJsp: function(url, element, width, height, events, options) {
options = options || {};
events = events || {};
var modal = UT.isBoolean(options.modal) ? options.modal : true;
var maximizable = UT.isBoolean(options.maximizable) ? options.maximizable : false;
var draggable = UT.isBoolean(options.draggable) ? options.draggable : true;
var resizable = UT.isBoolean(options.resizable) ? options.resizable : true;
var closable = UT.isBoolean(options.closable) ? options.closable : true;
var collapsible = UT.isBoolean(options.collapsible) ? options.collapsible : false;
var title = UT.isString(options.title) ? options.title : "";
var popup = SCPopupManager.create(null, element, width, height, modal, closable, maximizable, draggable, resizable, collapsible);
popup.titleText = title;
var iframe = document.createElement('iframe');
iframe.src = encodeURI(url);
iframe.frameborder = 0;
iframe.scrolling = UT.isString(options.scrolling) ? options.scrolling : 'yes';
iframe.width = '100%';
iframe.height = '100%';
popup._contentElement.appendChild(iframe);
popup.show();
content = iframe.contentWindow;
iframe.onload = function(){
iframe.contentWindow.fire = function(event, detail) {
popup.fire(event, detail);
};
};
if (UT.isObject(events)) {
for (var eventName in events) {
if (UT.isFunction(events[eventName]) && eventName !== "close") {
popup.addEventListener(eventName, events[eventName].bind(this, popup));
}
}
}
popup.addEventListener("close", function(e) {
popup.close();
if (UT.isFunction(events["close"])) {
events["close"].call(this, iframe.contentWindow, e);
}
});
content.focus();
return iframe.contentWindow;
},
/**
* 결재 팝업
*
* @method popupApproval
* @param {object} element element
* @param {object} param 결재 팝업으로 전달할 파라미터
* @param {string} [param.app_id] 해당 모듈의 APP 아이디(신규작성시)
* @param {string} [param.aprv_typcd] 결재 유형코드(신규작성시)
* @param {string} [param.aprv_id] 결재 아이디
* @param {function} [savedCallback(stsCd)] 결재 작성시(resultView=false) 결재정보가 저장된 후 콜백 함수
* @param {string} savedCallback(stsCd).stsCd 결재상태코드
* @async
* @example
* someFunction: function() {
* var me = this;
* UT.popupApproval(me, {aprv_id: data.aprv_id}, function() {
* ...
* });
* }
*/
popupApproval: function(element, param, savedCallback, isViewMode) {
var loadParam = {
app_id: param.app_id || "",
aprv_id: param.aprv_id || "",
aprv_stscd: param.aprv_stscd || "",
aprv_typcd: param.aprv_typcd || "",
pr_att_no: param.pr_att_no || "",
tmp_param : param.tmp_param || {},
is_view_mode: isViewMode === true,
doc_tit: UT.isNotEmpty(param.doc_tit) ? param.doc_tit + "" : "",
over_yn: UT.isNotEmpty(param.over_yn) ? param.over_yn + "" : "N"
};
var approvalPopup = SCPopupManager.get('ep-approval');
var savedApprovalHandler = function(e) {
approvalPopup.removeEventListener('saved-approval', savedApprovalHandler);
approvalPopup.removeEventListener('sc-window-hided', closeHandler);
if (UT.isFunction(savedCallback)) {
savedCallback.call(this, e.detail, approvalPopup);
}
approvalPopup.getWindowContent().reset();
approvalPopup.close();
};
var closeHandler = function(e) {
approvalPopup.removeEventListener('saved-approval', savedApprovalHandler);
approvalPopup.removeEventListener('sc-window-hided', closeHandler);
// 결재팝업에서 아무 처리 없이 닫기를 했을 때는 savedCallback 을 호출한다.
// saved-approval 이벤트 발생후 close되는 것과의 구별을 위함. savedCallback 이 두번 호출되는 것 방지
if (e.detail === "callback" && UT.isFunction(savedCallback)) {
savedCallback.call(this, "", approvalPopup);
}
approvalPopup.getWindowContent().reset();
approvalPopup.close();
};
if(!approvalPopup){
element.importLink('./ui/bp/shared/ep-approval.html', function(moduleId) {
SCPopupManager.register("ep-approval", "ep-approval", 900, "95%", {
modal: true,
maximizable: true,
draggable: true
});
approvalPopup = SCPopupManager.get('ep-approval');
approvalPopup.titleText = "결재";
approvalPopup.addEventListener("_resetAuthCheck",function(e){
var authChecker = approvalPopup.getWindowContent().querySelector('cc-auth-checker');
if(authChecker){
authChecker.applyAuthorization();
}
});
approvalPopup.addEventListener("saved-approval", savedApprovalHandler);
approvalPopup.addEventListener("sc-window-hided", closeHandler);
approvalPopup.show();
approvalPopup.getWindowContent().load(loadParam);
});
}
else{
approvalPopup.addEventListener("saved-approval", savedApprovalHandler);
approvalPopup.addEventListener("sc-window-hided", closeHandler);
approvalPopup.show();
approvalPopup.fire('_resetAuthCheck');
approvalPopup.getWindowContent().load(loadParam);
}
},
/**
* 첨부파일 업로드 팝업
*
* 콜백함수로부터 첨부파일 그룹코드와 파일 개수가 전달된다.
*
* @method popupAttach
* @param {object} element element
* @param {string} grpCd 첨부파일 그룹코드
* @param {function} [savedCallback(result)] 파일 저장 후 콜백 함수
* @param {object} savedCallback(result).result 콜백함수로부터 전달 되는 파라미터 - (예) {grp_cd: "xxx", file_count: 2}
* @param {string} savedCallback(result).result.grp_cd 첨부파일 그룹코드
* @param {number} savedCallback(result).result.file_count 업로드된 파일 총 수
* @param {object} [options] 업로더 설정 옵션
* @param {number} [options.maxTotalFileCount=0] 객최대 파일 개수, 0 : 제한없음.
* @param {string} [options.maxTotalFileSize=0] 업로드 될 파일의 총 용량. 단위 - B(byte), KB(kilobyte), MB(megabyte), GB(gigabyte)
* @async
* @example
* someFunction: function() {
* var me = this;
* me.gridView.onDataCellClicked = function(grid, cell) {
* var fieldName = cell.fieldName;
* if(fieldName == "field1"){
* UT.popupAttach(me, me.data.field2, function(result) {
* grid.setValues(cell.itemIndex, {
* field2: result.grp_cd,
* field1: result.file_count
* }, true);
* });
* }
* };
* }
*/
popupAttach: function(element, grpCd, savedCallback, options) {
var param = {
grp_cd: grpCd || "",
options: options
};
var attachPopup = SCPopupManager.get('ep-attach');
var savedAttachHandler = function(e){
attachPopup.removeEventListener("saved-attach", savedAttachHandler);
attachPopup.removeEventListener("sc-window-hided", closeHandler);
if (UT.isFunction(savedCallback)) {
savedCallback.call(this, e.detail);
}
attachPopup.getWindowContent().reset();
attachPopup.close();
};
var closeHandler = function(){
attachPopup.removeEventListener("saved-attach", savedAttachHandler);
attachPopup.removeEventListener("sc-window-hided", closeHandler);
attachPopup.getWindowContent().reset();
attachPopup.close();
};
if(!attachPopup){
// element.importLink('../../../../../ui/bp/shared/ep-attach.html', function(moduleId) {
element.importLink('./ui/bp/shared/ep-attach.html', function(moduleId) {
SCPopupManager.register("ep-attach", "ep-attach", 800, 400,{
modal: true,
maximizable: true
});
attachPopup = SCPopupManager.get('ep-attach');
attachPopup.addEventListener("saved-attach", savedAttachHandler);
attachPopup.addEventListener("sc-window-hided", closeHandler);
attachPopup.show();
attachPopup.getWindowContent().load(param);
});
}
else{
attachPopup.addEventListener("saved-attach", savedAttachHandler);
attachPopup.addEventListener("sc-window-hided", closeHandler);
attachPopup.getWindowContent().reset(); // sc-upload 초기화 위해 추가 2017.06.08 mgpark
attachPopup.show();
attachPopup.getWindowContent().load(param);
}
},
popupDrmAttach: function(element, grpCd, savedCallback, options) {
var param = {
grp_cd: grpCd || "",
options: options
};
var drmAttachPopup = SCPopupManager.get('ep-drm-attach');
var savedAttachHandler = function(e){
drmAttachPopup.removeEventListener("saved-attach", savedAttachHandler);
drmAttachPopup.removeEventListener("sc-window-hided", closeHandler);
if (UT.isFunction(savedCallback)) {
savedCallback.call(this, e.detail);
}
drmAttachPopup.getWindowContent().reset();
drmAttachPopup.close();
};
var closeHandler = function(){
drmAttachPopup.removeEventListener("saved-attach", savedAttachHandler);
drmAttachPopup.removeEventListener("sc-window-hided", closeHandler);
drmAttachPopup.getWindowContent().reset();
drmAttachPopup.close();
};
if(!drmAttachPopup){
// element.importLink('../../../../../ui/bp/shared/ep-attach.html', function(moduleId) {
element.importLink('./ui/bp/shared/ep-drm-attach.html', function(moduleId) {
SCPopupManager.register("ep-drm-attach", "ep-drm-attach", 800, 400,{
modal: true,
maximizable: true
});
drmAttachPopup = SCPopupManager.get('ep-drm-attach');
drmAttachPopup.addEventListener("saved-attach", savedAttachHandler);
drmAttachPopup.addEventListener("sc-window-hided", closeHandler);
drmAttachPopup.show();
drmAttachPopup.getWindowContent().load(param);
});
}
else{
drmAttachPopup.addEventListener("saved-attach", savedAttachHandler);
drmAttachPopup.addEventListener("sc-window-hided", closeHandler);
drmAttachPopup.getWindowContent().reset(); // sc-upload 초기화 위해 추가 2017.06.08 mgpark
drmAttachPopup.show();
drmAttachPopup.getWindowContent().load(param);
}
},
/**
* date를 format의 형태로 출력한다.
*
* @method formatDate
* @param {date|number} date 날짜 객체 | 날짜의 time값
* @param {string} [format=DEF.styles.formatDate.datetimeFormat] 변환할 format
* @return {string} 변환된 문자열
* @example
* someFunction: function() {
* var me = this;
* UT.formatDate(new Date(), "yyyy/MM/dd"); // 2016/04/20
* }
*/
formatDate: function(date, format) {
if (UT.isNumber(date)) {
date = new Date(date);
}
if (!(SCUtil.isDate(date))) {
return date;
}
var me = date;
format = format || DEF.styles.formatDate.datetimeFormat;
return format.replace(/(yyyy|yy|MM|M|dd|d|HH|H|mm|m|ss|s)/g, function(match) {
switch (match) {
case "yyyy":
return me.getFullYear();
case "yy":
var v = me.getFullYear() % 100;
return v > 10 ? v : "0" + v;
case "MM":
case "M":
var v = me.getMonth() + 1;
return match.length === 1 || v >= 10 ? v : "0" + v;
case "dd":
case "d":
var v = me.getDate();
return match.length === 1 || v >= 10 ? v : "0" + v;
case "HH":
case "H":
var v = me.getHours();
return match.length === 1 || v >= 10 ? v : "0" + v;
case "mm":
case "m":
var v = me.getMinutes();
return match.length === 1 || v >= 10 ? v : "0" + v;
case "ss":
case "s":
var v = me.getSeconds();
return match.length === 1 || v >= 10 ? v : "0" + v;
default:
return match;
}
});
},
/**
* string에 values를 replace 한다
*
* @method formatString
* @param {string} string 대상 문자열
* @param {string|array} values 바꿀 문자열
* @return {string} replace 된 문자열
* @example
* someFunction: function() {
* var me = this;
* UT.formatString("{0} / {1}", "a", "b"); // a / b
* UT.formatString("{0} / {1}", ["a", "b"]); // a / b
* UT.formatString("{name} / {value}", {name: "a", value: "b"}); // a / b
* }
*/
formatString: function(string, values) {
string = I18N.translate(string); //formatString의 key값을 translate
values = UT.isObject(values) ? values : Array.prototype.slice.call(arguments, 1);
return string.replace(/\{([^{}]+)\}/gm, function(matched, key) {
return typeof values[key] === "undefined" ? matched : values[key];
});
},
/**
* 숫자형으로.
*
* @method toNumber
* @param {string} s
* @return {number} n : param 이 숫자형이 아니면 0
*/
toNumber: function(s) {
if (UT.isString(s)) {
s = s.replace(/[\,]/g, "");
}
return isNaN(s) ? 0 : Number(s);
},
/**
* format 형태의 string을 date 로 변환한다.
*
* @method toDate
* @param {string} str 날짜 string
* @param {string} [format=DEF.styles.formatDate.datetimeFormat] str의 format
* @return {date} 변환된 date
* @example
* someFunction: function() {
* var me = this;
* UT.toDate("20160420", "yyyyMMdd"); // 2016/04/20
* }
*/
toDate: function(str, format) {
format = format || DEF.styles.formatDate.datetimeFormat;
if(UT.isDate(str)){
return str;
}
if(UT.isString(str)) {
str = str.replace(/\//g, "");
}
if(!UT.isString(str) || str.length !== format.length) {
return null;
}
var y = 0, m = 0, d = 0, h = 0, mi = 0, s = 0;
format.replace(/(yyyy|yy|MM|M|dd|d|HH|H|mm|m|ss|s)/g, function(match) {
var offset = arguments[arguments.length - 2];
switch (match) {
case "yyyy":
case "yy":
y = parseInt(str.substring(offset, offset + match.length), 10);
break;
case "MM":
case "M":
m = parseInt(str.substring(offset, offset + match.length), 10) - 1;
break;
case "dd":
case "d":
d = parseInt(str.substring(offset, offset + match.length), 10);
break;
case "HH":
case "H":
h = parseInt(str.substring(offset, offset + match.length), 10);
break;
case "mm":
case "m":
mi = parseInt(str.substring(offset, offset + match.length), 10);
break;
case "ss":
case "s":
s = parseInt(str.substring(offset, offset + match.length), 10);
break;
default:
break;
}
});
return new Date(y, m, d, h, mi, s);
},
/**
* Array 여부
*
* @method isArray
* @param {object} object
* @return {boolean} true is array
* @example
* someFunction: function() {
* var me = this;
* ...
* if (UT.isArray(dataRows)) {
* ...
* }
* }
*/
isArray: function(object) {
return Array.isArray(object);
// return Object.prototype.toString.call(object) === "[object Array]";
},
/**
* String 여부
*
* @method isString
* @param {object} object
* @return {boolean} true is string
* @example
* someFunction: function() {
* var me = this;
* ...
* if (UT.isString(usrId)) {
* ...
* }
* }
*/
isString: function(object) {
return "string" === typeof object;
},
/**
* Boolean 여부
*
* @method isBoolean
* @param {object} object
* @return {boolean} true is boolean
* @example
* someFunction: function() {
* var me = this;
* ...
* me.set("singleSelect", UT.isBoolean(options.singleSelect) ? options.singleSelect : false);
* }
*/
isBoolean: function(object) {
return "boolean" === typeof object;
},
/**
* Number 여부
*
* @method isNumber
* @param {object} object
* @return {boolean} true is number
* @example
* someFunction: function() {
* var me = this;
* ...
* if (UT.isNumber(count)) {
* ...
* }
* }
*/
isNumber: function(object) {
return "number" === typeof object;
},
/**
* Function 여부
*
* @method isFunction
* @param {object} object
* @return {boolean} true is function
* @example
* someFunction: function() {
* var me = this;
* if (UT.isFunction(callback)) {
* callback.call(this);
* }
* }
*/
isFunction: function(object) {
return "function" === typeof object;
},
/**
* Object 여부
*
* (주의: null 도 object이지만, 편의상 null 은 object에서 제외 한다)
*
* @method isObject
* @param {object} object
* @return {boolean} true is object
* @example
* someFunction: function() {
* var me = this;
* ...
* if (UT.isObject(options.defaultParam)) {
* me.set("findList.param", options.defaultParam);
* }
* }
*/
isObject: function(object) {
return object !== null && "object" === typeof object;
},
/**
* Date 여부
*
* @method isDate
* @param {object} object
* @return {boolean} true is date
* @example
* someFunction: function() {
* var me = this;
* ...
* if (UT.isDate(param)) {
* ...
* }
* }
*/
isDate: function(object) {
return UT.isObject(object) && typeof object.getTime === "function";
},
/**
* 데이터의 empty 여부
*
* string일 경우 trim 후 empty 검사한다
*
* @method isEmpty
* @param {string|array} object
* @return {boolean} true is empty
* @example
* someFunction: function() {
* var me = this;
* ...
* if (!UT.isEmpty(item)) {
* ...
* }
* }
*/
isEmpty: function(object) {
return object === null || "undefined" === typeof object || (UT.isObject(object) && !Object.keys(object).length && !UT.isDate(object)) || (UT.isString(object) && object.trim() === "") || (UT.isArray(object) && object.length === 0);
},
/**
* !UT.isEmpty(object)
*
* @method isNotEmpty
* @param {string|array} object
* @return {boolean} true is not empty
*/
isNotEmpty: function(object) {
return !UT.isEmpty(object);
},
/**
* input element에서 enter key가 눌렸을 때의 이벤트
*
* @method enter
* @param {object} element
* @param {function} callback enter key가 눌린 후 콜백 함수
* @example
* someFunction: function() {
* var me = this;
* }
*/
enter: function(element, callback) {
$(element).find("input").keypress(function(key) {
if (key.keyCode === 13) {
if (UT.isFunction(callback)) {
callback.call(this);
}
}
});
},
/**
* 부모를 탐색하며 selector와 동일한 엘리먼트를 찾아줌
*
* @method closest
* @param {object} element
* @param {string} selector
* @return {object}
* @example
* someFunction: function() {
* var me = this;
* }
*/
closest: function(element, selector) {
while(element) {
if (Polymer.DomApi.matchesSelector.call(element, selector)) {
return element;
} else {
element = element.parentElement;
}
}
},
/**
* 현재 화면의 MenuId를 return
*
* @method getMenuId
* @param {object} element
* @return {string} menuId
* @example
* someFunction: function() {
* var me = this;
* }
*/
getMenuId: function(element) {
return SCMdiManager.getCurrentMenuId(element);
},
/**
* 현재 화면의 authList를 return
*
* @method getAuthList
* @param {object} element
* @return {array} authList
* @example
* someFunction: function() {
* var me = this;
* }
*/
getAuthList: function(element) {
var menuId = UT.getMenuId(element);
if (menuId) {
return SCRoleManager.getUserFuncs(menuId);
}
},
/**
* menuId를 통해 메뉴생성
*
* @method createWindowByMenuId
* @param {string} menuId 메뉴아이디
* @example
* someFunction: function() {
* var me = this;
* }
*/
createWindowByMenuId: function(menuId) {
var mdiMain = document.querySelector("sc-mdi");
var menuList = SCMdiManager.getMenuList();//mdiMain.$.mdiTopMenu.menuList;
var windowIndex = mdiMain.$.mdiContent.createdWindows.indexOf(menuId);
if(windowIndex > -1){
mdiMain.$.mdiContent.removeWindow(menuId);
}
for (idx in menuList) {
if (menuId == menuList[idx].menu_id) {
mdiMain.$.mdiContent.createWindow(menuList[idx].menu_id, menuList[idx].menu_nm, menuList[idx].menu_url);
return;
}
}
},
/**
* 메뉴 생성
*
* @method createWindow
* @param {string} menuId 메뉴아이디
* @param {string} menuName 메뉴명
* @param {string} menuUrl 메뉴URL
* @example
* someFunction: function() {
* var me = this;
* }
*/
createWindow: function(menuId, menuName, menuUrl) {
var mdiMain = document.querySelector("sc-mdi");
var windowIndex = mdiMain.$.mdiContent.createdWindows.indexOf(menuId);
if(windowIndex > -1){
mdiMain.$.mdiContent.removeWindow(menuId);
}
mdiMain.$.mdiContent.createWindow(menuId, menuName, menuUrl);
},
/**
* Array 에 특정 필드에 특정 값이 필터값과 같으면 Array를 재생성함.
* @method : arrayFilterChange
* @param : {Array} array
* @param : {Object} filter : {key : filter처리할키 , value : 값}
* @example
* UT.arrayFilterChange(me.codes.prcStlTypCd,{key : "dtl_cd_attr_val",value : me.rfxData.rfx_typ});
*
*/
arrayFilterChange : function(array,filter){
//배열에서 자료추출
if(UT.isArray(array)){
var datas = array.filter(function (element) {
if (element[filter.key] === filter.value) {
return true;
}
});
return datas;
}else{
return array;
}
},
getHour : function(){
var array = [];
for(var i = 0 ; i< 24 ; i++){
array.push({data : i});
}
return array;
},
getMin : function(){
var array = [];
for(var i = 0 ; i< 60 ; i++){
array.push({data : i});
}
return array;
},
/**
* TODO : 날짜,시간,분이 있는 component의 값을 date로
* dt.hour.min이 있는 data의 경우 dt로 date를 만들어서 셋팅
*
* ynkim
*/
convertDayHourMinToDt : function(obj){
for (var key in obj) {
if (obj.hasOwnProperty(key) && /_dt$/.test(key)) {
var val = obj[key];
if(Date.parse(val)){
var day = obj[key],
hour = obj[key +"_hour"],
min = obj[key +"_min"];
if((UT.isDate(day) || !UT.isEmpty(day)) && !UT.isObject(hour) && !UT.isObject(min)){
var date = new Date(day);
date.setHours(!!hour?hour:0, !!min?min:0, 0, 0);
obj[key] = date;
}
}
}
}
return obj;
},
/**
* TODO: 추가개발필요 )))) date의 값을 날짜,시간,분이 있는 값으로 셋팅
* data에 dt가 있는 데이타의 경우 dt,hour,min data를 만들어서 셋팅
*
* ynkim
*/
convertDtToDayHourMin : function(obj){
for (var key in obj) {
if (obj.hasOwnProperty(key) && /_dt$/.test(key)) {
var val = obj[key];
if(Date.parse(val)){
var newKey = key+"_dt";
obj[newKey] = val;
newKey = key +"_hour";
obj[newKey] = val.getHours();
newKey = key +"_min";
obj[newKey] = val.getMinutes();
}
}
}
return obj;
},
convertDtToDayHourMinDisplay : function(obj){
for (var key in obj) {
if (obj.hasOwnProperty(key) && /_dt$/.test(key)) {
var val = obj[key];
if(Date.parse(val)){
var newKey = key+"_dt";
obj[newKey] = val;
newKey = key +"_hour";
obj[newKey] = val.getHours();
if(obj[newKey] <10){
obj[newKey] = ""+"0"+obj[newKey];
}
newKey = key +"_min";
obj[newKey] = val.getMinutes();
if(obj[newKey] <10){
obj[newKey] = ""+"0"+obj[newKey];
}
}
}
}
return obj;
},
//트리 변환 메서드
listToTree : function (arrayList, idKey,parentIdKey) {
var rootNodes = [];
var traverse = function (nodes, item, index) {
if (nodes instanceof Array) {
return nodes.some(function (node) {
if (node[idKey] === item[parentIdKey]) {
node.children = node.children || [];
return node.children.push(arrayList.splice(index, 1)[0]);
}
return traverse(node.children, item, index);
});
}
};
while (arrayList.length > 0) {
arrayList.some(function (item, index) {
if (item[parentIdKey] === "ROOT") {
return rootNodes.push(arrayList.splice(index, 1)[0]);
}
return traverse(rootNodes, item, index);
});
}
return rootNodes;
},
/**
* 협력사 profile 팝업 호출
* @param element
* @param param
* @param savedCallback
*/
popupVendor: function(element, param, savedCallback) {
var vendorPopup = SCPopupManager.get('ep-vendor-profile-tab');
var completeSaveHandler = function(e){
vendorPopup.removeEventListener("complete-save", completeSaveHandler);
vendorPopup.removeEventListener("sc-window-hided", closeHandler);
if (UT.isFunction(savedCallback)) {
savedCallback.call(this, e.detail);
}
vendorPopup.getWindowContent().reset();
vendorPopup.close();
};
var closeHandler = function(e){
vendorPopup.removeEventListener("complete-save", completeSaveHandler);
vendorPopup.removeEventListener("sc-window-hided", closeHandler);
vendorPopup.getWindowContent().reset();
vendorPopup.close();
};
if(!vendorPopup){
element.importLink('./ui/bp/esourcing/vendorInfoMgt/ep-vendor-profile-tab.html', function(moduleId) {
SCPopupManager.register("ep-vendor-profile-tab", "ep-vendor-profile-tab", "90%", "90%", {
modal: true,
maximizable: true,
//브라우저 리사이즈시 팝업 리사이즈
resizeOnBrowserResize : true,
//브라우저 리사이즈시 팝업 위치이동
refitOnBrowserResize : true
});
vendorPopup = SCPopupManager.get('ep-vendor-profile-tab');
vendorPopup.titleText = "협력업체정보";
vendorPopup.addEventListener("complete-save", completeSaveHandler);
vendorPopup.addEventListener("sc-window-hided", closeHandler);
vendorPopup.show();
vendorPopup.getWindowContent().load(param);
});
}
else{
vendorPopup.addEventListener("complete-save", completeSaveHandler);
vendorPopup.addEventListener("sc-window-hided", closeHandler);
vendorPopup.show();
vendorPopup.getWindowContent().load(param);
}
},
/**
* ASIS협력사 profile 팝업 호출
* @param element
* @param param
* @param savedCallback
*/
popupAfVendor: function(element, param, savedCallback) {
var vendorPopup = SCPopupManager.get('ep-afvendor-profile-tab');
var completeSaveHandler = function(e){
vendorPopup.removeEventListener("complete-save", completeSaveHandler);
vendorPopup.removeEventListener("sc-window-hided", closeHandler);
if (UT.isFunction(savedCallback)) {
savedCallback.call(this, e.detail);
}
vendorPopup.getWindowContent().reset();
vendorPopup.close();
};
var closeHandler = function(e){
vendorPopup.removeEventListener("complete-save", completeSaveHandler);
vendorPopup.removeEventListener("sc-window-hided", closeHandler);
vendorPopup.getWindowContent().reset();
vendorPopup.close();
};
if(!vendorPopup){
element.importLink('./ui/bp/afpro/ep-afvendor-profile-tab.html', function(moduleId) {
SCPopupManager.register("ep-afvendor-profile-tab", "ep-afvendor-profile-tab", "90%", "90%", {
modal: true,
maximizable: true,
//브라우저 리사이즈시 팝업 리사이즈
resizeOnBrowserResize : true,
//브라우저 리사이즈시 팝업 위치이동
refitOnBrowserResize : true
});
vendorPopup = SCPopupManager.get('ep-afvendor-profile-tab');
vendorPopup.titleText = "협력업체정보";
vendorPopup.addEventListener("complete-save", completeSaveHandler);
vendorPopup.addEventListener("sc-window-hided", closeHandler);
vendorPopup.show();
vendorPopup.getWindowContent().load(param);
});
}
else{
vendorPopup.addEventListener("complete-save", completeSaveHandler);
vendorPopup.addEventListener("sc-window-hided", closeHandler);
vendorPopup.show();
vendorPopup.getWindowContent().load(param);
}
},
/**
* moment.js의 date를 javascript date object로 변환
* @param {object} momentDate 변경하려는 momentjs 객체
* @returns {Date} 변환된 데이트 객체
*/
moment2Date : function(momentDate) {
var targetDate = new Date();
targetDate.setYear(momentDate.year());
targetDate.setMonth(momentDate.month());
targetDate.setDate(momentDate.date());
targetDate.setHours(momentDate.hour());
targetDate.setMinutes(momentDate.minute());
return targetDate;
},
/**
* 부동소수 수량의 곱 (소수점 3자리까지 입력가능. 결과는 소수점 6자리까지 나올수 있음)
* Round 값을 넣지 않으면 Scale 값은 무시
* @param _numberPrc 계산할 숫자1
* @param _numberQty 계산할 숫자2
* @param Round (ROUND: 반올림, CEIL: 올림, FLOOR: 내림, 입력안함: 전부표시)
* @param Scale 소수점 몇째자리에서 처리
* @returns {String}
*/
toFixedMultiply : function(_numberPrc, _numberQty, Round, Scale) {
var _divisor = Math.pow(10, 8);
var sign = 1;
var _multip, _multipPrc, _multipQty;
var _idxPrc, _idxQty;
if(Round === null || typeof Round === 'undefined'){
Round = "NONE";
}
if(Scale === null || typeof Scale === 'undefined'){
Scale = 4;
}
if(_numberPrc < 0) {
sign *= -1; _multipPrc = (_numberPrc * -1).toString();
}
else {
_multipPrc = _numberPrc.toString();
}
if(_numberQty < 0) {
sign *= -1; _multipQty = (_numberQty * -1).toString();
}
else {
_multipQty = _numberQty.toString();
}
_idxPrc = _multipPrc.indexOf(".");
_idxQty = _multipQty.indexOf(".");
if(_idxPrc == -1) {
_multipPrc = (_multipPrc + "0000");
}
else {
_multipPrc = (_multipPrc + "0000");
_multipPrc = _multipPrc.substring(0, _idxPrc) + _multipPrc.substring(_idxPrc+1, _idxPrc+5);
}
if(_idxQty == -1) {
_multipQty = (_multipQty + "0000");
}
else {
_multipQty = (_multipQty + "0000");
_multipQty = _multipQty.substring(0, _idxQty) + _multipQty.substring(_idxQty+1, _idxQty+5);
}
switch(Round) {
case "ROUND" :
_multip = ( (Number(_multipPrc) * Number(_multipQty) + (5*Math.pow(10, 8-Scale))) / _divisor * sign).toString();
_multip = (_multip.indexOf(".") == -1)? _multip : _multip.substring(0, _multip.indexOf(".") + Scale);
break;
case "CEIL":
_multip = ( (Number(_multipPrc) * Number(_multipQty) + (Math.pow(10, 9-Scale)-1)) / _divisor * sign).toString();
_multip = (_multip.indexOf(".") == -1)? _multip : _multip.substring(0, _multip.indexOf(".") + Scale);
break;
case "FLOOR":
_multip = ( (Number(_multipPrc) * Number(_multipQty)) / _divisor * sign).toString();
_multip = (_multip.indexOf(".") == -1)? _multip : _multip.substring(0, _multip.indexOf(".") + Scale);
break;
default:
_multip = ( (Number(_multipPrc) * Number(_multipQty)) / _divisor * sign).toString();
break;
}
return _multip;
},
/**
* 부동소수 수량의 나눗셈 (소수점 3자리까지 입력가능. 결과가 소수점 무한대로 나올수있으므로 Round 파라미터 입력필요 )
* Round 값을 넣지 않으면 Scale 값은 무시
* @param _number1 계산할 숫자1
* @param _number2 계산할 숫자2
* @param Round (ROUND: 반올림, CEIL: 올림, FLOOR: 내림, 입력안함: 전부표시)
* @param Scale 소수점 몇째자리에서 처리
* @returns {String}
*/
toFixedDivide : function(_number1, _number2, Round, Scale) {
var _multip1 = _number1.toString();
var _multip2 = _number2.toString();
var _idx1, _idx2;
if(Round === null || typeof Round === 'undefined'){
Round = "NONE";
}
if(Scale === null || typeof Scale === 'undefined'){
Scale = 4;
}
// 소수점 몇째자리까지 있는지 확인
_idx1 = _multip1.indexOf(".");
_idx2 = _multip2.indexOf(".");
//정수화된 값
var _multip1Num = "";
var _multip2Num = "";
//소수점 길이
var _multip1Len = 0;
var _multip2Len = 0;
if(_idx1 != -1)
_multip1Len = _multip1.length - _idx1 -1;
if(_idx2 != -1)
_multip2Len = _multip2.length - _idx2 -1;
// 각 수 정수로 바꾸기
if(_multip1Len == _multip2Len){
// 둘다 정수일때
if(_multip1Len == 0){
_multip1Num = _multip1;
_multip2Num = _multip2;
}
else{
_multip1Num = _multip1.substring(0, _idx1) + _multip1.substring(_idx1+1, _multip1.length);
_multip2Num = _multip2.substring(0, _idx2) + _multip2.substring(_idx2+1, _multip2.length);
}
}
else if(_multip1Len > _multip2Len){
// 소수점뒤 길이가 긴건 소수점만 없애고 짧은건 짧은 수만큼 0 붙이기
var powLen = Math.pow(10,_multip1Len-_multip2Len).toString();
_multip1Num = _multip1.substring(0, _idx1) + _multip1.substring(_idx1+1, _multip1.length);
if(_multip2Len == 0){
_multip2Num = _multip2 + powLen.substring(1,powLen.length);
}else{
_multip2Num = _multip2.substring(0, _idx2) + _multip2.substring(_idx2+1, _multip2.length) + powLen.substring(1,powLen.length);
}
}else{
// 소수점뒤 길이가 긴건 소수점만 없애고 짧은건 짧은 수만큼 0 붙이기
var powLen = Math.pow(10,_multip2Len-_multip1Len).toString();
_multip2Num = _multip2.substring(0, _idx2) + _multip2.substring(_idx2+1, _multip2.length);
if(_multip1Len == 0){
_multip1Num = _multip1 + powLen.substring(1,powLen.length);
}else{
_multip1Num = _multip1.substring(0, _idx1) + _multip1.substring(_idx1+1, _multip1.length) + powLen.substring(1,powLen.length);
}
}
// 결과값
var _result = Number(_multip1Num) / Number(_multip2Num);
//반올림 함수 호출부분
return this.toFixedRound(_result,Round,Scale);
},
/**
* 반올림 올림 내림 함수
* @param _number1 계산할 숫자
* @param Round (ROUND: 반올림, CEIL: 올림, FLOOR: 내림, 입력안함: 전부표시)
* @param Scale 소수점 몇째자리에서 처리
* @returns {String}
*/
toFixedRound : function(_number1, Round, Scale){
// String 변환
var _num = _number1.toString();
var sign = "";
if(Round === null || typeof Round === 'undefined'){
Round = "NONE";
}
if(Scale === null || typeof Scale === 'undefined'){
Scale = 4;
}
if(_number1 < 0){
sign = "-";
_num = _num.substring(1,_num.length);
}
//소수점 위치
var indexdot = _num.indexOf(".");
// 곱한 10의 n 승
var muxcnt = _num.length - indexdot -1;
// 정수가 들어왔거나 소수점처리 안한다면 그냥 리턴
if(indexdot == -1 || Round == "NONE" || muxcnt < Scale)
return _number1.toString();
// 소수점 제거된 입력값
var _numX = Number(_num.substring(0, indexdot) + _num.substring(indexdot+1, _num.length));
var _numS = "";
switch(Round)
{
case "ROUND" :
_numS = ( (Number(_numX) + (5*Math.pow(10, muxcnt-Scale))) / Math.pow(10,muxcnt) ).toString();
_numS = (_numS.indexOf(".") == -1)? _numS : _numS.substring(0, _numS.indexOf(".") + Scale);
break;
case "CEIL":
_numS = ( (Number(_numX) + (Math.pow(10, muxcnt+1-Scale)-1)) / Math.pow(10,muxcnt)).toString();
_numS = (_numS.indexOf(".") == -1)? _numS : _numS.substring(0, _numS.indexOf(".") + Scale);
break;
case "FLOOR":
_numS = ( Number(_numX) / Math.pow(10,muxcnt)).toString();
_numS = (_numS.indexOf(".") == -1)? _numS : _numS.substring(0, _numS.indexOf(".") + Scale);
break;
default: //아무것도 아닐 경우
return _number1.toString();
break;
}
return Number(sign+_numS).toString();
},
/**
* 부동소수 수량의 합. (소수점 4째자리까지 입력 가능)
* @param _numQtyA 계산할 숫자1
* @param _numQtyB 계산할 숫자2
* @returns {String}
*/
toFixedAdd : function(_numQtyA, _numQtyB) {
var _divisor = Math.pow(10, 4);
var _addition;
var _addQtyA = _numQtyA.toString();
var _addQtyB = _numQtyB.toString();
var _idxQtyA = _addQtyA.indexOf(".");
var _idxQtyB = _addQtyB.indexOf(".");
if(_idxQtyA == -1)
_addQtyA = (_addQtyA + "0000");
else
{
_addQtyA = (_addQtyA + "0000");
_addQtyA = _addQtyA.substring(0, _idxQtyA) + _addQtyA.substring(_idxQtyA+1, _idxQtyA+5);
}
if(_idxQtyB == -1)
_addQtyB = (_addQtyB + "0000");
else
{
_addQtyB = (_addQtyB + "0000");
_addQtyB = _addQtyB.substring(0, _idxQtyB) + _addQtyB.substring(_idxQtyB+1, _idxQtyB+5);
}
_addition = ( (Number(_addQtyA) + Number(_addQtyB) ) / _divisor).toString();
return _addition;
},
/**
* 부동소수 수량의 차. (소수점 4째자리까지 입력 가능)
* @param _numQtyA 계산할 숫자1
* @param _numQtyB 계산할 숫자2
* @returns {String}
*/
toFixedSub : function(_numQtyA, _numQtyB) {
var _divisor = Math.pow(10, 4);
var _addition;
var _addQtyA = _numQtyA.toString();
var _addQtyB = _numQtyB.toString();
var _idxQtyA = _addQtyA.indexOf(".");
var _idxQtyB = _addQtyB.indexOf(".");
if(_idxQtyA == -1) {
_addQtyA = (_addQtyA + "0000");
}
else {
_addQtyA = (_addQtyA + "0000");
_addQtyA = _addQtyA.substring(0, _idxQtyA) + _addQtyA.substring(_idxQtyA+1, _idxQtyA+5);
}
if(_idxQtyB == -1) {
_addQtyB = (_addQtyB + "0000");
}
else {
_addQtyB = (_addQtyB + "0000");
_addQtyB = _addQtyB.substring(0, _idxQtyB) + _addQtyB.substring(_idxQtyB+1, _idxQtyB+5);
}
_addition = ( (Number(_addQtyA) - Number(_addQtyB) ) / _divisor).toString();
return _addition;
},
/**
* session 정보에 값 저장
*/
setSession : function(_key, _value) {
sessionStorage.setItem(_key, JSON.stringify(_value));
},
/**
* session 정보의 값 가져오기
*/
getSession : function(_key){
return UT.isEmpty(sessionStorage.getItem(_key)) ? null : JSON.parse(sessionStorage.getItem(_key));
},
getImgUri: function(main_img_att_id){
var csrf = document.querySelector('meta[name=_csrf]').content;
var parameter = UT.uriConvert(main_img_att_id);
parameter += '&_csrf=' + csrf;
var _src = "upload/download.do?id=" +parameter;
return _src;
},
// img src 주소 가져오기
getImgUri2: function(main_img_att_id){
// var csrf = document.querySelector('meta[name=_csrf]').content;
var parameter = UT.uriConvert(main_img_att_id);
// parameter += '&_csrf=' + csrf;
var _src = "atth/" +parameter;
return _src;
},
objectMerge: function(obj1, obj2){
var obj2Keyset = Object.keys(obj2);
for(utIdx=0; utIdx