123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- })
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgStandardAndMinorSpecialtyCourseViewList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- function MinorPlanApply_Save() {
- var patten = /^-?\d+\.?\d{0,1}$/;
- var d = validChoose();
- for (var i = 0; i < d.length; i++) {
- if (d[i].Credit == null) {
- $.messager.alert("系统信息", "请填写学分信息!");
- return;
- }
- if (d[i].Credit.toString() == "") {
- $.messager.alert("系统信息", "请填写学分信息!");
- return;
- }
- if (!patten.test(d[i].Credit)) {
- d[i].Credit = d[i].Credit.trim();
- if (!patten.test(d[i].Credit)) {
- $.messager.alert("系统信息", "请在学分输入框输入数字");
- return;
- }
- }
- if (d[i].TheoryCourse == null) {
- $.messager.alert("系统信息", "请填写理论学时信息!");
- return;
- }
- if (d[i].TheoryCourse.toString() == "") {
- $.messager.alert("系统信息", "请填写理论学时信息!");
- return;
- }
- if (!patten.test(d[i].TheoryCourse)) {
- d[i].TheoryCourse = d[i].TheoryCourse.trim();
- if (!patten.test(d[i].TheoryCourse)) {
- $.messager.alert("系统信息", "请在理论学时输入框输入数字");
- return;
- }
- }
- if (d[i].Practicehours == null) {
- $.messager.alert("系统信息", "请填写实践学时信息!");
- return;
- }
- if (d[i].Practicehours.toString() == "") {
- $.messager.alert("系统信息", "请填写实践学时信息!");
- return;
- }
- if (!patten.test(d[i].Practicehours)) {
- d[i].Practicehours = d[i].Practicehours.trim();
- if (!patten.test(d[i].Practicehours)) {
- $.messager.alert("系统信息", "请在实践学时输入框输入数字");
- return;
- }
- }
- if (d[i].TheoryWeeklyNum.toString() == "") {
- d[i].TheoryWeeklyNum = null;
- }
- if (d[i].PracticeWeeklyNum.toString() == "") {
- d[i].PracticeWeeklyNum = null;
- }
- if (d[i].TrialWeeklyNum.toString() == "") {
- d[i].TrialWeeklyNum = null;
- }
- if (d[i].StartWeeklyNum == null) {
- $.messager.alert("系统信息", "请填写结束周次信息!");
- return;
- }
- if (d[i].StartWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "请填写开始周次信息!");
- return;
- }
- if (!patten.test(d[i].StartWeeklyNum)) {
- d[i].StartWeeklyNum = d[i].StartWeeklyNum.trim();
- if (!patten.test(d[i].StartWeeklyNum)) {
- $.messager.alert("系统信息", "请在开始周次输入框输入数字");
- return;
- }
- }
- if (d[i].EndWeeklyNum == null) {
- $.messager.alert("系统信息", "请填写结束周次信息!");
- return;
- }
- if (d[i].EndWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "请填写结束周次信息!");
- return;
- }
- if (!patten.test(d[i].EndWeeklyNum)) {
- d[i].EndWeeklyNum = d[i].EndWeeklyNum.trim();
- if (!patten.test(d[i].EndWeeklyNum)) {
- $.messager.alert("系统信息", "请在开始周次输入框输入数字");
- return;
- }
- }
- if (d[i].WeeklyHours.toString() == "") {
- d[i].WeeklyHours = null;
- }
- if (d[i].WeeklyNum.toString() == "") {
- d[i].WeeklyNum = null;
- }
- if (!isNaN($("#Trialhours").val()) && $("#Trialhours").val() != ""
- && !isNaN($("#Practicehours").val()) && $("#Practicehours").val() != ""
- && parseFloat($("#Trialhours").val()) > parseFloat($("#Practicehours").val())) {
- $.messager.alert("系统提示", "实验学时不能大于实践学时。");
- return;
- }
- if (!isNaN($("#TrialWeeklyNum").val()) && $("#TrialWeeklyNum").val() != ""
- && !isNaN($("#PracticeWeeklyNum").val()) && $("#PracticeWeeklyNum").val() != ""
- && parseFloat($("#TrialWeeklyNum").val()) > parseFloat($("#PracticeWeeklyNum").val())) {
- $.messager.alert("系统提示", "实验周次不能大于实践周次。");
- return;
- }
- }
- $("#MinorSpecialtyCourse").val(JSON.stringify(d));
- $(document.forms[0]).submit();
- }
- //弹出添加课程页面
- function MinorPlanApply_CourseAdd() {
- $.popupTopWindow('添加课程', CMS_SystemConfig.VirtualDirectoryPath + '/MinorPlanApply/AddCourse?FromMNU=' +
- mnu + '&YearID=0&StandardID=0', 800, 600, CourseAdd_Confirm);
- }
- //确定
- function CourseAdd_Confirm(CourseList) {
- if (CourseList == undefined)
- return;
- var CourseViewList = $("#dgStandardAndMinorSpecialtyCourseViewList").cmsXDataTable("getRows");
- $.each(CourseList, function (index, value) {
- if ($.grep(CourseViewList, function (row, index) { return value.MinorCourseID == CourseViewList.MinorCourseID; }).length == 0) {
- CourseViewList.push({
- MinorCourseID:value.MinorCourseID,
- CourseCode:value.CourseCode,
- CourseName:value.CourseName,
- StarttermName: value.StarttermName,
- SchoolyearNumID: value.SchoolyearNumID,
- SchoolcodeID:value.SchoolcodeID,
- Credit:value.Credit,
- TheoryCourse:value.TheoryCourse,
- Practicehours:value.Practicehours,
- TheoryWeeklyNum:value.TheoryWeeklyNum,
- PracticeWeeklyNum:value.PracticeWeeklyNum,
- TrialWeeklyNum:value.TrialWeeklyNum,
- StartWeeklyNum:value.StartWeeklyNum,
- EndWeeklyNum:value.EndWeeklyNum,
- WeeklyHours:value.WeeklyHours,
- WeeklyNum: value.WeeklyNum,
- Trialhours:value.Trialhours,
- StarttermID:value.StarttermID,
- CoursematerialID: value.CoursematerialID,
- DepartmentID: value.DepartmentID,
- CourseStructureID: value.CourseStructureID,
- CourseCategoryID: value.CourseCategoryID,
- CourseTypeID: value.CourseTypeID,
- CourseQualityID: value.CourseQualityID,
- PracticeTypeID: value.PracticeTypeID,
- ExaminationModeID: value.ExaminationModeID,
- CourseFineID: value.CourseFineID,
- TeachinglanguageID: value.TeachinglanguageID,
- ResultTypeID:value.ResultTypeID
- });
- }
- });
- $("#dgStandardAndMinorSpecialtyCourseViewList").cmsXDataTable("loadData", { rows: CourseViewList, total: CourseViewList.length });
- }
- //删除课程
- function MinorPlanApply_CourseDelete() {
- var d = validChoose();
- var CourseViewList = $("#dgStandardAndMinorSpecialtyCourseViewList").cmsXDataTable("getRows");
- var i, j;
- var len = CourseViewList.length;
- for (i = len - 1; i >= 0; i--) {
- for (j = 0; j < d.length; j++) {
- if (CourseViewList[i].MinorPlanApplicationID == d[j].MinorPlanApplicationID) {
- CourseViewList.splice(i, 1);
- break;
- }
- }
- }
- $("#dgStandardAndMinorSpecialtyCourseViewList").cmsXDataTable("loadData", { rows: CourseViewList, total: CourseViewList.length });
- }
- function reload() {
- $("#dgStandardAndMinorSpecialtyCourseViewList").cmsXDataTable("load", $.getDataGridParams("dgStandardAndMinorSpecialtyCourseViewList"));
- }
|