123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662 |
- require(['config'], function() {
- require([
- ], function($) {
- pageObj.init();
- });
- });
- /********************************************************
- --------------------------------------------------------
- - Object 목록 -
- --------------------------------------------------------
- * const gridColModel = {} : 화면 Grid Object *
- * let pageObj = {} : 화면공통 Object *
- * let listObj = {} : 목록화면 Object *
- * let viewObj = {} : 상세화면 Object *
- * let modifyObj = {} : 수정화면 Object *
- * let createObj = {} : 신규화면 Object *
- * let afflShopObj = {} : 가맹점 Object *
- *******************************************************/
- /*화면 변수*/
- const OPER01010_GRID_ID = '#ITP_OPER01010_jqGrid';
- const OPER01010_GRID_LIST = '#ITP_OPER01010_jqGrid_list';
- const OPER01010_GRID_PAGER = '#ITP_OPER01010_jqGridPager';
- const OPER01010_GRID_EMPTY = '#ITP_OPER01010_jqGridEmpty';
- const OPER01010_VIEW_GRID_ID = '#ITP_OPER01010_VIEW_jqGrid';
- const OPER01010_VIEW_GRID_LIST = '#ITP_OPER01010_VIEW_jqGrid_list';
- const OPER01010_VIEW_GRID_PAGER = '#ITP_OPER01010_VIEW_jqGridPager';
- const OPER01010_VIEW_GRID_EMPTY = '#ITP_OPER01010_VIEW_jqGridEmpty';
- const OPER01010_DETAIL_GRID_ID = '#ITP_OPER01010_DETAIL_jqGrid';
- const OPER01010_DETAIL_GRID_LIST = '#ITP_OPER01010_DETAIL_jqGrid_list';
- const OPER01010_DETAIL_GRID_PAGER = '#ITP_OPER01010_DETAIL_jqGridPager';
- const OPER01010_DETAIL_GRID_EMPTY = '#ITP_OPER01010_DETAIL_jqGridEmpty';
- let ITP_FORM_OPER01010_DETAIL_IS_DUPLICATE = false;
- let ITP_FORM_OPER01010_DETAIL_IS_WRITING = false;
- /*API URL*/
- let USER_DETAIL_GRID_LIST = '/api/user/detail-grid-list';
- let USER_USERAUTH_GRID_LIST = '/api/user/userauth-grid-list';
- let USER_INFO_USER = '/api/user/info-user';
- let USER_SAVE_USER = '/api/user/save-user';
- let USER_CHECK_DUPLICATE = '/api/user/check-duplicate';
- let USER_INTI_USERPW = '/api/user/inti-userpw';
- /*화면 Grid ColModel*/
- const gridColModel = {
- list: [
- {
- index: 'AFFL_SHOP_NM', name: 'afflShopNm',
- label: ITP_MSG_LOCALE.label.afflShopNm, //가맹점
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'BRAND_NM', name: 'brandNm',
- label: ITP_MSG_LOCALE.label.brandNm, //브랜드
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'USER_ID', name: 'userId',
- label: ITP_MSG_LOCALE.label.userId, //사용자ID
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'USER_NM', name: 'userNm',
- label: ITP_MSG_LOCALE.label.userName, //닉네임
- width: '13', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'EMAIL', name: 'email',
- label: ITP_MSG_LOCALE.label.idEmail, //아이디(이메일)
- width: '15', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'TEL_NO', name: 'telNo',
- label: ITP_MSG_LOCALE.label.telNo, //휴대폰 번호
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'USER_STAT_NM', name: 'userStatNm',
- label: ITP_MSG_LOCALE.label.status, //상태
- width: '6', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'USER_STAT_DT', name: 'userStatDt',
- label: ITP_MSG_LOCALE.label.statusDt, //상태일시
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'ADD_DT', name: 'addDt',
- label: ITP_MSG_LOCALE.label.regDt, //등록일
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- },
- {
- index: 'LAST_LOGIN_DT', name: 'lastLoginDt',
- label: ITP_MSG_LOCALE.label.lastLogin, //마지막 로그인
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: false
- }
- ],
- detail: [
- {
- index: 'VIEW_CD', name: 'viewCd',
- label: ITP_MSG_LOCALE.label.viewCd,
- width: '10', fixed: false, align: 'center',
- sortable: false, hidden: true
- },
- {
- index: 'AUTH_NO', name: 'authNo',
- label: ITP_MSG_LOCALE.label.permitCd,
- width: '20', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text',
- editrules: {required: true}
- },
- {
- index: 'AUTH_NM', name: 'authNm',
- label: ITP_MSG_LOCALE.label.permitName,
- width: '30', fixed: false, align: 'center',
- sortable: true, editable: false, edittype: 'text',
- editrules: {required: true}
- },
- {
- index: 'USE_YN_NM', name: 'useYnNm',
- label: ITP_MSG_LOCALE.label.status,
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text'
- },
- {
- index: 'ADD_DT', name: 'addDt',
- label: ITP_MSG_LOCALE.label.regDt,
- width: '10', fixed: false, align: 'center',
- sortable: false, editable: false, edittype: 'text'
- }
- ]
- };
- /*화면공통 Object*/
- let pageObj = {
- init: function () {
- this.ui.init();
- this.event.init();
- afflShopObj.init();
- },
- ui: {
- init: function () {
- this.view();
- this.grid();
- this.ready();
- },
- view: function() {
- // 버튼 권한설정
- fn_proc_btn_auth('OPER01010');
- // 공통코드 표시
- $('select').each(function() {
- if($(this).data('select-code')) {
- fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
- }
- });
- // 조회일자 지정
- $('#ITP_TAB_OPER01010 .input-group.date').datepicker(ITP_DATE_LANGUAGE);
- },
- grid: function() {
- itp_fn_jqgrid_resize(OPER01010_GRID_ID, OPER01010_GRID_LIST, 'lg');
- listObj.empty.init();
- itp_fn_fire_window_resize();
- },
- ready: function() {
- listObj.init();
- }
- },
- event: {
- init: function () {
- this.button();
- },
- button: function () {
- // 버튼 클릭 이벤트
- $('button').each(function() {
- var id = $(this).attr('id');
- $(this).on('click', function() {
- switch (id) {
- case 'ITP_BTN_OPER01010_SRH' : listObj.button.search(); break; // 조회 버튼 클릭
- case 'ITP_BTN_OPER01010_NEWREG' : listObj.button.create(); break; // 신규등록 버튼
- case 'ITP_BTN_OPER01010_MODIFY' : modifyObj.button.modify(); break; // 수정 버튼
- case 'ITP_BTN_OPER01010_CANCELLIST' : createObj.button.cancel(); break; // 취소/목록 버튼
- case 'ITP_BTN_OPER01010_DELETE' : break; // 삭제 버튼
- case 'ITP_BTN_OPER01010_SAVE' : createObj.button.save(); break; // 저장 버튼
- case 'ITP_FORM_OPER01010_DETAIL_DUP' : createObj.button.duplicate(); break; // 중복체크
- case 'ITP_BTN_OPER01010_RESET_PW' : createObj.button.resetPass(); break; // 상세:비밀번호 초기화
- case 'ITP_BTN_OPER01010_DETAIL_ADDROW' : pageObj.grid.button.addRow(); break; // 상세:추가버튼
- case 'ITP_BTN_OPER01010_DETAIL_DELROW' : pageObj.grid.button.delRow(); break; // 상세:삭제버튼
- }
- });
- });
- $('body').on('click', function(e) {
- var gridId = OPER01010_DETAIL_GRID_ID.replace('#', '');
- var rids = $(OPER01010_DETAIL_GRID_ID).jqGrid('getDataIDs');
- var last_row_id = rids[rids.length - 1];
- itp_fn_grid_reset_selection(e, last_row_id, gridId, 'OPER01010_DETAIL');
- });
- }
- },
- switchScreen: function(mode) {
- $('.itp_det_head').find('button[id^="ITP_BTN_OPER01010_"]').each(function(i) {
- $(this).hide();
- });
- $('div[id$="_CONTAINER"]').each(function(i) {
- if($(this).attr('id').startsWith('ITP_AJAX_OPER01010')) {
- $(this).hide();
- }
- });
- if(mode === 'LIST') { // 목록
- $('#ITP_AJAX_OPER01010_LIST_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_OPER01010_SRH', '#ITP_BTN_OPER01010_NEWREG']);
- } else if(mode == 'ADD') { // 등록
- $('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_OPER01010_CANCELLIST', '#ITP_BTN_OPER01010_SAVE']);
- $('#ITP_FORM_OPER01010_DETAIL').find('input, textarea, select, checkbox').each(function(i, elem) {
- $(this).attr('id') === 'ITP_FORM_OPER01010_DETAIL_VIEW_CD' ? $(this).val('C') : $(this).val('');
- if(elem.type === 'select') {
- $(this).val('').prop('selected', true);
- }
- });
- $('#ITP_FORM_OPER01010_DETAIL_USER_ID').removeAttr('readonly');
- $('#ITP_FORM_OPER01010_DETAIL_DUP').removeAttr('disabled');
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_BRAND_ID option').remove();
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').show();
- $('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').show();
- } else if(mode === 'MODIFY') { // 수정
- $('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_OPER01010_CANCELLIST', '#ITP_BTN_OPER01010_SAVE', '#ITP_BTN_OPER01010_RESET_PW']);
- $('#ITP_FORM_OPER01010_DETAIL_USER_ID').attr('readonly', true);
- $('#ITP_FORM_OPER01010_DETAIL_DUP').attr('disabled', true);
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').attr('readonly', true);
- $('#ITP_FORM_OPER01010_DETAIL_USER_NM').attr('readonly', true);
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').hide();
- $('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').hide();
- } else if(mode === 'VIEW') { // 보기
- $('#ITP_AJAX_OPER01010_VIEW_CONTAINER').show();
- fn_show_btn_auth_array(['#ITP_BTN_OPER01010_MODIFY', '#ITP_BTN_OPER01010_CANCELLIST']);
- }
- },
- grid: {
- init: function(mode) {
- this.mode = mode;
- this.gridId = (mode === 'VIEW') ? OPER01010_VIEW_GRID_ID : OPER01010_DETAIL_GRID_ID;
- this.unload();
- this.load(mode);
- },
- mode: 'DETAIL',
- gridId: '',
- button: {
- addRow: function() {
- // 팝업
- var popFn = function(rowDataPop) {
- // 기존등록 데이터
- var exists = '';
- const rowData = $(OPER01010_DETAIL_GRID_ID).getRowData();
- $.each(rowData, function(key, value) {
- exists = exists + value.authNo + ';';
- });
- $.each(rowDataPop, function(key, value) {
- if(exists.indexOf(value.authNo) < 0) {
- value['viewCd'] = (pageObj.grid.mode === 'MODIFY') ? 'U' : "C";
- $(OPER01010_DETAIL_GRID_ID).jqGrid('addRowData', value.authNo, value, 'last');
- }
- });
- $(OPER01010_DETAIL_GRID_EMPTY).hide();
- };
- fn_call_popup('comm', 'AUTH_SCH_POPUP', '#ITP_ASIDE', popFn, null, 'S');
- },
- delRow: function() {
- itp_fn_grid_del_row(OPER01010_DETAIL_GRID_ID);
- }
- },
- load: function() {
- let gridView = (this.mode === 'VIEW') ? 'OPER01010_VIEW' : 'OPER01010_DETAIL';
- let param = $('#ITP_FORM_' + gridView).serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.pagingYn = false; // 페이징안함
- var _this = this;
- var option = {
- gridId: _this.gridId,
- colModel: gridColModel.detail,
- param: JSON.stringify(param),
- url: DOMAIN + USER_USERAUTH_GRID_LIST,
- multiselect: (this.mode !== 'VIEW'),
- loadComplete: function(data) {
- itp_fn_grid_load_complete(data, _this.gridId, true, undefined, gridView);
- },
- onSortCol: function(index, columnIndex, sortOrder) {
- var sortingFn = {
- callBack: function(args) {
- $(args).trigger('reloadGrid');
- }
- };
- if (itp_fn_check_grid_is_writing(_this.gridId)) {
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, _this.gridId);
- return 'stop';
- } else {
- itp_fn_grid_sorting(_this.gridId, index, sortOrder);
- }
- }
- };
- itp_fn_grid_make_not_paging(option);
- },
- unload : function() {
- $.jgrid.gridUnload(this.gridId);
- }
- }
- };
- /*목록화면 Object*/
- let listObj = {
- init: function () {
- this.grid.init();
- },
- itp_OPER01010_search: false,
- button: {
- search: function() {
- listObj.itp_OPER01010_search = true;
- let param = $('#ITP_FORM_OPER01010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- param.gridPage = $.jgrid.defaults.page;
- $(OPER01010_GRID_ID).setGridParam({'postData': JSON.stringify(param)}).trigger('reloadGrid');
- },
- create: function() {
- pageObj.switchScreen('ADD');
- itp_fn_form_clear_validate(null, '#ITP_FORM_OPER01010_DETAIL');
- // 권한정보 리스트 조회
- createObj.init();
- }
- },
- empty: {
- init: function() {
- var _this = this;
- this.push();
- $(OPER01010_GRID_EMPTY).on('click', function() {
- _this.back();
- _this.itp_OPER01010_param.gridSize = $.jgrid.defaults.rowNum;
- $(OPER01010_GRID_ID).setGridParam({'postData': JSON.stringify(_this.itp_OPER01010_param)}).trigger('reloadGrid');
- });
- },
- itp_OPER01010_param: {},
- push: function() {
- let param = $('#ITP_FORM_OPER01010_SEARCH').serializeObject();
- listObj.itp_OPER01010_param = param;
- },
- back: function() {
- $('#ITP_FORM_OPER01010_DEVI_TP_CD').val(this.itp_OPER01010_param.deviTpCd);
- $('#ITP_FORM_OPER01010_ORDER_YN').val(this.itp_OPER01010_param.orderYn);
- $('#ITP_FORM_OPER01010_ADT_AUTH_CD').val(this.itp_OPER01010_param.adtAuthCd);
- $('#ITP_FORM_OPER01010_EMAIL_RCV_YN').val(this.itp_OPER01010_param.emailRcvYn);
- $('#ITP_FORM_OPER01010_MEMB_EXIT_DT').val(this.itp_OPER01010_param.membExitDt);
- $('#ITP_FORM_OPER01010_FROM_DT').val(this.itp_OPER01010_param.fromDt);
- $('#ITP_FORM_OPER01010_TO_DT').val(this.itp_OPER01010_param.toDt);
- $('#ITP_FORM_OPER01010_KEYWORD').val(this.itp_OPER01010_param.keyword);
- }
- },
- grid: {
- init: function () {
- // 데이터 없을때
- listObj.empty.push();
- this.search();
- },
- colModel: gridColModel.list,
- search: function() {
- pageObj.switchScreen('LIST');
- this.unload();
- this.load();
- },
- load: function() {
- let param = $('#ITP_FORM_OPER01010_SEARCH').serializeObject();
- param.gridSize = $.jgrid.defaults.rowNum;
- var option = {
- gridId: OPER01010_GRID_ID,
- colModel: gridColModel.list,
- param: JSON.stringify(param),
- url: DOMAIN + USER_DETAIL_GRID_LIST,
- pager: OPER01010_GRID_PAGER,
- onCellSelect: function(rowId, cellIdx, cellValue) {
- var cm = $(this).jqGrid('getGridParam', 'colModel');
- var colNm = cm[cellIdx].name;
- if (colNm == 'userNm') {
- const userIdVal = $(this).jqGrid('getCell', rowId, 'userId');
- const key = {userId: userIdVal, viewCd: 'R'};
- var param = $.param(key);
- viewObj.init(param);
- }
- },
- loadComplete: function(data) {
- console.log(data);
- itp_fn_grid_load_complete(data, OPER01010_GRID_ID, true, 'number', 'OPER01010', listObj.itp_OPER01010_search, listObj.empty, true, data.gridRecords, true);
- var ids = $(OPER01010_GRID_ID).getDataIDs();
- $.each(ids, function(idx, rowId) {
- $(OPER01010_GRID_ID).jqGrid('setCell', rowId, 'userNm', '', ITP_GRID_COL_STYLE.link);
- });
- },
- onPaging: function(action) {
- itp_fn_grid_paging(OPER01010_GRID_ID, action, param);
- }
- };
- itp_fn_grid_make_remote(option);
- },
- clearData : function() {
- $(OPER01010_GRID_ID).jqGrid('clearGridData', true);
- $(OPER01010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
- $(OPER01010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
- $(OPER01010_GRID_EMPTY).show();
- },
- unload : function() {
- $.jgrid.gridUnload(OPER01010_GRID_ID);
- }
- }
- };
- /*상세화면 Object*/
- let viewObj = {
- init: function (param) {
- this.load(param);
- },
- load: function(param) {
- fn_ajax_call(USER_INFO_USER, param, this.callback, 'GET');
- },
- callback: function (result) {
- console.log(result);
- pageObj.switchScreen('VIEW');
- $('#ITP_FORM_OPER01010_VIEW #ITP_FORM_OPER01010_VIEW_USER_ID').val(result.userId);
- $('#ITP_FORM_OPER01010_VIEW .fnAfflShopNm').text(result.afflShopNm);
- $('#ITP_FORM_OPER01010_VIEW .fnBrandNm').text(result.brandNm);
- $('#ITP_FORM_OPER01010_VIEW .fnUserNm').text(result.userNm);
- $('#ITP_FORM_OPER01010_VIEW .fnUserStatDt').text(result.userStatDt);
- $('#ITP_FORM_OPER01010_VIEW .fnUserStatNm').text(result.userStatNm);
- $('#ITP_FORM_OPER01010_VIEW .fnUserId').text(result.userId);
- $('#ITP_FORM_OPER01010_VIEW .fnEmail').text(result.email);
- $('#ITP_FORM_OPER01010_VIEW .fnTelNo').text(result.telNo);
- $('#ITP_FORM_OPER01010_VIEW .fnAddDt').text(result.addDt);
- $('#ITP_FORM_OPER01010_VIEW .fnLastLoginDt').text(result.lastLoginDt);
- // 권한정보 리스트 조회
- pageObj.grid.init('VIEW');
- // viewObj.grid.load(result.spplyMgrList);
- }
- };
- /*수정화면 Object*/
- let modifyObj = {
- init: function () {
- },
- button: {
- modify: function (param) {
- itp_fn_form_clear_validate(null, '#ITP_FORM_OPER01010_DETAIL');
- const userIdVal = $('#ITP_FORM_OPER01010_VIEW_USER_ID').val();
- const key = {userId: userIdVal, viewCd: 'R'};
- var param = $.param(key);
- modifyObj.load(param);
- }
- },
- load: function(param) {
- fn_ajax_call(USER_INFO_USER, param, this.callback, 'GET');
- },
- callback: function (result) {
- // console.log(result);
- pageObj.switchScreen('MODIFY');
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_VIEW_CD').val('U');
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_ID').val(result.afflShopId);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').val(result.afflShopNm);
- var brandId = result.brandId;
- var brandNm = result.brandNm;
- if(brandId !== '' && brandNm !== '') {
- var brandList = [{'brandId':brandId, 'brandNm':brandNm}];
- fn_make_select_brand(brandList, 'ITP_FORM_OPER01010_DETAIL_SEARCH_BRAND_ID');
- }
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_USER_NM').val(result.userNm);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_USER_STAT_CD').val(result.userStatCd);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_USER_ID').val(result.userId);
- $('#ITP_FORM_OPER01010_DETAIL .fnUserStatDt').text(result.userStatDt);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_USER_PW').val(result.userPw);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_USER_PW_CONFIRM').val(result.userPw);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_TEL_NO').val(result.telNo);
- $('#ITP_FORM_OPER01010_DETAIL #ITP_FORM_OPER01010_DETAIL_EMAIL').val(result.email);
- $('#ITP_FORM_OPER01010_DETAIL .fnAddDt').text(result.addDt);
- $('#ITP_FORM_OPER01010_DETAIL .fnLastLoginDt').text(result.lastLoginDt);
- // 권한정보 리스트 조회
- pageObj.grid.init('DETAIL');
- }
- };
- /*신규화면 Object*/
- let createObj = {
- init: function () {
- pageObj.grid.init('DETAIL');
- },
- button: {
- cancel: function() {
- listObj.grid.search();
- },
- save: function() {
- const formId = '#ITP_FORM_OPER01010_DETAIL';
- itp_fn_form_clear_validate(null, formId);
- var vali_userId = itp_fn_form_validate(formId, formId + '_USER_ID', ['empty'], undefined);
- var vali_userStatCd = itp_fn_form_validate(formId, formId + '_USER_STAT_CD', ['empty'], undefined);
- var vali_userNm = itp_fn_form_validate(formId, formId + '_USER_NM', ['empty'], undefined);
- var vali_telNo = itp_fn_form_validate(formId, formId + '_TEL_NO', ['empty'], undefined);
- var vali_email = itp_fn_form_validate(formId, formId + '_EMAIL', ['empty'], undefined);
- var vali_userPw = true;
- var vali_userPwConfirm = true;
- if($('#ITP_FORM_OPER01010_DETAIL_VIEW_CD').val() == 'C') { // 신규
- vali_userPw = itp_fn_form_validate(formId, formId + '_USER_PW', ['empty'], undefined);
- vali_userPwConfirm = itp_fn_form_validate(formId, formId + '_USER_PW_CONFIRM', ['empty'], undefined);
- }
- if (vali_userId && vali_userStatCd && vali_userNm && vali_userPw && vali_userPwConfirm && vali_telNo && vali_email) {
- if (ITP_FORM_OPER01010_DETAIL_IS_DUPLICATE) {
- itp_fn_modal_duplicate(ITP_MSG_LOCALE.label.userId, formId + '_USER_ID');
- } else {
- let gridInsertData = [];
- let gridUpdateData = [];
- let gridDeleteData = [];
- const rowData = $(OPER01010_DETAIL_GRID_ID).getRowData();
- const keyValue = $(formId + '_USER_ID').val();
- $.each(rowData, function(key, value) {
- if (value.viewCd != 'R') {
- value.userId = keyValue;
- if (value.viewCd == 'C') {
- gridInsertData.push(value);
- } else if (value.viewCd == 'U') {
- gridUpdateData.push(value);
- } else if (value.viewCd == 'D') {
- gridDeleteData.push(value);
- }
- }
- });
- let param = $(formId).serializeObject();
- param.gridInsertData = gridInsertData;
- param.gridUpdateData = gridUpdateData;
- param.gridDeleteData = gridDeleteData;
- //console.log(JSON.stringify(param));
- var searhFn = function() {
- ITP_FORM_OPER01010_DETAIL_IS_WRITING = false;
- listObj.grid.search();
- };
- fn_ajax_call(USER_SAVE_USER, JSON.stringify(param), searhFn, 'POST');
- }
- }
- },
- duplicate: function() {
- const formId = '#ITP_FORM_OPER01010_DETAIL';
- itp_fn_form_clear_validate(null, formId + '_DETAIL');
- var vali_userId = itp_fn_form_validate(formId + '_DETAIL', formId + '_USER_ID', ['empty'], undefined);
- if (vali_userId) {
- var dupFn = function(result) {
- if (result.code == 'N') {
- ITP_FORM_OPER01010_DETAIL_IS_DUPLICATE = false;
- } else {
- ITP_FORM_OPER01010_DETAIL_IS_DUPLICATE = true;
- }
- };
- const key = {'userId': $(formId + '_USER_ID').val()};
- const param = $.param(key);
- fn_ajax_call(USER_CHECK_DUPLICATE, param, dupFn, 'GET');
- }
- },
- resetPass: function() {
- var resetPwFn = {
- callBack: function(args) {
- const key = {'userId': $('#ITP_FORM_OPER01010_DETAIL_USER_ID').val()};
- const param = $.param(key);
- fn_ajax_call(USER_INTI_USERPW, param, undefined, 'GET');
- }
- };
- itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.askResetUserPw, resetPwFn, null);
- }
- }
- };
- /*가맹점 Object*/
- let afflShopObj = {
- init: function () {
- // (LOGIN_USER_INFO.authTpCd === '10' || LOGIN_USER_INFO.authTpCd === '20') ? this.action() : this.make();
- this.action();
- },
- make: function() {
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP').hide();
- $('#ITP_FORM_OPER01010_DELETE_AFFL_SHOP').hide();
- if(AFFL_SHOP_LIST) {
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_ID').val(LOGIN_USER_INFO.afflShopId);
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_NM').val(LOGIN_USER_INFO.afflShopNm);
- }
- if(LOGIN_USER_INFO.brandId !== '') {
- fn_make_select_brand(AFFL_BRAND_LIST, 'ITP_FORM_OPER01010_SEARCH_BRAND_ID');
- }
- },
- action: function () {
- var _this = this;
- // 가맹점 조회 버튼 클릭
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP').on('click', function() {
- _this.popup('L');
- });
- // 가맹점 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_OPER01010_DELETE_AFFL_SHOP').on('click', function() {
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_NM').val('');
- $('select#ITP_FORM_OPER01010_SEARCH_BRAND_ID option').remove();
- });
- // 신규등록 가맹점 조회 버튼 클릭
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').on('click', function() {
- _this.popup('C');
- });
- // 신규등록 가맹점 텍스트 삭제 버튼 클릭
- $('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').on('click', function() {
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').val('');
- $('select#ITP_FORM_OPER01010_DETAIL_SEARCH_BRAND_ID option').remove();
- });
- },
- popup: function (view) {
- // 팝업
- var popFn = (view === 'C') ? this.callback.create : this.callback.list;
- fn_call_popup('biz', 'BIZPOP_AFFL_SHOP', '#ITP_ASIDE', popFn, null, 'S');
- },
- callback: {
- list: function(rowDataPop) {
- // console.log(rowDataPop);
- if(rowDataPop.AFFL_SHOP) {
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_ID').val(rowDataPop.AFFL_SHOP.afflShopId);
- $('#ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_NM').val(rowDataPop.AFFL_SHOP.afflShopNm);
- }
- if(rowDataPop.AFFL_BRAND) {
- fn_make_select_brand(rowDataPop.AFFL_BRAND, 'ITP_FORM_OPER01010_SEARCH_BRAND_ID', true, '선택');
- }
- },
- create: function(rowDataPop) {
- // console.log(rowDataPop);
- if(rowDataPop.AFFL_SHOP) {
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_ID').val(rowDataPop.AFFL_SHOP.afflShopId);
- $('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').val(rowDataPop.AFFL_SHOP.afflShopNm);
- }
- if(rowDataPop.AFFL_BRAND) {
- fn_make_select_brand(rowDataPop.AFFL_BRAND, 'ITP_FORM_OPER01010_DETAIL_SEARCH_BRAND_ID', true, '선택');
- }
- }
- }
- };
|