瀏覽代碼

시스템관리-앱버전관리 -2

yhl88 2 年之前
父節點
當前提交
24847dd913

+ 14 - 15
src/main/webapp/app/popup/biz/BIZPOP_VERSION.html

@@ -1,5 +1,5 @@
1 1
 <div id="ITP_BIZPOP_VERSION" class="modal itp_modal in" style="display: block;">
2
-	<div class="modal-dialog" style="width: 450px">
2
+	<div class="modal-dialog" style="width: 700px">
3 3
 		<div class="modal-content ui-draggable ui-draggable-handle">
4 4
 			<form id="ITP_FORM_BIZPOP_VERSION" enctype="multipart/form-data">
5 5
 				<input type="hidden" id="ITP_FORM_BIZPOP_VERSION_VIEW_CD" name="viewCd" value="C">
@@ -24,36 +24,35 @@
24 24
 								</div>
25 25
 								<div class="form-group">
26 26
 									<label class="col-xs-3 itp_lb">버전</label>
27
-									<div class="col-xs-1 itp_ip">
28
-										<input type="text" id="ITP_FORM_BIZPOP_VERSION_APP_VER_LEFT" value="" class="form-control itp_input text-center numberOnly">
27
+									<div class="col-xs-2 itp_ip">
28
+										<input type="text" id="ITP_FORM_BIZPOP_VERSION_APP_VER_LEFT" name="appVerLeft" value="" class="form-control itp_input text-center numberOnly" onKeyup="this.value=this.value.replace(/[^-0-9]/g,'');" maxlength="2">
29 29
 									</div>
30 30
 									<span class="col-xs-1 itp_msg" style="width: auto; padding: 10px 4px 0 4px">.</span>
31
-									<div class="col-xs-1 itp_ip">
32
-										<input type="text" id="ITP_FORM_BIZPOP_VERSION_APP_VER_MIDDLE" value="" class="form-control itp_input text-center numberOnly">
31
+									<div class="col-xs-2 itp_ip">
32
+										<input type="text" id="ITP_FORM_BIZPOP_VERSION_APP_VER_MIDDLE" name="appVerMid" value="" class="form-control itp_input text-center numberOnly" onKeyup="this.value=this.value.replace(/[^-0-9]/g,'');" maxlength="2">
33 33
 									</div>
34 34
 									<span class="col-xs-1 itp_msg" style="width: auto; padding: 10px 4px 0 4px">.</span>
35
-									<div class="col-xs-1 itp_ip">
36
-										<input type="text" id="ITP_FORM_BIZPOP_VERSION_APP_VER_RIGHT" value="" class="form-control itp_input text-center numberOnly">
35
+									<div class="col-xs-2 itp_ip">
36
+										<input type="text" id="ITP_FORM_BIZPOP_VERSION_APP_VER_RIGHT" name="appVerRight" value="" class="form-control itp_input text-center numberOnly" onKeyup="this.value=this.value.replace(/[^-0-9]/g,'');" maxlength="2">
37 37
 									</div>
38 38
 									<span class="col-xs-4 itp_msg text-danger" style="width: auto; padding-left: 20px">major . major . minor</span>
39 39
 								</div>
40 40
 								<div class="form-group" style="margin-bottom: 0">
41 41
 									<label class="col-xs-3 itp_lb">버전 설명</label>
42 42
 									<div class="col-xs-8 itp_ip">
43
-										<textarea id="ITP_FORM_BIZPOP_VERSION_DES_VER" class="form-control" rows="3" name="desVer"></textarea>
43
+										<textarea id="ITP_FORM_BIZPOP_VERSION_DES_VER" class="form-control" rows="1" name="desVer"></textarea>
44 44
 									</div>
45 45
 								</div>
46 46
 							</div>
47 47
 						</div>
48 48
 					</div>
49 49
 				</div>
50
-				<div class="modal-footer">
51
-					<button type="button" class="btn btn-default" data-dismiss="modal">취소/닫기</button>
52
-					<button type="button" class="btn btn-primary" id="ITP_BIZPOP_VERSION_BTN_SAVE">저장</button>
53
-				</div>
54 50
 			</form>
51
+			<div class="modal-footer">
52
+				<button type="button" class="btn btn-default" data-dismiss="modal">취소/닫기</button>
53
+				<button type="button" class="btn btn-primary" id="ITP_BIZPOP_VERSION_BTN_SAVE">저장</button>
54
+			</div>
55 55
 		</div>
56
-	</div>
57
-
58
-	<script src="/js/app/popup/ITP_BIZPOP_VERSION.js"></script>
56
+	</div>	
57
+	<div id="ITP_POPUP_JS"></div>
59 58
 </div>

+ 1 - 1
src/main/webapp/app/system/SYSTEM07010.html

@@ -4,7 +4,7 @@
4 4
 			<div class="itp_det_head fix">
5 5
 				<h2 class="pull-left itp_det_tit"><i class="glyphicon glyphicon-chevron-right"></i> <strong>버전</strong></h2>
6 6
 				<div class="pull-right itp_cicon">
7
-					<button type="button" id="ITP_BTN_SYSTEM07010_SRH" class="btn btn-success btn-sm SEB"><i class="glyphicon glyphicon-plus"></i>신규등록</button>
7
+					<button type="button" id="ITP_BTN_SYSTEM07010_ADD" class="btn btn-success btn-sm SEB"><i class="glyphicon glyphicon-plus"></i>신규등록</button>
8 8
 				</div>
9 9
 			</div>
10 10
 			<div class="itp_det_in">

+ 63 - 0
src/main/webapp/js/app/popup/biz/ITP_BIZPOP_VERSION.js

@@ -0,0 +1,63 @@
1
+require(['config'], function() {
2
+	require([
3
+		'jquery',
4
+	], function($) {
5
+
6
+	});
7
+});
8
+
9
+let API_VERINFO_DETAIL_GRID_LIST = '/api/verinfo/detail-grid-list';
10
+let API_VERINFO_INFO_VERINFO = '/api/verinfo/info-verinfo';
11
+let API_VERINFO_SAVE_VERINFO = '/api/verinfo/save-verinfo';
12
+
13
+function itp_fn_BIZPOP_VERSION(parentPopFn, args, returnType) {
14
+	if (args) {
15
+		fn_ajax_call(API_VERINFO_INFO_VERINFO, args, function(result) {
16
+			let appVer = result.appVer;
17
+			appVer = appVer.split('.');
18
+			let appVerLeft = appVer[0];
19
+			let appVerMid = appVer[1];
20
+			let appVerRight = appVer[2];
21
+			$('#ITP_FORM_BIZPOP_VERSION_APP_NO').val(result.appNo);
22
+			$('#ITP_FORM_BIZPOP_VERSION_APP_VER_LEFT').val(appVerLeft);
23
+			$('#ITP_FORM_BIZPOP_VERSION_APP_VER_MIDDLE').val(appVerMid);
24
+			$('#ITP_FORM_BIZPOP_VERSION_APP_VER_RIGHT').val(appVerRight);
25
+			$('#ITP_FORM_BIZPOP_VERSION_DES_VER').text(result.desVer);
26
+			
27
+			$('#ITP_FORM_BIZPOP_VERSION_APP_VER_LEFT').attr('readonly', true);
28
+			$('#ITP_FORM_BIZPOP_VERSION_APP_VER_MIDDLE').attr('readonly', true);
29
+			$('#ITP_FORM_BIZPOP_VERSION_APP_VER_RIGHT').attr('readonly', true);
30
+			$('#ITP_FORM_BIZPOP_VERSION_DES_VER').attr('readonly', true);
31
+			$('#ITP_BIZPOP_VERSION_BTN_SAVE').hide();
32
+		}, 'GET');
33
+	}
34
+	
35
+	$('#ITP_BIZPOP_VERSION_BTN_SAVE').on('click', function() {
36
+		let param = $('#ITP_FORM_BIZPOP_VERSION').serializeObject();
37
+		let appVer = param.appVerLeft + '.' + param.appVerMid + '.' + param.appVerRight;
38
+		param.appVer = appVer;
39
+		
40
+		let input = {};		
41
+		input.pagingYn = true;
42
+		input.gridPage = 0;
43
+		input.gridSize = 0;
44
+		let output;
45
+		
46
+		function listFn(result) {
47
+			output = result.gridRows;
48
+		}
49
+		fn_ajax_call(API_VERINFO_DETAIL_GRID_LIST, JSON.stringify(input), listFn, 'POST');
50
+				
51
+		for (var i = 0; i < output.length; i++) {
52
+			if (appVer == output[i].appVer) {
53
+				itp_fn_modal_alert_ajax('앱 버전이 이미 존재합니다.');
54
+				return false;
55
+			}
56
+		}
57
+		
58
+		fn_ajax_call(API_VERINFO_SAVE_VERINFO, JSON.stringify(param), function() {	
59
+			parentPopFn();
60
+			$('#ITP_BIZPOP_VERSION').modal('hide'); // 팝업닫기			
61
+		}, 'POST');
62
+	});
63
+}

+ 184 - 26
src/main/webapp/js/app/system/ITP_SYSTEM07010.js

@@ -27,16 +27,106 @@ const SYSTEM07010_GRID_EMPTY = '#ITP_SYSTEM07010_jqGridEmpty';
27 27
 
28 28
 
29 29
 /*API URL*/
30
-
31 30
 let API_VERINFO_DETAIL_GRID_LIST = '/api/verinfo/detail-grid-list';
32 31
 let API_VERINFO_INFO_LASTVER = '/api/verinfo/info-lastver';
33 32
 let API_VERINFO_INFO_VERINFO = '/api/verinfo/info-verinfo';
34
-let API_VERINFO_SAVE_LASTVER = '/api/verinfo/save-verinfo';
35
-let API_VERINFO_DEL_LASTVER = '/api/verinfo/del-verinfo';
33
+let API_VERINFO_SAVE_VERINFO = '/api/verinfo/save-verinfo';
34
+let API_VERINFO_DEL_VERINFO = '/api/verinfo/del-verinfo';
35
+
36
+/*변수*/
37
+let gridId = 0;
38
+let spanId;
39
+
40
+/*앱버전 상세보기 그리드 함수*/
41
+function viewAppInfo(cellvalue, options, rowObject) {
42
+	gridId ++;
43
+	spanId = cellvalue;
44
+	return '<span id="'+cellvalue+'" style="cursor:pointer;" onclick="clickVer(' + gridId + ')" value="'+cellvalue+'">' + cellvalue + '</span>';
45
+}
46
+
47
+/*앱버전 클릭 발생 이벤트 함수*/
48
+function clickVer(num) {
49
+	let ids = $(SYSTEM07010_GRID_ID).jqGrid('getDataIDs');
50
+	for (var i = 0; i < ids.length; i++) {
51
+		if ((num - 1) == i) {
52
+			let rowData = $(SYSTEM07010_GRID_ID).jqGrid('getRowData', ids[i]);
53
+			rowData.appVer = spanId;
54
+			fn_call_popup('biz', 'BIZPOP_VERSION', '#ITP_ASIDE', null, rowData, 'S');
55
+		}
56
+	}
57
+	gridId = 0;
58
+}
59
+
60
+/*앱버전 삭제 그리드 함수*/
61
+function delAppInfo(cellvalue, options, rowObject) {
62
+	return '<span id="delete" style="cursor:pointer;" onclick="deleteApp(' + gridId + ')">삭제</span>';
63
+}
64
+
65
+/*앱버전 삭제 함수*/
66
+function deleteApp(num) {
67
+	let ids = $(SYSTEM07010_GRID_ID).jqGrid('getDataIDs');
68
+	for (var i = 0; i < ids.length; i++) {
69
+		if ((num - 1) == i) {
70
+			let rowData = $(SYSTEM07010_GRID_ID).jqGrid('getRowData', ids[i]);
71
+			rowData.appVer = spanId;
72
+			;
73
+			var confirmFn = {
74
+					callBack: function() {
75
+						let param = {};
76
+						param.appNo = rowData.appNo
77
+						var searchFn = function() {
78
+							listObj.grid.search();
79
+						};
80
+						fn_ajax_call(API_VERINFO_DEL_VERINFO, param, searchFn, 'GET');
81
+					}
82
+				};
83
+			itp_fn_modal_confirm(ITP_MSG_LOCALE.message.form.deleteData, confirmFn, null);
84
+		}
85
+	}
86
+	gridId = 0;
87
+}
88
+
36 89
 
37 90
 /*화면 Grid Object*/
38 91
 const gridColModel = {
39
-    list: [],
92
+    list: [
93
+    	{
94
+            index: 'VIEW_CD', name: 'viewCd',
95
+            label: ITP_MSG_LOCALE.label.viewCd,
96
+            width: '10', fixed: false, align: 'center',
97
+            sortable: false, hidden: true
98
+        },
99
+        {
100
+            index: 'APP_NO', name: 'appNo',
101
+            label: '앱번호',
102
+            width: '10', fixed: false, align: 'center',
103
+            sortable: false, hidden: true
104
+        },
105
+        {
106
+            index: 'APP_VER', name: 'appVer',
107
+            label: '앱버전',
108
+            width: '10', fixed: false, align: 'center',
109
+            sortable: false, hidden: false, formatter: viewAppInfo
110
+        },
111
+        {
112
+            index: 'DES_VER', name: 'desVer',
113
+            label: '버전설명',
114
+            width: '10', fixed: false, align: 'center',
115
+            sortable: false, hidden: false
116
+        },
117
+        {
118
+            index: 'APP_VER_DT', name: 'appVerDt',
119
+            label: '등록일시',
120
+            width: '10', fixed: false, align: 'center',
121
+            sortable: false, hidden: false
122
+        },
123
+        {
124
+            index: 'APP_VER_DEL', name: 'appVerDel',
125
+            label: '삭제',
126
+            width: '10', fixed: false, align: 'center',
127
+            sortable: false, hidden: false, formatter: delAppInfo
128
+        }
129
+    ],
40 130
     view: [],
41 131
     detail: []
42 132
 };
@@ -50,7 +140,34 @@ let pageObj = {
50 140
     },
51 141
     ui: {
52 142
         init: function () {
53
-        }
143
+        	this.view();
144
+        	this.grid();
145
+        	this.ready();
146
+        },
147
+        view: function() {
148
+        	// 버튼 권한설정
149
+            fn_proc_btn_auth('SYSTEM07010');
150
+            
151
+            // 공통코드 표시
152
+            $('select').each(function() {
153
+                if($(this).data('select-code')) {
154
+                    fn_make_select(CODE_LIST, $(this).data('select-code'), $(this).attr('id'));
155
+                }
156
+            });
157
+            
158
+         // form alert message 주입
159
+			$('input[data-alert-required="ONLYCHK"]').each(function() {
160
+				if($(this).data('alert-msg') === 'address') {
161
+					$(this).data('alert-msg', ITP_MSG_LOCALE.message.form.emptyAddr);
162
+				}
163
+			});
164
+		},
165
+		grid: function() {
166
+			
167
+		},
168
+		ready: function() {
169
+			listObj.init();
170
+		}
54 171
     },
55 172
     event: {
56 173
         init: function () {
@@ -58,10 +175,28 @@ let pageObj = {
58 175
         },
59 176
         button: function () {
60 177
             // 버튼 클릭 이벤트
178
+        	$('button').each(function() {
179
+                var id = $(this).attr('id');
180
+                $(this).on('click', function() {
181
+                    switch (id) {
182
+                        case 'ITP_BTN_SYSTEM07010_ADD'		: listObj.button.create.action();		break;	// 조회 버튼 클릭
183
+                    }
184
+                });
185
+            });
61 186
         }
62 187
     },
63 188
     switchScreen: function(mode) {
189
+    	$('.itp_det_head').find('button[id^="ITP_BTN_SYSTEM07010_"]').each(function(i) {
190
+            $(this).hide();
191
+        });
192
+        $('#ITP_TAB_SYSTEM07010').find('div[id$="_CONTAINER"]').each(function(i) {
193
+            $(this).hide();
194
+        });
64 195
         if (mode == 'LIST') { // 목록
196
+        	itp_fn_fire_window_resize();
197
+        	$('#ITP_AJAX_SYSTEM07010_LIST_CONTAINER').show();
198
+        	$('#ITP_FORM_SYSTEM07010_SEARCH').show();
199
+        	$('#ITP_BTN_SYSTEM07010_ADD').show();
65 200
         } else if(mode == 'ADD') { // 등록
66 201
         } else if(mode == 'MODIFY') { // 수정
67 202
         } else if(mode == 'VIEW') { // 보기
@@ -74,21 +209,65 @@ let listObj = {
74 209
     init: function () {
75 210
         this.grid.init();
76 211
     },
212
+    button: {
213
+    	create: {
214
+    		action: function() {
215
+    			$('#ITP_BTN_SYSTEM07010_ADD').on('click', function() {
216
+    				listObj.button.create.popup();
217
+    			});
218
+    		},
219
+    		popup: function() {
220
+    			const key = {};
221
+    			var popFn = function(result) {
222
+    				listObj.init();
223
+				}
224
+    			fn_call_popup('biz', 'BIZPOP_VERSION', '#ITP_ASIDE', popFn, null, 'S');
225
+			}
226
+    	}
227
+    },
77 228
     empty: {
78 229
     },
79 230
     grid: {
80 231
         init: function () {
232
+        	this.search();
81 233
         },
234
+        itp_SYSTEM07010_param: {},
235
+        itp_SYSTEM07010_search: false,
82 236
         colModel: gridColModel.list,
83 237
         search: function() {
238
+        	pageObj.switchScreen('LIST');
239
+            this.unload();
240
+            this.load();
84 241
         },
85 242
         load: function() {
243
+        	let param = {};
244
+        	var option = {
245
+        		gridId: SYSTEM07010_GRID_ID,
246
+        		colModel: gridColModel.list,
247
+        		url: DOMAIN + API_VERINFO_DETAIL_GRID_LIST,
248
+        		param: param,
249
+        		pager: SYSTEM07010_GRID_PAGER,
250
+        		rownumbers: true,
251
+        		loadComplete: function(data) {
252
+        			// console.log(data);
253
+        			itp_fn_grid_load_complete(data, SYSTEM07010_GRID_ID, true, 'number', 'SYSTEM07010', listObj.itp_SYSTEM07010_search, listObj.empty, true, data.gridRecords, true);
254
+				},
255
+                onPaging: function(action) {
256
+                    itp_fn_grid_paging(SYSTEM07010_GRID_PAGER, action, param);
257
+                }
258
+        	};
259
+        	itp_fn_grid_make_remote(option);
86 260
         },
87 261
         reload : function() {
88 262
         },
89 263
         clearData : function() {
264
+        	$(SYSTEM07010_GRID_ID).jqGrid('clearGridData', true);
265
+            $(SYSTEM07010_GRID_LIST).find('.ui-jqgrid-bdiv').css('min-height', '100px');
266
+            $(SYSTEM07010_GRID_EMPTY).html(ITP_MSG_LOCALE.message.grid.noData);
267
+            $(SYSTEM07010_GRID_EMPTY).show();
90 268
         },
91 269
         unload : function() {
270
+        	$.jgrid.gridUnload(SYSTEM07010_GRID_ID);
92 271
         }
93 272
     }
94 273
 };
@@ -104,24 +283,3 @@ let viewObj = {
104 283
         // console.log(result);
105 284
     }
106 285
 };
107
-
108
-/*수정화면 Object*/
109
-let modifyObj = {
110
-    init: function (param) {
111
-        this.load(param);
112
-    },
113
-    load: function() {
114
-    },
115
-    callback: function (result) {
116
-        // console.log(result);
117
-    }
118
-};
119
-
120
-/*신규화면 Object*/
121
-let createObj = {
122
-    init: function () {
123
-        this.load();
124
-    },
125
-    load: function () {
126
-    }
127
-};