123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- var url = CMS_SystemConfig.VirtualDirectoryPath + "/FinalExamination/Edit";
- var mnu = "";
- var isFirstLoadBuilding = true;
- //加载
- $(function () {
- mnu = $.SystemGeneral.getUrlParam("MNU");
- })
- //新增
- function FinalExamination_Add() {
- var d = validChoose();
- var redirectTo = url + "?finalExamination=" + d + "&MNU=" + mnu + "&aType=add";
- if (d == "") {
- redirectTo = url + "?MNU=" + mnu + "&aType=add";
- }
- if (d.length > 1) {
- $.messager.alert("系统提示", "只能选择单个记录进行复制新增。");
- return;
- }
- $.popupTopWindow('期末设定新增', redirectTo, 750, 420, reload);
- }
- //刷新列表
- function reload() {
- $("#dgFinalExaminationList").cmsXDataTable("load", $.getDataGridParams("dgFinalExaminationList"));
- }
- function FinalExaminationStudentDetail_Export()
- {
- var d = validChoose().join(',')
- if (d != "") {
- document.getElementById("FinalExaminationID").value = d;
- }
- else {
- document.getElementById("FinalExaminationID").value = "";
- }
- $("#formQuery").attr("action", CMS_SystemConfig.VirtualDirectoryPath + "/FinalExamination/StudentDetails_Excel");
- $("#formQuery").submit();
- }
- //期末设定导出
- function FinalExamination_Export() {
- var d = validChoose().join(',')
- if (d != "") {
- document.getElementById("FinalExaminationID").value = d;
- }
- else {
- document.getElementById("FinalExaminationID").value = "";
- }
- $("#formQuery").submit();
- }
- //获取选中的数据
- function validChoose() {
- var d = [];
- $.each($("#dgFinalExaminationList").cmsXDataTable("getSelections"), function (index) {
- d.push(this.FinalExaminationID);
- });
- return d;
- }
- function StudentCount() {
- var d = 0;
- $.each($("#dgFinalExaminationList").cmsXDataTable("getSelections"), function (index) {
- d = this.StudentCount;
- });
- return d;
- }
- function GetCreatorUser() {
- var d = 0;
- $.each($("#dgFinalExaminationList").cmsXDataTable("getSelections"), function (index) {
- d = this.CreatorUserName;
- });
- return d;
- }
- function ApprovalStatusName() {
- var d = 0;
- $.each($("#dgFinalExaminationList").cmsXDataTable("getSelections"), function (index) {
- d = this.ApprovalStatusName;
- });
- return d;
- }
- function ApprovalStatus() {
- var d = 0;
- $.each($("#dgFinalExaminationList").cmsXDataTable("getSelections"), function (index) {
- d = this.ApprovalStatus;
- });
- return d;
- }
- //明细
- function edit(rowindex, rowdata) {
- var redirectTo = url + "?finalExamination=" + rowdata.FinalExaminationID + "&MNU=" + mnu + "&aType=update&isView=1";
- $.popupTopWindow('期末设定信息', redirectTo, 750, 420, null, null);
- }
- //修改按钮
- function FinalExamination_Update() {
- var d = validChoose();
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要修改的信息。");
- return;
- }
- if (d.length > 1) {
- $.messager.alert("系统提示", "只能选择单个记录进行修改。");
- return;
- }
- var redirectTo = url + "?finalExamination=" + d + "&MNU=" + mnu + "&aType=update";
- $.popupTopWindow('期末设定修改', redirectTo, 750, 420, null, null);
- }
- //删除
- function FinalExamination_Delete() {
- var d = validChoose().join(',');
- var count = StudentCount();
- var statusName = ApprovalStatusName();
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要删除的信息。");
- return;
- }
- //if ($.grep(statusName, function (x) { return x != "未开放"; }).length > 0) {
- // if (count > 0) {
- // $.messager.alert("系统提示", "已录入学生信息,不能删除该期末设定!");
- // return;
- // }
- //}
- $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
- if (r) {
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Delete', { finalExaminationIDs: d }, function (data) {
- if (data == "删除成功!") {
- $.messager.alert("系统提示", data);
- $("#dgFinalExaminationList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- });
- }
- //生成考试科目
- function FinalExamination_Generate() {
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FinalExamination/GenerateEdit?MNU=" + mnu;
- $.popupTopWindow('生成考试科目', redirectTo, 600, 300, null, null);
- }
- //添加学生
- function FinalExamination_AddStudent() {
- var d = validChoose();
- var status = ApprovalStatus();
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要增加学生的信息。");
- return;
- }
- if (d.length > 1) {
- $.messager.alert("系统提示", "只能选择单个记录。");
- return;
- }
- if (status == "1" || status == "3" || status == "5") {
- var redirectTo = "/FinalExamination/StudentEdit?finalExamination=" + d + "&MNU=" + mnu;
- $.popupTopWindow('学生名单', redirectTo, 850, 480, reload);
- }
- else
- {
- $.messager.alert("系统提示", "该数据已经提交或已审核,不能添加学生!");
- return;
- }
- }
- function AddStudent_Confirm(studentList) {
- var d = validChoose().join(',');
- var student = [];
- $.each(studentList, function (index, value) {
- student.push(value.UserID);
- });
- var userIDs = student.join(',');
- $.post(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/FinalExaminationStudentAdd', { finalExaminationID: d, userIDs: userIDs }, function (data) {
- if (data == "保存成功。") {
- $.messager.alert("系统提示", data);
- $("#dgFinalExaminationList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- //学生成绩录入名单
- function StudentList(rowindex, rowdata) {
- var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/FinalExamination/StudentList?finalExaminationID=" + rowdata.FinalExaminationID + "&MNU=" + mnu;
- $.popupTopWindow('学生成绩录入名单', redirectTo, 850, 480, null, null);
- }
- //允许录入
- function FinalExamination_Input() {
- var d = validChoose().join(',');
- var dstate = ApprovalStatusName();
- var CreatorUserName = GetCreatorUser();
- var selected = $("#dgFinalExaminationList").cmsXDataTable("getSelections");
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要允许录入的信息。");
- return;
- }
- for (var i = 0; i < selected.length; i++) {
- if (selected[i].CreatorUserName == null) {
- $.messager.alert("系统提示", "录入人为空,无法进行允许录入,请设置。");
- return;
- }
- }
- //for (var i = 0; i < dstate.split(',').length; i++) {
- // if (dstate.split(',')[i] != "未开放") {
- // $.messager.alert("系统提示", "只能操作未开放的数据!");
- // return;
- // }
- //}
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Final_ResitExaminationIsEntry', { finalExaminationIDs: d }, function (data) {
- if (data == "允许录入成功。") {
- $.messager.alert("系统提示", data);
- $("#dgFinalExaminationList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- //批量修改前判断
- SystemBatchModifyControl.OnSubmit = function (a) {
- var d = validChoose().join(',');
- var status = ApprovalStatus();
- if (status != "1" && status != "3" && status != "5") {
- $.messager.alert("系统提示", "只能操作未开放,可录入,重新录入的数据!");
- return false;
- }
- }
- //取消录入
- function FinalExamination_Cancel() {
- var d = validChoose().join(',');
- var dstate = ApprovalStatusName();
- var CreatorUserName = GetCreatorUser();
- var selected = $("#dgFinalExaminationList").cmsXDataTable("getSelections");
- if (d == "") {
- $.messager.alert("系统提示", "请选择您要取消录入的信息。");
- return;
- }
- $.messager.confirm("系统提示", "撤销开放后,若所选记录中存在已录入的成绩,系统将同步进行删除,是否确定撤销开放?", function (r) {
- if (r) {
- $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/FinalExamination/Final_ResitExaminationBack', { finalExaminationIDs: d }, function (data) {
- if (data == "取消录入成功。") {
- $.messager.alert("系统提示", data);
- $("#dgFinalExaminationList").cmsXDataTable('load');
- } else {
- $.messager.alert("系统提示", data);
- }
- });
- }
- });
- }
- function SelectCollegeComboGrid() {
- var collegeID = $("#CollegeComboGrid").combogridX("getValue");
- if (collegeID != nonSelect) {
- var jsonString = "({'QueryParamsDatas':'CollegeDropdown|*|" + collegeID + "|@|'})";
- $("#DepartmentComboGrid").combogridX("reload", eval(jsonString));
- }
- reload();
- }
|