<#if parentId?has_content>
    <@sys.dept id=parentId!>
        <#assign parent=object/>
    </@sys.dept>
</#if>
<@sys.deptList parentId=parentId userId=userId name=name pageIndex=pageNum pageSize=numPerPage>
<div class="pageHeader card">
    <form class="pagerForm" autocomplete="off" onsubmit="return navTabSearch(this);" method="post">
        <#include "../include_page/parameters.html"/>
        <div class="searchBar">
            <ul class="searchContent">
            <#if parent?has_content>
                <li>
                    <label><@t.page 'dept.parent'/>:${(parent.name)!}</label>
                </li>
            </#if>
                <li>
                    <label><@t.page 'dept.master'/>:</label>
                    <#include "../include_page/userId.html"/>
                </li>
                <li>
                    <label><@t.page 'name'/>:</label>
                    <input type="text" name="name" value="${(name)!}"/>
                </li>
            </ul>
            <div class="subBar">
                <ul>
                    <li>
                        <button type="submit" class="buttonActive"><@t.page 'button.search'/></button>
                    </li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="card">
    <div class="panelBar">
        <ul class="toolBar">
            <#if parent?has_content>
                <li><a href="sysDept/list.html?parentId=${(parent.parentId)!}" target="navTab" data-change-title="false" rel="sysDept/list"><i class="icon-circle-arrow-up icon-large"></i><@t.page 'button.return'/></a></li>
                <li class="line">line</li>
            </#if>
            <li><a href="sysDept/add.html?parentId=${parentId!}" target="navTab" rel="sysDept/add"><i class="icon-plus-sign-alt icon-large"></i><@t.page 'dept.add'/></a></li>
        </ul>
    </div>
    <table class="table" width="100%" layoutH>
        <thead>
            <tr>
                <th width="30"><@t.page 'id'/></th>
                <th><@t.page 'name'/></th>
                <th><@t.page 'code'/></th>
                <th><@t.page 'dept.parent'/></th>
                <th><@t.page 'description'/></th>
                <th><@t.page 'dept.master'/></th>
                <th><@t.page 'dept.own_all_category'/></th>
                <th><@t.page 'content.max_top_level'/></th>
                <th><@t.page 'dept.own_all_page'/></th>
                <th><@t.page 'operate'/></th>
            </tr>
        </thead>
        <tbody>
            <#list page.list as a>
                <@t.merge 'userIds' a.userId!/>
                <@t.merge 'parentIds' a.parentId!/>
            </#list>
            
            <@sys.dept ids=t.parentIds!><#assign parentMap=map!/></@sys.dept>
            <@sys.user ids=t.userIds!><#assign userMap=map!/></@sys.user>

            <#list page.list as a>
            <tr>
                <td>${a.id!}</td>
                <td class="exclude-translate">${(a.name)!}</td>
                <td class="exclude-translate">${(a.code)!}</td>
                <td>${(parentMap[a.parentId?string].name)!}</td>
                <td class="exclude-translate">${a.description!}</td>
                <td class="exclude-translate">${(userMap[a.userId?string].nickname)!}</td>
                <td>${a.ownsAllCategory?then(t.pageMessage('yes'),'')}</td>
                <td>${a.maxSort}</td>
                <td>${a.ownsAllPage?then(t.pageMessage('yes'),'')}</td>
                <td class="wrap">
                    <a href="sysDept/add.html?id=${a.id}" class="edit btnText blue" target="navTab" rel="sysDept/edit"><i class="icon-edit"></i><@t.page 'dept.edit'/></a>
                <#if a.hasChild>
                    <a href="sysDept/list.html?parentId=${a.id}" class="btnText" target="navTab" data-change-title="false" rel="sysDept/list"><@t.page 'dept.child_management'/></a>
                </#if>
                    <a href="sysDept/delete?id=${a.id}&_csrf=<@tools.csrfToken admin=true/>" class="btnText warn" title="<@t.page 'confirm.delete'/>" target="ajaxTodo"><i class="icon-trash"></i><@t.page 'button.delete'/></a>
                </td>
            </tr>
            </#list>
        </tbody>
    </table>
    <#include "../include_page/page.html"/>
</div>
</@sys.deptList>