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.
simple-yewu/frontend/views/database/a-index.php

331 lines
15 KiB

5 years ago
<?php
use \common\libs\MyLib;
?>
5 years ago
<?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="$('#listTable').bootstrapTable('refresh');">
<i class="fa fa-refresh"></i> 刷新
</a>
</div>
</div>
<div class="ibox-content">
<form role="form" id="searchFrm" class="form-inline" onsubmit="return search();">
<div class="form-group" style="margin-bottom: 8px;">
<label for="car_no">车牌</label>
<input type="text" id="car_no" name="car_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no" style="margin-left:20px;">发动机号</label>
<input type="text" id="engine_no" name="engine_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no" style="margin-left:20px;">车架号</label>
<input type="text" id="car_frame_no" name="car_frame_no" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no" style="margin-left:20px;">车主</label>
<input type="text" id="car_man" name="car_man" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no">联系电话</label>
<input type="text" id="phone" name="phone" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no" style="margin-left:20px;">保险公司</label>
<input type="text" id="company" name="company" class="form-control">
</div>
5 years ago
<div class="form-group" style="margin-bottom: 8px;margin-left:20px;">
<label for="datepicker1">初登日期</label>
<div class="input-group input-daterange" id="datepicker1">
<input type="text" class="input-sm form-control" id="register_begin" name="register_begin" value="" autocomplete="off" />
5 years ago
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" id="register_end" name="register_end" value="" autocomplete="off" />
</div>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker2">保险日期</label>
<div class="input-group input-daterange" id="datepicker2">
<input type="text" class="input-sm form-control" id="insurer1_begin" name="insurer1_begin" value="" autocomplete="off" />
5 years ago
<span class="input-group-addon">-</span>
<input type="text" class="input-sm form-control" id="insurer1_end" name="insurer1_end" value="" autocomplete="off" />
</div>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="engine_no" style="margin-left:20px;">使用性质</label>
<select name="car_use_id" id="car_use_id" class="form-control">
<option value="0">全部</option>
<?php foreach($car_use_items as $item) {
echo '<option value="'.$item->id.'">'.$item->name.'</option>';
} ?>
</select>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="b_lib">范围</label>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="b_lib" id="b_lib" value="1">
<label for="b_lib">B库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="c_lib" id="c_lib" value="1">
<label for="c_lib">C库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="d_lib" id="d_lib" value="1">
<label for="d_lib">D库</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="e_lib" id="e_lib" value="1">
<label for="e_lib">E库</label>
5 years ago
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="invalid_lib" id="invalid_lib" value="1">
<label for="invalid_lib">无效库</label>
5 years ago
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="unsel_lib" id="unsel_lib" value="1">
<label for="unsel_lib">未分配</label>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="has_phone" id="has_phone" value="1">
<label for="has_phone">有电话号码</label>
</div>
<button type="submit" class="btn btn-primary mb-8">搜索</button>
</div>
<div class="form-group" style="margin-bottom: 8px;margin-left:20px;">
<button type="button" class="btn btn-primary btn-a-b">勾选A-&gt;B</button>
<button type="button" class="btn btn-primary btn-a-c">勾选A-&gt;C</button>
<button type="button" class="btn btn-primary btn-a-b-all">批量A-&gt;B</button>
</div>
5 years ago
<div class="form-group" style="margin-bottom: 8px;">
<select class="form-control" id="invalid_id" name="invalid_id" style="width:200px;">
<option value="0">请选择无效理由</option>
<?php foreach($invalid_items as $item) {
echo '<option value="'.$item->id.'">'.$item->name.'</option>';
}
?>
</select>
<button type="button" class="btn btn-primary btn-a-invalid">勾选无效数据</button>
5 years ago
</div>
</form>
<div class="row" style="margin-top:20px;">
5 years ago
<div class="col-md-12">
5 years ago
<table id="listTable" class="table" data-toggle="table" data-height="550">
<thead class="bg-warning">
<tr>
5 years ago
<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>
5 years ago
<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>');
}
5 years ago
return opStr.join(' ');
}
function create() {
title = '新增车辆';
layer_show(title, '/car/edit?id=0');
}
5 years ago
function edit(id) {
5 years ago
var title = '编辑车辆';
layer_show(title, '/car/edit?id=' + id);
5 years ago
}
function del(id) {
5 years ago
parent.layer.confirm('是否确认删除?', {
btn: ['删除','取消'], //按钮
shade: false //不显示遮罩
}, function(){
5 years ago
var index = parent.layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
5 years ago
$.post('/car/delete',{id:id},function(data) {
5 years ago
parent.layer.close(index);
5 years ago
parent.layer.msg(data.msg);
if(data.success == true) {
refreshList();
5 years ago
}
5 years ago
}, 'json');
}, function(){
//
});
5 years ago
}
5 years ago
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
5 years ago
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/database/a-index-json",
pagination: true,
sidePagination: 'server',
multipleSelectRow: true,
queryParams: function(params) {
o['offset'] = params['offset'];
o['limit'] = params['limit'];
5 years ago
return o;
5 years ago
}
});
return false;
5 years ago
}
5 years ago
//固定表头
function fix(){
//table设置一定的高度
var tab=$("#listTable").attr('data-height');
$('.fixed-table-body').css({'height':tab-100});
5 years ago
//当浏览器窗口变化时,表头与表格不对齐解决
$('.table').bootstrapTable();
$(window).resize(function () {
$('.table').bootstrapTable('resetView');
});
}
5 years ago
$(function() {
search();
5 years ago
fix();
5 years ago
$('#datepicker1').datepicker({
keyboardNavigation: false,
forceParse: false,
5 years ago
autoclose: true,
});
$('#datepicker2').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true,
format: 'mm-dd',
});
5 years ago
$('.btn-a-b').click(function(){
var rows = $('#listTable').bootstrapTable('getSelections');
var params = [];
rows.forEach(function(item,index,array){
params.push(item.id);
});
5 years ago
var index = parent.layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
5 years ago
$.post('/database/a-b', {ids:params.join(',')}, function(data) {
5 years ago
parent.layer.close(index);
5 years ago
parent.layer.msg(data.msg);
if(data.success == true) {
refreshList();
}
},'json');
5 years ago
});
5 years ago
$('.btn-a-b-all').click(function() {
5 years ago
parent.layer.confirm('是否确认批量移动?', {
5 years ago
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
5 years ago
var index = parent.layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
5 years ago
var params = o;
$.post('/database/a-b-all',params,function(obj){
5 years ago
parent.layer.close(index);
parent.layer.msg(obj.msg);
5 years ago
if(obj.success) {
5 years ago
parent.layer.msg('保存成功');
5 years ago
search();
5 years ago
}
},'json');
5 years ago
}, function(){
//
});
5 years ago
});
5 years ago
$('.btn-a-c').click(function() {
var rows = $('#listTable').bootstrapTable('getSelections');
var params = [];
rows.forEach(function(item,index,array){
params.push(item.id);
});
5 years ago
var index = parent.layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
5 years ago
$.post('/database/a-c', {ids:params.join(',')}, function(data) {
5 years ago
parent.layer.close(index);
5 years ago
parent.layer.msg(data.msg);
if(data.success == true) {
refreshList();
}
},'json');
5 years ago
});
$('.btn-a-invalid').click(function() {
5 years ago
parent.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);
});
5 years ago
var index = parent.layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
});
$.post('/database/a-invalid',{ids:params.join(','), invalid_id:invalid_id},function(obj){
5 years ago
parent.layer.close(index);
parent.layer.msg(obj.msg);
if(obj.success) {
5 years ago
parent.layer.msg('保存成功');
search();
}
},'json');
}, function(){
//
});
});
5 years ago
});
</script>
5 years ago
<?php $this->endBlock(); ?>