relation.js 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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: 'wechat/relation/index' + location.search,
  8. add_url: 'wechat/relation/add',
  9. edit_url: 'wechat/relation/edit',
  10. del_url: 'wechat/relation/del',
  11. multi_url: 'wechat/relation/multi',
  12. import_url: 'wechat/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: 'unionid', title: __('Unionid'), operate: 'LIKE'},
  27. {field: 'openid', title: __('Openid'), operate: 'LIKE'},
  28. {field: 'routine_openid', title: __('Routine_openid'), operate: 'LIKE'},
  29. {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
  30. {field: 'headimgurl', title: __('Headimgurl'), operate: 'LIKE', formatter: Table.api.formatter.url},
  31. {field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2'),"0":__('Sex 0')}, formatter: Table.api.formatter.normal},
  32. {field: 'city', title: __('City'), operate: 'LIKE'},
  33. {field: 'language', title: __('Language'), operate: 'LIKE'},
  34. {field: 'province', title: __('Province'), operate: 'LIKE'},
  35. {field: 'country', title: __('Country'), operate: 'LIKE'},
  36. {field: 'remark', title: __('Remark'), operate: 'LIKE'},
  37. {field: 'groupid', title: __('Groupid')},
  38. {field: 'tagid_list', title: __('Tagid_list'), operate: 'LIKE'},
  39. {field: 'subscribe', title: __('Subscribe'), searchList: {"0":__('Subscribe 0'),"1":__('Subscribe 1')}, formatter: Table.api.formatter.normal},
  40. {field: 'subscribe_time', title: __('Subscribe_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  41. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'stair', title: __('Stair')},
  43. {field: 'second', title: __('Second')},
  44. {field: 'order_stair', title: __('Order_stair')},
  45. {field: 'order_second', title: __('Order_second')},
  46. {field: 'brokerage_price', title: __('Brokerage_price'), operate:'BETWEEN'},
  47. {field: 'session_key', title: __('Session_key'), operate: 'LIKE'},
  48. {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},
  49. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  50. ]
  51. ]
  52. });
  53. // 为表格绑定事件
  54. Table.api.bindevent(table);
  55. },
  56. add: function () {
  57. Controller.api.bindevent();
  58. },
  59. edit: function () {
  60. Controller.api.bindevent();
  61. },
  62. api: {
  63. bindevent: function () {
  64. Form.api.bindevent($("form[role=form]"));
  65. }
  66. }
  67. };
  68. return Controller;
  69. });