二维表 课程表
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
%>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<title>课程管理平台</title>
<script src="<%=path%>/resources/admin/js/jquery-1.8.3.min.js"></script>
<link href="<%=path%>/resources/admin/css/bootstrap.min.css"
rel="stylesheet" />
<script src="<%=path%>/resources/admin/js/bootstrap.min.js"></script>
<script src="<%=path%>/resources/admin/js/bootstrap-select.js"></script>
<link href="<%=path%>/resources/admin/css/flat-ui.css"
rel="stylesheet" />
<link href="<%=path%>/resources/admin/css/AccountManagement.css"
rel="stylesheet" />
<link href="<%=path%>/resources/admin/css/style.css" rel="stylesheet" />
<link href="<%=path%>/resources/admin/css/reveal.css" rel="stylesheet" />
<link href="<%=path%>/resources/admin/css/dashboard.css"
rel="stylesheet">
<link rel="stylesheet"
href="<%=path%>/resources/admin/css/LevelCourse.css" />
<script type="text/javascript">
//当没有选择合作伙伴的时候,不能添加等级和结构
function jiance(){
var select1=$("#select option:selected").text();
if(select1!="选择主机厂"){
document.getElementById("zjdj").classname="btn btn-block btn-lg btn-inverse";
document.getElementById("zjjg").classname="btn btn-block btn-lg btn-inverse";
}
}
//根据选择的合作伙伴的id,出现不同的list页面
function xzzj(){
var partnerValue=$("#select option:selected").val();
document.getElementById("partnerId").value=partnerValue;
location.href="<%=path%>/admin/courseGrade/courseGradeList?partnerid="+partnerValue;
}
function show(obj,valu){
obj.innerHTML = "<input type='text' id='kk' onBlur='blurSJ(this,this.value);' name='name' value='"+ valu +"'> ";
var s=obj.innerHTML;
}
function blurSJ(obj,value){
$(obj).after(value);
$(obj).remove();
}
function test(){
var jglength=$("#mm td").length;
var djlength=$("#course tr").length;
var jiegou="",dengji="",zhishikuai="";
//等级的拼接
for(var j=1;j<djlength;j++){
var dj= "dj_"+j+"0"+":"+$("#dj_"+j+"0").text().trim();
dengji=dengji+dj+",";
}
for(var i=1;i<jglength;i++){
//结构的拼接
var jg="jg_"+"0"+i+":"+$("#jg_"+"0"+i).text().trim();
jiegou=jiegou+jg+",";
for(var j=1;j<djlength;j++){
//知识块的拼接
var zsk="zsk_"+j+i+":"+$("#zsk_"+j+i).text().trim();
zhishikuai=zhishikuai+zsk+",";
}
}
document.getElementById("jiegou").value=jiegou;
document.getElementById("dengji").value=dengji;
document.getElementById("zhishikuai").value=zhishikuai;
document.forms[0].action ="<%=path%>/admin/courseGrade/save";
document.forms[0].submit();
return false;
}
</script>
</head>
<body>
<div class="col-xs-10">
<div class="main">
<div class="main-top1">
<div class="col-xs-3">
<!-- 传到后台-->
<input type="hidden" id="partnerId" name="partnerId" value="">
<select name="partner.id" style="width: 200px" id="select"
onchange="xzzj();">
<c:forEach var="pl" items="${partnerList}">
<option name="pl.id" value="${pl.id}" <c:if test="${pl.id == pId}">selected</c:if>>${pl.name}</option>
</c:forEach>
</select>
</div>
<div class="col-xs-3" style="width: 150px">
<input type="button" value="添加等级" id="zjdj"
class="btn btn-inverse disabled" onclick="return tjdengji();">
</div>
<div class="col-xs-3" style="width: 150px">
<input type="button" value="添加结构" id="zjjg"
class="btn btn-inverse disabled" onclick="return tjjiegou();">
</div>
</div>
<div class="main-bottom">
<form action="<%=path%>/admin/courseGrade/save" method="post"
id="courseForm">
<table border="1px" width="800px" id="course">
<tr id="mm">
<td id="jg_00">
等级\结构
</td>
<!-- 结构 -->
<c:forEach items="${courseStructureList}" var="courseStructure"
varStatus="JG">
<input type="hidden" id="jiegou" name="jiegouid" value="">
<td onclick="show(this,'${courseStructure.name}')"
onDblClick="show(this,'${courseStructure.name}')"
id="jg_0${JG.index+1 }">
${courseStructure.name}
</td>
</c:forEach>
</tr>
<!--知识块 -->
<c:forEach items="${courseKnowledgeBlockList}"
var="courseKnowledgeBlock" varStatus="ZSK">
<tr>
<!-- 等级 -->
<c:forEach items="${courseGradeList}" var="courseGrade"
varStatus="DJ">
<input type="hidden" id="dengji" name="dengjiid" value="">
<c:if test="${ZSK.index==DJ.index}">
<td onDblClick="show(this,'${courseGrade.name}')"
id="dj_${ZSK.index+1}0">
${courseGrade.name}
</td>
</c:if>
</c:forEach>
<c:forEach items="${courseKnowledgeBlock}" var="zhishikuai"
varStatus="Jg">
<input type="hidden" id="zhishikuai" name="zhishikuaiid"
value="">
<td onDblClick="show(this,'${zhishikuai.name}')"
id="zsk_${ZSK.index+1}${Jg.index+1 }">
${zhishikuai.name}
</td>
</c:forEach>
</tr>
</c:forEach>
</table>
<tr>
<td colspan="7">
<input type="button" value="提交" id="tjForm" onclick="test();"
height="30px" />
</td>
</tr>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
function tjdengji(){
$("#course tr:last").after('<tr></tr>');
for(var a=0;a<$("tr:eq(0) td").length;a++) {
$("tr:last").append("<td ><input type='text' size='10'></td>");
}
$("zjdj").load('<%=path%>/admin/courseGrade/addDJ');
}
function tjjiegou(){
$("#course tr").append("<td><input type='text' size='10'></td>");
$("zjjg").load('<%=path%>/admin/courseGrade/addJG');
}
</script>
</html>