Browse Source

운영관리 > 사용자관리 수정

juney 2 years ago
parent
commit
295a9347ba

+ 3 - 2
src/main/webapp/app/oper/OPER01010.html

@@ -18,10 +18,10 @@
18 18
 						<div class="itp_srh_border fix">
19 19
 							<div class="col-xs-12">
20 20
 								<form id="ITP_FORM_OPER01010_SEARCH" class="form-horizontal">
21
-									<input type="hidden" id="ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_ID" name="afflShopId" value="">
21
+									<input type="hidden" id="ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_ID" name="safflShopId" value="">
22 22
 									<div class="form-group">
23 23
 										<div class="col-xs-2 itp_ip itp_noMar">
24
-											<input type="text" name="afflShopNm" id="ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_NM" class="form-control itp_input" placeholder="가맹점명" readonly>
24
+											<input type="text" name="safflShopNm" id="ITP_FORM_OPER01010_SEARCH_AFFL_SHOP_NM" class="form-control itp_input" placeholder="가맹점명" readonly>
25 25
 										</div>
26 26
 										<div class="col-xs-2 itp_ip itp_noMar">
27 27
 											<button type="button" id="ITP_FORM_OPER01010_SEARCH_AFFL_SHOP" class="btn btn-success btn-sm SEB"><i class="glyphicon glyphicon-search"></i></button>
@@ -70,6 +70,7 @@
70 70
 						<div class="col-xs-12">
71 71
 							<form id="ITP_FORM_OPER01010_DETAIL" class="form-horizontal">
72 72
 								<input type="hidden" id="ITP_FORM_OPER01010_DETAIL_VIEW_CD" name="viewCd" value="C">
73
+								<input type="hidden" id="ITP_FORM_OPER01010_DETAIL_SEARCH_AFFL_SHOP_ID" name="afflShopId" value="">
73 74
 								<section class="itp_form_sec">
74 75
 									<!-- <h4 class="itp_form_tit">사용자정보 현재 테스트중</h4> -->
75 76
 									<div class="itp_form_in">

File diff suppressed because it is too large
+ 673 - 544
src/main/webapp/js/app/oper/ITP_OPER01010.js


+ 86 - 19
src/main/webapp/js/app/oper/ITP_OPER02010.js

@@ -133,6 +133,12 @@ const gridColModel = {
133 133
 		}
134 134
 	],
135 135
 	brand: [
136
+		{
137
+			index: 'VIEW_CD', name: 'viewCd',
138
+			label: ITP_MSG_LOCALE.label.viewCd,
139
+			width: '10', fixed: false, align: 'center',
140
+			sortable: false, hidden: true
141
+		},
136 142
 		{
137 143
 			index: 'BRAND_ID', name: 'brandId',
138 144
 			label: ITP_MSG_LOCALE.table.brandId,
@@ -375,7 +381,7 @@ let listObj = {
375 381
 		create:  function () {
376 382
 			pageObj.switchScreen('ADD');
377 383
 			itp_fn_form_clear_validate(null, '#ITP_FORM_OPER02010_DETAIL');
378
-			// createObj.init();
384
+			createObj.init();
379 385
 		}
380 386
 	},
381 387
 	grid: {
@@ -478,7 +484,7 @@ let viewObj = {
478 484
 	},
479 485
 	button: {
480 486
 	},
481
-	load: function() {
487
+	load: function(param) {
482 488
 		fn_ajax_call(NTICE_INFO_NTICE, param, this.callback, 'GET');
483 489
 	},
484 490
 	callback: function (result) {
@@ -596,10 +602,11 @@ let createObj = {
596 602
 		init: function () {
597 603
 			this.selectbox();
598 604
 			this.checkbox();
605
+			this.button();
599 606
 		},
600 607
 		selectbox: function () {
601 608
 			// 브랜드 selectbox 선택
602
-			$('#ITP_FORM_OPER02010_DETAIL_SEARCH_BRAND_ID').on('change', function() {
609
+			$('#ITP_FORM_OPER02010_DETAIL_SEARCH_BRAND_ID').off('change').on('change', function() {
603 610
 				if(this.selectedIndex > 0) {
604 611
 					$('#ITP_FORM_OPER02010_DETAIL_TARGET_CD option:eq(0)').prop('selected', true);
605 612
 					$('#ITP_FORM_OPER02010_DETAIL_TARGET_CD').attr('disabled', true);
@@ -609,7 +616,7 @@ let createObj = {
609 616
 				}
610 617
 			});
611 618
 			// 공지대상 selectbox 선택
612
-			$('#ITP_FORM_OPER02010_DETAIL_TARGET_CD').on('change', function() {
619
+			$('#ITP_FORM_OPER02010_DETAIL_TARGET_CD').off('change').on('change', function() {
613 620
 				if(this.selectedIndex > 0) {
614 621
 					$('#ITP_BTN_OPER02010_DETAIL_ADDROW').attr('disabled', false);
615 622
 					$('#ITP_BTN_OPER02010_DETAIL_DELROW').attr('disabled', false);
@@ -622,35 +629,95 @@ let createObj = {
622 629
 		},
623 630
 		checkbox: function () {
624 631
 			// 공지대상 checkbox 선택
625
-			$('#ITP_FORM_OPER02010_TARGET').find('input:checkbox').on('change', function() {
632
+			$('#ITP_FORM_OPER02010_TARGET').find('input:checkbox').off('change').on('change', function() {
626 633
 				$(this).next().val($(this).is(':checked') ? 'Y' : '');
627 634
 			});
628
-		}
629
-	},
630
-	button: {
631
-		init: function() {
632
-			this.addRow();
633
-			this.delRow();
634
-			this.save();
635
-			this.cancel();
636 635
 		},
637
-		addRow: function() {
636
+		button: function() {
638 637
 			// 신규등록 가맹점 조회 버튼 클릭
639
-			$('#ITP_FORM_OPER02010_DETAIL_SEARCH_AFFL_SHOP').on('click', function() {
638
+			$('#ITP_FORM_OPER02010_DETAIL_SEARCH_AFFL_SHOP').off('click').on('click', function() {
640 639
 				afflShopObj.popup('C');
641 640
 			});
642
-		},
643
-		delRow: function() {
644 641
 			// 신규등록 가맹점 텍스트 삭제 버튼 클릭
645
-			$('#ITP_FORM_OPER02010_DETAIL_DELETE_AFFL_SHOP').on('click', function() {
642
+			$('#ITP_FORM_OPER02010_DETAIL_DELETE_AFFL_SHOP').off('click').on('click', function() {
646 643
 				$('#ITP_FORM_OPER02010_DETAIL_SEARCH_AFFL_SHOP_NM').val('');
647 644
 				$('select#ITP_FORM_OPER02010_DETAIL_SEARCH_BRAND_ID option').remove();
648 645
 				$('#ITP_FORM_OPER02010_DETAIL_TARGET_CD option:eq(0)').prop('selected', true);
649 646
 				$('#ITP_FORM_OPER02010_DETAIL_TARGET_CD').trigger('change');
650 647
 			});
648
+		}
649
+	},
650
+	button: {
651
+		init: function() {
652
+		},
653
+		addRow: function() {
654
+			// 팝업
655
+			var popFn = function(rowDataPop) {
656
+				// 기존등록 사용자ID
657
+				var exists = '';
658
+				const rowData = $(OPER02010_DETAIL_GRID_ID).getRowData();
659
+				$.each(rowData, function(key, value) {
660
+					exists = exists + value.userId + ';';
661
+				});
662
+
663
+				$.each(rowDataPop, function(key, value) {
664
+					// console.log(JSON.stringify(value));
665
+					// console.log(exists.indexOf(value.userId));
666
+					if(exists.indexOf(value.userId) < 0) {
667
+						// 행추가
668
+						$(OPER02010_DETAIL_GRID_ID).jqGrid('addRow', {position: 'last'});
669
+						var rids = $(OPER02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
670
+						var last_row_id = rids[rids.length - 1];
671
+						$(OPER02010_DETAIL_GRID_ID).jqGrid('setCell', last_row_id, 'viewCd', 'C');
672
+						$(OPER02010_DETAIL_GRID_ID).jqGrid('setCell', last_row_id, 'brandId', value.brandId);
673
+						$(OPER02010_DETAIL_GRID_ID).jqGrid('setCell', last_row_id, 'brandNm', value.brandNm);
674
+					}
675
+				});
676
+				$(OPER02010_DETAIL_GRID_EMPTY).hide();
677
+			};
678
+			var agrs = {'afflShopId': $('#ITP_FORM_OPER02010_DETAIL_SEARCH_AFFL_SHOP_ID').val()};
679
+			fn_call_popup('biz', 'BIZPOP_AFFL_BRAND', '#ITP_ASIDE', popFn, agrs, 'S');
680
+		},
681
+		delRow: function() {
682
+			itp_fn_grid_del_row(OPER02010_DETAIL_GRID_ID);
651 683
 		},
652 684
 		save: function() {
685
+			const formId = '#ITP_FORM_OPER02010_DETAIL';
686
+			itp_fn_form_clear_validate(null, formId);
687
+			var vali_nticeNo = itp_fn_form_validate(formId, formId + '_NTICE_TITL', ['empty'], undefined);
688
+			var vali_nticeDesc = itp_fn_form_validate(formId, formId + '_NTICE_DESC', ['empty'], undefined);
689
+			var vali_targetCd = itp_fn_form_validate(formId, formId + '_TARGET_CD', ['empty'], undefined);
690
+
691
+			if (vali_nticeNo && vali_nticeDesc && vali_targetCd) {
692
+				let gridInsertData = [];
693
+				let gridUpdateData = [];
694
+				let gridDeleteData = [];
695
+				const rowData = $(OPER02010_DETAIL_GRID_ID).getRowData();
696
+				const keyValue = $(formId + '_USER_ID').val();
697
+				$.each(rowData, function(key, value) {
698
+					if (value.viewCd != 'R') {
699
+						value.nticeNo = keyValue;
700
+						if (value.viewCd == 'C') {
701
+							gridInsertData.push(value);
702
+						} else if (value.viewCd == 'U') {
703
+							gridUpdateData.push(value);
704
+						} else if (value.viewCd == 'D') {
705
+							gridDeleteData.push(value);
706
+						}
707
+					}
708
+				});
709
+				let param = $(formId).serializeObject();
710
+				param.gridInsertData = gridInsertData;
711
+				param.gridUpdateData = gridUpdateData;
712
+				param.gridDeleteData = gridDeleteData;
713
+				// console.log(JSON.stringify(param));
653 714
 
715
+				var searhFn = function() {
716
+					ITP_FORM_OPER02010_DETAIL_IS_WRITING = false;
717
+					listObj.grid.search();
718
+				};
719
+				fn_ajax_call(NTICE_SAVE_NTICE, JSON.stringify(param), searhFn, 'POST');
720
+			}
654 721
 		},
655 722
 		cancel: function() {
656 723
 			listObj.grid.search();
@@ -659,7 +726,7 @@ let createObj = {
659 726
 			var gridId = OPER02010_DETAIL_GRID_ID.replace('#', '');
660 727
 			var rids = $(OPER02010_DETAIL_GRID_ID).jqGrid('getDataIDs');
661 728
 			var last_row_id = rids[rids.length - 1];
662
-			itp_fn_grid_reset_selection(e, last_row_id, gridId, 'OPER03010_DETAIL');
729
+			itp_fn_grid_reset_selection(e, last_row_id, gridId, 'OPER02010_DETAIL');
663 730
 		}
664 731
 	},
665 732
 	load: function () {

+ 123 - 0
src/main/webapp/js/app/templage.js

@@ -0,0 +1,123 @@
1
+/********************************************************
2
+ --------------------------------------------------------
3
+ - Object 목록								            -
4
+ --------------------------------------------------------
5
+ * const gridColModel = {}	: 화면 Grid Object			*
6
+ * let pageObj = {}			: 화면공통 Object			*
7
+ * let listObj = {}			: 목록화면 Object			*
8
+ * let viewObj = {}			: 상세화면 Object			*
9
+ * let modifyObj = {}		: 수정화면 Object			*
10
+ * let createObj = {}		: 신규화면 Object			*
11
+ *******************************************************/
12
+
13
+/*화면 변수*/
14
+const TEMPLATE_GRID_ID = '#ITP_TEMPLATE_jqGrid';
15
+const TEMPLATE_GRID_LIST = '#ITP_TEMPLATE_jqGrid_list';
16
+const TEMPLATE_GRID_PAGER = '#ITP_TEMPLATE_jqGridPager';
17
+const TEMPLATE_GRID_EMPTY = '#ITP_TEMPLATE_jqGridEmpty';
18
+
19
+const TEMPLATE_VIEW_GRID_ID = '#ITP_TEMPLATE_VIEW_jqGrid';
20
+const TEMPLATE_VIEW_GRID_LIST = '#ITP_TEMPLATE_VIEW_jqGrid_list';
21
+const TEMPLATE_VIEW_GRID_PAGER = '#ITP_TEMPLATE_VIEW_jqGridPager';
22
+const TEMPLATE_VIEW_GRID_EMPTY = '#ITP_TEMPLATE_VIEW_jqGridEmpty';
23
+
24
+const TEMPLATE_DETAIL_GRID_ID = '#ITP_TEMPLATE_DETAIL_jqGrid';
25
+const TEMPLATE_DETAIL_GRID_LIST = '#ITP_TEMPLATE_DETAIL_jqGrid_list';
26
+const TEMPLATE_DETAIL_GRID_PAGER = '#ITP_TEMPLATE_DETAIL_jqGridPager';
27
+const TEMPLATE_DETAIL_GRID_EMPTY = '#ITP_TEMPLATE_DETAIL_jqGridEmpty';
28
+
29
+/*API URL*/
30
+
31
+/*화면 Grid Object*/
32
+const gridColModel = {
33
+    list: [],
34
+    view: [],
35
+    detail: []
36
+};
37
+
38
+require(['config'], function() {
39
+    require([
40
+    ], function($) {
41
+        pageObj.init();
42
+    });
43
+});
44
+
45
+/*화면공통 Object*/
46
+let pageObj = {
47
+    init: function () {
48
+        this.ui.init();
49
+        this.event.init();
50
+    },
51
+    ui: {
52
+        init: function () {
53
+        }
54
+    },
55
+    event: {
56
+        init: function () {
57
+        }
58
+    },
59
+    switchScreen: function(mode) {
60
+        if (mode == 'LIST') { // 목록
61
+        } else if(mode == 'ADD') { // 등록
62
+        } else if(mode == 'MODIFY') { // 수정
63
+        } else if(mode == 'VIEW') { // 보기
64
+        }
65
+    }
66
+};
67
+
68
+/*목록화면 Object*/
69
+let listObj = {
70
+    init: function () {
71
+        this.grid.init();
72
+    },
73
+    empty: {
74
+    },
75
+    grid: {
76
+        init: function () {
77
+        },
78
+        colModel: gridColModel.list,
79
+        search: function() {
80
+        },
81
+        load: function() {
82
+        },
83
+        reload : function() {
84
+        },
85
+        clearData : function() {
86
+        },
87
+        unload : function() {
88
+        }
89
+    }
90
+};
91
+
92
+/*상세화면 Object*/
93
+let viewObj = {
94
+    init: function (param) {
95
+        this.load(param);
96
+    },
97
+    load: function() {
98
+    },
99
+    callback: function (result) {
100
+        // console.log(result);
101
+    }
102
+};
103
+
104
+/*수정화면 Object*/
105
+let modifyObj = {
106
+    init: function (param) {
107
+        this.load(param);
108
+    },
109
+    load: function() {
110
+    },
111
+    callback: function (result) {
112
+        // console.log(result);
113
+    }
114
+};
115
+
116
+/*신규화면 Object*/
117
+let createObj = {
118
+    init: function () {
119
+        this.load();
120
+    },
121
+    load: function () {
122
+    }
123
+};