You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
8.5 KiB
217 lines
8.5 KiB
<?php
|
|
use \common\libs\MyLib;
|
|
?>
|
|
<?php $this->beginBlock('header_css'); ?>
|
|
<link href="/assets/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
|
|
<?php $this->endBlock(); ?>
|
|
|
|
<div class="wrapper wrapper-content animated fadeInRight">
|
|
<div class="ibox float-e-margins">
|
|
<div class="ibox-title">
|
|
<h5>A库</h5>
|
|
<div class="ibox-tools">
|
|
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="create(0)">
|
|
<i class="fa fa-plus"></i> 添加
|
|
</a>
|
|
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="searchDlg()">
|
|
<i class="fa fa-search"></i> 搜索
|
|
</a>
|
|
<a class="btn btn-primary btn-xs edit-btn" data-id="0" href="javascript:void(0);" onclick="$('#listTable').bootstrapTable('refresh');">
|
|
<i class="fa fa-refresh"></i> 刷新
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div class="ibox-content">
|
|
<form role="form" class="form-horizontal" onsubmit="return search();">
|
|
<div class="form-group">
|
|
<div class="col-sm-8">
|
|
<button type="button" class="btn btn-primary btn-a-b">勾选A->B</button>
|
|
<button type="button" class="btn btn-primary btn-a-c">勾选A->C</button>
|
|
<button type="button" class="btn btn-primary btn-a-b-all">批量A->B</button>
|
|
<button type="button" class="btn btn-danger btn-clear">清空搜索条件</button>
|
|
</div>
|
|
<div class="col-sm-4">
|
|
<div class="col-sm-8">
|
|
<select class="form-control" id="invalid_id" name="invalid_id">
|
|
<option value="0">请选择无效理由</option>
|
|
<?php foreach($invalid_items as $item) {
|
|
echo '<option value="'.$item->id.'">'.$item->name.'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div class="col-sm-4">
|
|
<button type="button" class="btn btn-primary btn-a-invalid">勾选无效数据</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<div class="row">
|
|
<div class="col-md-12">
|
|
<table id="listTable">
|
|
<thead>
|
|
<tr>
|
|
<th data-field="state" data-checkbox="true"></th>
|
|
<th width="50" data-field="id">ID</th>
|
|
<th data-field="car_no">车牌</th>
|
|
<th data-field="factory_model">车型</th>
|
|
<th data-field="car_man">车主</th>
|
|
<th data-field="phone">联系电话</th>
|
|
<th data-field="register_date">初登日期</th>
|
|
<th data-field="insurer1_date">保险日期</th>
|
|
<th data-field="company">保险公司</th>
|
|
<th data-field="engine_no">发动机号</th>
|
|
<th data-field="car_frame_no">车架号</th>
|
|
<th data-field="location_name">位置</th>
|
|
<th data-formatter="opFormatter">操作</th>
|
|
</tr>
|
|
</thead>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<?php $this->beginBlock('footer_js'); ?>
|
|
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
|
|
<script src="/assets/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
|
|
<script src="/assets/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
|
|
<script>
|
|
var o = {};
|
|
function opFormatter(value, row, index) {
|
|
var opStr = [];
|
|
opStr.push('<a href="javascript:void(0);" onclick="edit(' + row.id + ')">');
|
|
opStr.push('<i class="fa fa-edit" title="编辑"></i>');
|
|
opStr.push('</a>');
|
|
if(row.location == 1) {
|
|
opStr.push('<a href="javascript:void(0);" onclick="del(' + row.id + ')">');
|
|
opStr.push('<i class="fa fa-trash" title="删除"></i>');
|
|
opStr.push('</a>');
|
|
}
|
|
|
|
return opStr.join(' ');
|
|
}
|
|
function create() {
|
|
title = '新增车辆';
|
|
layer_show(title, '/car/edit?id=0');
|
|
}
|
|
function searchDlg() {
|
|
title = '综合搜索';
|
|
layer_show(title, '/database/a-search');
|
|
}
|
|
function edit(id) {
|
|
var title = '编辑车辆';
|
|
layer_show(title, '/car/edit?id=' + id);
|
|
}
|
|
function del(id) {
|
|
parent.layer.confirm('是否确认删除?', {
|
|
btn: ['删除','取消'], //按钮
|
|
shade: false //不显示遮罩
|
|
}, function(){
|
|
$.post('/car/delete',{id:id},function(data) {
|
|
parent.layer.msg(data.msg);
|
|
if(data.success == true) {
|
|
refreshList();
|
|
}
|
|
}, 'json');
|
|
}, function(){
|
|
//
|
|
});
|
|
}
|
|
|
|
function refreshList() {
|
|
$('#listTable').bootstrapTable('refresh');
|
|
}
|
|
|
|
function search() {
|
|
$('#listTable').bootstrapTable('destroy');
|
|
$('#listTable').bootstrapTable({
|
|
url: "/database/a-index-json",
|
|
pagination: true,
|
|
sidePagination: 'server',
|
|
multipleSelectRow: true,
|
|
queryParams: function(params) {
|
|
o['limit'] = params['limit'];
|
|
o['offset'] = params['offset'];
|
|
return o;
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function() {
|
|
search();
|
|
|
|
$('.btn-a-b').click(function(){
|
|
var rows = $('#listTable').bootstrapTable('getSelections');
|
|
var params = [];
|
|
rows.forEach(function(item,index,array){
|
|
params.push(item.id);
|
|
});
|
|
$.post('/database/a-b', {ids:params.join(',')}, function(data) {
|
|
parent.layer.msg(data.msg);
|
|
if(data.success == true) {
|
|
refreshList();
|
|
}
|
|
},'json');
|
|
});
|
|
$('.btn-a-b-all').click(function() {
|
|
layer.confirm('是否确认批量移动?', {
|
|
btn: ['确认','取消'], //按钮
|
|
shade: false //不显示遮罩
|
|
}, function(){
|
|
var params = o;
|
|
$.post('/database/a-b-all',params,function(obj){
|
|
layer.msg(obj.msg);
|
|
if(obj.success) {
|
|
layer.msg('保存成功');
|
|
search();
|
|
}
|
|
},'json');
|
|
}, function(){
|
|
//
|
|
});
|
|
});
|
|
$('.btn-a-c').click(function() {
|
|
var rows = $('#listTable').bootstrapTable('getSelections');
|
|
var params = [];
|
|
rows.forEach(function(item,index,array){
|
|
params.push(item.id);
|
|
});
|
|
$.post('/database/a-c', {ids:params.join(',')}, function(data) {
|
|
parent.layer.msg(data.msg);
|
|
if(data.success == true) {
|
|
refreshList();
|
|
}
|
|
},'json');
|
|
});
|
|
$('.btn-clear').click(function() {
|
|
o = {};
|
|
search();
|
|
});
|
|
$('.btn-a-invalid').click(function() {
|
|
layer.confirm('是否确认移动?', {
|
|
btn: ['确认','取消'], //按钮
|
|
shade: false //不显示遮罩
|
|
}, function(){
|
|
var invalid_id = $('#invalid_id').val();
|
|
var rows = $('#listTable').bootstrapTable('getSelections');
|
|
var params = [];
|
|
rows.forEach(function(item,index,array){
|
|
params.push(item.id);
|
|
});
|
|
$.post('/database/a-invalid',{ids:params.join(','), invalid_id:invalid_id},function(obj){
|
|
layer.msg(obj.msg);
|
|
if(obj.success) {
|
|
layer.msg('保存成功');
|
|
search();
|
|
}
|
|
},'json');
|
|
}, function(){
|
|
//
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
<?php $this->endBlock(); ?>
|
|
|