topicdongtaireport.js 2.8 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: 'topicdongtaireport/index' + location.search,
  8. add_url: 'topicdongtaireport/add',
  9. // edit_url: 'topicdongtaireport/edit',
  10. del_url: 'topicdongtaireport/del',
  11. multi_url: 'topicdongtaireport/multi',
  12. import_url: 'topicdongtaireport/import',
  13. table: 'topic_dongtai_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. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. // {field: 'user_id', title: __('User_id')},
  27. {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
  28. // {field: 'to_user_id', title: __('To_user_id')},
  29. {field: 'dt_id', title: __('Dt_id')},
  30. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  31. {field: 'operate', title: __('Operate'), table: table,
  32. buttons:[
  33. {
  34. name:'dongtaidetail',
  35. text:'查看动态',
  36. title:'查看动态',
  37. icon:'fa fa-exclamation-circle',
  38. classname:'btn btn-xs btn-info btn-dialog',
  39. url:function($row){
  40. return 'topicdongtai/edit/ids/'+ $row.dt_id +'?dialog=1';
  41. },
  42. target:'_self',
  43. }
  44. ],
  45. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  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. });