report.js 3.4 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: 'agent/report/index' + location.search,
  8. // add_url: 'agent/report/add',
  9. // edit_url: 'agent/report/edit',
  10. // del_url: 'agent/report/del',
  11. // multi_url: 'agent/report/multi',
  12. // import_url: 'agent/report/import',
  13. table: 'report',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'id',
  21. sortName: 'id',
  22. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. // {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'type_id', title: __('Type_id')},
  29. {field: 'reporttype.name', title: __('Reporttype.name'), operate: 'LIKE'},
  30. {field: 'user_id', title: __('User_id')},
  31. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  32. {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
  33. {field: 'other_id', title: __('Other_id')},
  34. {field: 'userto.nickname', title: __('Userto.nickname'), operate: 'LIKE'},
  35. {field: 'userto.mobile', title: __('Userto.mobile'), operate: 'LIKE'},
  36. {field: 'content', title: __('Content'), operate: 'LIKE'},
  37. {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  38. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  39. {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'audittime', title: __('Audittime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'auditremark', title: __('Auditremark'), operate: 'LIKE'},
  42. {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  43. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  44. ]
  45. ]
  46. });
  47. // 为表格绑定事件
  48. Table.api.bindevent(table);
  49. },
  50. add: function () {
  51. Controller.api.bindevent();
  52. },
  53. edit: function () {
  54. Controller.api.bindevent();
  55. },
  56. api: {
  57. bindevent: function () {
  58. Form.api.bindevent($("form[role=form]"));
  59. }
  60. }
  61. };
  62. return Controller;
  63. });