CollegeClassroom.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/CollegeClassroom/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgCollegeClassroomList").cmsXDataTable("load", $.getDataGridParams("dgCollegeClassroomList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgCollegeClassroomList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.CollegeClassroomID);
  16. });
  17. return d;
  18. }
  19. //新增
  20. function CollegeClassroom_Add() {
  21. var d = validChoose();
  22. if (d.length > 0) {
  23. $.popupTopWindow('院系教室复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/CollegeClassroom/CopyAdd?collegeClassroomID=' + d[0] + '&MNU=' + mnu, 750, 320, null, null);
  24. } else {
  25. //var redirectTo = url + "?MNU=" + mnu;
  26. //$.popupTopWindow('院系教室新增', redirectTo, 750, 320, null, null);
  27. //采用以下方式新增
  28. //根据院系所信息选择教室信息新增BatchAdd
  29. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/CollegeClassroom/BatchAdd" + "?MNU=" + mnu;
  30. $.popupTopWindow('院系教室新增', redirectTo, 1080, 530, reload, null);
  31. ////根据院系教室信息新增CollegeClassroomBatchAdd
  32. //var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/CollegeClassroom/CollegeClassroomBatchAdd" + "?MNU=" + mnu;
  33. //$.popupTopWindow('院系教室新增', redirectTo, 1080, 530, reload, null);
  34. }
  35. }
  36. //修改按钮
  37. function CollegeClassroom_Edit() {
  38. var d = validChoose();
  39. if (d.length == 0) {
  40. $.messager.alert("系统信息", "请选择您要修改的信息。");
  41. return;
  42. }
  43. if (d.length > 1) {
  44. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  45. return;
  46. }
  47. var redirectTo = url + "?collegeClassroomID=" + d + "&MNU=" + mnu + "&type=edit";
  48. $.popupTopWindow('院系教室修改', redirectTo, 750, 320, null, null);
  49. }
  50. //查看明细
  51. function edit(rowindex, rowdata) {
  52. var redirectTo = url + "?collegeClassroomID=" + rowdata.CollegeClassroomID + "&MNU=" + mnu + "&type=detail";
  53. $.popupTopWindow('院系教室明细', redirectTo, 750, 320, null, null);
  54. }
  55. //删除
  56. function CollegeClassroom_Delete() {
  57. var d = validChoose().join(',');
  58. if (d == "") {
  59. $.messager.alert("系统提示", "请选择您要删除的信息。");
  60. return;
  61. }
  62. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  63. if (r) {
  64. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/CollegeClassroom/Delete', { collegeClassroomIDs: d }, function (data) {
  65. if (data.IsSuccess) {
  66. $.messager.alert("系统提示", data.Message);
  67. $("#dgCollegeClassroomList").cmsXDataTable('load');
  68. } else {
  69. $.messager.alert("系统提示", data.Message);
  70. }
  71. });
  72. }
  73. });
  74. }
  75. //设置列颜色为红色
  76. function SetRedColumn(index, row, value) {
  77. return " <span style=\"color: red;\">" + value + "</span>";
  78. }
  79. //设置相应的行颜色为红色
  80. function SetRedGrid(rowIndex, rowData) {
  81. if (rowData.IsAvailable != true || rowData.IsReserve == true) {
  82. return "color: red;";
  83. } else {
  84. return "";
  85. }
  86. }
  87. //导出Excel
  88. function CollegeClassroom_Export() {
  89. $("#formQuery").submit();
  90. }
  91. //联动查询
  92. function queryCollegeCampus(data) {
  93. var campusID = $("#CollegeCampusDropdown").combogridX("getValue");
  94. if (campusID != nonSelect) {
  95. var jsonString = "({'QueryParamsDatas':'CampusDropdown|*|" + campusID + "|@|'})";
  96. $("#CollegeDropdown").combogridX("reload", eval(jsonString));
  97. }
  98. else {
  99. $("#CollegeDropdown").combogridX("reload");
  100. }
  101. reload();
  102. }