114 lines
3.6 KiB
HTML
114 lines
3.6 KiB
HTML
|
{include file="common/head"}
|
||
|
|
||
|
<form class="layui-form" style="display: inline;">
|
||
|
<input type="text" name="keywords" required lay-verify="required" placeholder="" class="layui-input" autocomplete="off" style="max-width: 200px;display: inline;margin: 10px 10px 0 0;height: 30px;" />
|
||
|
<button class="layui-btn layui-btn-sm layui-btn-primary" lay-submit="" lay-filter="vaeform">立即搜索</button>
|
||
|
</form>
|
||
|
<table class="layui-hide" id="test" lay-filter="test"></table>
|
||
|
|
||
|
<script type="text/html" id="status">
|
||
|
<i class="layui-icon {{# if(d.status == 1){ }}layui-icon-ok{{# } else { }}layui-icon-close{{# } }}"></i>
|
||
|
</script>
|
||
|
<script type="text/html" id="href">
|
||
|
<a href="/index.php/{{d.module}}/{{d.url}}" target="_blank" style="color:#01AAED;">/{{d.module}}/{{d.url}}</a>
|
||
|
</script>
|
||
|
<script type="text/html" id="toolbarDemo">
|
||
|
<div class="layui-btn-container">
|
||
|
<button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="add">添加路由</button>
|
||
|
<span class="layui-badge-rim">注意:如果应用(模块)单独绑定了域名,在访问设置后的链接时无需加应用名</span>
|
||
|
</div>
|
||
|
</script>
|
||
|
<script type="text/html" id="barDemo">
|
||
|
<a class="layui-icon layui-icon-edit" lay-event="edit" href="javascript:;"></a>
|
||
|
<a class="layui-icon layui-icon-delete" lay-event="del" href="javascript:;"></a>
|
||
|
</script>
|
||
|
|
||
|
|
||
|
{include file="common/foot"}
|
||
|
|
||
|
<script>
|
||
|
layui.config({
|
||
|
base: '__AVIEW__/module/'
|
||
|
}).use(['table','vae','form'], function(){
|
||
|
var table = layui.table
|
||
|
,vae = layui.vae
|
||
|
,$ = layui.$
|
||
|
,form = layui.form;
|
||
|
|
||
|
var tableIns = table.render({
|
||
|
elem: '#test'
|
||
|
,toolbar: '#toolbarDemo'
|
||
|
,title: '用户数据表'
|
||
|
,url: "{:url('admin/route/index')}" //数据接口
|
||
|
,page: true //开启分页
|
||
|
,limit: 15
|
||
|
,cols: [[ //表头
|
||
|
{field: 'id', title: 'ID', sort: true, fixed: 'left', align:'center', width:80}
|
||
|
,{field: 'module', title: '应用(模块)', align:'center'}
|
||
|
,{field: 'full_url', title: '原始链接', align:'center'}
|
||
|
,{field: 'url', title:'路由', align:'center',}
|
||
|
,{field: '', title:'访问地址:应用(模块)名+路由', align:'center',toolbar: '#href'}
|
||
|
,{field: 'status', title:'状态', toolbar: '#status', align:'center', width:100}
|
||
|
,{field: 'right', toolbar: '#barDemo', width:150, align:'center'}
|
||
|
]]
|
||
|
,size: "sm"
|
||
|
});
|
||
|
|
||
|
//监听事件
|
||
|
table.on('toolbar(test)', function(obj){
|
||
|
var checkStatus = table.checkStatus(obj.config.id);
|
||
|
switch(obj.event){
|
||
|
case 'add':
|
||
|
vae.open({
|
||
|
href:"{:url('admin/route/add')}",
|
||
|
title:"添加路由",
|
||
|
end:function(){
|
||
|
tableIns.reload();
|
||
|
}
|
||
|
})
|
||
|
break;
|
||
|
};
|
||
|
});
|
||
|
|
||
|
//监听行工具事件
|
||
|
table.on('tool(test)', function(obj){
|
||
|
var data = obj.data;
|
||
|
if(obj.event === 'del'){
|
||
|
vae.confirm('真的删除么', function(index){
|
||
|
$.ajax({
|
||
|
url:"{:url('/admin/route/delete')}",
|
||
|
data:{id:data.id,module:data.module},
|
||
|
success:function(res){
|
||
|
layer.msg(res.msg);
|
||
|
if(res.code==200){
|
||
|
obj.del();
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
layer.close(index);
|
||
|
});
|
||
|
}else if(obj.event === 'edit'){
|
||
|
vae.open({
|
||
|
href:"{:url('admin/route/edit')}?id="+data.id,
|
||
|
title:'修改路由'+data.id,
|
||
|
end:function(){
|
||
|
tableIns.reload();
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
});
|
||
|
|
||
|
//监听搜索提交
|
||
|
form.on('submit(vaeform)', function(data){
|
||
|
console.log(data.field.keywords)
|
||
|
if(data.field.keywords) {
|
||
|
tableIns.reload({where:{keywords:data.field.keywords}});
|
||
|
vae.bundledTab();
|
||
|
}
|
||
|
return false;
|
||
|
});
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
</body>
|
||
|
</html>
|