填充单位表格数据
This commit is contained in:
1 parent
675028499f
commit
88c8da9f73
3 files changed
+33
-13
No files matched your search
@@ -88,18 +88,21 @@ class School extends Base
|
||||
public function ajaxData()
|
||||
{
|
||||
|
||||
$list = request()->post();
|
||||
|
||||
// 实例化
|
||||
$sch = new sch;
|
||||
|
||||
// 获取荣誉总数
|
||||
$data = $sch->select();
|
||||
$cnt = $sch->count();
|
||||
|
||||
// // 获取荣誉总数
|
||||
$data = $sch->page($list['page'],$list['limit'])->select();
|
||||
|
||||
// 重组返回内容
|
||||
$data = [
|
||||
'code'=> 0 , // ajax请求次数,作为标识符
|
||||
'msg'=>"", // 获取到的结果数(每页显示数量)
|
||||
'count'=>100, // 符合条件的总数据量
|
||||
'count'=>$cnt, // 符合条件的总数据量
|
||||
'data'=>$data, //获取到的数据结果
|
||||
];
|
||||
|
||||
|
||||
@@ -36,15 +36,9 @@ class School extends Base
|
||||
|
||||
|
||||
// 查询所有单位
|
||||
public function search($search)
|
||||
public function search()
|
||||
{
|
||||
// 获取参数
|
||||
$xingzhi = $search['xingzhi'];
|
||||
$order_field = $search['order_field'];
|
||||
$order = $search['order'];
|
||||
$search = $search['search'];
|
||||
|
||||
|
||||
|
||||
$data = $this->order([$order_field =>$order])
|
||||
->when(strlen($xingzhi)>0,function($query) use($xingzhi){
|
||||
@@ -73,7 +67,6 @@ class School extends Base
|
||||
}
|
||||
]
|
||||
)
|
||||
// ->append(['cnt'])
|
||||
->select();
|
||||
|
||||
|
||||
|
||||
@@ -70,10 +70,31 @@
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use('table', function(){
|
||||
var table = layui.table;
|
||||
|
||||
//头工具栏事件
|
||||
table.on('toolbar(test)', function(obj){
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch(obj.event){
|
||||
case 'getCheckData':
|
||||
var data = checkStatus.data;
|
||||
layer.alert(JSON.stringify(data));
|
||||
break;
|
||||
case 'getCheckLength':
|
||||
var data = checkStatus.data;
|
||||
layer.msg('选中了:'+ data.length + ' 个');
|
||||
break;
|
||||
case 'isAll':
|
||||
layer.msg(checkStatus.isAll ? '全选': '未全选');
|
||||
break;
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//第一个实例
|
||||
table.render({
|
||||
@@ -82,8 +103,10 @@
|
||||
url:"{:url('ajaxdata')}",
|
||||
method:"POST", //数据接口
|
||||
page: true, //开启分页
|
||||
loading:true,
|
||||
cols: [[ //表头
|
||||
{field: 'title', title: '单位名称',sort: true, fixed: 'left'},
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field: 'title', title: '单位名称',sort: true},
|
||||
{field: 'jiancheng', title: '单位简称'},
|
||||
{field: 'dw_xingzhi.title', title: '性质',sort: true},
|
||||
{field: 'dw_jibie.title', title: '级别'} ,
|
||||
@@ -93,7 +116,8 @@
|
||||
{field: 'status', title: '状态'},
|
||||
{field: 'id', title: '操作', sort: true}
|
||||
]],
|
||||
|
||||
limits:[1],
|
||||
limit:1,
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user