<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
<body class="gray-bg">

	<div class="ui-layout-west">
		<div class="main-content">
			<div class="box box-main">
				<div class="box-header">
					<div class="box-title">
						<i class="fa icon-grid"></i> 校区
					</div>
					<div class="box-tools pull-right">
						<!--<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="dept()" title="管理部门"><i class="fa fa-edit"></i></a>-->
						<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
						<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新"><i class="fa fa-refresh"></i></button>
					</div>
				</div>
				<div class="ui-layout-content">
					<div id="tree" class="ztree"></div>
				</div>
			</div>
		</div>
	</div>
    
     <div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>

							<!--<li>
								专业：<select id="majorId" name="majorId" type="text" style="padding: 0px">
								<option value="">全部</option>
								<option th:each="obj,eStat:${major}" th:value="${obj.majorId}"
										th:text="${obj.majorName}"></option>
							</select>
							</li>

							<li>
								班级：<input type="text" name="className"/>
							</li>-->

							<li style="width: 489px">
								统计月份：
								<input type="text" id="startTime" placeholder="开始时间" name="params[beginTime]" style="display: inline-block"/>
								<span>-</span>
								<input type="text" id="endTime" placeholder="结束时间" name="params[endTime]"  style="display: inline-block"/>
							</li>

							<li style="width: 100%;text-align: center">
								<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 hidden-xs" id="toolbar" role="group">
				<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="teach:teachClassStatistics:add">
					<i class="fa fa-plus"></i> 添加
				</a>
				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="teach:teachClassStatistics:edit">
					<i class="fa fa-edit"></i> 修改
				</a>
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="teach:teachClassStatistics:remove">
					<i class="fa fa-remove"></i> 删除
				</a>-->
				<!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="teach:teachClassStatistics:export">
						<i class="fa fa-download"></i> 导出
				 </a>-->
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
         <!-- 图表开始
         <div id="_top" class="col-sm-12 select-table" style="height:400px;"></div>
          图表结束 -->
	</div>
    <div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
    <!--<script th:src="@{/js/jquery.min.js}"></script>
    <script th:src="@{/chart/echarts.min.js}"></script>-->
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('teach:teachClassStatistics:edit')}]];
        var removeFlag = [[${@permission.hasPermi('teach:teachClassStatistics:remove')}]];
        var prefix = ctx + "teach/teachClassStatistics";

        $(function() {
            var panehHidden = false;
            if ($(this).width() < 769) {
                panehHidden = true;
            }
            $('body').layout({ initClosed: panehHidden, west__size: 185 });
            queryList();
            queryDeptTree();

            //年月选择器
            laydate.render({
                elem: '#startTime'
                ,type: 'month',trigger: 'click'
            });
            //年月选择器
            laydate.render({
                elem: '#endTime'
                ,type: 'month',trigger: 'click'
            });
        });

        function queryList() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "数据汇总（班级）",
                search: false,
                showExport: true,
                columns: [{
                    checkbox: true
                },
                    {
                        field : 'id',
                        title : '编号',
                        visible: false
                    },
                    {
                        field : 'className',
                        title : '班级名称',
                        sortable: false
                    },
                    {
                        field : 'month',
                        title : '统计月',
                        sortable: false
                    },
                    {
                        field : 'attendence',
                        title : '出勤率',
                        sortable: false
                    },
                    {
                        field : 'subjectPercentageComplete',
                        title : '项目完成率',
                        sortable: false
                    },
                    {
                        field : 'jobPercentageComplete',
                        title : '作业完成率',
                        sortable: false
                    },
                    {
                        field : 'examAcceptability',
                        title : '考试合格率',
                        sortable: false
                    }/*,
                    {
                        title: '操作',
                        align: 'center',
                        formatter: function(value, row, index) {
                            var actions = [];
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                            return actions.join('');
                        }
                    }*/]
            };
            $.table.init(options);
        }

        function queryDeptTree() {
            var url = ctx + "system/dept/treeData";
            var options = {
                url: url,
                expandLevel: 2,
                onClick : zOnClick
            };
            $.tree.init(options);

            function zOnClick(event, treeId, treeNode) {
                $("#schoolId").val(treeNode.id);
                $("#parentId").val(treeNode.pId);
                $.ajax({
                    type:"POST",
                    url:prefix + '/listById',
                    data:{schoolId:treeNode.id},
                    success : function(data) {
                        /*alert("成功");
                        console.log(data);*/
                        $("#bootstrap-table").bootstrapTable('load', data);
                    }
                })
            }
        }

        $('#btnExpand').click(function() {
            $._tree.expandAll(true);
            $(this).hide();
            $('#btnCollapse').show();
        });

        $('#btnCollapse').click(function() {
            $._tree.expandAll(false);
            $(this).hide();
            $('#btnExpand').show();
        });

        $('#btnRefresh').click(function() {
            queryDeptTree();
        });

        /* 学生管理-部门 */
        function dept() {
            var url = ctx + "system/dept";
            createMenuItem(url, "校区");
        }

/*
/!*----------------------------------------柱形图-------------------------------------*!/
        // 基于准备好的dom，初始化echarts实例
        var myChart = echarts.init(document.getElementById('_top'));

        // 指定图表的配置项和数据
        var option = {
            color: ['#3398DB'],
            tooltip : {
                trigger: 'axis',
                axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                    type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
                }
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            xAxis : [
                {
                    type : 'category',
                    data : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
                    axisTick: {
                        alignWithLabel: true
                    }
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],
            series : [
                {
                    name:'直接访问',
                    type:'bar',
                    barWidth: '60%',
                    data:[10, 52, 200, 334, 390, 330, 220]
                }
            ]
        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
*/

    </script>
</body>
</html>