car.js 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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: 'car/index' + location.search,
  8. add_url: 'car/add',
  9. edit_url: 'car/edit',
  10. del_url: 'car/del',
  11. multi_url: 'car/multi',
  12. import_url: 'car/import',
  13. table: 'car',
  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. fixedColumns: true,
  23. fixedRightNumber: 1,
  24. columns: [
  25. [
  26. {checkbox: true},
  27. {field: 'id', title: __('Id')},
  28. {field: 'chepaihao', title: __('Chepaihao'), operate: 'LIKE'},
  29. {field: 'color', title: __('Color'), operate: 'LIKE'},
  30. {field: 'chepaicolor', title: __('Chepaicolor'), searchList: {"5":__('Chepaicolor 5'),"1":__('Chepaicolor 1'),"2":__('Chepaicolor 2'),"3":__('Chepaicolor 3'),"4":__('Chepaicolor 4'),"9":__('Chepaicolor 9'),"91":__('Chepaicolor 91'),"92":__('Chepaicolor 92'),"94":__('Chepaicolor 94'),"224":__('Chepaicolor 224'),"225":__('Chepaicolor 225')}, formatter: Table.api.formatter.normal},
  31. {field: 'type', title: __('Type'), operate: 'LIKE'},
  32. {field: 'brand', title: __('Brand'), operate: 'LIKE'},
  33. {field: 'xinghao', title: __('Xinghao'), operate: 'LIKE'},
  34. {field: 'chejia', title: __('Chejia'), operate: 'LIKE'},
  35. {field: 'fadongji', title: __('Fadongji'), operate: 'LIKE'},
  36. {field: 'licheng', title: __('Licheng')},
  37. {field: 'is_etc', title: __('Is_etc'), searchList: {"0":__('Is_etc 0'),"1":__('Is_etc 1')}, formatter: Table.api.formatter.normal},
  38. {field: 'power', title: __('Power'), searchList: {"1":__('Power 1'),"2":__('Power 2')}, formatter: Table.api.formatter.normal},
  39. {field: 'seatnum', title: __('Seatnum')},
  40. {field: 'xingshi_num', title: __('Xingshi_num'), operate: 'LIKE'},
  41. {field: 'xingshi_images', title: __('Xingshi_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  42. {field: 'yingyun_images', title: __('Yingyun_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
  43. {field: 'zhucetime', title: __('Zhucetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  44. {field: 'department', title: __('Department'), operate: 'LIKE'},
  45. {field: 'leasetype', title: __('Leasetype'), searchList: {"1":__('Leasetype 1'),"2":__('Leasetype 2'),"3":__('Leasetype 3')}, formatter: Table.api.formatter.normal},
  46. {field: 'operate', title: __('Operate'), table: table,
  47. buttons:[
  48. {
  49. name:'gpsinfo',
  50. text:'即时信息',
  51. title:'即时信息',
  52. icon:'fa fa-exclamation-circle',
  53. classname:'btn btn-xs btn-info btn-dialog',
  54. url:'car/gpsinfo/id/{ids}',
  55. target:'_self',
  56. refresh:true,
  57. }
  58. ],
  59. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  60. ]
  61. ]
  62. });
  63. // 为表格绑定事件
  64. Table.api.bindevent(table);
  65. },
  66. add: function () {
  67. Controller.api.bindevent();
  68. },
  69. edit: function () {
  70. Controller.api.bindevent();
  71. },
  72. gpsinfo: function () {
  73. Controller.api.bindevent();
  74. },
  75. api: {
  76. bindevent: function () {
  77. Form.api.bindevent($("form[role=form]"));
  78. }
  79. }
  80. };
  81. return Controller;
  82. });