@using GTA.SCP.Common;
@model GTA.SCP.Entity.StuManage.Stu_Class
@{
Layout = null;
IEnumerable<SelectListItem> list = (IEnumerable<SelectListItem>)ViewData["ClassCount"];//拟定班数
IEnumerable<SelectListItem> listresult = (IEnumerable<SelectListItem>)ViewData["AdmissionType"];//招生类型
IEnumerable<SelectListItem> campusList = (IEnumerable<SelectListItem>)ViewBag.ListCampus; //校区列表
IEnumerable<SelectListItem> classList = (IEnumerable<SelectListItem>)ViewBag.ListClass;//班级列表
IEnumerable<SelectListItem> depList = (IEnumerable<SelectListItem>)ViewBag.ListDept;//系部列表
IEnumerable<SelectListItem> majorList = (IEnumerable<SelectListItem>)ViewBag.ListMajor;//专业列表
IEnumerable<SelectListItem> gradeList = (IEnumerable<SelectListItem>)ViewBag.ListGrade;//年级列表
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
@*<meta http-equiv="X-UA-Compatible" content="edge" />*@
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<title>班级管理</title>
<link href="/Content/css/main.css" rel="stylesheet" />
<-s-cript src="/Scripts/jquery-1.8.2.min.j-s"></script>
<-script type="text/javascript" src="/Scripts/verification.-j-s"></s-cript>
<-s-cript type="text/javascript" src="/Scripts/Common/formPlugin.-j-s"></s-cript>
<-s-cript type="text/javascript">
$-(f-unction () {
$-(".select").select();
});
</-script>
<style type="text/css">
.txt {
float: none;
}
#tdValue1 .select{
*position:relative;
*z-index:700;
}
#tdValue2 .select{
*position:relative;
*z-index:600;
}
#tdValue3 .select{
*position:relative;
*z-index:500;
}
/*#tdValue1 .selectbox {
*position:relative;
*z-index:1000;
}
#tdValue2 .selectbox {
*position:relative;
*z-index:900;
}
#tdValue3 .selectbox {
*position:relative;
*z-index:800;
}
#tdValue1 .selectbox-wrapper {
*z-index:10000;
}
#tdValue2 .selectbox-wrapper {
*z-index:9000;
}
#tdValue3 .selectbox-wrapper {
*z-index:8000;
}
#tdValue1 .selectbox-wrapper *{
*z-index:11000;
*position:relative;
}
#tdValue2 .selectbox-wrapper *{
*z-index:9100;
*position:relative;
}
#tdValue3 .selectbox-wrapper *{
*z-index:8100;
*position:relative;
}*/
</style>
</head>
<body>
<div style="width:98%; height:240px; padding-top:15px;" class="center">
<form id="frmClass">
<table class="table-edit">
<tr>
<td class="txt">
<label>校区:</label>
</td>
<td>
@OrganizationCommon.GetOrgNameByID(Model.CampusID)
@Html.HiddenFor(cls => cls.CampusID)
</td>
<td class="txt">
<label>年级:</label>
</td>
<td>
@ViewBag.GrageName
@Html.HiddenFor(cls => cls.Grade)
</td>
</tr>
<tr>
<td class="txt">
<label>系部:</label>
</td>
<td>
@OrganizationCommon.GetOrgNameByID(Model.DeptID)
@Html.HiddenFor(cls => cls.DeptID)
</td>
<td class="txt">
<label>专业:</label>
</td>
<td>
@OrganizationCommon.GetOrgNameByID(Model.MajorID)
@Html.HiddenFor(cls => cls.MajorID)
</td>
</tr>
<tr>
<td class="txt">学制:</td>
<td id="tdValue1" class="tdValue">
<div class="select selectdiv_s">
@Html.DropDownListFor(cls=>cls.EducationalSystem, GTA.SCP.Common.CommonDict.GetDataDictionary("SchoolLength"))
</div>
</td>
<td class="txt">
<label>专业总人数:</label>
</td>
<td>
<span class="lh30" id="totalNum">@ViewBag.TotalNum</span>
@Html.HiddenFor(cls => cls.ManCnt)
@Html.HiddenFor(cls => cls.WomanCnt)
</td>
</tr>
<tr>
<td class="txt">
<label>拟定班数:</label>
</td>
<td id="tdValue2" class="tdValue">
<div class="select selectdiv_s">
@Html.DropDownList("ClassCount", list, new { id = "ClassCount", @class = "IsSelect IsRequired", onchange = "changeClassStuNum();" })
</div>
<input type="hidden" name="ClassCnt" id="ClassCnt" value="0" />
</td>
<td class="txt">
<label>每班人数:</label>
</td>
<td>
<span id="classStuNum"></span>
@Html.HiddenFor(cls => cls.ManCnt)
@Html.HiddenFor(cls => cls.WomanCnt)
</td>
</tr>
<tr>
<td class="txt">
<label>招生类型:</label>
</td>
<td id="tdValue3" class="tdValue">
<div class="select selectdiv_s">
@Html.DropDownListFor(cls => cls.RecruitType, listresult, new { @class = "IsSelect IsRequired" })
</div>
</td>
<td></td>
<td></td>
</tr>
</table>
<div class="tlign-c popBottom">
<input type="button" value="保存" onclick="return checkData();" class="btnOk" />
<input type="button" value="取消" class="btnOk" onclick="parent.cancel();" />
</div>
</form>
</div>
<script type="text/javascript">
$(‘#ClassCount‘).val(mailto:‘@Request.QueryString[%22ClassCnt%22]‘);
$(‘#ClassCnt‘).val(mailto:‘@(String.IsNullOrEmpty(Request.QueryString[%22ClassCnt"]) || Request.QueryString["ClassCnt"] == "0" ? "1" : Request.QueryString["ClassCnt"])‘);
function changeClassStuNum() {
calculateNum();
$(‘#ClassCnt‘).val($(‘#ClassCount‘).val());
}
function calculateNum() {
$(‘#classStuNum‘).html(Math.floor(parseInt($(‘#totalNum‘).html()) / parseInt($(‘#ClassCount‘).val())));
}
calculateNum();
function checkData() {
if (submitClick(‘content‘)) {
if (parseInt($(‘#ClassCount‘).html()) > parseInt($(‘#totalNum‘).html())) {
if (confirm(‘分班班级数大于系部的总人数,将会导致其中部分班级分配不到学生!‘)) {
saveClass();
return true;
}
}
else {
saveClass();
return true;
}
}
return false;
}
function saveClass() {
$.ajax({
url: ‘/Enroll/StudentClass/Edit‘,
type: ‘post‘,
data: $(‘#frmClass‘).serialize(),
dataType: ‘json‘,
error: function () {
parent.cancelError();
},
success: function (data) {
data = eval(‘(‘ + data + ‘)‘);
if (data.IsSuccess == ‘True‘) {
parent.closeWin();
}
else if (data.IsSuccess == ‘False‘ && data.IsDivided == ‘True‘) {
parent.cancelDivided();
}
else {
parent.cancelError();
}
}
});
}
</script>
</body>
</html>
PS代码有点乱,以后整理下。
参考网址:http://maxthon2.blog.sohu.com/162368923.html
原文:http://www.cnblogs.com/freemindblog/p/4276027.html