colly_wyx
2018-04-17 62d6bc507aec5c330bc698e81ad90cc2a130dd93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
 
    <link rel="stylesheet" href="/themes/AdminLTE/plugins/datatables/dataTables.bootstrap.css">
 
    <section class="content-header">
      <h1>
        栏目管理
      </h1>
      <ol class="breadcrumb">
        <li><a href="/admin/index/index"><i class="fa fa-dashboard"></i> 平台首页</a></li>
        <li><a href="/module/manager/index">栏目管理</a></li>
        <li class="active">栏目列表</li>
      </ol>
    </section>
 
     <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">栏目列表</h3>
            </div>
            
            <!-- /.box-header -->
            <div class="box-body">
              <table id="table_list" class="table table-bordered table-hover">
                <thead>
                  <tr>
                    <th>模块名称</th>
                    <th>控制器名称</th>
                    <th>动作名称</th>
                    <th>描述</th>
                    <th>是否是顶级栏目</th>
                    <th>操作</th>
                  </tr>
                </thead>
              </table>
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </section>
 
<script>
  $(function () {
    var config = {
      "dom": 'l<"#toolbar">frtip',
      /*
       * 默认为false
       * 当表格在处理的时候(比如排序操作)是否显示“处理中...”
       * 当表格的数据中的数据过多以至于对其中的记录进行排序时会消耗足以被察觉的时间的时候,该选项会有些用处
       */
         "processing":true,
      /*
        * 默认为true
        * 是否允许终端用户从一个选择列表中选择分页的页数,页数为10,25,50和100,需要分页组件bPaginate的支持
        */
        "lengthChange":false,
        "serverSide":true,
        "autoWidth": true,
        "language":{
          "lengthMenu": "每页显示 _MENU_ 条",
          "emptyTable": "暂时没有任何数据记录",
          "processing": "正在载入数据...",
          "search": "搜索 _INPUT_",
          "info": "显示 _START_ 至 _END_ 项结果,共 _TOTAL_ 项",
          "zeroRecords": "暂时没有任何数据记录",
          "sInfoEmpty": "暂时没有任何数据记录",
          "paginate": {
            "first": "首页",
            "previous": "上一页",
            "next": "下一页",
            "last": "尾页"
          },
        },
        "ajax":{
          "url": "/module/manager/index",
          "type":"POST",
        },
        "columns":[
          {
            "data":"module",
            "orderable":false
          },
          {
            "data":"controller",
            "orderable":false
          },
          {
            "data":"action",
            "orderable":false
          },
          {
            "data":"name",
            "orderable":false
          },
          {
            "data":"parent",
            "orderable":false
          },
          {
            "data":null,
            "orderable":false
          },
        ],
        "columnDefs": [
          {
            "targets":4,
            "searchable0":false,
            "render":function(data, type, row, meta){
              if(data == 0) {
                return "是";
              }
              else{
                return "否";
              }
            }
          },
          {
            "targets":5,
            "searchable":false,
            "render":function(data, type, row, meta){
              return '<a class="btn btn-primary" href="/<?php echo $route['module']?>/<?php echo $route['controller']?>/edit/id/'+row['_id']+'">编辑</a>'
            }
          }
        ],
        "initComplete": function(){
          $("#toolbar").css("width", "100px").css("display", "inline").css("margin-left", "10px");
          $("#toolbar").append('<a id="build"  class="btn btn-success" data-toggle="modal" data-target="" href="/module/manager/add"> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>添加 <a> ');
        }
 
    }
    $("#table_list").DataTable(config);
  });
</script>