hdw
2018-10-19 f5def6a97e1a5de359121dfd7b6057ba29fe934c
from表单定义
2个文件已添加
2个文件已修改
262 ■■■■ 已修改文件
gx_tieta/.settings/org.jboss.tools.jst.web.xml 84 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/iframe/exportExcel.html 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/js/base.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
gx_tieta/WebRoot/temp.html 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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"/>
gx_tieta/WebRoot/iframe/exportExcel.html
New file
@@ -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>
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;    // 实例化XMLHttpRequest对象
    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;
}
gx_tieta/WebRoot/temp.html
New file
@@ -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;
        }
        // 初始化form
        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>