<!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 id="schoolId" class="form-control select2-multiple">
                                <option></option>
                            </select>
                        </li>
                        <li>
                            <label>校区：</label>
                            <select id="campusId" class="form-control select2-multiple">
                                <option></option>
                            </select>
                        </li>
                        <li>
                            <label>专业：</label>
                            <select id="majorId" class="form-control select2-multiple">
                                <option></option>
                            </select>
                        </li>
                        <li>
                            <label>入学时间：</label>
                            <input type="text" class="time-input" placeholder="请选择入学时间" name="enrollmentTime" id="enrollmentTime"/>
                        </li>
                        <li>
                            <label>申请开始时间：</label>
                            <input type="text" class="time-input" placeholder="请选择申请开始时间" name="applyStartDate" id="applyStartDate"/>
                        </li>
                        <li>
                            <label>申请结束时间：</label>
                            <input type="text" class="time-input" placeholder="请选择申请结束时间" name="applyEndDate"/>
                        </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-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:checkTime:edit">
                <i class="fa fa-edit"></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" />
<th:block th:include="include :: jquery-cxselect-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:checkTime:edit')}]];
    var prefix = ctx + "system/checkTime";

    $(function() {
        var options = {
            url: prefix + "/notPassList",
            updateUrl: prefix + "/edit/{id}",
            queryParams: myqueryParams,
            modalName: "入学时间",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '${comment}',
                    visible: false
                },
                {
                    field: 'schoolId',
                    title: '学校id',
                    visible: false
                },
                {
                    field: 'schoolCnName',
                    title: '学校名称'
                },
                {
                    field: 'schoolCampus',
                    title: '校区'
                },
                {
                    field: 'majorId',
                    title: '专业id',
                    visible: false
                },
                {
                    field: 'majorName',
                    title: '专业名称',
                },
                {
                    field: 'enrollmentTime',
                    title: '入学时间'
                },
                {
                    field: 'applyStartDate',
                    title: '申请开始时间'
                },
                {
                    field: 'applyEndDate',
                    title: '申请结束时间'
                },
                {
                    field: 'creatorDesc',
                    title: '创建人'
                },
                {
                    field: 'modifiedByDesc',
                    title: '修改人'
                },
                {
                    field: 'checkerDesc',
                    title: '审核人'
                },
                {
                    field: 'checkTime',
                    title: '审核时间'
                },
                {
                    field: 'checkStatusDesc',
                    title: '审核状态'
                },
                {
                    field: 'checkResult',
                    title: '审核结果'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    $(document).ready(function() {
        <!--异步请求-->
        $.ajax({
            <!--请求路径，与后端对应-->
            url: ctx + "system/school/getList",
            <!--请求类型-->
            type: "get",
            <!--期待的返回数据类型-->
            dataType: "json",
            <!--前端接收数据成功是执行的该函数-->
            success: function (data) {
                <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
                for (var i = 0; i < data.length; i++)
                    $("#schoolId").append("<option value='" + data[i].id + "'>" + data[i].schoolCnName + "</option>");
            }
        });

        $('#schoolId').change(function () {
            var sid=$('#schoolId')[0].value;
            $.ajax({
                <!--请求路径，与后端对应-->
                url: prefix + "/selectSchool/"+sid,
                <!--请求类型-->
                type: "get",
                <!--期待的返回数据类型-->
                dataType: "json",
                <!--前端接收数据成功是执行的该函数-->
                success: function (data) {
                    $("#campusId").empty();
                    $("#majorId").empty();
                    $("#campusId").append("<option></option>");
                    <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
                    for (var i = 0; i < data.length; i++)
                        $("#campusId").append("<option value='" + data[i].id + "'>" + data[i].schoolCampus + "</option>");
                }
            });
        });

        $('#campusId').change(function () {
            var cid=$('#campusId')[0].value;
            $.ajax({
                <!--请求路径，与后端对应-->
                url: prefix + "/selectMajor/"+cid,
                <!--请求类型-->
                type: "get",
                <!--期待的返回数据类型-->
                dataType: "json",
                <!--前端接收数据成功是执行的该函数-->
                success: function (data) {
                    $("#majorId").empty();
                    $("#majorId").append("<option></option>");
                    <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
                    for (var i = 0; i < data.length; i++)
                        $("#majorId").append("<option value='" + data[i].id + "'>" + data[i].majorCnName + "</option>");
                }
            });
        });
    });

    function myqueryParams(params) {
        var search = $.table.queryParams(params);
        search.schoolId = $("#schoolId")[0].value;
        search.majorId = $("#majorId")[0].value;
        return search;
    }
</script>
</body>
</html>