123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- //刷新
- function reload() {
- $("#dgSpecialtyCourseNoAddList").cmsXDataTable("load", $.getDataGridParams("dgSpecialtyCourseNoAddList"));
- }
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgSpecialtyCourseNoAddList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.SpecialtyCourseID);
- });
- return d;
- }
- //获取选中的数据All
- function validChooseAll() {
- var d = [];
- $.each($("#dgSpecialtyCourseNoAddList").cmsXDataTable("getSelections"), function (index) {
- d.push(this);
- });
- return d;
- }
- //确定生成成功后不关闭弹出页面
- function formSuccessReloadNoClose(data) {
- if (data.IsSuccess == true) {
- reload();
- }
- $.messager.alert("系统提示", data.Message);
- }
- //计算规则(暂时不可用,需对以下计算进行优化)
- function SetTheoryWeeklyNum(rowindex, rowdata) {
- //总周时=理论学时+实践学时
- //总周次=理论周次+实践周次
- //周学时=总学时/总周次
- //每周次数=周学时/2
- var totalhours = (Number(rowdata.TheoryCourse) + Number(rowdata.Practicehours)); //总周时
- var schoolweeksNum = (Number(rowdata.TheoryWeeklyNum) + Number(rowdata.PracticeWeeklyNum));//总周次
- var weeklyHours = (Number(rowdata.Totalhours) / Number(rowdata.SchoolweeksNum)).toFixed(0);//周学时
- var weeklyNum = (Number(rowdata.WeeklyHours / 2)).toFixed(0); //每周次数
- var tableRow = $('#dgSpecialtyCourseNoAddList').find("tr.row[xRowIndex=" + rowindex + "]");
- $(tableRow.find("td")[9]).children().val(totalhours);
- $(tableRow.find("td")[13]).children().val(schoolweeksNum);
- $(tableRow.find("td")[14]).children().val(weeklyHours);
- $(tableRow.find("td")[15]).children().val(weeklyNum);
- }
- //设置列颜色为红色
- function SetRedColumn(index, row, value) {
- return " <span style=\"color: red;\">" + value + "</span>";
- }
- //联动查询
- function queryCollege() {
- var collegeID = $("#CollegeDropdown").combogridX("getValue");
- if (collegeID != nonSelect) {
- var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
- $("#DepartmentDropdown").combogridX("reload", eval(jsonString));
- }
- else {
- $("#DepartmentDropdown").combogridX("reload");
- }
- reload();
- }
- function querySchoolyear(data) {
- $("#GrademajorID").combogridX("setValue", "-1");
- queryClass();
- }
- function queryStandard(data) {
- $("#GrademajorID").combogridX("setValue", "-1");
- queryClass();
- }
- function queryEducation(data) {
- $("#GrademajorID").combogridX("setValue", "-1");
- queryClass();
- }
- function queryLearningform(data) {
- $("#GrademajorID").combogridX("setValue", "-1");
- queryClass();
- }
- function queryLearnSystem(data) {
- $("#GrademajorID").combogridX("setValue", "-1");
- queryClass();
- }
- function queryClass() {
- var jsonString = "";
- var parameterString = "";
- var schoolYearID = $("#DictionarySchoolyear").combogridX("getValue"); //combobox
- var standardID = $("#DictionaryStandard").combogridX("getValue");
- var educationID = $("#DictionaryEducation").combogridX("getValue");
- var learningFormID = $("#DictionaryLearningform").combogridX("getValue");
- var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue");
- if (schoolYearID != nonSelect) parameterString += "DictionaryGrade|*|" + schoolYearID + "|@|";
- if (standardID != nonSelect) parameterString += "DictionaryStandard|*|" + standardID + "|@|";
- if (educationID != nonSelect) parameterString += "DictionaryEducation|*|" + educationID + "|@|";
- if (learningFormID != nonSelect) parameterString += "DictionaryLearningform|*|" + learningFormID + "|@|";
- if (learnSystem != nonSelect) parameterString += "DictionaryLearnSystem|*|" + learnSystem + "|@|";
- if (parameterString != "") {
- jsonString = "({'QueryParamsDatas':'" + parameterString + "'})";
- $("#DictionaryStandard").combogridX("reload", eval(jsonString));
- $("#GrademajorID").combogridX("reload", eval(jsonString));
- }
- else {
- $("#DictionaryStandard").combogridX("reload");
- $("#GrademajorID").combogridX("reload");
- }
- reload();
- }
- //确定
- function SpecialtyPlanBatchAdd_Confirm() {
- var grademajorID = $("#GrademajorID").combogridX("getValue");
- if (grademajorID == "" || grademajorID == "-1" || grademajorID == null) {
- $.messager.alert("系统提示", "请选择年级专业。");
- return;
- }
- var d = validChooseAll();
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要新增的信息。");
- return;
- }
- //对选择申请的信息进行验证
- var regA = /^\d+(\.{0,1}\d+){0,1}$/; //非负数
- var regB = /^\d+$/; //非负整数
- for (var i = 0; i < d.length; i++) {
- var credit = d[i].Credit;
- var theoryCourse = d[i].TheoryCourse;
- var practicehours = d[i].Practicehours;
- var trialhours = d[i].Trialhours;
- var theoryWeeklyNum = d[i].TheoryWeeklyNum;
- var practiceWeeklyNum = d[i].PracticeWeeklyNum;
- var trialWeeklyNum = d[i].TrialWeeklyNum;
- var weeklyHours = d[i].WeeklyHours;
- var weeklyNum = d[i].WeeklyNum;
- var startWeeklyNum = d[i].StartWeeklyNum;
- var endWeeklyNum = d[i].EndWeeklyNum;
- var teachingModeIDListName = d[i].TeachingModeIDListName;
- var handleModeID = d[i].HandleModeID;
- if (isNaN(credit) || credit == null || credit.toString() == "") {
- $.messager.alert("系统信息", "课程学分不能为空或格式不正确(非负数字),请检查。");
- return;
- }
- if (!regA.test(credit)) {
- $.messager.alert("系统信息", "课程学分格式不正确(非负数字),请检查。");
- return;
- }
- if (isNaN(theoryCourse) || theoryCourse == null || theoryCourse.toString() == "") {
- $.messager.alert("系统信息", "理论学时不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(theoryCourse)) {
- $.messager.alert("系统信息", "理论学时格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(practicehours) || practicehours == null || practicehours.toString() == "") {
- $.messager.alert("系统信息", "实践学时不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(practicehours)) {
- $.messager.alert("系统信息", "实践学时格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(trialhours) || trialhours == null || trialhours.toString() == "") {
- $.messager.alert("系统信息", "实验学时不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(trialhours)) {
- $.messager.alert("系统信息", "实验学时格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(theoryWeeklyNum) || theoryWeeklyNum == null || theoryWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "理论周次不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(theoryWeeklyNum)) {
- $.messager.alert("系统信息", "理论周次格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(practiceWeeklyNum) || practiceWeeklyNum == null || practiceWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "实践周次不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(practiceWeeklyNum)) {
- $.messager.alert("系统信息", "实践周次格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(trialWeeklyNum) || trialWeeklyNum == null || trialWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "实验周次不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(trialWeeklyNum)) {
- $.messager.alert("系统信息", "实验周次格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(weeklyHours) || weeklyHours == null || weeklyHours.toString() == "") {
- $.messager.alert("系统信息", "周学时不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(weeklyHours)) {
- $.messager.alert("系统信息", "周学时格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(weeklyNum) || weeklyNum == null || weeklyNum.toString() == "") {
- $.messager.alert("系统信息", "每周次数不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(weeklyNum)) {
- $.messager.alert("系统信息", "每周次数格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(startWeeklyNum) || startWeeklyNum == null || startWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "开始周次不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(startWeeklyNum)) {
- $.messager.alert("系统信息", "开始周次格式不正确(非负整数),请检查。");
- return;
- }
- if (isNaN(endWeeklyNum) || endWeeklyNum == null || endWeeklyNum.toString() == "") {
- $.messager.alert("系统信息", "结束周次不能为空或格式不正确(非负整数),请检查。");
- return;
- }
- if (!regB.test(endWeeklyNum)) {
- $.messager.alert("系统信息", "结束周次格式不正确(非负整数),请检查。");
- return;
- }
- //if (parseFloat(trialhours) > parseFloat(practicehours)) {
- // $.messager.alert("系统提示", "实验学时不能大于实践学时。");
- // return;
- //}
- //if (parseFloat(trialWeeklyNum) > parseFloat(practiceWeeklyNum)) {
- // $.messager.alert("系统提示", "实验周次不能大于实践周次。");
- // return;
- //}
- if (teachingModeIDListName == "" || teachingModeIDListName == null) {
- $.messager.alert("系统信息", "授课方式为空无法申请。");
- return;
- }
- if (handleModeID == "" || handleModeID == "-1" || handleModeID == null) {
- $.messager.alert("系统信息", "处理方式不能为空。");
- return;
- }
- }
- $("#specialtyCourseViewList").val(JSON.stringify(d));
- $(document.forms[0]).submit();
- }
|