|
@@ -0,0 +1,102 @@
|
|
|
+<%@ tag language="java" pageEncoding="UTF-8"%>
|
|
|
+<%@ include file="/webpage/include/taglib.jsp"%>
|
|
|
+<%@ attribute name="url" type="java.lang.String" required="true"%>
|
|
|
+
|
|
|
+<!-- 引入layer插件 -->
|
|
|
+<link href="${ctxStatic}/layer-v2.3/layui/css/layui.css" type="text/css" rel="stylesheet"/>
|
|
|
+<script src="${ctxStatic}/layer-v2.3/layer/layer.js"></script>
|
|
|
+<script src="${ctxStatic}/layer-v2.3/layer/laydate/laydate.js"></script>
|
|
|
+<%-- 使用方法: 1.将本tag写在查询的form之前;2.传入controller的url --%>
|
|
|
+<button id="btnImport" class="layui-btn layui-btn-sm layui-bg-blue" data-toggle="tooltip" data-placement="left" title="导入">
|
|
|
+ <%-- <i class="fa fa-folder-open-o"></i>--%>
|
|
|
+ 导入
|
|
|
+</button>
|
|
|
+<div id="importBox" class="hide">
|
|
|
+ <form id="importForm2" action="${url}" method="post" enctype="multipart/form-data" onsubmit="loading('正在导入,请稍等...');">
|
|
|
+ <br/>
|
|
|
+ <div class="layui-form-item" style="text-align:center; line-height: 41px;">
|
|
|
+ <label class="layui-form-label" style="vertical-align:middle;display:inline-block;"><span class="require-item" style="color:red;font-size: 20px;">*</span>导入类型</label>
|
|
|
+ <select id="concealType" name="concealType">
|
|
|
+ <option value="">请选择</option>
|
|
|
+ <option value="js" selected="">江苏电力模板导入</option>
|
|
|
+ <option value="sh">上海电力模板导入</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <input id="uploadFile" name="file" type="file" style="width:330px"/>导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!<br/>
|
|
|
+ </form>
|
|
|
+</div>
|
|
|
+<script type="text/javascript">
|
|
|
+ $(document).ready(function() {
|
|
|
+ $("#btnImport").click(function(){
|
|
|
+ top.layer.open({
|
|
|
+ type: 1,
|
|
|
+ area: [500, 300],
|
|
|
+ title:"导入数据",
|
|
|
+ content:$("#importBox").html() ,
|
|
|
+ btn: ['下载模板','确定', '关闭'],
|
|
|
+ btn1: function(index, layero){
|
|
|
+ var type = top.$("#concealType").val();
|
|
|
+ if(null == type || "" == type) {
|
|
|
+ top.layer.open({
|
|
|
+ title: '提示'
|
|
|
+ , content: '请选择需要下载的数据类型'
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ window.location.href='${url}/template?type='+type;
|
|
|
+ },
|
|
|
+ btn2: function(index, layero){
|
|
|
+
|
|
|
+ var type = top.$("#concealType").val();
|
|
|
+ if(null == type || "" == type) {
|
|
|
+ top.layer.open({
|
|
|
+ title: '提示'
|
|
|
+ , content: '请选择导入的数据类型'
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ var inputForm =top.$("#importForm2");
|
|
|
+ var top_iframe = top.getActiveTab().attr("name");//获取当前active的tab的iframe
|
|
|
+ inputForm.attr("target",top_iframe);//表单提交成功后,从服务器返回的url在当前tab中展示
|
|
|
+ top.$("#importForm2").submit();
|
|
|
+ top.layer.close(index);
|
|
|
+
|
|
|
+
|
|
|
+ /*var formData = new FormData();
|
|
|
+ formData.append("file",top.$("#uploadFile")[0].files[0]);
|
|
|
+ formData.append("type",top.$("#concealType").val());
|
|
|
+ //alert(top.$("#concealType").val());
|
|
|
+ $.ajax({
|
|
|
+ type: 'post',
|
|
|
+ url: "${url}",
|
|
|
+ data: formData,
|
|
|
+ dataType: "json",
|
|
|
+ cache: false,
|
|
|
+ processData: false,
|
|
|
+ contentType: false,
|
|
|
+ }).success(function (result) {
|
|
|
+ if(result.code == 0){
|
|
|
+ if("sh" == result.data[0].type){
|
|
|
+ genRow(result.data);
|
|
|
+ }else if("js" == result.data[0].type){
|
|
|
+ genWorkSiteLevelRow(result.data);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ top.layer.msg("导入文件异常:"+result.message);
|
|
|
+ }
|
|
|
+ }).error(function () {
|
|
|
+ top.layer.msg("导入文件失败!");
|
|
|
+ });*/
|
|
|
+ top.layer.close(index);
|
|
|
+ },
|
|
|
+ btn3: function(index){
|
|
|
+ top.layer.close(index);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+</script>
|