|
@@ -4,30 +4,26 @@
|
|
<%-- 使用方法: 1.将本tag写在查询的form之前;2.传入controller的url --%>
|
|
<%-- 使用方法: 1.将本tag写在查询的form之前;2.传入controller的url --%>
|
|
<button id="btnImport" class="nav-btn nav-btn-import" data-toggle="tooltip" data-placement="left" title="导入"><i class="fa fa-folder-open-o"></i> 导入</button>
|
|
<button id="btnImport" class="nav-btn nav-btn-import" data-toggle="tooltip" data-placement="left" title="导入"><i class="fa fa-folder-open-o"></i> 导入</button>
|
|
<div id="importBox" class="hide">
|
|
<div id="importBox" class="hide">
|
|
- <form id="importForm2" action="${url}" method="post" enctype="multipart/form-data" onsubmit="loading('正在导入,请稍等...');">
|
|
|
|
- <select id="concealType" name="conceal">
|
|
|
|
- <option value="0">请选择</option>
|
|
|
|
- <option value="workSiteLevel">场平工程量确认单</option>
|
|
|
|
- <option value="workConcealProject">屏蔽工程量确认单</option>
|
|
|
|
- </select>
|
|
|
|
- <br/>
|
|
|
|
- <input id="uploadFile" name="file" type="file" style="width:330px"/>导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!<br/>
|
|
|
|
- </form>
|
|
|
|
|
|
+ <form id="importForm2" action="${url}" method="post" enctype="multipart/form-data" onsubmit="loading('正在导入,请稍等...');">
|
|
|
|
+ <br/>
|
|
|
|
+ <input id="uploadFile" name="file" type="file" style="width:330px"/>导入文件不能超过5M,仅允许导入“xls”或“xlsx”格式文件!<br/>
|
|
|
|
+
|
|
|
|
+ </form>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
<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){
|
|
|
|
- window.location.href='${url}/template';
|
|
|
|
- },
|
|
|
|
- btn2: function(index, layero){
|
|
|
|
- /*$('#importForm2').ajaxSubmit({
|
|
|
|
|
|
+ $(document).ready(function() {
|
|
|
|
+ $("#btnImport").click(function(){
|
|
|
|
+ top.layer.open({
|
|
|
|
+ type: 1,
|
|
|
|
+ area: [500, 300],
|
|
|
|
+ title:"导入数据",
|
|
|
|
+ content:$("#importBox").html() ,
|
|
|
|
+ btn: ['下载模板','确定', '关闭'],
|
|
|
|
+ btn1: function(index, layero){
|
|
|
|
+ window.location.href='${url}/template';
|
|
|
|
+ },
|
|
|
|
+ btn2: function(index, layero){
|
|
|
|
+ /*$('#importForm2').ajaxSubmit({
|
|
dataType: "json",
|
|
dataType: "json",
|
|
success: function (result) {
|
|
success: function (result) {
|
|
console.log(result);
|
|
console.log(result);
|
|
@@ -42,35 +38,33 @@ $(document).ready(function() {
|
|
}
|
|
}
|
|
});*/
|
|
});*/
|
|
|
|
|
|
- var formData = new FormData();
|
|
|
|
- formData.append("file",top.$("#uploadFile")[0].files[0]);
|
|
|
|
- formData.append("type",top.$("#concealType").val());
|
|
|
|
|
|
+ var formData = new FormData();
|
|
|
|
+ formData.append("file",top.$("#uploadFile")[0].files[0]);
|
|
|
|
+ $.ajax({
|
|
|
|
+ type: 'post',
|
|
|
|
+ url: "${url}",
|
|
|
|
+ data: formData,
|
|
|
|
+ dataType: "json",
|
|
|
|
+ cache: false,
|
|
|
|
+ processData: false,
|
|
|
|
+ contentType: false,
|
|
|
|
+ }).success(function (result) {
|
|
|
|
+ if(result.code == 0){
|
|
|
|
+ genRow(result.data);
|
|
|
|
+ }else {
|
|
|
|
+ top.layer.msg("导入文件异常:"+result.message);
|
|
|
|
+ }
|
|
|
|
+ }).error(function () {
|
|
|
|
+ top.layer.msg("导入文件失败!");
|
|
|
|
+ });
|
|
|
|
+ top.layer.close(index);
|
|
|
|
+ },
|
|
|
|
+ btn3: function(index){
|
|
|
|
+ top.layer.close(index);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
|
|
- $.ajax({
|
|
|
|
- type: 'post',
|
|
|
|
- url: "${url}",
|
|
|
|
- data: formData,
|
|
|
|
- dataType: "json",
|
|
|
|
- cache: false,
|
|
|
|
- processData: false,
|
|
|
|
- contentType: false,
|
|
|
|
- }).success(function (result) {
|
|
|
|
- if(result.code == 0){
|
|
|
|
- genRow(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>
|
|
</script>
|