vipuser.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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: 'vipuser/index/vip_id/' + Config.vip_id + location.search,
  8. // add_url: 'vipuser/add',
  9. // edit_url: 'vipuser/edit',
  10. // del_url: 'vipuser/del',
  11. // multi_url: 'vipuser/multi',
  12. // import_url: 'vipuser/import',
  13. table: 'user',
  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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. showToggle: false,
  25. showColumns: false,
  26. showExport: false,
  27. columns: [
  28. [
  29. {checkbox: true},
  30. {field: 'id', title: __('Id')},
  31. {field: 'username', title: __('Username'), operate: 'LIKE'},
  32. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  33. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  34. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  35. {field: 'money', title: __('Money'), operate: 'LIKE'},
  36. {field: 'realname', title: __('Realname'), operate: 'LIKE'},
  37. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"2":__('Gender 2')}, formatter: Table.api.formatter.normal},
  38. {field: 'birthday', title: __('Birthday')},
  39. {field: 'idcard', title: __('Idcard'), operate: 'LIKE'},
  40. {field: 'passport', title: __('Passport'), operate: 'LIKE'},
  41. {field: 'emergencycontact', title: __('Emergencycontact'), operate: 'LIKE'},
  42. {field: 'contactmobile', title: __('Contactmobile'), operate: 'LIKE'},
  43. {field: 'outdoorduration', title: __('Outdoorduration'), operate: 'LIKE'},
  44. {field: 'invite_no', title: __('Invite_no'), operate: 'LIKE'},
  45. {field: 'growthvalue', title: __('Growthvalue')},
  46. {field: 'growthlevel', title: __('Growthlevel')},
  47. {field: 'experiencelevel', title: __('Experiencelevel')},
  48. {field: 'experiencetime', title: __('Experiencetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  49. {field: 'maxlevel', title: __('Maxlevel')},
  50. {field: 'freenumber', title: __('Freenumber')},
  51. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
  52. buttons: [
  53. {
  54. name: 'giveout',
  55. text: '发放',
  56. title: __('发放'),
  57. extend: 'data-area=\'["85%", "85%"]\'',
  58. classname: 'btn btn-xs btn-success btn-ajax',
  59. icon: 'fa fa-pencil',
  60. confirm: '确认发放?',
  61. url: 'vipuser/giveout/vip_id/' + Config.vip_id,
  62. refresh: true,
  63. // success: function (data, ret) {
  64. // // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data));
  65. // Layer.alert(ret.msg);
  66. // //如果需要阻止成功提示,则必须使用return false;
  67. // return false;
  68. // },
  69. // error: function (data, ret) {
  70. // // console.log(data, ret);
  71. // Layer.alert(ret.msg);
  72. // return false;
  73. // },
  74. // callback: function (data) {
  75. // Layer.alert("接收到回传数据:" + JSON.stringify(data), {title: "回传数据"});
  76. // },
  77. // visible: function (row) {
  78. // if (row.status == 0) {
  79. // return true;
  80. // } else {
  81. // return false;
  82. // }
  83. // }
  84. }
  85. ]
  86. }
  87. ]
  88. ]
  89. });
  90. // 为表格绑定事件
  91. Table.api.bindevent(table);
  92. },
  93. add: function () {
  94. Controller.api.bindevent();
  95. },
  96. edit: function () {
  97. Controller.api.bindevent();
  98. },
  99. api: {
  100. bindevent: function () {
  101. Form.api.bindevent($("form[role=form]"));
  102. }
  103. }
  104. };
  105. return Controller;
  106. });