From f5def6a97e1a5de359121dfd7b6057ba29fe934c Mon Sep 17 00:00:00 2001 From: hdw <496960745@qq.com> Date: 星期五, 19 十月 2018 18:24:50 +0800 Subject: [PATCH] from表单定义 --- gx_tieta/WebRoot/js/base.js | 25 +++++ gx_tieta/WebRoot/temp.html | 145 +++++++++++++++++++++++++++++ gx_tieta/WebRoot/iframe/exportExcel.html | 8 + gx_tieta/.settings/org.jboss.tools.jst.web.xml | 84 ++++++++-------- 4 files changed, 220 insertions(+), 42 deletions(-) diff --git a/gx_tieta/.settings/org.jboss.tools.jst.web.xml b/gx_tieta/.settings/org.jboss.tools.jst.web.xml index ab7f92f..760ca2e 100644 --- a/gx_tieta/.settings/org.jboss.tools.jst.web.xml +++ b/gx_tieta/.settings/org.jboss.tools.jst.web.xml @@ -8,74 +8,74 @@ <file-system NAME="lib" location="%workspace.home%/lib" model-entity="FileSystemFolder"/> <file-system NAME="classes" location="%workspace.home%/classes" model-entity="FileSystemFolder"/> <file-system NAME="fuguang" location="%eclipse.project%" model-entity="FileSystemFolder"/> - <file-system NAME="lib-javaee.jar" - location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\javaee.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-jsf-impl.jar" - location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-impl.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-jsf-api.jar" - location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-api.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-jstl-1.2.jar" - location="D:\Program Files\MyEclipse\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jstl-1.2.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-c3p0-0.9.5.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\lib\c3p0-0.9.5.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\lib\c3p0-0.9.5.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-c3p0-oracle-thin-extras-0.9.5.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\lib\c3p0-oracle-thin-extras-0.9.5.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\lib\c3p0-oracle-thin-extras-0.9.5.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-mchange-commons-java-0.2.9.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\lib\mchange-commons-java-0.2.9.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-resources.jar" - location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\resources.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-dnsns.jar" - location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\dnsns.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-localedata.jar" - location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\localedata.jar" model-entity="FileSystemJar"/> - <file-system NAME="lib-sunjce_provider.jar" - location="D:\Program Files\MyEclipse\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\sunjce_provider.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\lib\mchange-commons-java-0.2.9.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-beanutils-1.7.0.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-beanutils-1.7.0.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-beanutils-1.7.0.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-codec-1.10.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-codec-1.10.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-codec-1.10.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-collections-3.1.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-collections-3.1.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-collections-3.1.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-dbcp-1.2.1.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-dbcp-1.2.1.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-dbcp-1.2.1.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-fileupload-1.2.2.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-fileupload-1.2.2.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-fileupload-1.2.2.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-io-2.0.1.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-io-2.0.1.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-io-2.0.1.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-lang-2.5.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-lang-2.5.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-lang-2.5.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-commons-pool-1.2.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-pool-1.2.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\commons-pool-1.2.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-dom4j-1.6.1.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\dom4j-1.6.1.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\dom4j-1.6.1.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-ezmorph-1.0.3.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ezmorph-1.0.3.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ezmorph-1.0.3.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-freemarker-2.3.16.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\freemarker-2.3.16.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\freemarker-2.3.16.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-gson-2.2.4.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\gson-2.2.4.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\gson-2.2.4.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-javassist-3.11.0.GA.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\javassist-3.11.0.GA.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\javassist-3.11.0.GA.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-json-lib-2.1-jdk15.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\json-lib-2.1-jdk15.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\json-lib-2.1-jdk15.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-mysql-connector-java-5.1.33-bin.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.33-bin.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\mysql-connector-java-5.1.33-bin.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-ognl-3.0.1.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ognl-3.0.1.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\ognl-3.0.1.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-poi-3.10.1-20140818.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\poi-3.10.1-20140818.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\poi-3.10.1-20140818.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-sqljdbc.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\sqljdbc.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\sqljdbc.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-struts2-core-2.2.3.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-core-2.2.3.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-core-2.2.3.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-struts2-json-plugin-2.2.3.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-json-plugin-2.2.3.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-json-plugin-2.2.3.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-struts2-sunspoter-stream-1.0.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-sunspoter-stream-1.0.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\struts2-sunspoter-stream-1.0.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-xwork-core-2.2.3.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\xwork-core-2.2.3.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\xwork-core-2.2.3.jar" model-entity="FileSystemJar"/> <file-system NAME="lib-jacob.jar" - location="C:\Users\LiJun\git\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\jacob.jar" model-entity="FileSystemJar"/> + location="D:\GitWorkspace\gx_tieta\gx_tieta\WebRoot\WEB-INF\lib\jacob.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-javaee.jar" + location="D:\myeclipse10\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\javaee.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-jsf-impl.jar" + location="D:\myeclipse10\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-impl.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-jsf-api.jar" + location="D:\myeclipse10\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jsf-api.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-jstl-1.2.jar" + location="D:\myeclipse10\Common\plugins\com.genuitec.eclipse.j2eedt.core_10.0.0.me201110301321\data\libraryset\EE_5\jstl-1.2.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-resources.jar" + location="D:\myeclipse10\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\resources.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-dnsns.jar" + location="D:\myeclipse10\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\dnsns.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-localedata.jar" + location="D:\myeclipse10\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\localedata.jar" model-entity="FileSystemJar"/> + <file-system NAME="lib-sunjce_provider.jar" + location="D:\myeclipse10\Common\binary\com.sun.java.jdk.win32.x86_64_1.6.0.013\jre\lib\ext\sunjce_provider.jar" model-entity="FileSystemJar"/> <web SERVLET_VERSION="2.4" model-entity="JstWeb" model-path="/web.xml"> <module URI="/WEB-INF/faces-config.xml" model-entity="WebJSFModule" model-path="/faces-config.xml" src="src" web-root="WEB-ROOT"/> diff --git a/gx_tieta/WebRoot/iframe/exportExcel.html b/gx_tieta/WebRoot/iframe/exportExcel.html new file mode 100644 index 0000000..acf6c8d --- /dev/null +++ b/gx_tieta/WebRoot/iframe/exportExcel.html @@ -0,0 +1,8 @@ +<form id="exp_excel" action="ExportTable.servlet" method="post"> + <input type="hidden" id="exp_thead" name="exp_thead" value=""/> + <input type="hidden" id="exp_tbody" name="exp_tbody" value=""/> + <input type="hidden" id="exp_normal" name="exp_normal" value=""/> + <input type="hidden" id="exp_data_break" name="exp_data_break" value=""/> + <input type="hidden" id="exp_page_names" name="exp_page_names" value=""/> + <input type="hidden" id="exp_page_break" name="exp_page_break" value=""/> +</form> \ No newline at end of file diff --git a/gx_tieta/WebRoot/js/base.js b/gx_tieta/WebRoot/js/base.js index 61bbde9..8f573f9 100644 --- a/gx_tieta/WebRoot/js/base.js +++ b/gx_tieta/WebRoot/js/base.js @@ -1177,4 +1177,29 @@ // 鍒ゆ柇鏄惁涓哄璞� function isObject(s) { return (typeof s === 'object' && !isArray(s)); +} + +//浣跨敤XMLHttpRequest鐨勬柟寮忚幏鍙栨ā鏉块〉 +function getTpl(url) { + var xmlhttp; // 瀹炰緥鍖朮MLHttpRequest瀵硅薄 + if(window.XMLHttpRequest) { + xmlhttp = new XMLHttpRequest(); + }else { + xmlhttp = new ActiveXObject('Mocrosoft.XMLHTTP'); + } + + // 璁剧疆璇锋眰 + xmlhttp.open('GET', url, false); + + // 鍙戦�佽姹� + xmlhttp.send(); + + var tpl; + if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { + tpl = xmlhttp.responseText; + }else { + tpl = ""; + } + + return tpl; } \ No newline at end of file diff --git a/gx_tieta/WebRoot/temp.html b/gx_tieta/WebRoot/temp.html new file mode 100644 index 0000000..01f4f8e --- /dev/null +++ b/gx_tieta/WebRoot/temp.html @@ -0,0 +1,145 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <title>涓存椂鏂囦欢</title> + <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> + var ExpExcel = function() { + this.thead = ''; // 琛ㄦ牸鐨勫ご閮� + this.tbody = ''; // 琛ㄦ牸鐨勫唴瀹� + this.normal = 1; // 鏄惁涓洪�氱敤鐨勫鍑� + this.dataBreak = ''; // 鏁版嵁鍒嗗壊绗� + this.pageNames = ''; // 宸ヤ綔绨垮悕绉� + this.pageBreak = ''; // 宸ヤ綔绨垮垎闅旂 + this.form = ''; + this.form = this.initForm(); + }; + var prop = ExpExcel.prototype; + + // 鍒濆鍖� + prop._init = function(ele, obj) { + var defaults = { + thead: [], + tbody: [], + normal: 1, + dataBreak: '&', + pageNames: ['鏁版嵁琛ㄦ牸'], + pageBreak: '$' + }; + + // 鍚堝苟瀵硅薄 + var opts = $.extend({}, defaults, obj | {}); + + this._setThead(obj.thead, opts.pageBreak, opts.dataBreak); + this._setTbody(obj.tbody, opts.pageBreak, opts.dataBreak); + this._setPageNames(opts.pageNames, opts.pageBreak); + + this.dataBreak = opts.dataBreak; + this.pageBreak = opts.pageBreak; + this.normal = opts.normal; + + this.form = this.initForm(); + this._setForm(ele); + }; + + // 璁剧疆椤甸潰涓殑鍏冪礌 + prop._setForm = function(ele) { + // 鏇存柊鍐呭 + ele.text(''); + + var form = $('<form id="exp_excel" action="ExportTable.servlet" method="post"></form>'); + + var thead = $('<input type="hidden" id="exp_thead" name="exp_thead" value=""/>'); + var tbody = $('<input type="hidden" id="exp_tbody" name="exp_tbody" value=""/>'); + var normal = $('<input type="hidden" id="exp_normal" name="exp_normal" value=""/>'); + var dataBreak = $('<input type="hidden" id="exp_data_break" name="exp_data_break" value=""/>'); + var pageNames = $('<input type="hidden" id="exp_page_names" name="exp_page_names" value=""/>'); + var pageBreak = $('<input type="hidden" id="exp_page_break" name="exp_page_break" value=""/>'); + + thead.val(this.thead); + tbody.val(this.tbody); + normal.val(this.normal); + dataBreak.val(this.dataBreak); + pageNames.val(this.pageNames); + pageBreak.val(this.pageBreak); + + form.append(thead); + form.append(tbody); + form.append(normal); + form.append(dataBreak); + form.append(pageNames); + form.append(pageBreak); + + ele.append(form); + this.form = form; + } + + // 璁剧疆琛ㄦ牸澶撮儴鐨勫�� + prop._setThead = function(thead, pageBreak, dataBreak) { + var arr = []; + // 鏁版嵁鍒嗗壊 + for(var i=0; i<thead.length; i++) { + var _arr = thead[i].join(dataBreak); + arr.push(_arr) + } + // 宸ヤ綔绨垮垎鍓� + var str = arr.join(pageBreak); + this.thead = str; + }; + + // 璁剧疆琛ㄦ牸鍐呭 + prop._setTbody = function(tbody, pageBreak, dataBreak) { + var arr = []; + // 鏁版嵁鍒嗗壊 + for(var i=0; i<tbody.length; i++) { + var _arr = tbody[i].join(dataBreak); + arr.push(_arr) + } + // 宸ヤ綔绨垮垎鍓� + var str = arr.join(pageBreak); + this.tbody = str; + }; + + // 璁剧疆宸ヤ綔绨垮唴瀹� + 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) { + + this._init(ele, 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); + </script> +</body> +</html> \ No newline at end of file -- Gitblit v1.9.1