note.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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: 'messages/note/index' + location.search,
  8. table: 'short_link',
  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. columns: [
  18. [
  19. {checkbox: true},
  20. {field: 'id', title: __('Id'),searchable:false},
  21. {field: 'code', title: __('Code'),searchable:false},
  22. {field: 'createdAt', title: '发送时间', operate:'RANGE', addclass:'datetimerange'},
  23. {field: 'overdueTime', title: '存储时间(天)',searchable:false},
  24. {field: 'phone', title: __('Phone')},
  25. {field: 'send_message', title:'是否已发送短信',formatter: Controller.api.formatter.send,searchable:false},
  26. {field: 'source', title: '短信发送时机',searchable:false,formatter: Controller.api.formatter.source},
  27. // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  28. ]
  29. ]
  30. });
  31. // 为表格绑定事件
  32. Table.api.bindevent(table);
  33. },
  34. add: function () {
  35. Controller.api.bindevent();
  36. },
  37. edit: function () {
  38. Controller.api.bindevent();
  39. },
  40. api: {
  41. bindevent: function () {
  42. Form.api.bindevent($("form[role=form]"));
  43. },
  44. formatter: {
  45. send: function (value) {
  46. switch (value) {
  47. case '1':
  48. return '是';
  49. case '0':
  50. return '否';
  51. default:
  52. return value;
  53. }
  54. },
  55. source: function (value) {
  56. switch (value) {
  57. case '1':
  58. return '生成检查';
  59. case '2':
  60. return '检查信息同步';
  61. case '3':
  62. return '报告信息同步';
  63. default:
  64. return value;
  65. }
  66. },
  67. }
  68. }
  69. };
  70. return Controller;
  71. });