user.js 6.0 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: 'user/user/index' + location.search,
  8. add_url: 'user/user/add',
  9. edit_url: 'user/user/edit',
  10. // del_url: 'user/user/del',
  11. multi_url: 'user/user/multi',
  12. import_url: 'user/user/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. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'id', title: __('Id')},
  26. // {field: 'intro_uid', title: __('Intro_uid')},
  27. {field: 'username', title: __('Username'), operate: 'LIKE'},
  28. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  29. {field: 'introcode', title: __('Introcode'), operate: 'LIKE'},
  30. // {field: 'password', title: __('Password'), operate: 'LIKE'},
  31. // {field: 'salt', title: __('Salt'), operate: 'LIKE'},
  32. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  33. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  34. {field: 'gender', title: __('Gender'), searchList: {"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  35. // {field: 'height', title: __('Height'), operate: 'LIKE'},
  36. // {field: 'weight', title: __('Weight'), operate: 'LIKE'},
  37. // {field: 'birthday', title: __('Birthday')},
  38. // {field: 'bio', title: __('Bio'), operate: 'LIKE'},
  39. // {field: 'audio_bio', title: __('Audio_bio'), operate: 'LIKE'},
  40. {field: 'idcard_status', title: __('Idcard_status'), searchList: {"-1":__('Idcard_status -1'),"0":__('Idcard_status 0'),"1":__('Idcard_status 1'),"2":__('Idcard_status 2')}, formatter: Table.api.formatter.status},
  41. // {field: 'successions', title: __('Successions')},
  42. // {field: 'maxsuccessions', title: __('Maxsuccessions')},
  43. // {field: 'prevtime', title: __('Prevtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. // {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  45. // {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
  46. // {field: 'loginfailure', title: __('Loginfailure')},
  47. // {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
  48. // {field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  49. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  50. // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  51. // {field: 'token', title: __('Token'), operate: 'LIKE'},
  52. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
  53. // {field: 'verification', title: __('Verification'), operate: 'LIKE'},
  54. // {field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
  55. // {field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
  56. // {field: 'cityname', title: __('Cityname'), operate: 'LIKE'},
  57. // {field: 'photo_images', title: __('Photo_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  58. // {field: 'tag_ids', title: __('Tag_ids'), operate: 'LIKE'},
  59. // {field: 'hide_is_finishinfo', title: __('Hide_is_finishinfo'), searchList: {"1":__('Hide_is_finishinfo 1'),"0":__('Hide_is_finishinfo 0')}, formatter: Table.api.formatter.normal},
  60. // {field: 'wechat_openid', title: __('Wechat_openid'), operate: 'LIKE'},
  61. // {field: 'is_active', title: __('Is_active'), searchList: {"1":__('Is_active 1'),"0":__('Is_active 0')}, formatter: Table.api.formatter.normal},
  62. {field: 'attribute', title: __('Attribute'), operate: 'LIKE'},
  63. {field: 'shoesize', title: __('Shoesize'), operate: 'LIKE'},
  64. {field: 'is_tuijian', title: __('Is_tuijian'), searchList: {"1":__('Is_tuijian 1'),"0":__('Is_tuijian 0')}, formatter: Table.api.formatter.normal},
  65. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  66. ]
  67. ]
  68. });
  69. // 为表格绑定事件
  70. Table.api.bindevent(table);
  71. },
  72. add: function () {
  73. Controller.api.bindevent();
  74. },
  75. edit: function () {
  76. Controller.api.bindevent();
  77. },
  78. api: {
  79. bindevent: function () {
  80. Form.api.bindevent($("form[role=form]"));
  81. }
  82. }
  83. };
  84. return Controller;
  85. });