donate.js 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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: 'donate/index' + location.search,
  8. add_url: 'donate/add',
  9. edit_url: 'donate/edit',
  10. del_url: 'donate/del',
  11. multi_url: 'donate/multi',
  12. import_url: 'donate/import',
  13. table: 'donate',
  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: 'user_id', title: __('User_id')},
  28. {field: 'full_name', title: __('Full_name'), operate: 'LIKE'},
  29. {field: 'sex', title: __('Sex'), searchList: {"0":__('Sex 0'),"1":__('Sex 1')}, formatter: Table.api.formatter.normal},
  30. {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
  31. {field: 'id_card', title: __('Id_card'), operate: 'LIKE'},
  32. {field: 'vocation', title: __('Vocation'), operate: 'LIKE'},
  33. {field: 'education', title: __('Education'), searchList: {"0":__('Education 0'),"1":__('Education 1'),"2":__('Education 2'),"3":__('Education 3'),"4":__('Education 4'),"5":__('Education 5'),"6":__('Education 6'),"7":__('Education 7'),"8":__('Education 8'),"9":__('Education 9')}, formatter: Table.api.formatter.normal},
  34. {field: 'category_id', title: __('Category_id'), operate: 'LIKE'},
  35. {field: 'tel', title: __('Tel'), operate: 'LIKE'},
  36. {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
  37. {field: 'executor', title: __('Executor'), operate: 'LIKE'},
  38. {field: 'executor_id_card', title: __('Executor_id_card'), operate: 'LIKE'},
  39. {field: 'executor_tel', title: __('Executor_tel'), operate: 'LIKE'},
  40. {field: 'executor_mobile', title: __('Executor_mobile'), operate: 'LIKE'},
  41. {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  42. {field: 'status', title: __('Status'), searchList: {"-1":__('Status -1'),"0":__('Status 0'),"1":__('Status 1')}, formatter: Table.api.formatter.status},
  43. {field: 'SN', title: __('Sn'), operate: 'LIKE'},
  44. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  45. ]
  46. ]
  47. });
  48. // 为表格绑定事件
  49. Table.api.bindevent(table);
  50. },
  51. add: function () {
  52. Controller.api.bindevent();
  53. },
  54. edit: function () {
  55. Controller.api.bindevent();
  56. },
  57. api: {
  58. bindevent: function () {
  59. Form.api.bindevent($("form[role=form]"));
  60. }
  61. }
  62. };
  63. return Controller;
  64. });