Browse Source

엑셀 다운로드 공통 작업

juney 2 years ago
parent
commit
0af4e89427

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

@@ -92,7 +92,8 @@ require([
92
 	'jquery.bootstrap',
92
 	'jquery.bootstrap',
93
 	'jquery.bootstrap.datepicker.locale',
93
 	'jquery.bootstrap.datepicker.locale',
94
 	'jquery.jqGrid.locale',
94
 	'jquery.jqGrid.locale',
95
-	'message.locale'
95
+	'message.locale',
96
+	'xlsx'
96
 ], function($) {
97
 ], function($) {
97
 	$.jgrid.styleUI.Bootstrap.base.rowTable = 'table table-bordered table-striped';
98
 	$.jgrid.styleUI.Bootstrap.base.rowTable = 'table table-bordered table-striped';
98
 	$.jgrid.defaults.styleUI = 'Bootstrap';
99
 	$.jgrid.defaults.styleUI = 'Bootstrap';
@@ -3013,11 +3014,11 @@ var itp_fn_export_excel = function(excelData, fileName, sheetName) {
3013
 }
3014
 }
3014
 
3015
 
3015
 var itp_fn_remote_to_excel = function(param) {
3016
 var itp_fn_remote_to_excel = function(param) {
3016
-	param['pagingYn'] = false;
3017
+	param.param['pagingYn'] = false;
3017
 	var options = {
3018
 	var options = {
3018
-		url: url,
3019
-		param: param,
3020
-		fileName: 'data1',
3019
+		url: param.url,
3020
+		param: param.param,
3021
+		fileName: 'data1.xlsx',
3021
 		sheetName: 'sheet1'
3022
 		sheetName: 'sheet1'
3022
 	};
3023
 	};
3023
 	$.extend(options, param);
3024
 	$.extend(options, param);
@@ -3025,7 +3026,7 @@ var itp_fn_remote_to_excel = function(param) {
3025
 		console.log(result);
3026
 		console.log(result);
3026
 		itp_fn_export_excel(result.gridRows, options.fileName, options.sheetName);
3027
 		itp_fn_export_excel(result.gridRows, options.fileName, options.sheetName);
3027
 	};
3028
 	};
3028
-	fn_ajax_call(API_MOBILE_INIT_INFO, $.param(options.param), callbackFn, 'POST');
3029
+	fn_ajax_call(options.url, JSON.stringify(options.param), callbackFn, 'POST');
3029
 };
3030
 };
3030
 
3031
 
3031
 var itp_fn_jqgrid_to_excel = function(gridId, fileName, sheetName){
3032
 var itp_fn_jqgrid_to_excel = function(gridId, fileName, sheetName){

+ 10 - 0
src/main/webapp/js/app/stinfo/ITP_STINFO06010.js

@@ -336,6 +336,7 @@ let pageObj = {
336
 						case 'ITP_BTN_STINFO06010_NEWREG'			: listObj.button.create(); 		break;	// 신규등록 버튼
336
 						case 'ITP_BTN_STINFO06010_NEWREG'			: listObj.button.create(); 		break;	// 신규등록 버튼
337
 						case 'ITP_BTN_STINFO06010_CANCELLIST'		: listObj.grid.search(); 		break;	// 취소/목록 버튼
337
 						case 'ITP_BTN_STINFO06010_CANCELLIST'		: listObj.grid.search(); 		break;	// 취소/목록 버튼
338
 						case 'ITP_BTN_STINFO06010_SAVE'				: createObj.button.save(); 		break;	// 저장 버튼
338
 						case 'ITP_BTN_STINFO06010_SAVE'				: createObj.button.save(); 		break;	// 저장 버튼
339
+						case 'ITP_BTN_STINFO06010_EXCEL'			: pageObj.excelDown(); 			break;	// 엑셀 다운로드 버튼
339
 					}
340
 					}
340
 				});
341
 				});
341
 			});
342
 			});
@@ -478,6 +479,15 @@ let pageObj = {
478
 			
479
 			
479
 		}
480
 		}
480
 		this.screenMode = mode;
481
 		this.screenMode = mode;
482
+	},
483
+	excelDown: function() {
484
+		var param = {
485
+			'url': API_DETAIL_GRID_LIST,
486
+			'param': $('#ITP_FORM_STINFO06010_SEARCH').serializeObject(),
487
+			'fileName': '매장단가관리.xlsx',
488
+			'sheetName': '매장단가관리'
489
+		};
490
+		itp_fn_remote_to_excel(param);
481
 	}
491
 	}
482
 };
492
 };
483
 
493