MinorGraduationConditionPackageEdit.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. var mnu = "";
  2. //加载
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. })
  6. //获取选中的列表数据(All)
  7. function validChoose() {
  8. var d = [];
  9. $.each($("#dgMinorGraduationConditionList").cmsXDataTable("getSelections"), function (index) {
  10. d.push(this);
  11. });
  12. return d;
  13. }
  14. //获取列表数据(列表中的所有行数据)
  15. function validChooseID() {
  16. var d = [];
  17. $.each($("#dgMinorGraduationConditionList").cmsXDataTable("getRows"), function (index) {
  18. d.push(this.MinorGraduationConditionID);
  19. });
  20. return d;
  21. }
  22. //保存
  23. function MinorGraduationConditionPackage_Save() {
  24. var d = validChooseID();
  25. if (d == "") {
  26. $.messager.alert("系统提示", "请添加辅修毕业条件。");
  27. return
  28. }
  29. $(document.forms[0]).submit();
  30. }
  31. //添加页面(毕业条件添加)
  32. function MinorGraduationConditionAdd() {
  33. $.popupTopWindow('辅修毕业条件添加', CMS_SystemConfig.VirtualDirectoryPath + '/MinorGraduationConditionPackage/MinorGraduationConditionList?FromMNU='
  34. + mnu, 600, 420, AddGraduationCondition_Confirm);
  35. }
  36. //加载选中的信息(毕业条件)
  37. function AddGraduationCondition_Confirm(MinorGraduationConditionList) {
  38. if (MinorGraduationConditionList == undefined || MinorGraduationConditionList.length < 1) {
  39. return;
  40. }
  41. var minorGraduationConditionViewList = $("#dgMinorGraduationConditionList").cmsXDataTable("getRows");
  42. $.each(MinorGraduationConditionList, function (index, value) {
  43. if ($.grep(minorGraduationConditionViewList, function (row, index) {
  44. return value.MinorGraduationConditionID == row.MinorGraduationConditionID;
  45. }).length == 0) {
  46. minorGraduationConditionViewList.push({
  47. MinorGraduationConditionID: value.MinorGraduationConditionID,
  48. Title: value.Title,
  49. IsEnable: value.IsEnable
  50. });
  51. }
  52. });
  53. $("#dgMinorGraduationConditionList").cmsXDataTable("loadData", {
  54. rows: minorGraduationConditionViewList,
  55. total: minorGraduationConditionViewList.length
  56. });
  57. }
  58. //删除(毕业条件删除)
  59. function MinorGraduationConditionDelete() {
  60. var d = validChoose();
  61. if (d == "") {
  62. $.messager.alert("系统提示", "请选择您要删除的信息。");
  63. return;
  64. }
  65. var minorGraduationConditionViewList = $("#dgMinorGraduationConditionList").cmsXDataTable("getRows");
  66. var i, j;
  67. var len = minorGraduationConditionViewList.length;
  68. for (i = len - 1; i >= 0; i--) {
  69. for (j = 0; j < d.length; j++) {
  70. if (minorGraduationConditionViewList[i].MinorGraduationConditionID == d[j].MinorGraduationConditionID) {
  71. minorGraduationConditionViewList.splice(i, 1);
  72. break;
  73. }
  74. }
  75. }
  76. $("#dgMinorGraduationConditionList").cmsXDataTable("loadData", {
  77. rows: minorGraduationConditionViewList,
  78. total: minorGraduationConditionViewList.length
  79. });
  80. }