crontab_log.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'general/crontab_log/index',
  8. add_url: 'general/crontab_log/add',
  9. edit_url: '',
  10. del_url: 'general/crontab_log/del',
  11. multi_url: 'general/crontab_log/multi',
  12. table: 'crontab'
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. sortName: 'id',
  20. fixedColumns: true,
  21. fixedRightNumber: 1,
  22. columns: [
  23. [
  24. {field: 'state', checkbox: true,},
  25. {field: 'id', title: 'ID'},
  26. {field: 'crontab_id', title: __('Crontab_id'), formatter: Table.api.formatter.search},
  27. {field: 'executetime', title: __('Execute time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  28. {field: 'completetime', title: __('Complete time'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
  29. {field: 'status', title: __('Status'), searchList: Config.statusList, custom: {success: 'success', failure: 'danger', 'inprogress': 'warning'}, formatter: Table.api.formatter.status},
  30. {
  31. field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  32. buttons: [
  33. {
  34. name: "detail",
  35. text: __("Result"),
  36. classname: "btn btn-xs btn-info btn-dialog",
  37. icon: "fa fa-file",
  38. url: "general/crontab_log/detail",
  39. extend: "data-window='parent'"
  40. }
  41. ]
  42. }
  43. ]
  44. ]
  45. });
  46. // 为表格绑定事件
  47. Table.api.bindevent(table);
  48. },
  49. add: function () {
  50. Controller.api.bindevent();
  51. },
  52. edit: function () {
  53. Controller.api.bindevent();
  54. },
  55. api: {
  56. bindevent: function () {
  57. Form.api.bindevent($("form[role=form]"));
  58. },
  59. }
  60. };
  61. return Controller;
  62. });