private_access_log.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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: 'private_access_log/index' + location.search,
  8. add_url: 'private_access_log/add',
  9. edit_url: 'private_access_log/edit',
  10. del_url: 'private_access_log/del',
  11. multi_url: 'private_access_log/multi',
  12. import_url: 'private_access_log/import',
  13. table: 'private_access_log',
  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: 'order_number', title: __('Id'), operate: false},
  26. {field: 'vehiclenumber', title: __('Vehiclenumber'), operate: false},
  27. {field: 'vehiclecategory', title: __('Vehiclecategory'), searchList: {"临时":__('临时'),"内部":__('内部')}, formatter: Table.api.formatter.normal},
  28. {field: 'vehiclemodel', title: __('Vehiclemodel'), operate: false},
  29. {field: 'vehiclecolor', title: __('Vehiclecolor'), operate: false},
  30. {field: 'people_id_text', title: __('People_id'), operate: false},
  31. {field: 'contactnumber', title: __('Contactnumber'), operate: false},
  32. {field: 'time1', title: __('Time1'), operate: false},
  33. {field: 'time2', title: __('Time2'), operate: false},
  34. {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate
  35. ,buttons:[
  36. {
  37. name: '返回',
  38. text: '返回',
  39. title: '返回',
  40. classname: 'btn btn-xs btn-warning btn-view btn-ajax ',
  41. icon: 'fa fa-search',
  42. refresh: true,
  43. url: 'private_access_log/goback',
  44. confirm:'确认已返回?',
  45. visible:function(row){
  46. if(row.time2=='-'){
  47. return true;
  48. }
  49. return false;
  50. }
  51. }
  52. ]
  53. }
  54. ]
  55. ]
  56. });
  57. // 为表格绑定事件
  58. Table.api.bindevent(table);
  59. },
  60. add: function () {
  61. $(document).on("change", "#c-private_car_id", function(){
  62. $('#c-vehiclenumber').val($('#c-private_car_id_text').val());
  63. var ids = $(this).val();
  64. $.get('private_car/huoq',{ids:ids},function(res){
  65. $('#c-vehiclecategory').val(res.data.vehiclecategory);
  66. $('#c-vehiclecategory').selectpicker('refresh');
  67. $('#c-vehiclemodel').val(res.data.vehiclemodel);
  68. $('#c-people_id').val(res.data.people_id);
  69. $('#c-people_id').selectPageRefresh();
  70. $('#c-vehiclecolor').val(res.data.vehiclecolor);
  71. $('#c-contactnumber').val(res.data.contactnumber);
  72. });
  73. });
  74. $(document).on('change','#c-driver_id',function(){
  75. var ids = $(this).val();
  76. $.get('people/huoq',{ids:ids},function(res){
  77. $('#c-contactnumber').val(res.data.contact);
  78. });
  79. });
  80. Controller.api.bindevent();
  81. },
  82. edit: function () {
  83. $(document).on("change", "#c-private_car_id", function(){
  84. $('#c-vehiclenumber').val($('#c-private_car_id_text').val());
  85. var ids = $(this).val();
  86. $.get('private_car/huoq',{ids:ids},function(res){
  87. $('#c-vehiclecategory').val(res.data.vehiclecategory);
  88. $('#c-vehiclecategory').selectpicker('refresh');
  89. $('#c-vehiclemodel').val(res.data.vehiclemodel);
  90. $('#c-people_id').val(res.data.people_id);
  91. $('#c-people_id').selectPageRefresh();
  92. $('#c-vehiclecolor').val(res.data.vehiclecolor);
  93. $('#c-contactnumber').val(res.data.contactnumber);
  94. });
  95. });
  96. $(document).on('change','#c-driver_id',function(){
  97. var ids = $(this).val();
  98. $.get('people/huoq',{ids:ids},function(res){
  99. $('#c-contactnumber').val(res.data.contact);
  100. });
  101. });
  102. Controller.api.bindevent();
  103. },
  104. api: {
  105. bindevent: function () {
  106. Form.api.bindevent($("form[role=form]"));
  107. }
  108. }
  109. };
  110. return Controller;
  111. });