invcode.js 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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: 'csminvite/invcode/index' + location.search,
  8. add_url: 'csminvite/invcode/add',
  9. edit_url: 'csminvite/invcode/edit',
  10. del_url: 'csminvite/invcode/del',
  11. multi_url: 'csminvite/invcode/multi',
  12. table: 'csminvite_invcode',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. columns: [
  22. [
  23. {checkbox: true},
  24. {field: 'id', title: __('Id')},
  25. {field: 'name', title: __('Name')},
  26. {field: 'effectbegintime', title: __('Effectbegintime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  27. {field: 'effectendtime', title: __('Effectendtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  28. {field: 'status', title: __('Status'), searchList: {"normal":__('Normal'),"hidden":__('Hidden')}, formatter: Table.api.formatter.status},
  29. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  30. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  31. // {field: 'b1', title: __('B1')},
  32. // {field: 'b2', title: __('B2')},
  33. // {field: 'b3', title: __('B3')},
  34. // {field: 'b4', title: __('B4')},
  35. // {field: 'b5', title: __('B5')},
  36. // {field: 'b6', title: __('B6')},
  37. // {field: 'b7', title: __('B7')},
  38. // {field: 'b8', title: __('B8')},
  39. // {field: 'b9', title: __('B9')},
  40. {
  41. field: 'operate',
  42. title: __('Operate'),
  43. table: table, events: Table.api.events.operate,
  44. formatter: Table.api.formatter.operate,
  45. //formatter: Table.api.formatter.buttons,
  46. buttons: [
  47. {
  48. name: 'confinfos',
  49. text: __('邀请码列表'),
  50. classname: 'btn btn-xs btn-success btn-click',
  51. icon: 'fa fa-file',
  52. click: function (res, row) {
  53. window.open("../csminvite/invcodeuser?parentid=" + row.id);
  54. },
  55. },
  56. {
  57. name: 'confusers',
  58. text: __('生成邀请码'),
  59. classname: 'btn btn-xs btn-danger btn-dialog',
  60. icon: 'fa fa-file',
  61. url: 'csminvite/invcode/addinvcode?ids={ids}',
  62. refresh: true,
  63. visible: function (row) {
  64. return true;
  65. }
  66. }
  67. ]
  68. }
  69. ]
  70. ]
  71. });
  72. // 为表格绑定事件
  73. Table.api.bindevent(table);
  74. },
  75. add: function () {
  76. Controller.api.bindevent();
  77. },
  78. edit: function () {
  79. Controller.api.bindevent();
  80. },
  81. addinvcode: function () {
  82. Controller.api.bindevent();
  83. },
  84. api: {
  85. bindevent: function () {
  86. Form.api.bindevent($("form[role=form]"));
  87. }
  88. }
  89. };
  90. return Controller;
  91. });