自定义表单优化
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
<a href="{:url('admin/form/edit?id='.$item['id'])}">编辑</a>
|
||||
<a href="{:url('admin/form/del?id='.$item['id'])}" class="confirm ajax-get">删除</a>
|
||||
<a href="{:url('admin/form/lists?form_id='.$item['id'])}">数据</a>
|
||||
<a href="{:url('index/form/index', ['id'=>$item['id'], 'name'=>$item['show_title']])}" target="_blank">浏览</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
|
||||
85
application/admin/view/form/list.html
Normal file
85
application/admin/view/form/list.html
Normal file
@@ -0,0 +1,85 @@
|
||||
{extend name="public/base"/}
|
||||
{block name="body"}
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>{$meta_title}</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-primary" data-action="out" data-href="{:url('admin/form/outxls?form_id='.$form_id)}" target="_blank">导出</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input class="checkbox check-all" type="checkbox"></th>
|
||||
{volist name="grid_list" id="item"}
|
||||
<th>{$item['title']}</th>
|
||||
{/volist}
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="list" id="item"}
|
||||
<tr>
|
||||
<td><input class="ids row-selected" type="checkbox" name="id[]" value="{$item['id']}"></td>
|
||||
{volist name="grid_list" id="grid"}
|
||||
<td>{$item[$grid['field']]|default=''}</td>
|
||||
{/volist}
|
||||
<td>
|
||||
<a href="{:url('deldata',array('id'=>$item['id'], 'form_id'=>$form_id))}" class="confirm ajax-get">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
{$page}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script type="text/javascript" src="/static/js/xlsx.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$('a[data-action=out]').click(function(e){
|
||||
e.preventDefault();
|
||||
outXlsx($(this).data('href'), 1)
|
||||
});
|
||||
})
|
||||
|
||||
var outList = [];
|
||||
function outXlsx(url, page = 1){
|
||||
var data = $('form').serialize();
|
||||
var pagesize = $('select.pagesize').val() || 30;
|
||||
data = data + '&out=1&pagesize='+pagesize+'&page='+page
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: 'get',
|
||||
beforeSend: function(){
|
||||
layer.load();
|
||||
layer.msg('正在导出第'+page+'页,请耐心等待,不要关闭浏览器');
|
||||
},
|
||||
error: function(){
|
||||
layer.msg('导出失败!');
|
||||
},
|
||||
success:function(res){
|
||||
outList = outList.concat(res.data);
|
||||
if (res.last_page > page) {
|
||||
outXlsx(url, page+1)
|
||||
}else{
|
||||
xls.downloadExl(outList,res.file_name);
|
||||
layer.msg('导出完成!');
|
||||
setTimeout(function(){
|
||||
layer.closeAll('loading');
|
||||
}, 3000);
|
||||
}
|
||||
},
|
||||
dataType: 'json'
|
||||
})
|
||||
}
|
||||
</script>
|
||||
{/block}
|
||||
Reference in New Issue
Block a user