task.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="renderer" content="webkit|ie-comp|ie-stand">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  7. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="Cache-Control" content="no-siteapp" />
  9. <!--[if lt IE 9]>
  10. <script type="text/javascript" src="${ctx}/assets/lib/html5.js"></script>
  11. <script type="text/javascript" src="${ctx}/assets/lib/respond.min.js"></script>
  12. <script type="text/javascript" src="${ctx}/assets/lib/PIE_IE678.js"></script>
  13. <![endif]-->
  14. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui/css/H-ui.min.css" />
  15. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/H-ui.admin.css" />
  16. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/Hui-iconfont/1.0.7/iconfont.css" />
  17. <link rel="stylesheet" type="text/css" href="${ctx}/assets/lib/icheck/icheck.css" />
  18. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/skin/default/skin.css" id="skin" />
  19. <link rel="stylesheet" type="text/css" href="${ctx}/assets/static/h-ui.admin/css/style.css" />
  20. <script type="text/ecmascript" src="${ctx}/assets/lib/jquery/1.9.1/jquery.js"></script>
  21. <script type="text/javascript" src="${ctx}/assets/static/h-ui/js/H-ui.js"></script>
  22. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqueryui/jquery-ui.css" />
  23. <link rel="stylesheet" type="text/css" media="screen" href="${ctx}/assets/lib/jqgrid/css/ui.jqgrid.css" />
  24. <script type="text/ecmascript" src="${ctx}/assets/lib/jqueryui/jquery-ui.js"></script>
  25. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/i18n/grid.locale-cn.js"></script>
  26. <script type="text/ecmascript" src="${ctx}/assets/lib/jqgrid/js/jquery.jqGrid.min.js"></script>
  27. <script type="text/javascript" src="${ctx}/assets/js/base.js"></script>
  28. <script type="text/javascript" src="${ctx}/assets/lib/layer/3.0.3/layer.js"></script>
  29. <!--[if IE 6]>
  30. <script type="text/javascript" src="${ctx}/assets/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
  31. <script>DD_belatedPNG.fix('*');</script>
  32. <![endif]-->
  33. <script type="text/javascript">
  34. $(function() {
  35. $(window).resize(function(){
  36. $("#jqGrid").setGridWidth($(window).width()-40); 
  37. });
  38. $("#jqGrid").jqGrid({
  39. url : '${ctx}/myconsole/task/getByPage',
  40. editurl:"${ctx}/myconsole/task/saveOrUpdate",
  41. mtype : "POST",
  42. datatype : "json",
  43. prmNames:{id:"keyid"},
  44. caption:'定时任务',
  45. colModel : [ {
  46. label : '任务编号',
  47. name : 'keyid',
  48. hidden : true,
  49. key : true,
  50. width : 50,
  51. }, {
  52. label : '任务名称',
  53. name : 'taskname',
  54. editable: true,
  55. width : 80,
  56. editoptions: {
  57. size:50,
  58. maxlength: 32
  59. }
  60. },{
  61. label : '任务描述',
  62. name : 'taskdesc',
  63. editable: true,
  64. edittype : "textarea",
  65. editoptions: {
  66. size:50,
  67. maxlength: 500,
  68. rows:"5",
  69. cols:"53"
  70. }
  71. }, {
  72. label : '任务状态',
  73. name : 'taskstate',
  74. editable: true,
  75. formatter:"select",
  76. edittype: "select",
  77. editoptions: {
  78. value: "true:启用;false:停用"
  79. },
  80. stype:"select",
  81. searchoptions:{
  82. value: "true:启用;false:停用"
  83. },
  84. width : 80,
  85. }, {
  86. label : 'cron表达式',
  87. name : 'taskcron',
  88. editable: true,
  89. width : 80,
  90. editoptions: {
  91. size:50,
  92. maxlength: 32
  93. }
  94. }, {
  95. label : '执行类',
  96. name : 'taskclass',
  97. editable: true,
  98. width : 80,
  99. editoptions: {
  100. size:50,
  101. maxlength: 120
  102. }
  103. }, {
  104. label : '执行参数',
  105. name : 'taskdatamap',
  106. editable: true,
  107. width : 80,
  108. formoptions:{
  109. elmsuffix:"Map类型的JSON字符串",
  110. }
  111. },{
  112. label : '操作',
  113. name:'operMod',
  114. index:'operMod',
  115. align:"center",
  116. width:"40",
  117. formatter: function (cellvalue, options, rowdata) {
  118. var html = "<button class='btn btn-success radius size-S' onclick=execution('"+rowdata.keyid+"')>立即执行</button>";
  119. return html;
  120. }
  121. }],
  122. rownumbers : true,//添加左侧行号
  123. viewrecords : true,//是否在浏览导航栏显示记录总数
  124. rowNum : 10,//每页显示记录数
  125. rowList : [10,15,20,30,40,50 ],//用于改变显示行数的下拉列表框的元素数组。
  126. autowidth : true,
  127. height : 'auto',
  128. pager : "#jqGridPager"
  129. });
  130. $('#jqGrid').navGrid('#jqGridPager',
  131. // the buttons to appear on the toolbar of the grid
  132. {
  133. edit : true,
  134. add : true,
  135. del : true,
  136. search : true,
  137. refresh : true,
  138. view : true,
  139. position : "left",
  140. cloneToTop : true
  141. },
  142. // options for the Edit Dialog
  143. {
  144. recreateForm : true,
  145. checkOnUpdate : true,
  146. checkOnSubmit : true,
  147. closeAfterEdit : true,
  148. onInitializeForm:function(formid) {
  149. },
  150. serializeEditData: function(postdata) {
  151. //myconsole.log(postdata);
  152. $.each(postdata,function (index, value) {
  153. //myconsole.log(index);
  154. if(index!="jqGrid_id" && index!="oper" && index!="keyid"){
  155. modifyJosnKey(postdata,index,"task."+index);
  156. }
  157. if(index=="keyid"){
  158. postdata["task."+index]=value
  159. }
  160. })
  161. //myconsole.log(postdata);
  162. return postdata;
  163. },
  164. afterSubmit: function (response, postdata) {
  165. // console.log(response);
  166. var res=eval('(' + response.responseText + ')');
  167. layer.msg(res.msg);
  168. return [res.state,res.msg,''];
  169. },
  170. errorTextFormat : function(data) {
  171. return 'Error: ' + data.responseText
  172. }
  173. },
  174. // options for the Add Dialog
  175. {
  176. closeAfterAdd : true,
  177. recreateForm : true,
  178. beforeSubmit: function(postdata, formid){
  179. $.each(postdata,function (index, value) {
  180. if(index!="jqGrid_id" && index!="oper"){
  181. modifyJosnKey(postdata,index,"task."+index);
  182. }
  183. })
  184. return[true,''];
  185. },
  186. afterSubmit: function (response, postdata) {
  187. // console.log(response);
  188. var res=eval('(' + response.responseText + ')');
  189. layer.msg(res.msg);
  190. return [res.state,res.msg,''];
  191. },
  192. errorTextFormat : function(data) {
  193. return 'Error: ' + data.responseText
  194. }
  195. },
  196. // options for the Delete Dailog
  197. {
  198. errorTextFormat : function(data) {
  199. return 'Error: ' + data.responseText
  200. }
  201. },{
  202. // search options 这里支持多条件查询
  203. multipleSearch: true,
  204. sopt:['eq','ne','cn','nc','lt','le','gt','ge'],
  205. afterSubmit: function(r, data) {
  206. var messageString = r.responseText;
  207. var mesObj = eval('(' + messageString + ')');
  208. return [mesObj.state, mesObj.message];
  209. }
  210. }
  211. );
  212. })
  213. function execution(taskID){
  214. $.post("${ctx}/myconsole/task/execution",{"taskID":taskID},function(data){
  215. var msg="执行失败";
  216. if(data=="true"){
  217. msg="执行成功";
  218. }
  219. layer.msg(msg);
  220. })
  221. }
  222. </script>
  223. <title>我的桌面</title>
  224. </head>
  225. <body>
  226. <div class="page-container">
  227. <table id="jqGrid"></table>
  228. <div id="jqGridPager"></div>
  229. </div>
  230. <footer class="footer mt-20">
  231. <div class="container">
  232. <p></p>
  233. </div>
  234. </footer>
  235. </body>
  236. </html>