123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447 |
- var mnu = "";
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- });
- //Excel导出
- function OptionalCourseSetting_Export() {
- $(document.forms[0]).submit();
- }
- //任务生成确定
- function OptionalCourseSetting_Save() {
- if ($("#frmSaveOptionalCourse").form("validate")) {
- $("#frmSaveOptionalCourse").submit();
- }
- }
- function reload() {
- $("#dgOptionalCourseSettingList").cmsXDataTable("load", $.getDataGridParams("dgOptionalCourseSettingList"));
- }
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgOptionalCourseSettingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.ExecutableOptionalCourseID);
- });
- return d;
- }
- function isOpenvalidChoose() {
- var d = [];
- $.each($("#dgOptionalCourseSettingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.IsOpenDesc);
- });
- return d;
- }
- function statusvalidChoose() {
- var d = [];
- $.each($("#dgOptionalCourseSettingList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.RecordStatusCode);
- });
- return d;
- }
- function queryCollege(data) {
- $("#CollegeDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/College/CollegeDropdownListBanid?campusID=" + data.Value + "");
- }
- //弹出添加教师页面
- 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_Create() {
- $.popupTopWindow('限选任务生成', CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCourseSetting/Create?MNU=" +
- mnu, 600, 300, null, null);
- }
- //批量修改
- SystemBatchModifyControl.OnSubmit = function () {
- var r = statusvalidChoose();
- for (var i = 0; i < r.length; i++) {
- if (r[i] == CreatedStatus) {
- $.messager.alert("系统提示", "已开班状态的信息无法修改。");
- return false;
- }
- else if (r[i] != NotOpenStatus && document.getElementById("IsOpened_CheckBox").checked == true &&
- document.getElementById("IsOpenedCheckBox_div").style.display != "none") {
- $.messager.alert("系统提示", "已开放状态的信息无法重复开放。");
- return false;
- }
- else if (r[i] != OpenedStatus && document.getElementById("IsOpened_CheckBox").checked == false &&
- document.getElementById("IsOpenedCheckBox_div").style.display != "none") {
- $.messager.alert("系统提示", "未开放状态的信息无法重复取消。");
- return false;
- }
- }
- }
- //新增按钮
- function OptionalCourseSetting_Add() {
- var d = validChoose();
- var r = statusvalidChoose();
- if (d.length > 1) {
- $.messager.alert("系统信息", "只能选择单个记录进行复制新增。");
- return;
- }
- if (d.length == 1) {
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCourseSetting/Edit?ExecutableOptionalCourseIDs=" + d + "&MNU=" + mnu + "&type=add";
- $.popupTopWindow('限选设定复制新增', redirectTo, 750, 550, null, null);
- }
- else
- {
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCourseSetting/Edit?MNU=" + mnu + "&type=add";
- $.popupTopWindow('限选设定新增', redirectTo, 750, 550, null, null);
- }
-
- }
- //修改按钮
- function OptionalCourseSetting_Update() {
- var d = validChoose();
- var r = statusvalidChoose();
- if (d == "") {
- $.messager.alert("系统信息", "请选择您要修改的信息。");
- return;
- }
- if (d.length > 1) {
- $.messager.alert("系统信息", "只能选择单个记录进行修改。");
- return;
- }
- if (r[0] == CreatedStatus) {
- $.messager.alert("系统提示", "已开班状态的信息无法修改。");
- return ;
- }
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCourseSetting/Edit?ExecutableOptionalCourseIDs=" + d + "&MNU=" + mnu + "&type=edit";
- $.popupTopWindow('限选设定修改', redirectTo, 750, 550, null, null);
- }
- //删除
- function OptionalCourseSetting_Delete() {
- var d = validChoose().join(',');
- var r = statusvalidChoose();
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要删除的信息。");
- return;
- }
- for (var i = 0; i < r.length; i++) {
- if (r[i] == CreatedStatus) {
- $.messager.alert("系统提示", "已开班状态的信息无法删除!");
- return ;
- }
-
- }
- $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
- if (r) {
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/OptionalCourseSetting/Delete', { optionalCourseSettingIDs: d }, function (data) {
- if (data == "删除成功!") {
- $.messager.alert("系统提示", data);
- $("#dgOptionalCourseSettingList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- });
- }
- //开放
- function OptionalCourseSetting_Submit() {
- var d = validChoose().join(",");
- var r = statusvalidChoose();
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要开放的信息。");
- return;
- }
- for (var i = 0; i < r.length; i++) {
- if (r[i] != NotOpenStatus) {
- $.messager.alert("系统提示", "已开放状态的信息无法重复开放。");
- return;
- }
- }
- $.messager.confirm("系统提示", "您确定要对选择的限选设定进行开放?", function (r) {
- if (r) {
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/OptionalCourseSetting/Submit', { optionalCourseSettingIDs: d }, function (data) {
- if (data == "开放成功!") {
- $.messager.alert("系统提示", data);
- $("#dgOptionalCourseSettingList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- });
- }
- //取消
- function OptionalCourseSetting_Cancel() {
- var d = validChoose().join(',');
- if (d == "") {
- $.messager.alert("系统信息", "请选择您要取消的信息。");
- return;
- }
- var status = statusvalidChoose();
- for (var i = 0; i < status.length; i++) {
- if (status[i] != OpenedStatus) {
- $.messager.alert("系统提示", "只能对已开放状态的信息进行取消。");
- return;
- }
- }
- $.messager.confirm("系统提示", "您确定要对选择的限选设定进行取消?", function (r) {
- if (r) {
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/OptionalCourseSetting/Cancel', { optionalCourseSettingIDs: d }, function (data) {
- if (data == "取消成功!") {
- $.messager.alert("系统提示", data);
- $("#dgOptionalCourseSettingList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- });
- }
- 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 + "_" + document.getElementById("CourseName").value + "(限选)";
- // 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 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({
- ExecutableOptionalCourseID: $("#ExecutableOptionalCourseID").val(),
- 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 validTeacherChoose() {
- var d = [];
- $.each($("#dgTeacherList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- function validClassChoose() {
- var d = [];
- $.each($("#dgClassList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- //删除添加教师信息
- 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 OptionalCourseSetting_AddClass() {
- $.popupTopWindow('添加班级', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ClassmajorSelect?FromMNU=' +
- mnu + "&GrademajorID=" +
- document.getElementById("GrademajorID").value, 600, 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({
- ExecutableOptionalCourseID: $("#ExecutableOptionalCourseID").val(),
- ClassmajorID: value.ClassmajorID,
- Name: value.Name,
- No: value.No,
- StudentCount: value.StudentCount
- });
- }
- });
- $("#dgClassList").cmsXDataTable("loadData", { rows: classViewList, total: classViewList.length });
- }
- //开放范围
- function StudentList(rowindex, rowdata) {
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/OptionalCourseSetting/ClassList?executableOptionalCourseID=" + rowdata.ExecutableOptionalCourseID + "&Type=" + rowdata.SelectCourseType + "&MNU=" + mnu;
- //var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/SelectCourseResult/Student";
- $.popupTopWindow('开放范围', redirectTo, 700, 400, null, null);
- }
- 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 queryStandard(data) {
- queryClass();
- }
- function queryCollege(data) {
- var campusID = $("#CampusDropdown").combogridX("getValue");
- var collegeID = $("#CollegeDropdown").combogridX("getValue");
- var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|";
- jsonString += "CollegeDropdown|*|" + collegeID + "|@|'})";
- $("#CollegeDropdown").combogridX("reload", eval(jsonString));
- $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString));
- // if (campusID != nonSelect) {
- // var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
- // $("#CollegeDropdown").combogridX("reload", eval(jsonString));
- // }
- queryClass();
- }
- function queryClass() {
- var jsonString = "";
- var parameterString = "";
- var campusID = $("#CampusDropdown").combogridX("getValue");
- var collegeID = $("#CollegeDropdown").combogridX("getValue");
- //var educationID = $("#Education").combobox("getValue");
- var schoolYearID = $("#SchoolyearDictionaryDropDown").combobox("getValue");
- var standardID = $("#StandardDictionaryDropDown").combogridX("getValue");
- //var learningFormID = $("#LearningformDictionaryDropDown").combobox("getValue");
- if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|";
- if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|";
- //if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
- if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
- if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
- //if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
- if (parameterString != "") {
- jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
- $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
- $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString));
- } else {
- $("#GrademajorComboGrid").combogridX("reload", eval(jsonString));
- $("#StandardDictionaryDropDown").combogridX("reload", eval(jsonString));
- }
- reload();
- }
|