@section header
    {
    <link rel="stylesheet" href="/css/treetable.css" />
    <link rel="stylesheet" href="/js/dtree/dtree.css" />
    <link rel="stylesheet" href="/js/dtree/font/dtreefont.css" />
}

<style>

</style>
<div class="main">
    <div class="left">
        <div class="layui-menu-body-title" style="padding: 14px; border-bottom: 1px solid #ddd; overflow: auto;">
            组织结构树
        </div>
        <ul id="tree" class="ztree">
        </ul>
    </div>
    <div class="right">
        <div class="toolList">
            <div class="search">
                <input type="text" class="layui-input" /><button class="layui-btn layui-btn-sm">查询</button>
            </div>
            <div class="btns" id="menus"></div>
        </div>
        <div class="container">
            <table class="layui-table"
                   lay-data="{height:'full-68', page:true, id:'mainList'}"
                   lay-filter="list">
                <thead>
                    <tr>
                        <th lay-data="{checkbox:true, fixed: true}"></th>
                        <th lay-data="{field:'Account', width:150, sort: true, fixed: true}">账号</th>
                        <th lay-data="{field:'Name', width:150}">用户名</th>
                        <th lay-data="{field:'Sex', width:80,  templet: '#sexTpl'}">性别</th>
                        <th lay-data="{field:'Status', width:80,  templet: '#statusTpl'}">状态</th>
                        <th lay-data="{field:'Organizations'}">所属部门</th>
                        <th lay-data="{field:'CreateTime', width:180}">创建时间</th>
                        <th lay-data="{fixed: 'right', width:160, align:'center', toolbar: '#barList'}"></th>
                    </tr>
                </thead>
            </table>
        </div>


        <script type="text/html" id="statusTpl">
            {{#  if(d.Status == 0){ }}
            <span class="layui-badge layui-bg-green">正常</span>
            {{#  } else { }}
            <span class="layui-badge layui-bg-gray">无效</span>
            {{#  } }}
        </script>

        <script type="text/html" id="sexTpl">
                {{#  if(d.Sex == 1){ }}
                <span class="layui-badge layui-bg-green">男</span>
                {{#  } else { }}
            <span class="layui-badge">女</span>
                {{#  } }}
        </script>
    </div>
</div>

<script type="text/html" id="barList">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
</script>

<!--用户添加/编辑窗口-->
<div id="divEdit" style="display: none;padding:10px">
    <form class="layui-form layui-form-pane" action="" id="formEdit">

        <input type="hidden" name="Id" v-model="tmp.Id" />

        <div class="layui-form-item">
            <label class="layui-form-label">账号</label>
            <div class="layui-input-block">
                <input type="text" name="Account" v-model="tmp.Account" required lay-verify="required"
                       placeholder="请输入登录账号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">姓名</label>
            <div class="layui-input-block">
                <input type="text" name="Name" v-model="tmp.Name" required lay-verify="required"
                       placeholder="请输入昵称或姓名" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">所属部门</label>
            <div class="layui-input-block">
                <input id="Organizations" name="Organizations" v-model="tmp.Organizations" required lay-verify="required" class="layui-input" />
                <input id="OrganizationIds" name="OrganizationIds" v-model="tmp.OrganizationIds" required lay-verify="required" type="hidden" />

            </div>
        </div>

        <div class="layui-form-item" pane>
            <label class="layui-form-label">性别</label>
            <div class="layui-input-block">
                <input type="radio" name="Sex" value="1" title="男" v-model="tmp.Sex">
                <input type="radio" name="Sex" value="0" title="女" v-model="tmp.Sex">
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">禁用</label>
            <div class="layui-input-block">
                <input type="checkbox" name="Status" v-model="tmp.Status" lay-skin="switch" value="1">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
                <button type="reset" id="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/userJs/users.js?v2.0"></script>