productchufabanci.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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: 'productchufabanci/index' + location.search,
  8. add_url: 'productchufabanci/add',
  9. edit_url: 'productchufabanci/edit',
  10. del_url: 'productchufabanci/del',
  11. multi_url: 'productchufabanci/multi',
  12. import_url: 'productchufabanci/import',
  13. table: 'product_chufabanci',
  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: 'chufatime', title: __('Chufatime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  27. {field: 'ticket_number', title: __('Ticket_number')},
  28. {field: 'ticket_remain', title: __('Ticket_remain')},
  29. {field: 'chufatype', title: __('Chufatype'), searchList: {"1":__('Chufatype 1'),"2":__('Chufatype 2')}, formatter: Table.api.formatter.normal},
  30. {field: 'chepaihao', title: __('Chepaihao'), operate: 'LIKE'},
  31. {field: 'sijimobile', title: __('Sijimobile'), operate: 'LIKE'},
  32. {field: 'fache_status', title: __('Fache_status'), searchList: {"0":__('Fache_status 0'),"1":__('Fache_status 1'),"2":__('Fache_status 2')}, formatter: Table.api.formatter.status},
  33. {field: 'fache_time', title: __('Fache_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  34. {field: 'daozhan_time', title: __('Daozhan_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
  35. {field: 'road_id', title: __('Road_id')},
  36. {field: 'road.roadname', title: __('Road.roadname'), operate: 'LIKE'},
  37. {field: 'product_id', title: __('Product_id')},
  38. {field: 'product.name', title: __('Product.name'), operate: 'LIKE'},
  39. {field: 'car_id', title: __('Car_id')},
  40. {field: 'car.chepaihao', title: __('Car.chepaihao'), operate: 'LIKE'},
  41. {field: 'coach_id', title: __('Coach_id')},
  42. {field: 'coach.nickname', title: __('Coach.nickname'), operate: 'LIKE'},
  43. {field: 'coach.mobile', title: __('Coach.mobile'), operate: 'LIKE'},
  44. {field: 'operate', title: __('Operate'), table: table,
  45. buttons:[
  46. {
  47. name:'copytomorrow',
  48. text:'顺延N天',
  49. title:'顺延N天',
  50. icon:'fa fa-exclamation-circle',
  51. classname:'btn btn-xs btn-info btn-dialog',
  52. url:'productchufabanci/copytomorrow/id/{ids}',
  53. target:'_self',
  54. refresh:true
  55. },
  56. ],
  57. events: Table.api.events.operate, formatter: Table.api.formatter.operate}
  58. ]
  59. ]
  60. });
  61. // 为表格绑定事件
  62. Table.api.bindevent(table);
  63. },
  64. add: function () {
  65. Controller.api.bindevent();
  66. },
  67. edit: function () {
  68. Controller.api.bindevent();
  69. },
  70. copytomorrow: function () {
  71. Controller.api.bindevent();
  72. },
  73. api: {
  74. bindevent: function () {
  75. Form.api.bindevent($("form[role=form]"));
  76. }
  77. }
  78. };
  79. return Controller;
  80. });
  81. $("#c-road_id").data("params", function (obj) {
  82. return {
  83. custom: {product_id: $("#c-product_id").val(),roadtype:['IN','1,2']}
  84. };
  85. });
  86. $(document).on("change","#c-product_id",function(){
  87. $("#c-road_id").selectPageClear();
  88. })
  89. $("#c-car_id").data("params", function (obj) {
  90. return {
  91. custom: {leasetype: 1}
  92. };
  93. });