project_donation_user.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: 'project/project_donation_user/index' + location.search,
  8. add_url: 'project/project_donation_user/add',
  9. edit_url: 'project/project_donation_user/edit',
  10. del_url: 'project/project_donation_user/del',
  11. multi_url: 'project/project_donation_user/multi',
  12. import_url: 'project/project_donation_user/import',
  13. table: 'project_donation_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: 'cid', title: __('Cid')},
  27. {field: 'uid', title: __('Uid')},
  28. {field: 'name', title: __('Name'), operate: 'LIKE'},
  29. {field: 'card_id', title: __('Card_id'), operate: 'LIKE'},
  30. {field: 'phone', title: __('Phone'), operate: 'LIKE'},
  31. {field: 'tel', title: __('Tel'), operate: 'LIKE'},
  32. {field: 'contacts', title: __('Contacts'), operate: 'LIKE'},
  33. {field: 'anonymous', title: __('Anonymous'), searchList: {"0":__('Anonymous 0'),"1":__('Anonymous 1')}, formatter: Table.api.formatter.normal},
  34. {field: 'invoice', title: __('Invoice'), searchList: {"0":__('Invoice 0'),"1":__('Invoice 1')}, formatter: Table.api.formatter.normal},
  35. {field: 'user_type', title: __('User_type'), searchList: {"0":__('User_type 0'),"1":__('User_type 1')}, formatter: Table.api.formatter.normal},
  36. {field: 'logistics', title: __('Logistics'), operate: 'LIKE'},
  37. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  38. ]
  39. ]
  40. });
  41. // 为表格绑定事件
  42. Table.api.bindevent(table);
  43. },
  44. add: function () {
  45. Controller.api.bindevent();
  46. },
  47. edit: function () {
  48. Controller.api.bindevent();
  49. },
  50. api: {
  51. bindevent: function () {
  52. Form.api.bindevent($("form[role=form]"));
  53. }
  54. }
  55. };
  56. return Controller;
  57. });