<!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"/>
                            </li>
                            <li>
                                <label>申请开始时间：</label>
                                <input type="text" class="time-input" placeholder="请选择申请开始时间" name="applyStartDate"/>
                            </li>
                            <li>
                                <label>申请结束时间：</label>
                                <input type="text" class="time-input" placeholder="请选择申请结束时间" name="applyEndDate"/>
                            </li>
<!--                            <li>-->
<!--                                <label>创建人：</label>-->
<!--                                <input type="text" name="creator"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>修改人：</label>-->
<!--                                <input type="text" name="modifiedBy"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>审核人：</label>-->
<!--                                <input type="text" name="checker"/>-->
<!--                            </li>-->
<!--                            <li>-->
<!--                                <label>审核时间：</label>-->
<!--                                <input type="text" class="time-input" placeholder="请选择审核时间" name="checkTime"/>-->
<!--                            </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-success" onclick="$.operate.add()" shiro:hasPermission="system:time:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:time:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:time:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:time: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" />
    <th:block th:include="include :: jquery-cxselect-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:time:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:time:remove')}]];
        var prefix = ctx + "system/time";

        $(function() {
            var options = {
                url: prefix + "/list",
                queryParams: queryParams,
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                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: 'degreeCnName',
                        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> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></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) {
                        $("#majorId").empty();
                        $("#campusId").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();
                        <!--使用循环解析后端传来的数据，并用使用js动态拼接html语言-->
                        $("#majorId").append("<option>请选择专业</option>");
                        for (var i = 0; i < data.length; i++)
                            $("#majorId").append("<option value='" + data[i].id + "'>" + data[i].majorCnName + "</option>");
                    }
                });
            });
        });

        function queryParams(params) {
            var search = $.table.queryParams(params);
            var ii=$("#schoolId")[0].value;
            if(ii != '请选择学校'){
                search.schoolId= ii;
            }
            var i=$("#campusId").val();
            if(i != '请选择校区'){
                search.campusId= i;
            }
            var ij=$("#majorId").val();
            if(ij != '请选择专业'){
                search.majorId= ij;
            }
            return search;
        }
    </script>
</body>
</html>