interfacecall.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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: 'exception/interfacecall/index' + location.search,
  8. add_url: 'exception/interfacecall/add',
  9. edit_url: '',
  10. del_url: '',
  11. multi_url: 'exception/interfacecall/multi',
  12. table: 'interface_call',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. sortOrder: 'asc',
  22. columns: [
  23. [
  24. {field: 'name', title: __('Name')},
  25. {field: 'institution', title: __('Institution')},
  26. {field: 'times', title: __('Times')},
  27. {field: 'datetime', title: __('Datetime'), operate:'RANGE', addclass:'datetimerange'},
  28. {
  29. field: 'operate',
  30. title: __('Operate'),
  31. table: table,
  32. events: Table.api.events.operate,
  33. formatter: Table.api.formatter.operate,
  34. buttons: [
  35. {
  36. name : 'detail',
  37. title : '详情',
  38. text : '详情',
  39. extend : 'data-toggle="tooltip"',
  40. icon : 'fa fa-th-list',
  41. classname: 'btn btn-xs btn-warning btn-dialog',
  42. url : 'exception/interfacecall/edit',
  43. }
  44. ]
  45. }
  46. ]
  47. ]
  48. });
  49. // 为表格绑定事件
  50. Table.api.bindevent(table);
  51. },
  52. add: function () {
  53. Controller.api.bindevent();
  54. },
  55. edit: function () {
  56. Controller.api.bindevent();
  57. },
  58. api: {
  59. bindevent: function () {
  60. Form.api.bindevent($("form[role=form]"));
  61. }
  62. }
  63. };
  64. return Controller;
  65. });