From 3eb929dbba8a3ab9c7c52300779bfa8e3c59bc55 Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期四, 06 十二月 2018 15:28:05 +0800
Subject: [PATCH] 修订导出数据函数
---
gx_tieta/WebRoot/pages/js/common.js | 41 ++++++++++++++++++++++++++++++++++++++---
gx_tieta/WebRoot/bts-comm-task.jsp | 4 ++--
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/gx_tieta/WebRoot/bts-comm-task.jsp b/gx_tieta/WebRoot/bts-comm-task.jsp
index 405766e..33dc6cb 100644
--- a/gx_tieta/WebRoot/bts-comm-task.jsp
+++ b/gx_tieta/WebRoot/bts-comm-task.jsp
@@ -555,8 +555,8 @@
//鐐瑰嚮瀵煎嚭鎶ヨ〃
$('#export_table').click(function(){
- var tblData = createTableData(tOptions);
- GLOBAL.expExcel.xls(tblData);
+ var tblData = GLOBAL.Table.cTblData(tOptions);
+ GLOBAL.Table.expExcel.xls(tblData);
});
//鏋勯�犲鍑鸿〃鏍煎璞�
diff --git a/gx_tieta/WebRoot/pages/js/common.js b/gx_tieta/WebRoot/pages/js/common.js
index 5a80746..fe0877c 100644
--- a/gx_tieta/WebRoot/pages/js/common.js
+++ b/gx_tieta/WebRoot/pages/js/common.js
@@ -549,7 +549,7 @@
// 瀵煎嚭鎶ヨ〃
;(function($, window, document, gl, undefined) {
// 瀹氫箟testVal鐨勫懡鍚嶇┖闂�
- gl.namespace('expExcel');
+ gl.namespace('Table');
var ExpExcel = function() {
this.thead = ''; // 琛ㄦ牸鐨勫ご閮�
this.tbody = ''; // 琛ㄦ牸鐨勫唴瀹�
@@ -678,9 +678,44 @@
var expExcel = new ExpExcel();
- console.log(expExcel);
+ //console.log(expExcel);
// 缁戝畾瀵煎嚭鏁版嵁瀵硅薄
- GLOBAL.expExcel = expExcel;
+ GLOBAL.Table.expExcel = expExcel;
+
+
+ //鏋勯�犲鍑鸿〃鏍煎璞�
+ function createTableData(tOptions){
+ var thead_arr = new Array(); //琛ㄥご鏁版嵁鏁扮粍
+ var thody_arr = new Array(); //琛ㄦ牸鏁版嵁鏁扮粍
+ var proname_arr = new Array(); //灞炴�у悕鏁扮粍
+ //console.info(tOptions);
+ if(tOptions != undefined){
+ //鏋勯�犺〃澶存暟缁�
+ for(var i = 0;i< tOptions.cols.length;i++){
+ var _th = tOptions.cols[i];
+ for(var k=0;k<_th.length;k++){
+ if(_th[k].field != undefined){
+ proname_arr.push(_th[k].field);
+ thead_arr.push(_th[k].title);
+ }
+ }
+ }
+ //鏋勯�犺〃鏍煎唴閮ㄦ暟鎹暟缁�
+ for(var j = 0;j < tOptions.data.length;j++){
+ var _data = tOptions.data[j];
+ for(var k=0;k<proname_arr.length;k++){
+ thody_arr.push(_data[proname_arr[k]]);
+ }
+ }
+ }
+ return {
+ thead: [thead_arr],
+ tbody:[thody_arr]
+ };
+ }
+
+ // 缁戝畾瀵煎嚭鏁版嵁瀵硅薄
+ GLOBAL.Table.cTblData = createTableData;
})(jQuery, window, document, GLOBAL);
// 鐢熸垚闃块噷鍥炬爣鐨勫厓绱�
--
Gitblit v1.9.1