From a3e0ff8aab80c2a9425d4ccb66c862df957dcf2f Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期四, 06 十二月 2018 14:29:09 +0800
Subject: [PATCH] 导出数据

---
 gx_tieta/WebRoot/temp.html |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/gx_tieta/WebRoot/temp.html b/gx_tieta/WebRoot/temp.html
index 01f4f8e..6f47c04 100644
--- a/gx_tieta/WebRoot/temp.html
+++ b/gx_tieta/WebRoot/temp.html
@@ -8,10 +8,10 @@
     <link rel="stylesheet" href="src/css/layui.css">
 </head>
 <body>
-	<div id="exp_container"></div>
 	<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
     <script type="text/javascript" src="src/layui.js"></script>
     <script type="text/javascript" src="js/base.js"></script>
+   	<script type="text/javascript" src="pages/js/common.js"></script>
     <script>
     	var ExpExcel = function() {
             this.thead = '';        // 琛ㄦ牸鐨勫ご閮�
@@ -26,7 +26,7 @@
         var prop = ExpExcel.prototype;
         
         // 鍒濆鍖�
-        prop._init = function(ele, obj) {
+        prop._init = function(obj) {
             var defaults = {
                 thead: [],
                 tbody: [],
@@ -48,11 +48,17 @@
             this.normal = opts.normal;
             
             this.form = this.initForm();
-            this._setForm(ele);
+            this._setForm();
         };
         
         // 璁剧疆椤甸潰涓殑鍏冪礌
-        prop._setForm = function(ele) {
+        prop._setForm = function() {
+        	var ele = $('#exp_container');
+        	// 鍒涘缓瀹瑰櫒
+        	if(ele.length == 0) {
+        		$('body').append($('<div id="exp_container"></div>'));
+        	}
+        	ele = $('#exp_container');
             // 鏇存柊鍐呭
             ele.text('');
 
@@ -81,7 +87,7 @@
 			
             ele.append(form);
             this.form = form;
-        }
+        };
 
         // 璁剧疆琛ㄦ牸澶撮儴鐨勫��
         prop._setThead = function(thead, pageBreak, dataBreak) {
@@ -113,33 +119,32 @@
         prop._setPageNames = function(pageNames, pageBreak) {
             var str = pageNames.join(pageBreak);
             this.pageNames = str;
-        }
+        };
         
         // 鍒濆鍖杅orm
         prop.initForm = function() {
             this.form = '12345';
-        }
+        };
 
         // 瀵煎嚭琛ㄦ牸
-        prop.xls = function(ele, obj) {
+        prop.xls = function(obj) {
 
-            this._init(ele, obj); // 鍒濆鍖栧唴瀹�
+            this._init(obj); // 鍒濆鍖栧唴瀹�
             // 瀵煎嚭鍐呭
             if(this.form == '12345') {
                 alert('娌℃湁妫�娴嬪埌form琛ㄥ崟')
             }else {
                 this.form.submit();
             }
-        }
+        };
 
         var expExcel = new ExpExcel();
-
         var tblData = {
             thead: [['h1', 'h2', 'h3', 'h4'], ['xh1', 'xh2', 'xh3', 'xh4']],
             tbody:[['t1', 't2', 't3', 't4'], ['xt1', 'xt2', 'xt3', 'xt3']]
-        }
+        };
         
-        expExcel.xls($('#exp_container'), tblData);
+        GLOBAL.expExcel.xls(tblData);
     </script>
 </body>
 </html>
\ No newline at end of file

--
Gitblit v1.9.1