<!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>
                            <select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
                                <option value="">---请选择---</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>审核状态：</label>
                            <select name="examine" th:with="type=${@dict.getType('sys_examine_state')}">
                                <option value="">---请选择---</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>人员姓名：</label>
                            <input type="text" name="userName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </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 examineFlag = [[${@permission.hasPermi('system:userexamine:examine')}]];
    var downloadFlag = [[${@permission.hasPermi('system:userexamine:examine')}]];
    var userStatus = [[${@dict.getType('sys_normal_disable')}]];
    var userPolitics = [[${@dict.getType('sys_user_politics')}]];
    var examineState = [[${@dict.getType('sys_examine_state')}]];
    var prefix = ctx + "system/user";

    $(function() {
        var options = {
            url: prefix + "/list",
            modalName: "涉密人员审核",
            columns: [{
                checkbox: true
            },
                {
                    field: 'userId',
                    title: 'id',
                },
                {
                    field: 'loginName',
                    title: '人员编号',
                },
                {
                    field: 'examine',
                    title: '审核状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(examineState, value);
                    }
                },
                {
                    field: 'examineuser',
                    title: '审核人',
                },
                {
                    field: 'examinedate',
                    title: '审核时间',
                },
                {
                    field: 'userName',
                    title: '人员姓名',
                },
                {
                    field: 'status',
                    title: '用户状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(userStatus, value);
                    }
                },
                {
                    field: 'phonenumber',
                    title: '联系电话'
                },
                {
                    field: 'politics',
                    title: '政治面貌',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(userPolitics, value);
                    }
                },
                {
                    field: 'userarea',
                    title: '户籍地址',
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.examine !== '2'){
                            actions.push('<a disabled class="btn btn-success btn-xs ' + examineFlag + '" href="javascript:void(0)"><i class="fa fa-edit"></i>审核</a> ');
                            actions.push('<a class="btn btn-success btn-xs ' + downloadFlag + '" href="javascript:void(0)"  onclick="examineprint(\'' + row.userId + '\')"><i class="fa fa-download"></i>打印</a> ');
                        }else{
                            actions.push('<a class="btn btn-success btn-xs ' + examineFlag + '" href="javascript:void(0)" onclick="examinedetail(\'' + row.userId + '\')"><i class="fa fa-edit"></i>审核</a> ');
                            actions.push('<a class="btn btn-success btn-xs ' + downloadFlag + '" href="javascript:void(0)" onclick="examineprint(\'' + row.userId + '\')"><i class="fa fa-download"></i>打印</a> ');
                        }
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function examinedetail(id) {
        var url ='/system/userexamine/examine/' + id;
        $.modal.openTab("涉密人员审核", url);
    }
    function examineprint(id){
        var url ='system/userexamine/examineprint/' + id;
        $.modal.openTab("打印", url);
    }
</script>
</body>
</html>
