OpenObject.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. var url = CMS_SystemConfig.VirtualDirectoryPath + "/OpenObject/Edit";
  2. var mnu = "";
  3. //加载
  4. $(function () {
  5. mnu = $.SystemGeneral.getUrlParam("MNU");
  6. })
  7. //刷新
  8. function reload() {
  9. $("#dgStudentEditObjectList").cmsXDataTable("load", $.getDataGridParams("dgStudentEditObjectList"));
  10. }
  11. //获取选中的数据
  12. function validChoose() {
  13. var d = [];
  14. $.each($("#dgStudentEditObjectList").cmsXDataTable("getSelections"), function (index) {
  15. d.push(this.StudentEditObjectsID);
  16. });
  17. return d;
  18. }
  19. //新增
  20. function StudentEditObject_Add() {
  21. var d = validChoose();
  22. if (d.length > 0) {
  23. $.popupTopWindow('开放对象复制新增', CMS_SystemConfig.VirtualDirectoryPath + '/OpenObject/CopyAdd?studentEditObjectID=' + d[0] + '&MNU=' + mnu, 600, 250, null, null);
  24. }
  25. else {
  26. //var redirectTo = url + "?MNU=" + mnu;
  27. //$.popupTopWindow('开放对象新增', redirectTo, 600, 250, null, null);
  28. //采用以下方式新增
  29. var redirectTo = CMS_SystemConfig.VirtualDirectoryPath + "/OpenObject/OpenObjectBatchAdd" + "?MNU=" + mnu;
  30. $.popupTopWindow('开放对象新增', redirectTo, 800, 530, reload, null);
  31. }
  32. }
  33. //修改
  34. function StudentEditObject_Edit() {
  35. var d = validChoose();
  36. if (d.length == 0) {
  37. $.messager.alert("系统信息", "请选择您要修改的信息。");
  38. return;
  39. }
  40. if (d.length > 1) {
  41. $.messager.alert("系统提示", "只能选择单个记录进行修改。");
  42. return;
  43. }
  44. var redirectTo = url + "?studentEditObjectID=" + d + "&MNU=" + mnu + "&type=edit";
  45. $.popupTopWindow('开放对象修改', redirectTo, 600, 250, null, null);
  46. }
  47. //查看明细
  48. function edit(rowindex, rowdata) {
  49. var redirectTo = url + "?studentEditObjectID=" + rowdata.StudentEditObjectsID + "&MNU=" + mnu + "&type=detail";
  50. $.popupTopWindow('开放对象明细', redirectTo, 600, 250, null, null);
  51. }
  52. //删除
  53. function StudentEditObject_Delete() {
  54. var d = validChoose().join(',');
  55. if (d == "") {
  56. $.messager.alert("系统提示", "请选择您要删除的信息。");
  57. return;
  58. }
  59. $.messager.confirm("系统提示", "您确定要删除选择的信息?", function (r) {
  60. if (r) {
  61. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/OpenObject/Delete', { studentEditObjectIDs: d }, function (data) {
  62. if (data.IsSuccess) {
  63. $.messager.alert("系统提示", data.Message);
  64. $("#dgStudentEditObjectList").cmsXDataTable('load');
  65. } else {
  66. $.messager.alert("系统提示", data.Message);
  67. }
  68. });
  69. }
  70. });
  71. }
  72. //设置列颜色为红色
  73. function SetRedColumn(index, row, value) {
  74. return " <span style=\"color: red;\">" + value + "</span>";
  75. }
  76. //导出Excel
  77. function StudentEditObject_Export() {
  78. $("#formQuery").submit();
  79. }