charge_second.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <title>违章车辆信息补全</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>违章车辆管理</cite></a>
  6. <a><cite>违章车辆信息补全</cite></a>
  7. </div>
  8. </div>
  9. <div class="layui-fluid">
  10. <div class="layui-row layui-col-space15">
  11. <div class="layui-col-md12">
  12. <div class="layui-card">
  13. <!--<div class="layui-card-header">开启头部工具栏</div>-->
  14. <div class="layui-card-body">
  15. <div class="test-table-reload-btn" style="margin-bottom: 10px;">
  16. 搜索车牌:
  17. <div class="layui-inline">
  18. <input class="layui-input" name="车牌号" id="test-table-demoReload" style="text-transform:uppercase;">
  19. <!--autocomplete="off"-->
  20. </div>
  21. <button class="layui-btn" data-type="reload">搜索</button>
  22. </div>
  23. <table class="layui-hide" id="test-table-radio" lay-filter="test-table-radio"></table>
  24. <script type="text/html" id="test-table-radio-toolbarDemo">
  25. <div class="layui-btn-container">
  26. <button class="layui-btn layui-btn-sm" lay-event="edit">信息补全</button>
  27. <!--<button class="layui-btn layui-btn-sm" lay-event="del">删除选中项目</button>-->
  28. <!--<button class="layui-btn layui-btn-sm" lay-event="add">增加新客户</button>-->
  29. </div>
  30. </script>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </body>
  37. <script>
  38. layui.use(['admin', 'table','layer','form','view'], function(){
  39. var admin = layui.admin
  40. ,$ = layui.$
  41. ,layer = layui.layer
  42. ,view = layui.view
  43. ,form = layui.form
  44. ,table = layui.table;
  45. table.render({
  46. elem: '#test-table-radio'
  47. ,url:'/charge/violationList'
  48. ,method:'post'
  49. ,where:{"license":""}
  50. ,toolbar: '#test-table-radio-toolbarDemo'
  51. ,title: '违章车辆记录数据表'
  52. ,even: true//隔行背景
  53. ,cols: [[
  54. {type: 'radio', fixed: 'left'}
  55. ,{field:'license', title:'车牌', width:120}
  56. ,{field:'VIN', title:'车架号', width:120}
  57. ,{field:'owner', title:'所有人', width:120}
  58. ,{field:'EP_type', title:'环保类型', width:120}
  59. ,{field:'car_type', title:'安检类型', width:120}
  60. ,{field:'customer', title:'挂账客户', width:120}
  61. ,{field:'EP_receivable', title:'环检应收', width:120}
  62. ,{field:'Safe_receivable', title:'安检应收', width:120}
  63. ,{field:'receivable', title:'应收总和', width:120}
  64. ,{field:'cost', title:'实收总和', width:120}
  65. ,{field:'telephone', title:'联系电话', width:120}
  66. ,{field:'date', title:'检测日期', width:120}
  67. ,{field:'remarks', title:'备注', width:120}
  68. // ,{fixed: 'right', title:'操作', toolbar: '#test-table-toolbar-barDemo', width:150}
  69. ]]
  70. ,page: true
  71. });
  72. var active = {
  73. reload: function(){
  74. var demoReload = $('#test-table-demoReload');
  75. //执行重载
  76. table.reload('test-table-radio', {
  77. where: {
  78. 'license': demoReload.val(),
  79. }
  80. ,page: {
  81. curr: 1 //重新从第 1 页开始
  82. }
  83. });
  84. }
  85. };
  86. $('.test-table-reload-btn .layui-btn').on('click', function(){
  87. var type = $(this).data('type');
  88. active[type] ? active[type].call(this) : '';
  89. });
  90. //头工具栏事件
  91. table.on('toolbar(test-table-radio)', function(obj){
  92. var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
  93. var data = checkStatus.data; //获取选中行数据
  94. switch(obj.event){
  95. case 'edit':
  96. if (data.length !== 0) {//选中
  97. $.ajax({
  98. type:"POST",
  99. url:"/charge/violationMsg",
  100. data:{"license":data[0].license},
  101. success:function (res) {
  102. if(res){
  103. //获取车辆信息成功
  104. // if(!res.车辆识别代号.$["i:nil"]){
  105. if(res.车辆识别代号.length === 17){
  106. $.ajax({
  107. type:"POST",
  108. url:"/charge/violationUpdate",
  109. data:{
  110. "id":data[0].id,
  111. "VIN":res.车辆识别代号,
  112. "owner":res.所有人,
  113. },
  114. success:function (Res) {
  115. // layer.close(index)
  116. layui.table.reload('test-table-radio'); //重载表格
  117. }
  118. })
  119. }else {
  120. layer.msg("未获取到信息!")
  121. }
  122. }
  123. }
  124. })
  125. }else {//未选中
  126. layer.msg("请选择!");
  127. }
  128. // layer.alert(JSON.stringify(data));
  129. break;
  130. };
  131. });
  132. });
  133. </script>
  134. </html>