You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

161 lines
7.1 KiB

  1. /* * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  2. * Copyright (c) 2013-2018 上海力软信息技术有限公司
  3. * 创建人:超级管理员
  4. * 日 期:2018-10-19 16:07
  5. * 描 述:任务计划模板
  6. */
  7. var selectedRow;
  8. var refreshGirdData;
  9. var bootstrap = function ($, learun) {
  10. "use strict";
  11. var page = {
  12. init: function () {
  13. page.initGird();
  14. page.bind();
  15. },
  16. bind: function () {
  17. // 查询
  18. $('#btn_Search').on('click', function () {
  19. var keyword = $('#txt_Keyword').val();
  20. page.search({ keyWord: keyword });
  21. });
  22. // 刷新
  23. $('#lr_refresh').on('click', function () {
  24. location.reload();
  25. });
  26. // 新增
  27. $('#lr_add').on('click', function () {
  28. learun.layerForm({
  29. id: 'form',
  30. title: '新增任务',
  31. url: top.$.rootUrl + '/LR_TaskScheduling/TSScheme/Form',
  32. width: 700,
  33. height: 610,
  34. btn: null
  35. });
  36. });
  37. // 编辑
  38. $('#lr_edit').on('click', function () {
  39. var keyValue = $('#gridtable').jfGridValue('F_Id');
  40. if (learun.checkrow(keyValue)) {
  41. learun.layerForm({
  42. id: 'form',
  43. title: '编辑任务',
  44. url: top.$.rootUrl + '/LR_TaskScheduling/TSScheme/Form?keyValue=' + keyValue,
  45. width: 700,
  46. height: 610,
  47. btn: null
  48. });
  49. }
  50. });
  51. // 删除
  52. $('#lr_delete').on('click', function () {
  53. var keyValue = $('#gridtable').jfGridValue('F_Id');
  54. if (learun.checkrow(keyValue)) {
  55. learun.layerConfirm('是否确认删除该项!', function (res) {
  56. if (res) {
  57. learun.deleteForm(top.$.rootUrl + '/LR_TaskScheduling/TSScheme/DeleteForm', { keyValue: keyValue }, function () {
  58. refreshGirdData();
  59. });
  60. }
  61. });
  62. }
  63. });
  64. ///暂停任务
  65. $('#lr_disabled').on('click', function () {
  66. var processId = $('#gridtable').jfGridValue('F_PorcessId');
  67. selectedRow = $('#gridtable').jfGridGet('rowdata');
  68. if (learun.checkrow(processId)) {
  69. if (selectedRow.F_State == "2" || selectedRow.F_State == "1") {
  70. learun.layerConfirm('是否确认暂停该任务!', function (res,_index) {
  71. if (res) {
  72. learun.loading(true, '暂停任务中...');
  73. learun.httpAsync('Post', top.$.rootUrl + '/LR_TaskScheduling/TSScheme/PauseJob', { processId: processId }, function (data) {
  74. learun.loading(false);
  75. refreshGirdData();
  76. });
  77. top.layer.close(_index);
  78. }
  79. });
  80. } else {
  81. learun.alert.error('当前任务状态下,无法暂停任务');
  82. }
  83. }
  84. });
  85. ///重新启动任务
  86. $('#lr_enabled').on('click', function () {
  87. var processId = $('#gridtable').jfGridValue('F_PorcessId');
  88. selectedRow = $('#gridtable').jfGridGet('rowdata');
  89. if (learun.checkrow(processId)) {
  90. if (selectedRow.F_State == "3") {
  91. learun.layerConfirm('是否确认启动该任务!', function (res, _index) {
  92. if (res) {
  93. if (res) {
  94. learun.loading(true, '启动任务中...');
  95. learun.httpAsync('Post', top.$.rootUrl + '/LR_TaskScheduling/TSScheme/ResumeJob', { processId: processId }, function (data) {
  96. learun.loading(false);
  97. refreshGirdData();
  98. });
  99. top.layer.close(_index);
  100. }
  101. }
  102. });
  103. } else {
  104. learun.alert.error('当前任务状态下,无法启动任务');
  105. }
  106. }
  107. });
  108. },
  109. initGird: function () {
  110. $('#gridtable').lrAuthorizeJfGrid({
  111. url: top.$.rootUrl + '/LR_TaskScheduling/TSScheme/GetPageList',
  112. headData: [
  113. { label: '名称', name: 'F_Name', width: 200, align: "left" },
  114. {
  115. label: '状态', name: 'F_State', width: 80, align: "center",
  116. formatter: function (cellvalue) {
  117. if (cellvalue == 1) {
  118. return '<span class=\"label label-primary\" style=\"cursor: pointer;\">待执行</span>';
  119. } else if (cellvalue == 2) {
  120. return '<span class=\"label label-success\" style=\"cursor: pointer;\">运行中</span>';
  121. }
  122. else if (cellvalue == 3) {
  123. return '<span class=\"label label-default\" style=\"cursor: pointer;\">暂停中</span>';
  124. }
  125. else if (cellvalue == 4) {
  126. return '<span class=\"label label-info\" style=\"cursor: pointer;\">已结束</span>';
  127. }
  128. }
  129. },
  130. {
  131. label: '开始时间', name: 'F_BeginTime', width: 140, align: "center",
  132. formatter: function (cellvalue) {
  133. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  134. }
  135. },
  136. {
  137. label: '结束时间', name: 'F_EndTime', width: 140, align: "center",
  138. formatter: function (cellvalue) {
  139. return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm:ss');
  140. }
  141. },
  142. { label: '说明', name: 'F_Description', width: 200, align: "left" },
  143. ],
  144. mainId: 'F_Id',
  145. sidx:'',
  146. isPage: true
  147. });
  148. page.search();
  149. },
  150. search: function (param) {
  151. param = param || {};
  152. $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
  153. }
  154. };
  155. refreshGirdData = function () {
  156. page.search();
  157. };
  158. page.init();
  159. }