108 lines
4.3 KiB
PHP
108 lines
4.3 KiB
PHP
@extends('admin.layouts.base')
|
|
@section('add_css')
|
|
|
|
@endsection
|
|
@section('content')
|
|
<div class="layui-fluid">
|
|
|
|
<div class="layui-card">
|
|
|
|
<div class="layui-card-body">
|
|
<div style="padding-bottom: 10px;">
|
|
<button class="layui-btn layuiadmin-btn-tophandel" data-type="batchdel">删除</button>
|
|
<button class="layui-btn layuiadmin-btn-tophandel" data-type="add">添加</button>
|
|
</div>
|
|
<table id="LAY-list-table" lay-filter="LAY-list-table"></table>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@verbatim
|
|
|
|
<script type="text/html" id="imgTpl">
|
|
<img src="{{ d.thumb }}" alt="" lay-event="lgimg" style="max-width: 120px">
|
|
</script>
|
|
@endverbatim
|
|
<script type="text/html" id="table-useradmin-admin">
|
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i
|
|
class="layui-icon layui-icon-edit"></i>编辑</a>
|
|
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i
|
|
class="layui-icon layui-icon-delete"></i>删除</a>
|
|
</script>
|
|
|
|
|
|
@endsection
|
|
@section('add_js')
|
|
|
|
<script>
|
|
var listConfig={
|
|
table_name:'{{ $table_name }}',
|
|
page_name:'{{ $page['name'] }}',
|
|
del_url:"{{ admin_url('Handle','handle',['group_type'=>$group_type,'type'=>'del']) }}",
|
|
edit_field_url:"{{ admin_url('Handle','handle',['group_type'=>$group_type,'type'=>'edit']) }}",
|
|
create_url:'{{ action($controller.'@create',['group_type'=>$group_type]) }}',
|
|
stroe_url:"{{ action($controller.'@store',['group_type'=>$group_type]) }}",
|
|
open_height:'240px',
|
|
open_width:'400px'
|
|
};
|
|
|
|
layui.use(['index', 'table', 'listable'], function () {
|
|
var $ = layui.$
|
|
, form = layui.form
|
|
, listable = layui.listable
|
|
, table = layui.table;
|
|
var element = layui.element;
|
|
|
|
//搜索角色
|
|
form.on('select(LAY-user-adminrole-type)', function (data) {
|
|
//执行重载
|
|
table.reload('LAY-list-table', {
|
|
where: {
|
|
role: data.value
|
|
}
|
|
});
|
|
});
|
|
|
|
//顶部添加和删除事件
|
|
var active = {
|
|
batchdel: listable.del,
|
|
add: listable.add
|
|
};
|
|
$('.layui-btn.layuiadmin-btn-tophandel').on('click', function () {
|
|
var type = $(this).data('type');
|
|
active[type] ? active[type].call(this) : '';
|
|
});
|
|
//请求数据
|
|
|
|
cols=[[
|
|
{type: 'checkbox', fixed: 'left'}
|
|
, {field: 'id', width: 80, title: 'ID', sort: true}
|
|
, {field: 'sort', title: '排序',width:80,edit:1}
|
|
, {field: 'name', title: '名称'},
|
|
{
|
|
field:'is_checked',title:'状态',templet:'#true-false-table-switchTpl'
|
|
}
|
|
, {
|
|
title: '操作',
|
|
width: 150,
|
|
align: 'center',
|
|
fixed: 'right',
|
|
toolbar: '#table-useradmin-admin'
|
|
}
|
|
]];
|
|
listable_url="{{ action($controller.'@apiJson',['group_type'=>$group_type]) }}";
|
|
//监听表操作
|
|
listable.handle()
|
|
|
|
//监听搜索
|
|
form.on('submit(LAY-user-back-search)', function (data) {
|
|
var field = data.field;
|
|
//执行重载
|
|
table.reload('LAY-list-table', {
|
|
where: field
|
|
});
|
|
});
|
|
|
|
});
|
|
</script>
|
|
@endsection |