user.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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: 'group_id', title: __('Group_id')},
  27. {field: 'usergroup.name', title: __('Usergroup.name'), operate: 'LIKE'},
  28. {field: 'intro_uid', title: __('Intro_uid')},
  29. {field: 'agent_id', title: __('Agent_id')},
  30. {field: 'yaoqingtime', title: __('Yaoqingtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  31. {field: 'invite_uid', title: __('Invite_uid')},
  32. {field: 'username', title: __('Username'), operate: 'LIKE'},
  33. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  34. {field: 'agentname', title: __('Agentname'), operate: 'LIKE'},
  35. // {field: 'introcode', title: __('Introcode'), operate: 'LIKE'},
  36. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  37. {field: 'avatar', title: __('Avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
  38. {field: 'gender', title: __('Gender'), searchList: {"-1":__('Gender -1'),"1":__('Gender 1'),"0":__('Gender 0')}, formatter: Table.api.formatter.normal},
  39. // {field: 'height', title: __('Height'), operate: 'LIKE'},
  40. // {field: 'weight', title: __('Weight'), operate: 'LIKE'},
  41. // {field: 'birthday', title: __('Birthday')},
  42. // {field: 'bio', title: __('Bio'), operate: 'LIKE'},
  43. // {field: 'audio_bio', title: __('Audio_bio'), operate: 'LIKE'},
  44. // {field: 'video_bio', title: __('Video_bio'), operate: 'LIKE'},
  45. {field: 'idcard_status', title: __('Idcard_status'), searchList: {"-1":__('Idcard_status -1'),"0":__('Idcard_status 0'),"1":__('Idcard_status 1')}, formatter: Table.api.formatter.status},
  46. {field: 'real_status', title: __('Real_status'), searchList: {"-1":__('Real_status -1'),"0":__('Real_status 0'),"1":__('Real_status 1')}, formatter: Table.api.formatter.status},
  47. // {field: 'logintime', title: __('Logintime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  48. // {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
  49. // {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
  50. // {field: 'jointime', title: __('Jointime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  51. // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  52. // {field: 'token', title: __('Token'), operate: 'LIKE'},
  53. {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"0":__('Status 0'),"-1":__('Status -1')}, formatter: Table.api.formatter.status},
  54. // {field: 'provincename', title: __('Provincename'), operate: 'LIKE'},
  55. // {field: 'cityname', title: __('Cityname'), operate: 'LIKE'},
  56. // {field: 'hide_is_finishinfo', title: __('Hide_is_finishinfo'), searchList: {"1":__('Hide_is_finishinfo 1'),"0":__('Hide_is_finishinfo 0')}, formatter: Table.api.formatter.normal},
  57. // {field: 'wechat_openid', title: __('Wechat_openid'), operate: 'LIKE'},
  58. // {field: 'is_active', title: __('Is_active'), searchList: {"1":__('Is_active 1'),"0":__('Is_active 0')}, formatter: Table.api.formatter.normal},
  59. // {field: 'ios_user_id', title: __('Ios_user_id'), operate: 'LIKE'},
  60. // {field: 'plat_unique_id', title: __('Plat_unique_id'), operate: 'LIKE'},
  61. // {field: 'marital_id', title: __('Marital_id'), operate: 'LIKE'},
  62. // {field: 'job_id', title: __('Job_id'), operate: 'LIKE'},
  63. // {field: 'wages_id', title: __('Wages_id'), operate: 'LIKE'},
  64. // {field: 'suqiu_id', title: __('Suqiu_id'), operate: 'LIKE'},
  65. // {field: 'tag_ids', title: __('Tag_ids'), operate: 'LIKE'},
  66. // {field: 'hobby_ids', title: __('Hobby_ids'), operate: 'LIKE'},
  67. // {field: 'open_match_video', title: __('Open_match_video'), searchList: {"1":__('Open_match_video 1'),"0":__('Open_match_video 0')}, formatter: Table.api.formatter.normal},
  68. // {field: 'open_match_audio', title: __('Open_match_audio'), searchList: {"1":__('Open_match_audio 1'),"0":__('Open_match_audio 0')}, formatter: Table.api.formatter.normal},
  69. // {field: 'match_video_price', title: __('Match_video_price')},
  70. // {field: 'match_audio_price', title: __('Match_audio_price')},
  71. // {field: 'match_typing_price', title: __('Match_typing_price')},
  72. {field: 'jinyantime', title: __('Jinyantime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  73. {field: 'jinyantype', title: __('Jinyantype'), searchList: {"1":__('Jinyantype 1'),"2":__('Jinyantype 2'),"3":__('Jinyantype 3')}, formatter: Table.api.formatter.normal},
  74. // {field: 'is_shouchong', title: __('Is_shouchong'), searchList: {"0":__('Is_shouchong 0'),"1":__('Is_shouchong 1')}, formatter: Table.api.formatter.normal},
  75. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  76. ]
  77. ]
  78. });
  79. // 为表格绑定事件
  80. Table.api.bindevent(table);
  81. },
  82. add: function () {
  83. Controller.api.bindevent();
  84. },
  85. edit: function () {
  86. Controller.api.bindevent();
  87. },
  88. api: {
  89. bindevent: function () {
  90. Form.api.bindevent($("form[role=form]"));
  91. }
  92. }
  93. };
  94. return Controller;
  95. });