<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('人员信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>姓名：</label>
                                <input type="text" name="name"/>
                            </li>
                            <li>
                                <label>出生年月：</label>
                                <input type="text" name="birthday"/>
                            </li>
                            <li>
                                <label>身份证号码：</label>
                                <input type="text" name="idCard"/>
                            </li>
                            <li>
                                <label>手机号：</label>
                                <input type="text" name="mobilePhone"/>
                            </li>
                            <li>
                                <label>微信号：</label>
                                <input type="text" name="wxCode"/>
                            </li>
                            <li>
                                <a class="btn btn-unite btn-rounded btn-sm" onclick="$.table.search()">搜索</a>
                                <a class="btn btn-unite btn-rounded btn-sm" onclick="$.form.reset()">重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div id="toolbar" role="group">
                <a class="btn btn-unite" onclick="$.operate.addTab()" shiro:hasPermission="system:information:add">
                    添加
                </a>
                <a class="btn btn-unite single disabled" onclick="$.operate.editTab()" shiro:hasPermission="system:information:edit">
                    修改
                </a>
                <a class="btn btn-unite multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:information:remove">
                    删除
                </a>
                <a class="btn btn-unite" onclick="$.table.exportExcel()" shiro:hasPermission="system:information:export">
                    导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:information:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:information:remove')}]];
        var sexDatas = [[${@dict.getType('sys_user_sex')}]];
        var prefix = ctx + "system/information";
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "人员信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键id',
                    visible: false
                },
                {
                    field: 'name',
                    title: '姓名'
                },
                {
                    field: 'sex',
                    title: '性别',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(sexDatas, value);
                    }
                },
                {
                    field: 'birthday',
                    title: '出生年月'
                },
                {
                    field: 'mobilePhone',
                    title: '手机号'
                },
                {
                    field: 'nation',
                    title: '民族'
                },
                {
                    field: 'party',
                    title: '党派'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-unite btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')">编辑</a> ');
                        actions.push('<a class="btn btn-unite btn-xs" href="javascript:void(0)" onclick="viewShow(\'' + row.id + '\')">查看</a> ');
                        actions.push('<a class="btn btn-unite btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')">删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        //查看个人信息
        function viewShow(id){
            top.layer.open({
                type: 2,
                area: [window.innerWidth*0.8+"px", ($(window).height() - 20)+'px'],
                fix: false,
                maxmin: true,
                shade: 0.3,
                title: "信息查看",
                content: prefix+'/informationView/'+id,
                btn: ['关闭'],
                shadeClose: true,
                cancel: function(index) {
                    return true;
                }
            });
        }
    </script>
</body>
</html>