carfix.js 3.2 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: 'carfix/index' + location.search,
  8. add_url: 'carfix/add',
  9. edit_url: 'carfix/edit',
  10. del_url: 'carfix/del',
  11. multi_url: 'carfix/multi',
  12. import_url: 'carfix/import',
  13. table: 'car_fix',
  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: 'car_id', title: __('Car_id')},
  27. {field: 'car.chepaihao', title: __('Car.chepaihao'), operate: 'LIKE'},
  28. {field: 'car.color', title: __('Car.color'), operate: 'LIKE'},
  29. {field: 'car.type', title: __('Car.type'), operate: 'LIKE'},
  30. {field: 'car.brand', title: __('Car.brand'), operate: 'LIKE'},
  31. {field: 'car.xinghao', title: __('Car.xinghao'), operate: 'LIKE'},
  32. {field: 'car.chejia', title: __('Car.chejia'), operate: 'LIKE'},
  33. {field: 'car.fadongji', title: __('Car.fadongji'), operate: 'LIKE'},
  34. {field: 'car.licheng', title: __('Car.licheng')},
  35. {field: 'car.zhucetime', title: __('Car.zhucetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  36. {field: 'fix_name', title: __('Fix_name'), operate: 'LIKE'},
  37. {field: 'fix_info', title: __('Fix_info'), operate: 'LIKE'},
  38. {field: 'fix_price', title: __('Fix_price'), operate:'BETWEEN'},
  39. {field: 'addtime', title: __('Addtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  40. {field: 'coach_id', title: __('Coach_id')},
  41. {field: 'coach.nickname', title: __('Coach.nickname'), operate: 'LIKE'},
  42. {field: 'coach.mobile', title: __('Coach.mobile'), operate: 'LIKE'},
  43. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  44. ]
  45. ]
  46. });
  47. // 为表格绑定事件
  48. Table.api.bindevent(table);
  49. },
  50. add: function () {
  51. Controller.api.bindevent();
  52. },
  53. edit: function () {
  54. Controller.api.bindevent();
  55. },
  56. api: {
  57. bindevent: function () {
  58. Form.api.bindevent($("form[role=form]"));
  59. }
  60. }
  61. };
  62. return Controller;
  63. });