#include("/view/include/list.html")
#@layout()

#define main()
	<script type="text/html" id="toolbar">
        <div class="layui-btn-container">
            <button class="layui-btn layui-btn-sm" lay-event="form" url="add.html"> 添加 </button>
            <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="ajax_select" url="delete"> 删除选择 </button>
			<button class="layui-btn layui-btn-sm" lay-event="js" fun="expandAll">全部展开</button>
            <button class="layui-btn layui-btn-sm" lay-event="js" fun="foldAll">全部折叠</button>
            <button class="layui-btn layui-btn-sm" lay-event="form" url="imports.html"> 导入 </button>
            <button class="layui-btn layui-btn-sm" lay-event="open_search" url="exports"> 导出 </button>
        </div>
    </script>
	<script type="text/html" id="tool">
        <a class="layui-btn layui-btn-xs " lay-event="form" url="edit.html">编辑</a>
        <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="ajax" url="delete">删除</a>
    </script>
		<script type="text/html" id="tpl_status">
        	{{= dict_status(d.status) }}
    	</script>
		<script type="text/html" id="tpl_type">
        	{{= dict_depart_type(d.type) }}
    	</script>

#end

#define script()
<script>
        layui.use(['curd'], function () {
        	 var $ = layui.jquery,
             curd = layui.curd,
             layuimini = layui.layuimini;

        curd.tree({
            elem: '#listTable',
            url: '#(CONTEXT)#(_module)/#(_controller)/slist',
            cols: [[
                {type: "checkbox", width: 50, fixed: "left"},
                {field: 'title', minWidth: 200, title: '部门名称'},
                {field: 'code', minWidth: 150, title: '部门代码'},
                {field: 'type', minWidth: 150, title: '部门类型', templet: '#tpl_type'},
                {field: 'status', minWidth: 100, title: '状态', templet: '#tpl_status'},
                {field: 'listSort', minWidth: 100, title: '排序'},
                {title: '操作', width: 150, templet: '#tool', fixed: "right", align: "center"}
            ]]
        });
    });      
</script>
#end