<!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="trainName"/>
                        </li>
                        <li>
                            <label>所属地市：</label>
                            <input type="text" name="AREAID"/>
                        </li>
                        <li>
                            <label>培训日期：</label>
                            <input type="text" class="time-input" placeholder="请选择培训日期" name="trainDate"/>
                        </li>

                        <li>
                            <label>培训状态：</label>
                            <select name="trainState" 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>
                            <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="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:trainnum:export">
                <i class="fa fa-download"></i> 导出
            </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 detailFlag = [[${@permission.hasPermi('system:trainnum:detail')}]];
    var listFlag = [[${@permission.hasPermi('system:trainnum:list')}]];
    var trainTypeDatas = [[${@dict.getType('sys_usertrain_typer')}]];
    var trainSubjectDatas = [[${@dict.getType('sys_usertrain_obj')}]];
    var trainStateDatas = [[${@dict.getType('sys_examine_state')}]];
    var prefix = ctx + "system/trainnum";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            detailUrl: prefix + "/detail/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "涉密人员培训",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'AREAID',
                    title: '所属地市',
                    visible: false

                },
                {
                    field: 'trainName',
                    title: '培训人员'
                },
                {
                    field: 'FRAMEWORK',
                    title: '所属区县',
                    visible: false
                },
                {
                    field: 'USERNAME',
                    title: '人员名称',
                    visible: false
                },
                {
                    field: 'deptName',
                    title: '单位名称',
                    visible: false
                },
                {
                    field: 'trainType',
                    title: '培训类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(trainTypeDatas, value);
                    }
                },
                {
                    field: 'trainSubject',
                    title: '培训对象',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(trainSubjectDatas, value);
                    }
                },
                {
                    field: 'trainAddress',
                    title: '培训地点'
                },
                {
                    field: 'trainDate',
                    title: '培训开始日期'
                },
                {
                    field: 'trainTimeend',
                    title: '培训结束时间'
                },
                {
                    field: 'updateDepartid',
                    title: '更新单位',
                    visible: false
                },
                {
                    field: 'trainState',
                    title: '培训状态',//
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(trainStateDatas, value);
                    }
                },
                {
                    field: 'PART',
                    title: '部门',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-warning btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-search"></i>详细</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function examine(id) {
        var url = prefix + '/examine/' + id;
        $.modal.open("涉密人员培训审核", url);
    }
</script>
</body>
</html>