user_relation.js 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_relation/index' + location.search,
  8. add_url: 'user_relation/add',
  9. edit_url: 'user_relation/edit',
  10. del_url: 'user_relation/del',
  11. multi_url: 'user_relation/multi',
  12. import_url: 'user_relation/import',
  13. table: 'user_relation',
  14. }
  15. });
  16. var table = $("#table");
  17. // 初始化表格
  18. table.bootstrapTable({
  19. url: $.fn.bootstrapTable.defaults.extend.index_url,
  20. pk: 'user_id',
  21. sortName: 'user_id',
  22. columns: [
  23. [
  24. {checkbox: true},
  25. {field: 'user_id', title: __('User_id')},
  26. {field: 'cid', title: __('Cid')},
  27. {field: 'unionid', title: __('Unionid'), operate: 'LIKE'},
  28. {field: 'openid', title: __('Openid'), operate: 'LIKE'},
  29. {field: 'routine_openid', title: __('Routine_openid'), operate: 'LIKE'},
  30. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  31. {field: 'headimgurl', title: __('Headimgurl'), operate: 'LIKE', formatter: Table.api.formatter.url},
  32. {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal},
  33. {field: 'city', title: __('City'), operate: 'LIKE'},
  34. {field: 'language', title: __('Language'), operate: 'LIKE'},
  35. {field: 'province', title: __('Province'), operate: 'LIKE'},
  36. {field: 'country', title: __('Country'), operate: 'LIKE'},
  37. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  38. {field: 'groupid', title: __('Groupid')},
  39. {field: 'tagid_list', title: __('Tagid_list'), operate: 'LIKE'},
  40. {field: 'subscribe', title: __('Subscribe'), searchList: {"0":__('Subscribe 0'),"1":__('Subscribe 1')}, formatter: Table.api.formatter.normal},
  41. {field: 'subscribe_time', title: __('Subscribe_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  43. {field: 'stair', title: __('Stair')},
  44. {field: 'second', title: __('Second')},
  45. {field: 'order_stair', title: __('Order_stair')},
  46. {field: 'order_second', title: __('Order_second')},
  47. {field: 'brokerage_price', title: __('Brokerage_price'), operate:'BETWEEN'},
  48. {field: 'session_key', title: __('Session_key'), operate: 'LIKE'},
  49. {field: 'user_type', title: __('User_type'), searchList: {"0":__('User_type 0'),"1":__('User_type 1'),"2":__('User_type 2'),"3":__('User_type 3')}, formatter: Table.api.formatter.normal},
  50. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  51. ]
  52. ]
  53. });
  54. // 为表格绑定事件
  55. Table.api.bindevent(table);
  56. },
  57. add: function () {
  58. Controller.api.bindevent();
  59. },
  60. edit: function () {
  61. Controller.api.bindevent();
  62. },
  63. api: {
  64. bindevent: function () {
  65. Form.api.bindevent($("form[role=form]"));
  66. }
  67. }
  68. };
  69. return Controller;
  70. });