92 lines
3.5 KiB
PHP
92 lines
3.5 KiB
PHP
@extends('admin.layouts.base')
|
||
@section('add_css')
|
||
|
||
@endsection
|
||
@section('content')
|
||
|
||
|
||
<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>
|
||
|
||
|
||
|
||
|
||
@endsection
|
||
@section('add_js')
|
||
@verbatim
|
||
|
||
<script type="text/html" id="true-false-table-switchTpl">
|
||
<input type="checkbox" name="sex" lay-skin="switch" lay-text="启用|禁用" lay-filter="test-table-checked"
|
||
value="{{ d.is_checked }}" data-field="is_checked" data-json="{{ encodeURIComponent(JSON.stringify(d)) }}" {{ d.is_checked == 1 ? 'checked' : '' }}>
|
||
</script>
|
||
|
||
<script type="text/html" id="table-useradmin-admin">
|
||
<a class="layui-btn layui-btn-normal layui-btn-xs openLayer" data-url="{{ d.show_url }}" data-w="620px" data-h="750px" data-title="公告" title="公告" lay-event="openLayer" ><i
|
||
class="layui-icon layui-icon-about"></i>查看</a>
|
||
<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>
|
||
@endverbatim
|
||
|
||
@include('admin.layouts.commonscript')
|
||
<script>
|
||
listConfig.open_width='100%';
|
||
listConfig.open_height='100%';
|
||
|
||
layui.use(['index', 'table', 'listable'], function () {
|
||
var $ = layui.$
|
||
, form = layui.form
|
||
, listable = layui.listable
|
||
, table = layui.table;
|
||
var element = layui.element;
|
||
//获取hash来切换选项卡,假设当前地址的hash为lay-id对应的值
|
||
var layid = location.hash.replace(/^#type=/, '');
|
||
console.log(layid);
|
||
element.tabChange('test1', layid); //假设当前地址为:http://a.com#test1=222,那么选项卡会自动切换到“发送消息”这一项
|
||
//监听Tab切换,以改变地址hash值
|
||
element.on('tab(test1)', function () {
|
||
location.hash = 'type=' + this.getAttribute('lay-id');
|
||
type = this.getAttribute('lay-id');
|
||
var field = {
|
||
'type': type
|
||
}
|
||
table.reload('LAY-list-table', {
|
||
where: field
|
||
});
|
||
|
||
});
|
||
|
||
|
||
cols= [[
|
||
{type: 'checkbox', width: 80,}
|
||
, {field: 'id', width: 80, title: 'ID', sort: true}
|
||
, {field: 'name', title: '名称', minWidth: 150}
|
||
, {field: 'user_name', title: '发布者', width: 150}
|
||
, {field: 'created_at', title: '发布时间', width: 180}
|
||
, {title: '操作', align: 'center', toolbar: '#table-useradmin-admin', width: 180}
|
||
]];
|
||
listable.list(listable_url,cols,{
|
||
where: {
|
||
'type': layid
|
||
}
|
||
});
|
||
//监听表操作
|
||
listable.handle();
|
||
listable.top_handle();
|
||
|
||
|
||
});
|
||
</script>
|
||
@endsection |