var url = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Edit"; var mnu = ""; //加载 $(function () { mnu = $.SystemGeneral.getUrlParam("MNU"); }) //刷新 function reload() { $("#dgStudentEncourageList").cmsXDataTable("load", $.getDataGridParams("dgStudentEncourageList")); } //获取选中的数据All function validChooseAll() { var d = []; $.each($("#dgStudentEncourageList").cmsXDataTable("getSelections"), function (index) { d.push(this); }); return d; } //获取选中的数据 function validChoose() { var d = []; $.each($("#dgStudentEncourageList").cmsXDataTable("getSelections"), function (index) { d.push(this.StudentEncourageID); }); return d; } //获取选中的状态 function validChooseStatus() { var d = []; $.each($("#dgStudentEncourageList").cmsXDataTable("getSelections"), function (index) { d.push(this.ApprovalStatus); }); return d; } //查看 function edit(rowindex, rowdata) { var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Edit?studentEncourageID=" + rowdata.StudentEncourageID + "&MNU=" + mnu + "&type=detail"; $.popupTopWindow('学生奖励信息', redirectTo, 620, 385, null, null); } //新增 function StudentEncourage_Add() { var d = validChoose(); if (d.length > 0) { $.popupTopWindow('学生奖励复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/StudentEncourage/CopyAdd?studentEncourageID=' + d[0] + '&MNU=' + mnu, 620, 385, null, null); } else { var redirectTo = url + "?MNU=" + mnu; $.popupTopWindow('学生奖励新增', redirectTo, 620, 385, null, null); } } //修改 function StudentEncourage_Edit() { var d = validChoose(); if (d == "") { $.messager.alert("系统提示", "请选择您要修改的信息。"); return; } if (d.length > 1) { $.messager.alert("系统提示", "只能选择单个记录进行修改。"); return; } var id = validChooseAll(); if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) { $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。"); return; } var redirectTo = url + "?studentEncourageID=" + d + "&MNU=" + mnu + "&type=edit"; $.popupTopWindow('学生奖励修改', redirectTo, 620, 385, null, null); } //批量修改 SystemBatchModifyControl.OnSubmit = function () { var status = validChooseStatus().join(','); for (var i = 0; i < status.split(',').length; i++) { if (!(status.split(',')[i] == startStatusID || status.split(',')[i] == sendBackStatusID)) { $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行修改。"); return false; } } } //删除 function StudentEncourage_Delete() { var d = validChoose().join(','); if (d == "") { $.messager.alert("系统提示", "请选择您要删除的信息。"); return; } $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentEncourage/Delete', { studentEncourageIDs: d }, function (data) { if (data.IsSuccess) { $.messager.alert("系统提示", data.Message); $("#dgStudentEncourageList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //提交 function StudentEncourage_Submit() { var d = validChoose().join(','); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要提交的信息。"); return; } var id = validChooseAll(); if ($.grep(id, function (v, i) { return !(v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID); }).length > 0) { $.messager.alert("系统提示", "只能对未提交、已退回状态的信息进行提交。"); return; } $.messager.confirm("系统提示", "您确定要对选择的信息进行提交?", function (r) { if (r) { $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/StudentEncourage/Submit', { studentEncourageIDs: d }, function (data) { if (data.IsSuccess == true) { $.messager.alert("系统提示", data.Message); $("#dgStudentEncourageList").cmsXDataTable('load'); } else { $.messager.alert("系统提示", data.Message); } }); } }); } //审核 function StudentEncourage_Approve() { var d = validChooseAll(); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要审核的信息。"); return; } if ($.grep(d, function (v, i) { return (v.ApprovalStatus == startStatusID || v.ApprovalStatus == sendBackStatusID || v.ApprovalStatus == passNoEndStatusID || v.ApprovalStatus == endStatusID); }).length > 0) { $.messager.alert("系统提示", "只能对待审核的信息进行审核。"); return; } var status = d[0].ApprovalStatus; if ($.grep(d, function (v, i) { return v.ApprovalStatus != status; }).length > 0) { $.messager.alert("系统提示", "只能对相同状态的待审核的信息进行批量审核。"); return; } var studentEncourageIDs = validChoose(); if (studentEncourageIDs.length > 1) { //批量审核 var approveID = studentEncourageIDs[0]; $.popupTopWindow('审核信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=EM_StudentEncourage&FormID=' + approveID, 400, 300, StudentEncourage_ApproveConfirm); } else { var studentEncourageID = studentEncourageIDs; //单个审核 var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Approve?MNU=" + mnu + "&studentEncourageID=" + studentEncourageID; $.popupTopWindow('学生奖励审核', redirectTo, 620, 450, null, null); } } //确定(审核) function StudentEncourage_ApproveConfirm(action) { if (!action) { return; } if (action.ActionID == "") { return; } var approveIDs = validChoose().join(','); $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/ApproveConfirm", { studentEncourageIDs: approveIDs, actionID: action.Action, comment: action.Comment }, function (data) { if (data.IsSuccess) { reload(); } $.messager.alert("系统提示", data.Message); }, 'json'); } //撤销 function StudentEncourage_Cancel() { var d = validChooseAll(); if (d.length == 0) { $.messager.alert("系统提示", "请选择您要撤销的信息。"); return; } if ($.grep(d, function (v, i) { return v.ApprovalStatus != passNoEndStatusID; }).length > 0) { $.messager.alert("系统提示", "只能对审核通过的信息进行撤销。"); return; } var studentEncourageIDs = validChoose(); if (studentEncourageIDs.length > 1) { //批量撤销 var approveID = studentEncourageIDs[0]; $.popupTopWindow('撤销信息', CMS_SystemConfig.VirtualDirectoryPath + '/Common/ApproveHandler?TableName=EM_StudentEncourage&FormID=' + approveID, 400, 300, StudentEncourage_CancelConfirm); } else { var studentEncourageID = studentEncourageIDs; //单个撤销 var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/Cancel?MNU=" + mnu + "&studentEncourageID=" + studentEncourageID; $.popupTopWindow('学生奖励撤销', redirectTo, 620, 450, null, null); } } //确定(撤销) function StudentEncourage_CancelConfirm(action) { if (!action) { return; } if (action.ActionID == "") { return; } var approveIDs = validChoose().join(','); $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + "/StudentEncourage/CancelConfirm", { studentEncourageIDs: approveIDs, actionID: action.Action, comment: action.Comment }, function (data) { if (data.IsSuccess) { reload(); } $.messager.alert("系统提示", data.Message); }, 'json'); } //Excel导出 function StudentEncourage_Export() { $("#formQuery").submit(); } //联动查询 function queryCampus(data) { var campusID = $("#CampusDropdown").combogridX("getValue"); var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})"; $("#CollegeDropdown").combogridX("reload", eval(jsonString)); 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)); $("#DictionaryStandard").combogridX("reload", eval(jsonString)); queryClass(); } function queryGrade(data) { queryClass(); } function queryStandard(data) { queryClass(); } function queryLearnSystem(data) { queryClass(); } function queryClass() { var jsonString = ""; var parameterString = ""; var campusID = $("#CampusDropdown").combogridX("getValue"); var collegeID = $("#CollegeDropdown").combogridX("getValue"); var gradeID = $("#DictionaryGrade").combogridX("getValue"); var standardID = $("#DictionaryStandard").combogridX("getValue"); var educationID = $("#DictionaryEducation").combogridX("getValue"); var learningformID = $("#DictionaryLearningform").combogridX("getValue"); var learnSystem = $("#DictionaryLearnSystem").combogridX("getValue"); if (campusID != nonSelect) parameterString += "CampusDropdown|*|" + campusID + "|@|"; if (collegeID != nonSelect) parameterString += "CollegeDropdown|*|" + collegeID + "|@|"; if (gradeID != nonSelect) parameterString += "DictionaryGrade|*|" + gradeID + "|@|"; 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)); } else { $("#DictionaryStandard").combogridX("reload"); } reload(); }