소스 검색

소스정리

juney 2 년 전
부모
커밋
7bcd58180a

+ 40 - 7
src/main/webapp/js/app/config.js

@@ -476,10 +476,10 @@ function fn_make_side_menu() {
476 476
 
477 477
 		console.log('[ITP_NAV_LINK] data-itp-nav-id = ' + id + ', data-conn-url = ' + connUrl + ', tabSize = ' + tabSize);
478 478
 
479
-		// if(String(id).indexOf('OPER') === -1 && String(id).indexOf('SYSTEM') === -1 && !sessionStorage.getItem('itp_manage_brand_info')) {
480
-		// 	itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noChoiceBrand);
481
-		// 	return false;
482
-		// }
479
+		if(String(id).indexOf('OPER') === -1 && String(id).indexOf('SYSTEM') === -1 && !sessionStorage.getItem('itp_manage_brand_info')) {
480
+			itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noChoiceBrand);
481
+			return false;
482
+		}
483 483
 
484 484
 		if (tabSize > 10) {
485 485
 			itp_fn_modal_alert(ITP_MSG_LOCALE.message.page.noMoreTab);
@@ -584,6 +584,12 @@ function fn_show_btn_auth(btn_id) {
584 584
 	}
585 585
 }
586 586
 
587
+function fn_show_btn_auth_array(btn_ids) {
588
+	$.each(btn_ids, function(i, value) {
589
+		fn_show_btn_auth(value);
590
+	});
591
+}
592
+
587 593
 function fn_make_select(options, code, select_id, all_show_yn, all_name) { //셀렉트 박스 만들기
588 594
 	$select_id = $('#' + select_id);
589 595
 	$select_id.empty();
@@ -1654,19 +1660,46 @@ function itp_fn_grid_make_remote(option) {
1654 1660
 	}).navGrid(options.pager, ITP_GRID_NAV_DEFAULTS.navGrid);
1655 1661
 }
1656 1662
 
1663
+function itp_fn_grid_make_not_paging(option) {
1664
+	var options = $.extend({
1665
+		mtype: 'POST',
1666
+		multiselect: false,
1667
+		rownumbers: false,
1668
+		loadBeforeSend: function(jqXHR) {
1669
+			jqXHR.setRequestHeader('X-AUTH-TOKEN', CONN_KEY);
1670
+		},
1671
+		loadError: function(jqXHR, textStatus, errorThrown) {
1672
+			itp_fn_grid_load_error(jqXHR, textStatus, errorThrown);
1673
+		}
1674
+	}, option);
1675
+
1676
+	$(options.gridId).jqGrid({
1677
+		colModel: options.colModel,
1678
+		postData: options.param,
1679
+		mtype: options.mtype,
1680
+		url: options.url,
1681
+		multiselect: options.multiselect,
1682
+		rownumbers: options.rownumbers,
1683
+		loadBeforeSend: options.loadBeforeSend,
1684
+		onCellSelect: options.onCellSelect,
1685
+		loadComplete: options.loadComplete,
1686
+		loadError: options.loadError
1687
+	});
1688
+}
1689
+
1657 1690
 function itp_fn_grid_make_local(option) {
1658 1691
 	var options = $.extend({
1659 1692
 		multiselect: false,
1660
-		rownumbers: true
1693
+		rownumbers: false
1661 1694
 	}, option);
1662 1695
 	$(option.gridId).jqGrid({
1663 1696
 		colModel: options.colModel,
1664 1697
 		data: options.data,
1665 1698
 		datatype: 'local',
1666 1699
 		multiselect: options.multiselect,
1667
-		rownumbers: options.rownumbers
1700
+		rownumbers: options.rownumbers,
1701
+		loadComplete: options.loadComplete
1668 1702
 	});
1669
-// }).navGrid(options.pager, ITP_GRID_NAV_DEFAULTS.navGrid);
1670 1703
 }
1671 1704
 
1672 1705
 function itp_fn_grid_paging(grid_id, action, args) {

+ 91 - 87
src/main/webapp/js/app/oper/ITP_OPER01010.js

@@ -249,79 +249,111 @@ let pageObj = {
249 249
 		}
250 250
 	},
251 251
 	switchScreen: function(mode) {
252
-		if(mode == 'LIST') { // 목록
253
-			$('#ITP_BTN_OPER01010_MODIFY').hide();
254
-			$('#ITP_BTN_OPER01010_CANCELLIST').hide();
255
-			$('#ITP_BTN_OPER01010_DELETE').hide();
256
-			$('#ITP_BTN_OPER01010_SAVE').hide();
257
-			fn_show_btn_auth('#ITP_BTN_OPER01010_SRH');
258
-			fn_show_btn_auth('#ITP_BTN_OPER01010_NEWREG');
259
-
252
+		$('.itp_det_head').find('button[id^="ITP_BTN_OPER01010_"]').each(function(i) {
253
+			$(this).hide();
254
+		});
255
+		$('div[id$="_CONTAINER"]').each(function(i) {
256
+			if($(this).attr('id').startsWith('ITP_AJAX_OPER01010')) {
257
+				$(this).hide();
258
+			}
259
+		});
260
+		if(mode === 'LIST') { // 목록
261
+			fn_show_btn_auth_array(['#ITP_BTN_OPER01010_SRH', '#ITP_BTN_OPER01010_NEWREG']);
260 262
 			$('#ITP_AJAX_OPER01010_LIST_CONTAINER').show();
261
-			$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').hide();
262
-			$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').hide();
263 263
 		} else if(mode == 'ADD') { // 등록
264
-			ITP_FORM_OPER01010_DETAIL_IS_DUPLICATE = true;
264
+			fn_show_btn_auth_array(['#ITP_BTN_OPER01010_CANCELLIST', '#ITP_BTN_OPER01010_SAVE']);
265
+			$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
265 266
 
266
-			$('#ITP_BTN_OPER01010_SRH').hide();
267
-			$('#ITP_BTN_OPER01010_MODIFY').hide();
268
-			$('#ITP_BTN_OPER01010_NEWREG').hide();
269
-			$('#ITP_BTN_OPER01010_DELETE').hide();
270
-			$('#ITP_BTN_OPER01010_RESET_PW').hide();
271
-			fn_show_btn_auth('#ITP_BTN_OPER01010_CANCELLIST');
272
-			fn_show_btn_auth('#ITP_BTN_OPER01010_SAVE');
267
+			$('input[id^="ITP_FORM_OPER01010_DETAIL_"]').each(function(i) {
268
+				($(this).attr('id') === 'ITP_FORM_OPER01010_DETAIL_VIEW_CD') ? $(this).val('C') : $(this).val('');
269
+			});
273 270
 
274
-			$('#ITP_AJAX_OPER01010_LIST_CONTAINER').hide();
275
-			$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
276
-			$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').hide();
277 271
 			$('#ITP_FORM_OPER01010_DETAIL_USER_ID').removeAttr('readonly');
278 272
 			$('#ITP_FORM_OPER01010_DETAIL_DUP').removeAttr('disabled');
279
-
280
-			$('#ITP_FORM_OPER01010_DETAIL_VIEW_CD').val('C');
281
-			$('#ITP_FORM_OPER01010_DETAIL_USER_NM').val('');
282
-			$('#ITP_FORM_OPER01010_DETAIL_USER_STAT_CD').val('');
283
-			$('#ITP_FORM_OPER01010_DETAIL_USER_ID').val('');
284
-			$('#ITP_FORM_OPER01010_DETAIL_USER_PW').val('');
285
-			$('#ITP_FORM_OPER01010_DETAIL_TEL_NO').val('');
286
-			$('#ITP_FORM_OPER01010_DETAIL_USER_PW_CONFIRM').val('');
287
-			$('#ITP_FORM_OPER01010_DETAIL_EMAIL').val('');
288
-
289
-			$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_ID').val('');
290
-			$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').val('');
291 273
 			$('#ITP_FORM_OPER01010_DETAIL_SEARCH_BRAND_ID option').remove();
292 274
 			$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').show();
293 275
 			$('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').show();
294
-		} else if(mode == 'MODIFY') { // 수정
295
-			$('#ITP_BTN_OPER01010_SRH').hide();
296
-			$('#ITP_BTN_OPER01010_MODIFY').hide();
297
-			$('#ITP_BTN_OPER01010_NEWREG').hide();
298
-			$('#ITP_BTN_OPER01010_DELETE').hide();
299
-			fn_show_btn_auth('#ITP_BTN_OPER01010_CANCELLIST');
300
-			fn_show_btn_auth('#ITP_BTN_OPER01010_SAVE');
301
-			fn_show_btn_auth('#ITP_BTN_OPER01010_RESET_PW');
302
-
303
-			$('#ITP_AJAX_OPER01010_LIST_CONTAINER').hide();
276
+		} else if(mode === 'MODIFY') { // 수정
277
+			fn_show_btn_auth_array(['#ITP_BTN_OPER01010_CANCELLIST', '#ITP_BTN_OPER01010_SAVE', '#ITP_BTN_OPER01010_RESET_PW']);
304 278
 			$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
305
-			$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').hide();
279
+
306 280
 			$('#ITP_FORM_OPER01010_DETAIL_USER_ID').attr('readonly', true);
307 281
 			$('#ITP_FORM_OPER01010_DETAIL_DUP').attr('disabled', true);
308 282
 			$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').attr('readonly', true);
309
-
310 283
 			$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').hide();
311 284
 			$('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').hide();
312
-		} else if(mode == 'VIEW') { // 보기
313
-			$('#ITP_BTN_OPER01010_SRH').hide();
314
-			$('#ITP_BTN_OPER01010_NEWREG').hide();
315
-			$('#ITP_BTN_OPER01010_DELETE').hide();
316
-			$('#ITP_BTN_OPER01010_SAVE').hide();
317
-			fn_show_btn_auth('#ITP_BTN_OPER01010_MODIFY');
318
-			fn_show_btn_auth('#ITP_BTN_OPER01010_CANCELLIST');
319
-
320
-			$('#ITP_AJAX_OPER01010_LIST_CONTAINER').hide();
321
-			$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').hide();
285
+		} else if(mode === 'VIEW') { // 보기
286
+			fn_show_btn_auth_array(['#ITP_BTN_OPER01010_MODIFY', '#ITP_BTN_OPER01010_CANCELLIST']);
322 287
 			$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').show();
323 288
 		}
324
-	}
289
+	},
290
+	// switchScreen: function(mode) {
291
+	// 	if(mode == 'LIST') { // 목록
292
+	// 		$('#ITP_BTN_OPER01010_MODIFY').hide();
293
+	// 		$('#ITP_BTN_OPER01010_CANCELLIST').hide();
294
+	// 		$('#ITP_BTN_OPER01010_DELETE').hide();
295
+	// 		$('#ITP_BTN_OPER01010_SAVE').hide();
296
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_SRH');
297
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_NEWREG');
298
+	//
299
+	// 		$('#ITP_AJAX_OPER01010_LIST_CONTAINER').show();
300
+	// 		$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').hide();
301
+	// 		$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').hide();
302
+	// 	} else if(mode == 'ADD') { // 등록
303
+	// 		ITP_FORM_OPER01010_DETAIL_IS_DUPLICATE = true;
304
+	//
305
+	// 		$('#ITP_BTN_OPER01010_SRH').hide();
306
+	// 		$('#ITP_BTN_OPER01010_MODIFY').hide();
307
+	// 		$('#ITP_BTN_OPER01010_NEWREG').hide();
308
+	// 		$('#ITP_BTN_OPER01010_DELETE').hide();
309
+	// 		$('#ITP_BTN_OPER01010_RESET_PW').hide();
310
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_CANCELLIST');
311
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_SAVE');
312
+	//
313
+	// 		$('#ITP_AJAX_OPER01010_LIST_CONTAINER').hide();
314
+	// 		$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
315
+	// 		$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').hide();
316
+	// 		$('#ITP_FORM_OPER01010_DETAIL_USER_ID').removeAttr('readonly');
317
+	// 		$('#ITP_FORM_OPER01010_DETAIL_DUP').removeAttr('disabled');
318
+	//
319
+	// 		$('input[id^="ITP_FORM_OPER03010_DETAIL_"]').each(function(i) {
320
+	// 			($(this).attr('id') === 'ITP_FORM_OPER01010_DETAIL_VIEW_CD') ? $(this).val('C') : $(this).val('');
321
+	// 		});
322
+	//
323
+	// 		$('#ITP_FORM_OPER01010_DETAIL_SEARCH_BRAND_ID option').remove();
324
+	// 		$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').show();
325
+	// 		$('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').show();
326
+	// 	} else if(mode == 'MODIFY') { // 수정
327
+	// 		$('#ITP_BTN_OPER01010_SRH').hide();
328
+	// 		$('#ITP_BTN_OPER01010_MODIFY').hide();
329
+	// 		$('#ITP_BTN_OPER01010_NEWREG').hide();
330
+	// 		$('#ITP_BTN_OPER01010_DELETE').hide();
331
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_CANCELLIST');
332
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_SAVE');
333
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_RESET_PW');
334
+	//
335
+	// 		$('#ITP_AJAX_OPER01010_LIST_CONTAINER').hide();
336
+	// 		$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').show();
337
+	// 		$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').hide();
338
+	// 		$('#ITP_FORM_OPER01010_DETAIL_USER_ID').attr('readonly', true);
339
+	// 		$('#ITP_FORM_OPER01010_DETAIL_DUP').attr('disabled', true);
340
+	// 		$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_NM').attr('readonly', true);
341
+	//
342
+	// 		$('#ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP').hide();
343
+	// 		$('#ITP_FORM_OPER01010_DETAIL_DELETE_AFFL_SHOP').hide();
344
+	// 	} else if(mode == 'VIEW') { // 보기
345
+	// 		$('#ITP_BTN_OPER01010_SRH').hide();
346
+	// 		$('#ITP_BTN_OPER01010_NEWREG').hide();
347
+	// 		$('#ITP_BTN_OPER01010_DELETE').hide();
348
+	// 		$('#ITP_BTN_OPER01010_SAVE').hide();
349
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_MODIFY');
350
+	// 		fn_show_btn_auth('#ITP_BTN_OPER01010_CANCELLIST');
351
+	//
352
+	// 		$('#ITP_AJAX_OPER01010_LIST_CONTAINER').hide();
353
+	// 		$('#ITP_AJAX_OPER01010_DETAIL_CONTAINER').hide();
354
+	// 		$('#ITP_AJAX_OPER01010_VIEW_CONTAINER').show();
355
+	// 	}
356
+	// }
325 357
 };
326 358
 
327 359
 /*목록화면 Object*/
@@ -453,7 +485,7 @@ let viewObj = {
453 485
 		$('#ITP_FORM_OPER01010_VIEW .fnLastLoginDt').text(result.lastLoginDt);
454 486
 
455 487
 		// 권한정보 리스트 조회
456
-		viewObj.grid.init();
488
+		viewObj.grid.load(result.spplyMgrList);
457 489
 	},
458 490
 	grid: {
459 491
 		init: function() {
@@ -470,23 +502,9 @@ let viewObj = {
470 502
 				colModel: gridColModel.detail,
471 503
 				param: JSON.stringify(param),
472 504
 				url: DOMAIN + USER_USERAUTH_GRID_LIST,
473
-				pager: OPER01010_VIEW_GRID_PAGER,
474 505
 				loadComplete: function(data) {
475 506
 					itp_fn_grid_load_complete(data, OPER01010_VIEW_GRID_ID, true, undefined, 'OPER01010_VIEW');
476 507
 				},
477
-				onPaging: function(action) {
478
-					var pagingFn = {
479
-						callBack: function(args) {
480
-							$(args).trigger('reloadGrid');
481
-						}
482
-					};
483
-					if (itp_fn_check_grid_is_writing(OPER01010_VIEW_GRID_ID)) {
484
-						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, OPER01010_VIEW_GRID_ID);
485
-						return 'stop';
486
-					} else {
487
-						itp_fn_grid_paging(OPER01010_VIEW_GRID_ID, action, param);
488
-					}
489
-				},
490 508
 				onSortCol: function(index, columnIndex, sortOrder) {
491 509
 					var sortingFn = {
492 510
 						callBack: function(args) {
@@ -501,7 +519,7 @@ let viewObj = {
501 519
 					}
502 520
 				}
503 521
 			};
504
-			itp_fn_grid_make_remote(option);
522
+			itp_fn_grid_make_not_paging(option);
505 523
 		},
506 524
 		clearData : function() {
507 525
 			$(OPER01010_VIEW_GRID_ID).jqGrid('clearGridData', true);
@@ -572,24 +590,10 @@ let modifyObj = {
572 590
 				colModel: gridColModel.detail,
573 591
 				param: JSON.stringify(param),
574 592
 				url: DOMAIN + USER_USERAUTH_GRID_LIST,
575
-				pager: OPER01010_DETAIL_GRID_PAGER,
576 593
 				multiselect: true,
577 594
 				loadComplete: function(data) {
578 595
 					itp_fn_grid_load_complete(data, OPER01010_DETAIL_GRID_ID, true, undefined, 'OPER01010_DETAIL');
579 596
 				},
580
-				onPaging: function(action) {
581
-					var pagingFn = {
582
-						callBack: function(args) {
583
-							$(args).trigger('reloadGrid');
584
-						}
585
-					};
586
-					if (itp_fn_check_grid_is_writing(OPER01010_DETAIL_GRID_ID)) {
587
-						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, OPER01010_DETAIL_GRID_ID);
588
-						return 'stop';
589
-					} else {
590
-						itp_fn_grid_paging(OPER01010_DETAIL_GRID_ID, action, param);
591
-					}
592
-				},
593 597
 				onSortCol: function(index, columnIndex, sortOrder) {
594 598
 					var sortingFn = {
595 599
 						callBack: function(args) {
@@ -604,7 +608,7 @@ let modifyObj = {
604 608
 					}
605 609
 				}
606 610
 			};
607
-			itp_fn_grid_make_remote(option);
611
+			itp_fn_grid_make_not_paging(option);
608 612
 		},
609 613
 		clearData : function() {
610 614
 			$(OPER01010_DETAIL_GRID_ID).jqGrid('clearGridData', true);

+ 30 - 121
src/main/webapp/js/app/oper/ITP_OPER02010.js

@@ -198,10 +198,6 @@ let pageObj = {
198 198
 				});
199 199
 			});
200 200
 
201
-			$('body').on('click', function(e) {
202
-				createObj.button.resetGrid(e);
203
-			});
204
-
205 201
 		}
206 202
 	},
207 203
 	switchScreen: function(mode) {
@@ -228,12 +224,11 @@ let pageObj = {
228 224
 			$('#ITP_AJAX_OPER02010_DETAIL_CONTAINER').show();
229 225
 			$('#ITP_AJAX_OPER02010_VIEW_CONTAINER').hide();
230 226
 
231
-			$('#ITP_FORM_OPER02010_DETAIL_VIEW_CD').val('C');
232
-			$('#ITP_FORM_OPER02010_DETAIL_NTICE_NO').val('');
233
-			$('#ITP_FORM_OPER02010_DETAIL_NTICE_TITL').val('');
227
+			$('input[id^="ITP_FORM_OPER02010_DETAIL_"]').each(function(i) {
228
+				($(this).attr('id') === 'ITP_FORM_OPER02010_DETAIL_VIEW_CD') ? $(this).val('C') : $(this).val('');
229
+			});
230
+
234 231
 			$('#ITP_FORM_OPER02010_DEL_YN').val('N');
235
-			$('#ITP_FORM_OPER02010_DETAIL_NTICE_DESC').val('');
236
-			// $('#ITP_FORM_OPER02010_DETAIL_TARGET_CD').val('');
237 232
 			$('#ITP_FORM_OPER02010_FROM_DT').datepicker('setDate', new Date());
238 233
 			$('#ITP_FORM_OPER02010_TO_DT').datepicker('setDate', new Date());
239 234
 
@@ -274,38 +269,26 @@ let pageObj = {
274 269
 		}
275 270
 	},
276 271
 	grid: {
277
-		init: function() {
272
+		init: function(mode) {
273
+			this.gridId = (mode === 'VIEW') ? OPER02010_VIEW_GRID_ID : OPER02010_DETAIL_GRID_ID;
278 274
 			this.unload();
279
-			this.load();
275
+			this.load(mode);
280 276
 		},
281
-		load : function() {
282
-			let param = $('#ITP_FORM_OPER02010_DETAIL').serializeObject();
277
+		gridId: '',
278
+		load : function(mode) {
279
+			let param = $('#ITP_FORM_OPER02010_' + mode).serializeObject();
283 280
 			param.gridSize = $.jgrid.defaults.rowNum;
284 281
 			param.pagingYn = false; // 페이지안함
285 282
 
283
+			var _gridId = this.gridId;
286 284
 			var option = {
287
-				gridId: OPER02010_DETAIL_GRID_ID,
285
+				gridId: _gridId,
288 286
 				colModel: gridColModel.detail,
289 287
 				param: JSON.stringify(param),
290 288
 				url: DOMAIN + NTICE_TARGET_GRID_LIST,
291
-				pager: OPER02010_DETAIL_GRID_PAGER,
292
-				multiselect: true,
293
-				rownumbers: false,
289
+				multiselect: (mode !== 'VIEW'),
294 290
 				loadComplete: function(data) {
295
-					itp_fn_grid_load_complete(data, OPER02010_DETAIL_GRID_ID, true, undefined, 'OPER02010_DETAIL');
296
-				},
297
-				onPaging: function(action) {
298
-					var pagingFn = {
299
-						callBack: function(args) {
300
-							$(args).trigger('reloadGrid');
301
-						}
302
-					};
303
-					if (itp_fn_check_grid_is_writing(OPER02010_DETAIL_GRID_ID)) {
304
-						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, OPER02010_DETAIL_GRID_ID);
305
-						return 'stop';
306
-					} else {
307
-						itp_fn_grid_paging(OPER02010_DETAIL_GRID_ID, action, param);
308
-					}
291
+					itp_fn_grid_load_complete(data, _gridId, true, undefined, 'OPER02010_' + mode);
309 292
 				},
310 293
 				onSortCol: function(index, columnIndex, sortOrder) {
311 294
 					var sortingFn = {
@@ -313,24 +296,24 @@ let pageObj = {
313 296
 							$(args).trigger('reloadGrid');
314 297
 						}
315 298
 					};
316
-					if (itp_fn_check_grid_is_writing(OPER02010_DETAIL_GRID_ID)) {
317
-						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, OPER02010_DETAIL_GRID_ID);
299
+					if (itp_fn_check_grid_is_writing(_gridId)) {
300
+						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, _gridId);
318 301
 						return 'stop';
319 302
 					} else {
320
-						itp_fn_grid_sorting(OPER02010_DETAIL_GRID_ID, index, sortOrder);
303
+						itp_fn_grid_sorting(_gridId, index, sortOrder);
321 304
 					}
322 305
 				}
323 306
 			};
324
-			itp_fn_grid_make_remote(option);
307
+			itp_fn_grid_make_not_paging(option);
325 308
 		},
326
-		clearData : function() {
327
-			$(OPER02010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
328
-			$(OPER02010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
329
-			$(OPER02010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
330
-			$(OPER02010_DETAIL_GRID_EMPTY).show();
309
+		resetGrid: function(e) {
310
+			var gridId = this.gridId.replace('#', '');
311
+			var rids = $(this.gridId).jqGrid('getDataIDs');
312
+			var last_row_id = rids[rids.length - 1];
313
+			itp_fn_grid_reset_selection(e, last_row_id, gridId, 'OPER02010_DETAIL');
331 314
 		},
332 315
 		unload : function() {
333
-			$.jgrid.gridUnload(OPER02010_DETAIL_GRID_ID);
316
+			$.jgrid.gridUnload(this.gridId);
334 317
 		}
335 318
 	}
336 319
 };
@@ -392,7 +375,7 @@ let listObj = {
392 375
 					}
393 376
 				},
394 377
 				loadComplete: function(data) {
395
-					//console.log(JSON.stringify(data));
378
+					console.log(data);
396 379
 					itp_fn_grid_load_complete(data, OPER02010_GRID_ID, true, 'number', 'OPER02010', listObj.grid.itp_OPER02010_search, _this.itp_fn_OPER02010_empty, true, data.gridRecords, true);
397 380
 					var ids = $(OPER02010_GRID_ID).getDataIDs();
398 381
 					$.each(ids, function(idx, rowId) {
@@ -475,75 +458,7 @@ let viewObj = {
475 458
 		itp_fn_set_file_upload('ITP_OPER02010_VIEW_UPLOAD', 'notice', true, false, 'OPER02010', fileArgs);
476 459
 
477 460
 		// 권한정보 리스트 조회
478
-		viewObj.grid.init();
479
-	},
480
-	grid: {
481
-		init: function() {
482
-			this.unload();
483
-			this.load();
484
-		},
485
-		load: function() {
486
-			let param = $('#ITP_FORM_OPER02010_VIEW').serializeObject();
487
-			param.gridSize = $.jgrid.defaults.rowNum;
488
-			param.pagingYn = false; // 페이징안함
489
-
490
-			var option = {
491
-				gridId: OPER02010_VIEW_GRID_ID,
492
-				colModel: gridColModel.detail,
493
-				param: JSON.stringify(param),
494
-				url: DOMAIN + NTICE_TARGET_GRID_LIST,
495
-				pager: OPER02010_VIEW_GRID_PAGER,
496
-				onCellSelect: function(rowId, cellIdx, cellValue) {
497
-					var cm = $(this).jqGrid('getGridParam', 'colModel');
498
-					var colNm = cm[cellIdx].name;
499
-					if (colNm == 'afflShopNm') {
500
-						const afflCdVal = $(this).jqGrid('getCell', rowId, 'afflShopId');
501
-						const key = {afflShopId: afflCdVal, viewCd: 'R'};
502
-						var param = $.param(key);
503
-						viewObj.init(param);
504
-					}
505
-				},
506
-				loadComplete: function(data) {
507
-					itp_fn_grid_load_complete(data, OPER02010_VIEW_GRID_ID, true, undefined, 'OPER02010_VIEW');
508
-				},
509
-				onPaging: function(action) {
510
-					var pagingFn = {
511
-						callBack: function(args) {
512
-							$(args).trigger('reloadGrid');
513
-						}
514
-					};
515
-					if (itp_fn_check_grid_is_writing(OPER02010_VIEW_GRID_ID)) {
516
-						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, pagingFn, OPER02010_VIEW_GRID_ID);
517
-						return 'stop';
518
-					} else {
519
-						itp_fn_grid_paging(OPER02010_VIEW_GRID_ID, action, param);
520
-					}
521
-				},
522
-				onSortCol: function(index, columnIndex, sortOrder) {
523
-					var sortingFn = {
524
-						callBack: function(args) {
525
-							$(args).trigger('reloadGrid');
526
-						}
527
-					};
528
-					if (itp_fn_check_grid_is_writing(OPER02010_VIEW_GRID_ID)) {
529
-						itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.cancelData, sortingFn, OPER02010_VIEW_GRID_ID);
530
-						return 'stop';
531
-					} else {
532
-						itp_fn_grid_sorting(OPER02010_VIEW_GRID_ID, index, sortOrder);
533
-					}
534
-				}
535
-			};
536
-			itp_fn_grid_make_remote(option);
537
-		},
538
-		clearData : function() {
539
-			$(OPER02010_VIEW_GRID_ID).jqGrid('clearGridData', true);
540
-			$(OPER02010_VIEW_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
541
-			$(OPER02010_VIEW_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
542
-			$(OPER02010_VIEW_GRID_EMPTY).show();
543
-		},
544
-		unload : function() {
545
-			$.jgrid.gridUnload(OPER02010_VIEW_GRID_ID);
546
-		}
461
+		pageObj.grid.init('VIEW');
547 462
 	}
548 463
 };
549 464
 
@@ -613,7 +528,7 @@ let modifyObj = {
613 528
 
614 529
 		// 리스트 조회
615 530
 		createObj.form.init();
616
-		pageObj.grid.init();
531
+		pageObj.grid.init('DETAIL');
617 532
 	}
618 533
 };
619 534
 
@@ -667,13 +582,13 @@ let createObj = {
667 582
 				var exists = '';
668 583
 				const rowData = $(OPER02010_DETAIL_GRID_ID).getRowData();
669 584
 				$.each(rowData, function(key, value) {
670
-					exists = exists + value.userId + ';';
585
+					exists = exists + value.brandId + ';';
671 586
 				});
672 587
 
673 588
 				$.each(rowDataPop, function(key, value) {
674 589
 					// console.log(JSON.stringify(value));
675 590
 					// console.log(exists.indexOf(value.userId));
676
-					if(exists.indexOf(value.userId) < 0) {
591
+					if(exists.indexOf(value.brandId) < 0) {
677 592
 						// 행추가
678 593
 						$(OPER02010_DETAIL_GRID_ID).jqGrid('addRow', {position: 'last'});
679 594
 						var rids = $(OPER02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
@@ -732,12 +647,6 @@ let createObj = {
732 647
 		},
733 648
 		cancel: function() {
734 649
 			listObj.grid.search();
735
-		},
736
-		resetGrid: function(e) {
737
-			var gridId = OPER02010_DETAIL_GRID_ID.replace('#', '');
738
-			var rids = $(OPER02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
739
-			var last_row_id = rids[rids.length - 1];
740
-			itp_fn_grid_reset_selection(e, last_row_id, gridId, 'OPER02010_DETAIL');
741 650
 		}
742 651
 	},
743 652
 	load: function () {
@@ -753,7 +662,7 @@ let createObj = {
753 662
 		itp_fn_set_file_upload('ITP_OPER02010_DETAIL_UPLOAD', 'notice', true, false, 'OPER02010', fileArgs);
754 663
 
755 664
 		// 권한정보 리스트 조회
756
-		pageObj.grid.init();
665
+		pageObj.grid.init('DETAIL');
757 666
 	}
758 667
 };
759 668
 

+ 3 - 10
src/main/webapp/js/app/oper/ITP_OPER06010.js

@@ -200,16 +200,9 @@ let pageObj = {
200 200
             $('#ITP_FORM_OPER06010_DETAIL_BRAND_CD').removeAttr('readonly');
201 201
             $('#ITP_FORM_OPER06010_DETAIL_DUP').removeAttr('disabled');
202 202
 
203
-            $('#ITP_FORM_OPER06010_DETAIL_VIEW_CD').val('C');
204
-            $('#ITP_FORM_OPER06010_DETAIL_BRAND_NM').val('');
205
-            $('#ITP_FORM_OPER06010_DETAIL_BRAND_USE_CD').val('');
206
-            $('#ITP_FORM_OPER06010_DETAIL_BRAND_CD').val('');
207
-            $('#ITP_FORM_OPER06010_DETAIL_CATE_CD').val('');
208
-            $('#ITP_FORM_OPER06010_DETAIL_TAKEOUT_YN').val('');
209
-            $('#ITP_FORM_OPER06010_DETAIL_CIRCULATE_STORE_YN').val('');
210
-            $('#ITP_FORM_OPER06010_DETAIL_STORE_MENU_REG_YN').val('');
211
-            $('#ITP_FORM_OPER06010_DETAIL_SALES_USER_ID').val('');
212
-            $('#ITP_FORM_OPER06010_DETAIL_SALES_USER_NM').val('');
203
+            $('input[id^="ITP_FORM_OPER06010_DETAIL_"]').each(function(i) {
204
+                ($(this).attr('id') === 'ITP_FORM_OPER06010_DETAIL_VIEW_CD') ? $(this).val('C') : $(this).val('');
205
+            });
213 206
 
214 207
         } else if(mode == 'MODIFY') { // 수정
215 208
             $('#ITP_BTN_OPER06010_SRH').hide();

+ 43 - 115
src/main/webapp/js/app/stinfo/ITP_STINFO03010.js

@@ -221,68 +221,57 @@ let pageObj = {
221 221
 		}
222 222
 	},
223 223
 	switchScreen: function(mode) {
224
+		$('.itp_det_head').find('button[id^="ITP_BTN_STINFO03010_"]').each(function(i) {
225
+			$(this).hide();
226
+		});
227
+		$('div[id$="_CONTAINER"]').each(function(i) {
228
+			if($(this).attr('id').startsWith('ITP_AJAX_STINFO03010')) {
229
+				$(this).hide();
230
+			}
231
+		});
224 232
 		if(mode == 'LIST') { // 목록
225
-			$('#ITP_BTN_STINFO03010_MODIFY').hide();
226
-			$('#ITP_BTN_STINFO03010_CANCELLIST').hide();
227
-			$('#ITP_BTN_STINFO03010_DELETE').hide();
228
-			$('#ITP_BTN_STINFO03010_SAVE').hide();
229
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_SRH');
230
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_NEWREG');
231
-
233
+			fn_show_btn_auth_array(['#ITP_BTN_STINFO03010_SRH', '#ITP_BTN_STINFO03010_NEWREG']);
232 234
 			$('#ITP_AJAX_STINFO03010_LIST_CONTAINER').show();
233
-			$('#ITP_AJAX_STINFO03010_DETAIL_CONTAINER').hide();
234
-			$('#ITP_AJAX_STINFO03010_VIEW_CONTAINER').hide();
235 235
 		} else if(mode == 'ADD') { // 등록
236
-			$('#ITP_BTN_STINFO03010_SRH').hide();
237
-			$('#ITP_BTN_STINFO03010_MODIFY').hide();
238
-			$('#ITP_BTN_STINFO03010_NEWREG').hide();
239
-			$('#ITP_BTN_STINFO03010_DELETE').hide();
240
-			$('#ITP_BTN_STINFO03010_RESET_PW').hide();
241
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_CANCELLIST');
242
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_SAVE');
243
-
244
-			$('#ITP_AJAX_STINFO03010_LIST_CONTAINER').hide();
236
+			fn_show_btn_auth_array(['#ITP_BTN_STINFO03010_CANCELLIST', '#ITP_BTN_STINFO03010_SAVE']);
245 237
 			$('#ITP_AJAX_STINFO03010_DETAIL_CONTAINER').show();
246
-			$('#ITP_AJAX_STINFO03010_VIEW_CONTAINER').hide();
247
-			$('#ITP_FORM_STINFO03010_DETAIL_STORE_ID').removeAttr('readonly');
248
-			$('#ITP_FORM_STINFO03010_DETAIL_DUP').removeAttr('disabled');
249 238
 
250
-			$.each($('input, select, checkbox, radio, textarea', '#ITP_FORM_STINFO03010_DETAIL'),function(k) {
251
-				$(this).val('');
239
+			$('input[id^="ITP_FORM_STINFO03010_DETAIL_"]').each(function(i) {
240
+				($(this).attr('id') === 'ITP_FORM_STINFO03010_DETAIL_VIEW_CD') ? $(this).val('C') : $(this).val('');
252 241
 			});
253 242
 
254
-			$('#ITP_FORM_STINFO03010_DETAIL_VIEW_CD').val('C');
255 243
 			$('#ITP_FORM_STINFO03010_DETAIL .fnSpplyId').text('(자동부여) (비밀번호는 사업자번호로 초기화 됩니다.)');
256 244
 		} else if(mode == 'MODIFY') { // 수정
257
-			$('#ITP_BTN_STINFO03010_SRH').hide();
258
-			$('#ITP_BTN_STINFO03010_MODIFY').hide();
259
-			$('#ITP_BTN_STINFO03010_NEWREG').hide();
260
-			$('#ITP_BTN_STINFO03010_DELETE').hide();
261
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_CANCELLIST');
262
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_SAVE');
263
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_RESET_PW');
264
-
265
-			$('#ITP_AJAX_STINFO03010_LIST_CONTAINER').hide();
245
+			fn_show_btn_auth_array(['#ITP_BTN_STINFO03010_CANCELLIST', '#ITP_BTN_STINFO03010_SAVE', '#ITP_BTN_STINFO03010_RESET_PW']);
266 246
 			$('#ITP_AJAX_STINFO03010_DETAIL_CONTAINER').show();
267
-			$('#ITP_AJAX_STINFO03010_VIEW_CONTAINER').hide();
268
-			$('#ITP_FORM_STINFO03010_DETAIL_STORE_ID').attr('readonly', true);
269
-			$('#ITP_FORM_STINFO03010_DETAIL_DUP').attr('disabled', true);
270
-			$('#ITP_FORM_STINFO03010_DETAIL_SEARCH_AFFL_SHOP_NM').attr('readonly', true);
271
-
272
-			$('#ITP_FORM_STINFO03010_DETAIL_SEARCH_AFFL_SHOP').hide();
273
-			$('#ITP_FORM_STINFO03010_DETAIL_DELETE_AFFL_SHOP').hide();
274 247
 		} else if(mode == 'VIEW') { // 보기
275
-			$('#ITP_BTN_STINFO03010_SRH').hide();
276
-			$('#ITP_BTN_STINFO03010_NEWREG').hide();
277
-			$('#ITP_BTN_STINFO03010_DELETE').hide();
278
-			$('#ITP_BTN_STINFO03010_SAVE').hide();
279
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_MODIFY');
280
-			fn_show_btn_auth('#ITP_BTN_STINFO03010_CANCELLIST');
281
-
282
-			$('#ITP_AJAX_STINFO03010_LIST_CONTAINER').hide();
283
-			$('#ITP_AJAX_STINFO03010_DETAIL_CONTAINER').hide();
248
+			fn_show_btn_auth_array(['#ITP_BTN_STINFO03010_MODIFY', '#ITP_BTN_STINFO03010_CANCELLIST']);
284 249
 			$('#ITP_AJAX_STINFO03010_VIEW_CONTAINER').show();
285 250
 		}
251
+	},
252
+	grid: {
253
+		init: function(mode, gridData) {
254
+			this.gridId = (mode === 'VIEW') ? STINFO03010_VIEW_GRID_ID : STINFO03010_DETAIL_GRID_ID;
255
+			this.unload();
256
+			this.load(mode, gridData);
257
+		},
258
+		gridId: '',
259
+		load: function(mode, gridData) {
260
+			var option = {
261
+				gridId: this.gridId,
262
+				colModel: gridColModel.detail,
263
+				data: gridData,
264
+				multiselect: (mode !== 'VIEW'),
265
+				loadComplete: function(data) {
266
+					let gridList = (mode === 'VIEW') ? STINFO03010_VIEW_GRID_LIST : STINFO03010_DETAIL_GRID_LIST;
267
+					$(gridList).find('.ui-jqgrid .ui-jqgrid-bdiv').css('overflow-x', 'hidden');
268
+				}
269
+			};
270
+			itp_fn_grid_make_local(option);
271
+		},
272
+		unload : function() {
273
+			$.jgrid.gridUnload(this.gridId);
274
+		}
286 275
 	}
287 276
 };
288 277
 
@@ -427,29 +416,8 @@ let viewObj = {
427 416
 		// $('#ITP_FORM_STINFO03010_VIEW .fnCloseDt').text(result.openDt);
428 417
 
429 418
 		// 담당자정보  리스트 조회
430
-		viewObj.grid.load(result.spplyMgrList);
431
-	},
432
-	grid: {
433
-		init: function() {
434
-		},
435
-		load: function(gridList) {
436
-			var option = {
437
-				gridId: STINFO03010_VIEW_GRID_ID,
438
-				colModel: gridColModel.detail,
439
-				data: gridList,
440
-				pager: STINFO03010_VIEW_GRID_PAGER,
441
-			};
442
-			itp_fn_grid_make_local(option);
443
-		},
444
-		clearData : function() {
445
-			$(STINFO03010_VIEW_GRID_ID).jqGrid('clearGridData', true);
446
-			$(STINFO03010_VIEW_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
447
-			$(STINFO03010_VIEW_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
448
-			$(STINFO03010_VIEW_GRID_EMPTY).show();
449
-		},
450
-		unload : function() {
451
-			$.jgrid.gridUnload(STINFO03010_VIEW_GRID_ID);
452
-		}
419
+		pageObj.grid.init('VIEW', result.spplyMgrList);
420
+		// viewObj.grid.load(result.spplyMgrList);
453 421
 	}
454 422
 };
455 423
 
@@ -500,29 +468,8 @@ let modifyObj = {
500 468
 		$('#ITP_FORM_STINFO03010_DETAIL #ITP_FORM_STINFO03010_DETAIL_DTL_ADDR').val(result.addr2);
501 469
 
502 470
 		// 담당자정보  리스트 조회
503
-		modifyObj.grid.load(result.spplyMgrList);
504
-	},
505
-	grid: {
506
-		init: function() {
507
-		},
508
-		load: function(gridList) {
509
-			var option = {
510
-				gridId: STINFO03010_DETAIL_GRID_ID,
511
-				colModel: gridColModel.detail,
512
-				data: gridList,
513
-				pager: STINFO03010_DETAIL_GRID_PAGER,
514
-			};
515
-			itp_fn_grid_make_local(option);
516
-		},
517
-		clearData : function() {
518
-			$(STINFO03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
519
-			$(STINFO03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
520
-			$(STINFO03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
521
-			$(STINFO03010_DETAIL_GRID_EMPTY).show();
522
-		},
523
-		unload : function() {
524
-			$.jgrid.gridUnload(STINFO03010_DETAIL_GRID_ID);
525
-		}
471
+		pageObj.grid.init('DETAIL', result.spplyMgrList);
472
+		// modifyObj.grid.load(result.spplyMgrList);
526 473
 	}
527 474
 };
528 475
 
@@ -532,8 +479,7 @@ let createObj = {
532 479
 		pageObj.switchScreen('ADD');
533 480
 		itp_fn_form_clear_validate(null, '#ITP_FORM_STINFO03010_DETAIL');
534 481
 		$('#ITP_FORM_STINFO03010_DETAIL_BRAND_ID').val(pageObj.brandInfo.brandId);
535
-		this.unload();
536
-		this.load();
482
+		pageObj.grid.init('DETAIL', []);
537 483
 	},
538 484
 	button: {
539 485
 		cancel: function() {
@@ -599,23 +545,5 @@ let createObj = {
599 545
 			};
600 546
 			itp_fn_modal_confirm(ITP_MSG_LOCALE.message.ajax.askResetUserPw, resetPwFn, null);
601 547
 		}
602
-	},
603
-	load: function () {
604
-		var option = {
605
-			gridId: STINFO03010_DETAIL_GRID_ID,
606
-			colModel: gridColModel.detail,
607
-			data: [],
608
-			pager: STINFO03010_DETAIL_GRID_PAGER,
609
-		};
610
-		itp_fn_grid_make_local(option);
611
-	},
612
-	clearData : function() {
613
-		$(STINFO03010_DETAIL_GRID_ID).jqGrid('clearGridData', true);
614
-		$(STINFO03010_DETAIL_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
615
-		$(STINFO03010_DETAIL_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
616
-		$(STINFO03010_DETAIL_GRID_EMPTY).show();
617
-	},
618
-	unload : function() {
619
-		$.jgrid.gridUnload(STINFO03010_DETAIL_GRID_ID);
620 548
 	}
621 549
 };