DegreeConditionPackageEdit.js 2.9 KB

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