extends /admin/include/layout.pug
block content
    .row: div.col-lg-12
        h1.site-h1(style='background-color:#FFFFFF;')
            | 系统数据字典列表 (#{sysDicList.totalElements})
            span(style='float:right;')
                button.layui-btn.layui-btn-small.green(href='/admin/sysdic/add.html', data-toggle='ajax', data-width='550', data-title='创建新字典项')
                    | 创建新字典项
        .row(style='padding:5px;')
            .col-lg-12
                table.layui-table(lay-skin='line')
                    colgroup
                        col(width='15%')
                        col(width='15%')
                        col(width='15%')
                        col(width='20%')
                        col(width='20%')
                        col(width='13%')
                        col
                    thead
                        tr
                            th 名称
                            th 代码
                            th 系统字典
                            th 说明
                            th 创建时间
                            th(style='white-space:nowrap;', nowrap) 操作
                    tbody
                        if sysDicList.totalElements > 0
                            for dic in sysDicList.content
                                tr
                                    td
                                        if dic.haschild && dic.haschild
                                            a(href='/admin/sysdic/dicitem.html?id=' + dic.id + '&dicid=' + dic.id)= dic.name
                                        else
                                            | #{dic.name}
                                    td= dic.code
                                    if dic.ctype == "data"
                                        td 数据字典
                                    else if dic.ctype == "auth"
                                        td 权限字典
                                    else if dic.ctype == "resu"
                                        td 系统资源
                                    else
                                        td
                                    td=dic.description
                                    if dic.createtime
                                        td= pugHelper.formatDate('yyyy-MM-dd HH:mm:ss', dic.createtime)
                                    else
                                        td
                                    td(style="white-space:nowrap;" nowrap="nowrap")
                                        a(title="编辑"+dic.name, data-width="550", data-toggle="ajax", href="/admin/sysdic/edit.html?id="+dic.id+"&p="+(sysDicList.number+1))
                                            i.layui-icon &#xe642;
                                            span 编辑
                                        a(title="删除"+dic.name, data-toggle="tip", data-title="删除字典项同时会删除字典项下的所有子项，请确认是否删除字典项“"+dic.name+"”？", href="/admin/sysdic/delete.html?id="+dic.id+"&p="+(sysDicList.number+1))
                                            i.layui-icon(style="color:red;") &#x1006;
                                            span 删除
        .row(style='padding:5px;')
            .col-lg-12#page(style='text-align:center;')
    script.
        layui.use(['laypage', 'layer'], function(){
                  var laypage = layui.laypage
                  ,layer = layui.layer;
                  var msg = "#{msg}";
                  if(msg){
                      top.layer.msg(msg)
                  };
                  laypage({
                        cont: 'page'
                        ,pages: #{sysDicList.totalPages} //总页数
                        ,curr: #{sysDicList.number+1}
                        ,groups: 5 //连续显示分页数
                        ,jump:function(data , first){
                            if(!first){
                                location.href = "/admin/sysdic/index.html?p="+data.curr ;
                            }
                        }
                   });
                });