加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
common_list.html 3.78 KB
一键复制 编辑 原始数据 按行查看 历史
NullFeng 提交于 2017-12-26 16:18 . 渲染模板
<form id="common-form" class="form-horizontal form-label-left" method="post" action="">
<input type="hidden" id="page-no" name="_page_no" value="1">
{notempty name='_search'}
{foreach $_search as $key => $field}
{switch name='field.type'}
{case value='text'}
<div style="display: inline-block;">
<label for="_{$key}">{$field.title}</label>
<input type="text" name="_query[{$key}]" value="{$_query_fields[$key]}" style="width: 140px;display: inline-block" id="_{$key}"
class="form-control">
</div>
{/case}
{case value='select'}
<div style="display: inline-block;">
<label for="_{$key}">{$field.title}</label>
<select name="_query[{$key}]">
<option value="_no_select_">全部</option>
{foreach $field['list'] as $ik=>$iv}
<?php
$selected="";
if(isset($_query_fields[$key])){
$selected = $ik==$_query_fields[$key]?'selected':'';
}
?>
<option value="{$ik}" {$selected} >{$iv}</option>
{/foreach}
</select>
</div>
{/case}
{/switch}
{/foreach}
<div style="display: inline-block;margin-left: 5px;">
<input type="submit" class="btn btn-primary" value="搜索"><a href="" class="btn btn-default">重置</a>
</div>
{/notempty}
</form>
<table class="table">
<thead>
{foreach $_headers as $header}
<th>{$header.title}</th>
{/foreach}
</thead>
<tbody>
{foreach $_rows as $row}
<tr>
{foreach $_headers as $key=>$header}
<td>{$row[$key]}</td>
{/foreach}
</tr>
{/foreach}
{empty name="_rows"}
<td align="center" colspan="{$_headers|count}">当前没有数据哦@_@~~</td>
{/empty}
</tbody>
<tfoot>
<tr>
<td colspan="{$_headers|count}">
<?php
//dump($_page);
?>
总数据:{$_page.total}
总页数:{$_page.count}
&nbsp;&nbsp;
<div class="btn-group">
{if condition="$_page['no']-1>0"}
<button class="btn btn-default" type="button" onclick="jump_page('{$_page.no-1}')"><i class="glyphicon glyphicon-menu-left"></i></button>
{/if}
{if condition="$_page['count']>0"}
{for start="1" end="$_page['count']+1"}
{if condition="$_page['no']==$i"}
<button class="btn btn-default active" type="button">{$i}</button>
{else /}
<button class="btn btn-default" type="button" onclick="jump_page('{$i}')">{$i}</button>
{/if}
{/for}
{/if}
{if condition="$_page['no']+1<=$_page['count']"}
<button class="btn btn-default" type="button" onclick="jump_page('{$_page.no+1}')"><i class="glyphicon glyphicon-menu-right"></i></button>
{/if}
</div>
</td>
</tr>
</tfoot>
</table>
<script>
function jump_page(no) {
var form = document.getElementById('common-form');
var page_no = document.getElementById('page-no');
no = parseInt(no);
if(no<=0 && no > parseInt("{$_page.count}")){
console.log('该页不存在!');
return;
}
page_no.value = no;
form.submit();
}
</script>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化