message.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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: 'send/summary/message/index',
  8. table: 'send_user_group',
  9. }
  10. });
  11. var table = $("#table");
  12. // 初始化表格
  13. table.bootstrapTable({
  14. url: $.fn.bootstrapTable.defaults.extend.index_url,
  15. pk: 'id',
  16. sortName: 'id',
  17. search: false,
  18. columns: [
  19. [
  20. {checkbox: true},
  21. {field: 'id', title: __('ID'), operate: false},
  22. {field: 'message_name', title: __('消息名称'), operate: 'LIKE'},
  23. {
  24. field: 'message_type', title: __('消息类型'),
  25. searchList: {"1": __('文本类型'), "2": __('图文类型'), "3": __('图片消息')},
  26. formatter: function (val, row, index) {
  27. if (val == 1) {
  28. return '文本类型';
  29. } else if (val == 2) {
  30. return '图文类型';
  31. } else {
  32. return '图片消息';
  33. }
  34. }
  35. },
  36. {
  37. field: 'subscription_type',
  38. title: __('发送类型'),
  39. searchList: {"1": __('全部公众号'), "2": __('指定公众号')},
  40. formatter: function (val, row, index) {
  41. if (val == 1) {
  42. return '全部公众号';
  43. } else {
  44. return '指定公众号';
  45. }
  46. }
  47. },
  48. {field: 'send_time', title: __('发送时间'), formatter: Table.api.formatter.datetime, operate: false},
  49. {
  50. field: 'user_count', title: __('预计发送人数'), operate: false,
  51. formatter: function (val, row, index) {
  52. if (row.group_type == 0) {
  53. return '全部用户';
  54. } else {
  55. return val;
  56. }
  57. }
  58. },
  59. {
  60. field: 'uv', title: __('消息点击人数(总/今日)'), operate: false,
  61. formatter: function (val, row, index) {
  62. return val + '(' + row.today_uv + ')';
  63. }
  64. },
  65. {
  66. field: 'amount', title: __('充值金额(总/今日)'), operate: false,
  67. formatter: function (val, row, index) {
  68. return val + '(' + row.today_amount + ')';
  69. }
  70. }
  71. ]
  72. ]
  73. });
  74. // 为表格绑定事件
  75. Table.api.bindevent(table);
  76. },
  77. api: {
  78. bindevent: function () {
  79. Form.api.bindevent($("form[role=form]"));
  80. },
  81. formatter: {
  82. }
  83. }
  84. };
  85. return Controller;
  86. });