123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- var mnu = "";
- //加载
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- $("#Credit").val(parseFloat($("#Credit").val()).toFixed(1));
- $("#TheoryCourse").keyup(function () {
- recalculate();
- });
- $("#Practicehours").keyup(function () {
- recalculate();
- });
- $("#TheoryWeeklyNum").keyup(function () {
- recalculate();
- });
- $("#PracticeWeeklyNum").keyup(function () {
- recalculate();
- });
- });
- function reload() {
- $("#dgOptionalCourseSettingList").cmsXDataTable("load", $.getDataGridParams("dgOptionalCourseSettingList"));
- }
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgOptionalCourseSettingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.ExecutableOptionalCourseID);
- });
- return d;
- }
- function enablevalidChoose() {
- var d = [];
- $.each($("#dgOptionalCourseSettingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.IsEnableDesc);
- });
- return d;
- }
- function statusvalidChoose() {
- var d = [];
- $.each($("#dgOptionalCourseSettingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.RecordStatus);
- });
- return d;
- }
- function queryCollege(data) {
- $("#CollegeDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/College/CollegeDropdownListBanid?campusID=" + data.Value + "");
- }
- //弹出限选任务生成页面
- function OptionalCourseSetting_Create() {
- $.popupTopWindow('限选任务生成', CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCourseSetting/Create?MNU=" +
- mnu, 600, 300, null, null);
- }
- function QueryCoursematerialComboGrid(data) {
- reload();
- }
- function QuerySpecialtyComboGrid(data) {
- reload();
- }
- function QuerySchoolYearNumDropdownList(data) {
- reload();
- }
- function QueryIsEnableDropdownList(data) {
- reload();
- }
- function QueryIsOpenDropdownList(data) {
- reload();
- }
- function SelectCollegeComboGrid(data) {
- reload();
- }
- function SelectDictionaryGrade(data) {
- reload();
- }
- //选修任务班名称生成规则
- function QueryClassmajor(data) {
- document.getElementById("DefaultClassName").value = data.Name + "_" + $("#CoursematerialID").combogridX("getText") + "(限选)";
- // var GrademajorID = $("#GrademajorID").combogridX("getValue");
- // if (GrademajorID != null) {
- // var jsonString = "({'QueryParamsDatas':'GrademajorComboGrid|*|" + GrademajorID + "|@|'})";
- // $("#ClassmajorID").combogridX("reload", eval(jsonString));
- // }
- }
- function swapWeekSettings() {
- if ($("#weekExpander").attr("expanded") == "0") {
- $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -50px 0");
- $("#weekExpander").closest("tr")
- .next().css("display", "")
- .next().css("display", "")
- .next().css("display", "")
- .next().css("display", "");
- $("#weekExpander").attr("expanded", "1");
- } else {
- $("#weekExpander").css("background", "url('../../Content/Bowin.Control.Core/themes/metro-blue/images/tree_icons.png') no-repeat -32px 0");
- $("#weekExpander").closest("tr")
- .next().css("display", "none")
- .next().css("display", "none")
- .next().css("display", "none")
- .next().css("display", "none");
- $("#weekExpander").attr("expanded", "0");
- }
- }
- //弹出添加老师页面
- function addTeachers(rowindex, rowdata) {
- $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/OptionalCourseSetting/TeacherEdit?OptionalCourseID=' + rowdata.OptionalCourseID + '&MNU=' +
- mnu, 560, 480, AddTeachers_Confirm, rowdata);
- }
- //确定添加教师
- function AddTeachers_Confirm(data) {
- reload();
- }
- //弹出添加教师页面
- function OptionalCourseSetting_AddTeacher() {
- $.popupTopWindow('添加教师', CMS_SystemConfig.VirtualDirectoryPath + '/Common/TeacherSelect?FromMNU=' +
- mnu, 560, 480, AddTeachers_Confirm);
- }
- //确定添加教师
- function AddTeachers_Confirm(teacherList) {
- if (!teacherList) return;
- var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
- $.each(teacherList, function (index, value) {
- if ($.grep(teacherViewList, function (row, index) { return value.UserID == row.UserID; }).length == 0) {
- teacherViewList.push({
- UserID: value.UserID,
- LoginID: value.StaffCode,
- Name: value.Name,
- CollegeID: value.CollegeID,
- CollegeName: value.CollegeName,
- BirthDate: value.BirthDate,
- TeacherType: value.TeacherType,
- TeacherTypeName: value.TeacherTypeName,
- IncumbencyState: value.IncumbencyState,
- IncumbencyStateName: value.IncumbencyStateName,
- Title: value.Title,
- TitleName: value.TitleName,
- TeachingMethod: null,
- TeachingMethodDesc: null
- });
- }
- });
- $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
- }
- //删除添加教师
- function OptionalCourseSetting_DelTeacher() {
- var d = validTeacherChoose();
- var teacherViewList = $("#dgTeacherList").cmsXDataTable("getRows");
- var i, j;
- var len = teacherViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (teacherViewList[i].UserID == d[j].UserID) {
- teacherViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgTeacherList").cmsXDataTable("loadData", { rows: teacherViewList, total: teacherViewList.length });
- }
- //获取选中的教师信息
- function validTeacherChoose() {
- var d = [];
- $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- //添加开放范围班级信息
- function OptionalCourseSetting_AddClass() {
- var GrademajorID = $("#GrademajorID").combogridX("getValue");
- $.popupTopWindow('添加班级', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ClassmajorSelect?FromMNU=' + mnu + "&GrademajorID=" +
- GrademajorID, 650, 480, AddClass_Confirm);
- }
- //删除添加班级信息
- function OptionalCourseSetting_DelClass() {
- var d = validClassChoose();
- var classViewList = $("#dgClassList").cmsXDataTable("getRows");
- var i, j;
- var len = classViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (classViewList[i].ClassmajorID == d[j].ClassmajorID) {
- classViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgClassList").cmsXDataTable("loadData", { rows: classViewList, total: classViewList.length });
- }
- //确定添加班级
- function AddClass_Confirm(classList) {
- if (!classList) return;
- var classViewList = $("#dgClassList").cmsXDataTable("getRows");
- $.each(classList, function (index, value) {
- if ($.grep(classViewList, function (row, index) { return value.ClassmajorID == row.ClassmajorID; }).length == 0) {
- classViewList.push({
- ClassmajorID: value.ClassmajorID,
- Name: value.Name,
- No: value.No,
- StudentCount: value.StudentCount
- });
- }
- });
- $("#dgClassList").cmsXDataTable("loadData", { rows: classViewList, total: classViewList.length });
- QueryClassmajor(classViewList[0])
- }
- //获取选中的班级信息
- function validClassChoose() {
- var d = [];
- $.each($("#dgClassList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- function recalculate() {
- var theoryCourse = parseInt($("#TheoryCourse").val() == "" ? "0" : $("#TheoryCourse").val());
- var practicehours = parseInt($("#Practicehours").val() == "" ? "0" : $("#Practicehours").val());
- var theoryWeeklyNum = parseInt($("#TheoryWeeklyNum").val() == "" ? "0" : $("#TheoryWeeklyNum").val());
- var practiceWeeklyNum = parseInt($("#PracticeWeeklyNum").val() == "" ? "0" : $("#PracticeWeeklyNum").val());
- var totalHours = theoryCourse + practicehours;
- var totalWeeklyNum = theoryWeeklyNum + practiceWeeklyNum;
- var weeklyHours = totalHours / totalWeeklyNum;
- var weeklyNum = weeklyHours / 2;
- $("#Totalhours").val(totalHours);
- if (totalWeeklyNum != 0) {
- $("#SchoolweeksNum").val(totalWeeklyNum);
- $("#WeeklyHours").val(weeklyHours);
- $("#WeeklyNum").val(weeklyNum);
- }
- }
- function queryClass() {
- var jsonString = "";
- var parameterString = "";
- var StandardID = $("#StandardID").combogridX("getValue");
- var Schoolyear = $("#GradeID").combobox("getValue");
- if (StandardID != nonSelect) parameterString += "StandardDictionaryDropDown|*|" + StandardID + "|@|";
- if (StandardID != nonSelect) parameterString += "DictionaryStandard|*|" + StandardID + "|@|";
- if (Schoolyear != nonSelect) parameterString += "DictionaryGrade|*|" + Schoolyear + "|@|";
- if (parameterString != "") {
- jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
- $("#CoursematerialID").combogridX("reload", eval(jsonString));
- $("#GrademajorID").combogridX("reload", eval(jsonString));
- } else {
- $("#CoursematerialID").combogridX("reload", eval(jsonString));
- $("#GrademajorID").combogridX("reload", eval(jsonString));
- }
- reload();
- }
- function CoursematerialSelect(data) {
- if (data != "") {
- $("#SchoolyearNumID").combobox("setValue", data.SchoolyearNumID)
- $("#SchoolcodeID").combobox("setValue", data.SchoolcodeID)
- $("#CourseTypeID").combobox("setValue", data.CourseTypeID)
- $("#DepartmentID").combogridX("setValue", data.DepartmentID)
- $("#CourseStructureID").combobox("setValue", data.CourseStructureID)
- $("#CourseCategoryID").combobox("setValue", data.CourseCategoryID)
- $("#CourseQualityID").combobox("setValue", data.CourseQualityID)
- $("#TeachinglanguageID").combobox("setValue", data.TeachinglanguageID)
- $("#ExaminationModeID").combobox("setValue", data.ExaminationModeID)
- $("#ResultTypeID").combobox("setValue", data.ResultTypeID)
- $("#PracticeTypeID").combobox("setValue", data.PracticeTypeID)
- $("#Credit").val(data.Credit);
- $("#TheoryCourse").val(data.TheoryCourse);
- $("#Practicehours").val(data.Practicehours);
- $("#Trialhours").val(data.Trialhours);
- $("#TheoryWeeklyNum").val(data.TheoryWeeklyNum);
- $("#PracticeWeeklyNum").val(data.PracticeWeeklyNum);
- $("#TrialWeeklyNum").val(data.TrialWeeklyNum);
- $("#StartWeeklyNum").val(data.StartWeeklyNum);
- $("#EndWeeklyNum").val(data.EndWeeklyNum);
- $("#WeeklyHours").val(data.WeeklyHours);
- $("#WeeklyNum").val(data.WeeklyNum);
- $("#OptionalCourseID").val(data.OptionalCourseID);
- $.post(CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCoursePlan/TeachingModeType?OptionalCourseID=" + data.OptionalCourseID, null, function (result) {
- $.each($("[name='TeachingModeID']"), function (i, x) {
- if ($.grep(result, function (v) { return v == $(x).val(); }).length > 0) {
- $(x).attr("checked", "checked")
- } else {
- $(x).removeAttr("checked")
- }
- });
- });
- } else {
- $.messager.alert("系统提示", "任选课程信息为空。");
- }
- recalculate();
- }
|