<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>项目报表</title>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="decorator" content="ani"/>
	<%@ include file="/webpage/include/bootstraptable.jsp"%>
	<%@ include file="/webpage/include/echarts.jsp"%>

	<style type="text/css">
		#div1{
			margin-top: 10px;
		}
	</style>
</head>
<body>
	<div class="wrapper wrapper-content">
	<div class="panel panel-primary">
	<div class="panel-heading">
		<h3 class="panel-title">项目报表</h3>
	</div>
	<div class="panel-body">
		<div>
		<ul class="nav nav-tabs">
			<li role="presentation" class="active"><a href="">按施工单位</a></li>
			<li role="presentation"><a href="${ctx}/sg/report/unitlist">按归口部门</a></li>
			<li role="presentation"><a href="${ctx}/sg/report/secondlist">按二级单位</a> </li>
		</ul>
		</div>
	<!-- 表格 -->
		<div id="div1">
		<table class="table table-bordered">
            <thead>
			<tr>
				<th> </th>
				<c:forEach items="${list}" var="data" varStatus="index">
				<th>${data.name}</th>
				</c:forEach>
			</tr>
			<tr>
				<th>完成</th>
				<c:forEach items="${list}" var="data" varStatus="index">
					<th><a class="finish"><input class="finishOne" type="hidden" value="${data.name}"/>${data.finishCount}</a></th>
				</c:forEach>
			</tr>
			<tr>
				<th>未完成</th>
				<c:forEach items="${list}" var="data" varStatus="index">
					<th><a class="noFinish"><input class="finishOne" type="hidden" value="${data.name}"/>${data.unfinishCount}</a></th>
				</c:forEach>
			</tr>
			</thead>
		</table>
		</div>
		<div class="btn-group" role="group" aria-label="...">
			<div class="btn-group" role="group">
				<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
					项目状态
					<span class="caret"></span>
				</button>
				<ul class="dropdown-menu">
					<li><a href="${ctx}/sg/report?status=1">完成</a></li>
					<li><a href="${ctx}/sg/report?status=0">未完成</a></li>
				</ul>
			</div>
		</div>
		<div id="main" style="width: 100%;height: 400px"></div>
		<script type="text/javascript">
			// 基于准备好的dom，初始化echarts实例4
			var myChart = echarts.init(document.getElementById('main'));
			window.onresize = myChart.resize;

			$(function () {
				jp.get("${ctx}${dataURL}", function (option) {
					// 指定图表的配置项和数据
					// 使用刚指定的配置项和数据显示图表。
					myChart.setOption(option);
				})
				//点击完成的数量导出对应项目文件
				$(".finish").on("click", function () {
					var conditionBe = $(this).find("input").val();
					var condition = encodeURI(encodeURI(conditionBe));
					console.log(conditionBe);
					console.log(condition);
					jp.downloadFile('${ctx}/sg/report/exportInformation?condition=' + condition + '&status=0&type=0')
				});
				//点击为完成的数量导出对应项目文件
				$(".noFinish").click(function () {
					var conditionBe = $(this).find("input").val();
					var condition = encodeURI(encodeURI(conditionBe));
					console.log(conditionBe);
					console.log(condition);
					jp.downloadFile('${ctx}/sg/report/exportInformation?condition=' + condition + '&status=1&type=0');
				})
			})
		</script>
	</div>
	</div>
	</div>
</body>
</html>