{include file="common/head"/}
<div class="admin-main layui-anim layui-anim-upbit">
<fieldset class="layui-elem-field layui-field-title">
<legend>{$title}
</legend>
</fieldset>
<blockquote class="layui-elem-quote">
<a href="{:url('add')}" class="layui-btn layui-btn-sm">{:lang('add')}栏目
</a>
</blockquote>
<table class="layui-table">
<thead>
<tr>
<th>编号
</th>
<th>栏目名称
<span id="cateNameMsg">(点击查看内容)
</span></th>
<th>所属模型
</th>
<th>导航
</th>
<th>{:lang('order')}
</th>
<th>操作
</th>
</tr>
</thead>
<tbody id="con">
{volist name="categorys" id="vo"}
<tr>
<td class="visible-lg visible-md">{$vo['id']}
</td>
<td class="text-left"><a href="{:url($vo['cateUrl'],['id'=>$vo['id']])}" class="green" title="查看内容">{$vo['catname']}
</a>
</td>
<td class="visible-lg visible-md">{$vo['modulename']}
</td>
<td class="visible-lg visible-md"><font color="green">{$vo['menu'] == '1'?'显示':'不显示'}
</font></td>
<td><input type="text" size="10" data-id="1" value="{$vo['listorder']}" class="layui-input list_order"></td>
<td>
<a class="orange" href="{:url($vo['cateUrl'],['id'=>$vo['id']])}" title="修改内容"><i
class="icon icon-file-text2"></i></a>
{if($vo['moduleid'] !=1)}
<a class="blue" title="添加子栏目" href="{:url('admin/Category/add',['parentid'=>$vo['id']])}"> <i
class="icon icon-plus"></i></a>
{/if}
<a class="green" href="{:url('admin/Category/edit',['id'=>$vo['id']])}" title="修改"><i
class="icon icon-pencil2"></i></a>
<a class="red" href="javascript:del('{$vo['id']}')" title="删除"><i class="icon icon-bin"></i></a>
</td>
</tr>
{if(!empty($vo['child']))}
{volist name="vo['child']" id="vo"}
<tr>
<td class="visible-lg visible-md">{$vo['id']}
</td>
<td class="text-left">
└─
<a href="{:url($vo['cateUrl'],['id'=>$vo['id']])}" class="green" title="查看内容">{$vo['catname']}
</a>
</td>
<td class="visible-lg visible-md">{$vo['modulename']}
</td>
<td class="visible-lg visible-md"><font color="green">{$vo['menu'] == '1'?'显示':'不显示'}
</font></td>
<td><input type="text" size="10" data-id="15" value="{$vo['listorder']}" class="layui-input list_order">
</td>
<td>
<a class="orange" href="{:url($vo['cateUrl'],['id'=>$vo['id']])}" title="修改内容"><i
class="icon icon-file-text2"></i></a>
<!-- <a class="blue" title="添加子栏目" href="/index.php/admin/Category/add/parentid/15.html"> <i class="icon icon-plus"></i></a> -->
<a class="green" href="{:url('admin/Category/edit',['id'=>$vo['id']])}" title="修改"><i
class="icon icon-pencil2"></i></a>
<a class="red" href="javascript:del('{$vo['id']}')" title="删除"><i class="icon icon-bin"></i></a>
</td>
</tr>
{/volist}
{/if}
{/volist}
<!-- {$categorys} -->
</tbody>
<tfoot>
</table>
</div>
{include file="common/foot"/}
<script src="__STATIC__/common/js/jquery.2.1.1.min.js"></script>
<script>
layui.use(
'table', function () {
var $ =
layui.
jquery;
$(
'body').
on(
'blur', '.list_order', function () {
var id = $(
this).
attr(
'data-id')
;
var listorder = $(
this).
val()
;
var loading = layer.
load(
1, {
shade: [
0.1, '#fff']})
;
$.
post(
'{:url("cOrder")}', {
id: id
, listorder: listorder}
, function (res) {
layer.
close(loading)
;
if (res.
code ===
1) {
layer.
msg(res.
msg, {
time:
1000, icon:
1}
, function () {
location.href = res.
url;
})
;
}
else {
layer.
msg(res.
msg, {
time:
1000, icon:
2})
;
}
})
})
;
})
;
function del(id) {
layer.
confirm(
'你确定要删除该栏目及其子栏目吗?', {
icon:
3}
, function (index) {
$.
post(
'{:url("del")}', {
id: id}
, function (data) {
if (data.
status ===
1) {
layer.
alert(data.
info, {
icon:
6}
, function (index) {
layer.
close(index)
;
window.location.href = data.
url;
})
;
}
else {
layer.
msg(data.
info, {
icon:
5})
;
}
})
;
layer.
close(index)
;
})
;
}
</script>