imloggroup.js 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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: 'imloggroup/index' + location.search,
  8. add_url: 'imloggroup/add',
  9. // edit_url: 'imloggroup/edit',
  10. // del_url: 'imloggroup/del',
  11. multi_url: 'imloggroup/multi',
  12. import_url: 'imloggroup/import',
  13. table: 'imlog_group',
  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: 'ClientIP', title: __('Clientip'), operate: 'LIKE'},
  27. {field: 'From_Account', title: __('From_account')},
  28. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  29. {field: 'GroupId', title: __('Groupid')},
  30. {field: 'party.party_name', title: __('Party.party_name'), operate: 'LIKE'},
  31. // {field: 'MsgBody', title: __('Msgbody')},
  32. {field: 'MsgFromPlatform', title: __('Msgfromplatform'), operate: 'LIKE'},
  33. // {field: 'MsgSeq', title: __('Msgseq'), operate: 'LIKE'},
  34. {field: 'MsgTimestamp', title: __('Msgtimestamp'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  35. {field: 'MsgType', title: __('Msgtype'), operate: 'LIKE'},
  36. {field: 'MsgInfo', title: __('Msginfo'), operate: 'LIKE'},
  37. // {field: 'party.room_type', title: __('Party.room_type')},
  38. {field: 'operate', title: __('Operate'),
  39. buttons:[
  40. {
  41. name:'showbody',
  42. text:'消息体',
  43. title:'消息体',
  44. icon:'fa fa-exclamation-circle',
  45. classname:'btn btn-xs btn-info btn-dialog',
  46. url:'imloggroup/showbody/id/{ids}?dialog=1',
  47. target:'_self',
  48. extend: 'data-area=["90%","90%"]'
  49. },
  50. ],
  51. table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  52. ]
  53. ]
  54. });
  55. // 为表格绑定事件
  56. Table.api.bindevent(table);
  57. },
  58. add: function () {
  59. Controller.api.bindevent();
  60. },
  61. edit: function () {
  62. Controller.api.bindevent();
  63. },
  64. showbody: function () {
  65. Controller.api.bindevent();
  66. },
  67. api: {
  68. bindevent: function () {
  69. Form.api.bindevent($("form[role=form]"));
  70. }
  71. }
  72. };
  73. return Controller;
  74. });