datacall.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/datacall/index' + location.search,
  8. add_url: '',
  9. edit_url: '',
  10. del_url: '',
  11. multi_url: 'exception/datacall/multi',
  12. table: 'data_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: 'data_type', title: __('Data_type')},
  25. {field: 'institution', title: __('Institution')},
  26. {field: 'data_range', title: __('Data_range')},
  27. {field: 'datetime', title: __('Datetime'), operate:'RANGE', addclass:'datetimerange'},
  28. {field: 'times', title: __('Times')},
  29. {
  30. field: 'operate',
  31. title: __('Operate'),
  32. table: table,
  33. events: Table.api.events.operate,
  34. formatter: Table.api.formatter.operate,
  35. buttons: [
  36. {
  37. name : 'detail',
  38. title : '详情',
  39. text : '详情',
  40. extend : 'data-toggle="tooltip"',
  41. icon : 'fa fa-th-list',
  42. classname: 'btn btn-xs btn-warning btn-dialog',
  43. url : 'exception/datacall/edit',
  44. }
  45. ]
  46. }
  47. ]
  48. ]
  49. });
  50. // 为表格绑定事件
  51. Table.api.bindevent(table);
  52. },
  53. add: function () {
  54. Controller.api.bindevent();
  55. },
  56. edit: function () {
  57. Controller.api.bindevent();
  58. },
  59. api: {
  60. bindevent: function () {
  61. Form.api.bindevent($("form[role=form]"));
  62. }
  63. }
  64. };
  65. return Controller;
  66. });