university_event_apply.js 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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: 'university_event_apply/index' + location.search,
  8. // add_url: 'university_event_apply/add',
  9. // edit_url: 'university_event_apply/edit',
  10. del_url: 'university_event_apply/del',
  11. multi_url: 'university_event_apply/multi',
  12. import_url: 'university_event_apply/import',
  13. table: 'university_event_apply',
  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. showToggle: false,// 禁用视图切换
  23. search:false,// 禁用默认搜索框
  24. fixedColumns: true,
  25. fixedRightNumber: 1,
  26. columns: [
  27. [
  28. {checkbox: true},
  29. {field: 'id', title: __('Id')},
  30. {field: 'user_id', title: __('User_id')},
  31. {field: 'event_id', title: __('Event_id')},
  32. {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
  33. {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  34. {field: 'events.name', title: __('Events.name'), operate: 'LIKE'},
  35. {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
  36. {field: 'pay_amount', title: __('报名费用'), operate:'BETWEEN'},
  37. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
  38. {field: 'num', title: __('Num')},
  39. // {field: 'is_pay', title: __('Is_pay'), searchList: {"1":__('Is_pay 1'),"0":__('Is_pay 0')}, formatter: Table.api.formatter.normal},
  40. // {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. // {field: 'cancel_time', title: __('Cancel_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {
  45. field: 'operate',
  46. title: __('Operate'),
  47. table: table,
  48. events: Table.api.events.operate,
  49. formatter: Table.api.formatter.operate,
  50. buttons: [
  51. {
  52. name: 'info',
  53. text: '报名信息',
  54. title: '报名信息',
  55. originalTitle:'报名信息',
  56. classname: 'btn btn-xs btn-success btn-dialog btn-selectuser',
  57. // icon: 'fa fa-jpy',
  58. url: 'university_event_apply_info/index/order_no/{order_no}?dialog=1',
  59. callback: function (data) {
  60. Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  61. }
  62. }
  63. ]
  64. }
  65. ]
  66. ]
  67. });
  68. // 为表格绑定事件
  69. Table.api.bindevent(table);
  70. },
  71. add: function () {
  72. Controller.api.bindevent();
  73. },
  74. edit: function () {
  75. Controller.api.bindevent();
  76. },
  77. api: {
  78. bindevent: function () {
  79. Form.api.bindevent($("form[role=form]"));
  80. }
  81. }
  82. };
  83. return Controller;
  84. });