imlogc2c.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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: 'imlogc2c/index' + location.search,
  8. add_url: 'imlogc2c/add',
  9. // edit_url: 'imlogc2c/edit',
  10. del_url: 'imlogc2c/del',
  11. multi_url: 'imlogc2c/multi',
  12. import_url: 'imlogc2c/import',
  13. table: 'imlog_c2c',
  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: 'fromuser.nickname', title: __('fromuser.nickname'), operate: 'LIKE'},
  29. {field: 'MsgFromPlatform', title: __('Msgfromplatform'), operate: 'LIKE'},
  30. // {field: 'MsgRandom', title: __('Msgrandom'), operate: 'LIKE'},
  31. // {field: 'MsgSeq', title: __('Msgseq'), operate: 'LIKE'},
  32. {field: 'MsgTimestamp', title: __('Msgtimestamp'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  33. {field: 'To_Account', title: __('To_account')},
  34. {field: 'touser.nickname', title: __('touser.nickname'), operate: 'LIKE'},
  35. {field: 'MsgType', title: '类型', searchList: Config.typeList, formatter: Table.api.formatter.status},
  36. {field: 'MsgInfo', title: __('MsgInfo'), operate: false,events: Table.api.events.image,formatter: function (value,row,index){
  37. if (row.MsgType == 'TIMTextElem'){
  38. return value;
  39. }
  40. if (row.MsgType == 'TIMCustomElem'){
  41. return value;
  42. }
  43. if (row.MsgType == 'TIMSoundElem'){
  44. return Table.api.formatter.audio(value,row,index);
  45. }
  46. if (row.MsgType == 'TIMImageElem'){
  47. return Table.api.formatter.image(value,row,index);
  48. }
  49. if (row.MsgType == 'TIMVideoFileElem'){
  50. return Table.api.formatter.video(value,row,index);
  51. }
  52. return value;
  53. },
  54. cellStyle: {css: {
  55. "white-space": "break-spaces",
  56. "max-width": "200px",
  57. "min-width": "200px",
  58. "line-height": "24px",
  59. "text-align": "left !important"
  60. }
  61. }
  62. },
  63. {field: 'operate', title: __('Operate'),
  64. /*buttons:[
  65. {
  66. name:'showbody',
  67. text:'消息体',
  68. title:'消息体',
  69. icon:'fa fa-exclamation-circle',
  70. classname:'btn btn-xs btn-info btn-dialog',
  71. url:'imlogc2c/showbody/id/{ids}?dialog=1',
  72. target:'_self',
  73. extend: 'data-area=["90%","90%"]'
  74. },
  75. ],*/
  76. table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  77. ]
  78. ]
  79. });
  80. // 为表格绑定事件
  81. Table.api.bindevent(table);
  82. },
  83. add: function () {
  84. Controller.api.bindevent();
  85. },
  86. edit: function () {
  87. Controller.api.bindevent();
  88. },
  89. showbody: function () {
  90. Controller.api.bindevent();
  91. },
  92. api: {
  93. bindevent: function () {
  94. Form.api.bindevent($("form[role=form]"));
  95. }
  96. }
  97. };
  98. return Controller;
  99. });