OpenControl.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationOpenControl/Edit";
  2. var mnu;
  3. $(function () {
  4. mnu = $.SystemGeneral.getUrlParam("MNU");
  5. });
  6. function OpenControl_Export() {
  7. $(document.forms[0]).submit();
  8. }
  9. function OpenControl_Add() {
  10. redirectTo = url + "?MNU=" + mnu;
  11. $.popupTopWindow("开放控制新增", redirectTo, 800, 400, null, null);
  12. }
  13. function reload() {
  14. $("#dgOpenControlList").cmsXDataTable("load", $.getDataGridParams("dgOpenControlList"));
  15. }
  16. //获取选中的数据
  17. function validChoose() {
  18. var d = [];
  19. $.each($("#dgOpenControlList").cmsXDataTable("getSelections"), function (index) {
  20. d.push(this.ExaminationOpenControlID);
  21. });
  22. return d;
  23. }
  24. function validChooseStartDate() {
  25. var d = [];
  26. $.each($("#dgOpenControlList").cmsXDataTable("getSelections"), function (index) {
  27. d.push(this.StartDate);
  28. });
  29. return d;
  30. }
  31. function validChooseEndDate() {
  32. var d = [];
  33. $.each($("#dgOpenControlList").cmsXDataTable("getSelections"), function (index) {
  34. d.push(this.EndDate);
  35. });
  36. return d;
  37. }
  38. //批量修改执行前触发事件
  39. SystemBatchModifyControl.OnSubmit = function (a) {
  40. if (document.getElementById("StartDateTextBoxDate_div").style.display != "none") {
  41. var StartDate = $("#StartDate_TextBoxDate").val();
  42. var d = validChooseEndDate();
  43. for (var i = 0; i < d.length; i++) {
  44. var time = new Date(d[i]);
  45. if (d[i].toDateString("yyyy-MM-dd") <= StartDate) {
  46. $.messager.alert("系统提示", "报名时间起要小于报名时间止");
  47. return false;
  48. }
  49. }
  50. }
  51. else if (document.getElementById("EndDateTextBoxDate_div").style.display != "none") {
  52. var EndDate = $("#EndDate_TextBoxDate").val();
  53. var d = validChooseStartDate();
  54. for (var i = 0; i < d.length; i++) {
  55. if (EndDate <= d[i].toDateString("yyyy-MM-dd")) {
  56. $.messager.alert("系统提示", "报名时间止要大于报名时间起");
  57. return false;
  58. }
  59. }
  60. }
  61. }
  62. //点击列表更新
  63. function edit(rowindex, rowdata) {
  64. redirectTo = url + "?OpenControlID=" + rowdata.ExaminationOpenControlID + "&MNU=" + mnu + "&isView=1";
  65. $.popupTopWindow("开放控制详情", redirectTo, 800, 400, null, null);
  66. }
  67. //修改按钮
  68. function OpenControl_Update() {
  69. var d = validChoose();
  70. if (d.length == 0) {
  71. $.messager.alert("系统提示", "请选择您要修改的开放控制记录。");
  72. return;
  73. }
  74. if (d.length > 1) {
  75. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  76. return;
  77. }
  78. redirectTo = url + "?OpenControlID=" + d + "&MNU=" + mnu ;
  79. $.popupTopWindow("开放控制详情", redirectTo, 800, 400, null, null);
  80. }
  81. //删除
  82. function OpenControl_Delete() {
  83. var d = validChoose().join(',');
  84. if (d == "") {
  85. $.messager.alert("系统提示", "请选择您要删除的开放控制记录。");
  86. return;
  87. }
  88. $.messager.confirm("系统提示", "您确定要删除该开放控制记录?", function (r) {
  89. if (r) {
  90. $.post(CMS_SystemConfig.VirtualDirectoryPath + '/ExaminationOpenControl/Delete', { openControlIDs: d }, function (data) {
  91. if (data == "删除成功") {
  92. $.messager.alert("系统提示", "删除成功!");
  93. $("#dgOpenControlList").cmsXDataTable('load');
  94. } else {
  95. $.messager.alert("系统提示", data);
  96. }
  97. });
  98. }
  99. });
  100. }
  101. function queryExaminationSubject(data) {
  102. $("#ExaminationSubjectDropdown").combobox("reload", CMS_SystemConfig.VirtualDirectoryPath + "/ExaminationSubject/DropdownList?examinationTypeID=" + data.Value + "");
  103. }