123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <title>违章车辆信息补全</title>
- <div class="layui-card layadmin-header">
- <div class="layui-breadcrumb" lay-filter="breadcrumb">
- <a lay-href="">主页</a>
- <a><cite>违章车辆管理</cite></a>
- <a><cite>违章车辆信息补全</cite></a>
- </div>
- </div>
- <div class="layui-fluid">
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="layui-card">
- <!--<div class="layui-card-header">开启头部工具栏</div>-->
- <div class="layui-card-body">
- <div class="test-table-reload-btn" style="margin-bottom: 10px;">
- 搜索车牌:
- <div class="layui-inline">
- <input class="layui-input" name="车牌号" id="test-table-demoReload" style="text-transform:uppercase;">
- <!--autocomplete="off"-->
- </div>
- <button class="layui-btn" data-type="reload">搜索</button>
- </div>
- <table class="layui-hide" id="test-table-radio" lay-filter="test-table-radio"></table>
- <script type="text/html" id="test-table-radio-toolbarDemo">
- <div class="layui-btn-container">
- <button class="layui-btn layui-btn-sm" lay-event="edit">信息补全</button>
- <!--<button class="layui-btn layui-btn-sm" lay-event="del">删除选中项目</button>-->
- <!--<button class="layui-btn layui-btn-sm" lay-event="add">增加新客户</button>-->
- </div>
- </script>
- </div>
- </div>
- </div>
- </div>
- </div>
- </body>
- <script>
- layui.use(['admin', 'table','layer','form','view'], function(){
- var admin = layui.admin
- ,$ = layui.$
- ,layer = layui.layer
- ,view = layui.view
- ,form = layui.form
- ,table = layui.table;
- table.render({
- elem: '#test-table-radio'
- ,url:'/charge/violationList'
- ,method:'post'
- ,where:{"license":""}
- ,toolbar: '#test-table-radio-toolbarDemo'
- ,title: '违章车辆记录数据表'
- ,even: true//隔行背景
- ,cols: [[
- {type: 'radio', fixed: 'left'}
- ,{field:'license', title:'车牌', width:120}
- ,{field:'VIN', title:'车架号', width:120}
- ,{field:'owner', title:'所有人', width:120}
- ,{field:'EP_type', title:'环保类型', width:120}
- ,{field:'car_type', title:'安检类型', width:120}
- ,{field:'customer', title:'挂账客户', width:120}
- ,{field:'EP_receivable', title:'环检应收', width:120}
- ,{field:'Safe_receivable', title:'安检应收', width:120}
- ,{field:'receivable', title:'应收总和', width:120}
- ,{field:'cost', title:'实收总和', width:120}
- ,{field:'telephone', title:'联系电话', width:120}
- ,{field:'date', title:'检测日期', width:120}
- ,{field:'remarks', title:'备注', width:120}
- // ,{fixed: 'right', title:'操作', toolbar: '#test-table-toolbar-barDemo', width:150}
- ]]
- ,page: true
- });
- var active = {
- reload: function(){
- var demoReload = $('#test-table-demoReload');
- //执行重载
- table.reload('test-table-radio', {
- where: {
- 'license': demoReload.val(),
- }
- ,page: {
- curr: 1 //重新从第 1 页开始
- }
- });
- }
- };
- $('.test-table-reload-btn .layui-btn').on('click', function(){
- var type = $(this).data('type');
- active[type] ? active[type].call(this) : '';
- });
- //头工具栏事件
- table.on('toolbar(test-table-radio)', function(obj){
- var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
- var data = checkStatus.data; //获取选中行数据
- switch(obj.event){
- case 'edit':
- if (data.length !== 0) {//选中
- $.ajax({
- type:"POST",
- url:"/charge/violationMsg",
- data:{"license":data[0].license},
- success:function (res) {
- if(res){
- //获取车辆信息成功
- // if(!res.车辆识别代号.$["i:nil"]){
- if(res.车辆识别代号.length === 17){
- $.ajax({
- type:"POST",
- url:"/charge/violationUpdate",
- data:{
- "id":data[0].id,
- "VIN":res.车辆识别代号,
- "owner":res.所有人,
- },
- success:function (Res) {
- // layer.close(index)
- layui.table.reload('test-table-radio'); //重载表格
- }
- })
- }else {
- layer.msg("未获取到信息!")
- }
- }
- }
- })
- }else {//未选中
- layer.msg("请选择!");
- }
- // layer.alert(JSON.stringify(data));
- break;
- };
- });
- });
- </script>
- </html>
|