完成A库、B库整理

dev
曾超新 5 years ago
parent fe6986f367
commit af7e6c87e2
  1. 64
      frontend/controllers/DatabaseController.php
  2. 121
      frontend/views/database/a-index-search.php
  3. 122
      frontend/views/database/a-index.php
  4. 89
      frontend/views/database/b-index.php
  5. 10
      frontend/web/assets/css/custom.css

@ -224,10 +224,6 @@ class DatabaseController extends BaseController
'invalid_items' => $invalid_items
]);
}
//A库搜索页
public function actionASearch() {
return $this->render('a-index-search');
}
//A库列表数据
public function actionAIndexJson()
{
@ -561,10 +557,6 @@ class DatabaseController extends BaseController
'invalid_items' => $invalid_items
]);
}
//B库搜索页
public function actionBSearch() {
return $this->render('b-index-search');
}
//B库列表数据
public function actionBIndexJson()
{
@ -599,6 +591,7 @@ class DatabaseController extends BaseController
}
return $data;
}
//勾选B库分配
public function actionBAssign()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@ -706,6 +699,7 @@ class DatabaseController extends BaseController
}
return $result;
}
//勾选B库回收
public function actionBReturn()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@ -724,7 +718,7 @@ class DatabaseController extends BaseController
try {
foreach($ids as $id) {
$b_info = CarBT::findOne(['id'=>$id]);
$this->addLog($b_info->id,'从B库回收数据到A库',1);
$this->addLog($b_info->id,'从B库业务手中回收数据',1);
//删除预约
AppointmentT::deleteAll('car_id='.$b_info->id);
@ -739,14 +733,8 @@ class DatabaseController extends BaseController
//删除保单
$order_info->delete();
}
$car_info = $b_info->car;
$car_info->location = 1;
if(!$car_info->save(false)) {
throw new \Exception(print_r($car_info->getErrors(),true));
}
$b_info->delete();
$b_info->user_id = 0;
$b_info->save();
}
$result['success'] = true;
$result['msg'] = '操作成功';
@ -759,6 +747,7 @@ class DatabaseController extends BaseController
}
return $result;
}
//批量B库分配
public function actionBAllAssign()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@ -877,6 +866,7 @@ class DatabaseController extends BaseController
}
return $result;
}
//批量B库回收
public function actionBReturnAllA()
{
Yii::$app->response->format = Response::FORMAT_JSON;
@ -893,41 +883,44 @@ class DatabaseController extends BaseController
$insurer1_begin = $request->post('insurer1_begin');
$insurer1_end = $request->post('insurer1_end');
if($status!=1){
$result['msg'] = '请选择未分配状态';
return $result;
}
$query = CarBT::find()
->leftJoin('car_t','`car_t`.`id`=`car_b_t`.`id`')
->andWhere('car_b_t.user_id=0');
->leftJoin('car_t','`car_t`.`id`=`car_b_t`.`id`');
if($register_begin != '') {
$query = $query->andWhere('car_t.register_date>="'.$register_begin.'"');
$query->andWhere('car_t.register_date>="'.$register_begin.'"');
}
if($register_end != '') {
$query = $query->andWhere('car_t.register_date<="'.$register_end.'"');
$query->andWhere('car_t.register_date<="'.$register_end.'"');
}
if($insurer1_begin != '') {
$query = $query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
$query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
}
if($insurer1_end != '') {
$query = $query->andWhere('car_t.insurer1_end<="'.$insurer1_end.'"');
$query->andWhere('car_t.insurer1_end<="'.$insurer1_end.'"');
}
$tran = CarT::getDb()->beginTransaction();
try {
foreach($query->each(1000) as $item) {
$car_info = $item->car;
$car_info->location = 1;
if(!$car_info->save()) {
throw new \Exception(print_r($car_info->getErrors(), true));
//删除预约
AppointmentT::deleteAll('car_id='.$item->id);
//删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作
//删除操作人员
$orders = OrderT::find()
->where('car_id='.$item->id.' and status_id<5')
->all();
foreach($orders as $order_info) {
OrderUserT::deleteAll('order_id='.$order_info->id);
//删除保单
$order_info->delete();
}
$item->delete();
$item->user_id = 0;
$item->save();
// FiltrationT
//删除预约拨打
// FiltrationT::deleteAll('car_id='.$c_info->id);
$this->addLog($item->id,'从B库未分配的数据批量收回到A库',1);
$this->addLog($item->id,'从B库业务员手中批量回收数据',1);
}
$result['success'] = true;
@ -942,6 +935,7 @@ class DatabaseController extends BaseController
return $result;
}
//C库
//C库列表页
private function getCQuery($request)
{

@ -1,121 +0,0 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<form role="form" class="form-horizontal" id="searchFrm" onsubmit="return search();">
<div class="form-group">
<label class="control-label col-sm-1">车牌</label>
<div class="col-sm-3">
<input type="text" id="car_no" name="car_no" class="form-control">
</div>
<label class="control-label col-sm-1">发动机号</label>
<div class="col-sm-3">
<input type="text" id="engine_no" name="engine_no" class="form-control">
</div>
<label class="control-label col-sm-1">车架号</label>
<div class="col-sm-3">
<input type="text" id="car_frame_no" name="car_frame_no" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">车主</label>
<div class="col-sm-3">
<input type="text" id="car_man" name="car_man" class="form-control">
</div>
<label class="control-label col-sm-1">联系电话</label>
<div class="col-sm-3">
<input type="text" id="phone" name="phone" class="form-control">
</div>
<label class="control-label col-sm-1">保险公司</label>
<div class="col-sm-3">
<input type="text" id="company" name="company" class="form-control">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">初登日期</label>
<div class="col-sm-3">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="register_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" name="register_end" value="" autocomplete="off" />
</div>
</div>
<label class="control-label col-sm-1">保险日期</label>
<div class="col-sm-3">
<div class="input-daterange input-group" id="datepicker">
<input type="text" class="input-sm form-control" name="insurer1_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" name="insurer1_end" value="" autocomplete="off" />
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">范围</label>
<div class="col-sm-11">
<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>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="invalid_lib" id="invalid_lib" value="1">
<label for="invalid_lib">无效库</label>
</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>
</div>
</div>
<div class="form-group">
<div class="col-sm-3 col-sm-offset-5">
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript">
function search() {
var o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
parent.o = o;
parent.refreshList();
layer_close();
}
$(function () {
$('.input-daterange').datepicker({
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -13,38 +13,100 @@ use \common\libs\MyLib;
<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();">
<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">发动机号</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">车架号</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">车主</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">保险公司</label>
<input type="text" id="company" name="company" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker1">初登日期</label>
<div class="input-group" id="datepicker1">
<input type="text" class="input-sm form-control" id="register_begin" name="register_begin" value="" autocomplete="off" />
<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" id="datepicker2">
<input type="text" class="input-sm form-control" id="insurer1_begin" name="insurer1_begin" value="" autocomplete="off" />
<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="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>
</div>
<div class="checkbox checkbox-inline">
<input type="checkbox" name="invalid_lib" id="invalid_lib" value="1">
<label for="invalid_lib">无效库</label>
</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">
<div class="col-sm-8">
<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>
<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">
<div class="form-group">
<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>
</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">
@ -78,6 +140,7 @@ use \common\libs\MyLib;
<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 src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
var o = {};
function opFormatter(value, row, index) {
@ -97,10 +160,6 @@ use \common\libs\MyLib;
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);
@ -126,6 +185,11 @@ use \common\libs\MyLib;
}
function search() {
o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/database/a-index-json",
@ -133,15 +197,33 @@ use \common\libs\MyLib;
sidePagination: 'server',
multipleSelectRow: true,
queryParams: function(params) {
o['limit'] = params['limit'];
o['offset'] = params['offset'];
o['limit'] = params['limit'];
return o;
}
});
return false;
}
$(function() {
search();
laydate({
elem:'#register_begin',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#register_end',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#insurer1_begin',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#insurer1_end',
format: 'YYYY-MM-DD',
istime: true
});
$('.btn-a-b').click(function(){
var rows = $('#listTable').bootstrapTable('getSelections');
@ -186,10 +268,6 @@ use \common\libs\MyLib;
}
},'json');
});
$('.btn-clear').click(function() {
o = {};
search();
});
$('.btn-a-invalid').click(function() {
layer.confirm('是否确认移动?', {
btn: ['确认','取消'], //按钮

@ -10,16 +10,58 @@ use \common\libs\MyLib;
<div class="ibox-title">
<h5>B库</h5>
<div class="ibox-tools">
<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-inline" onsubmit="return search();">
<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="car_man">车主</label>
<input type="text" id="car_man" name="car_man" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="phone">联系电话</label>
<input type="text" id="phone" name="phone" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="datepicker1">初登日期</label>
<div class="input-daterange input-group" id="datepicker1">
<input type="text" class="input-sm form-control" id="register_begin" name="register_begin" value="" autocomplete="off" />
<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-daterange input-group" id="datepicker2">
<input type="text" class="input-sm form-control" id="insurer1_begin" name="insurer1_begin" value="" autocomplete="off" />
<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="company">保险公司</label>
<input type="text" id="company" name="company" class="form-control">
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="status">状态</label>
<select id="status" name="status" class="form-control">
<option value="0">全部</option>
<option value="1">未分配</option>
<option value="2">已分配</option>
</select>
</div>
<div class="form-group" style="margin-bottom: 8px;">
<label for="username">业务员</label>
<input type="text" id="username" name="username" class="form-control">
</div>
<button type="submit" class="btn btn-primary mb-8">搜索</button>
<div class="form-group">
<select class="form-control" id="user_id" name="user_id">
<option value="0">请选择业务员</option>
@ -28,8 +70,12 @@ use \common\libs\MyLib;
}
?>
</select>
</div>
<div class="form-group">
<button type="button" class="btn btn-primary btn-assign">勾选分配</button>
<button type="button" class="btn btn-primary btn-assign-return">勾选收回</button>
</div>
<div class="form-group">
<label class="form-control-static">分配给业务员</label>
<input type="text" name="assign_users" id="assign_users" class="form-control">
<label class="form-control-static">每个业务员分配</label>
@ -37,7 +83,8 @@ use \common\libs\MyLib;
<label class="form-control-static">条记录</label>
<button type="button" class="btn btn-primary btn-assign-all">批量分配</button>
<button type="button" class="btn btn-primary btn-assign-all-return">批量收回</button>
<button type="button" class="btn btn-danger btn-clear">清空搜索条件</button>
</div>
<div class="form-group">
<select class="form-control" id="invalid_id" name="invalid_id" style="width:200px;">
<option value="0">请选择无效理由</option>
<?php foreach($invalid_items as $item) {
@ -79,18 +126,19 @@ use \common\libs\MyLib;
<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 src="/assets/js/plugins/layer/laydate/laydate.js"></script>
<script>
var o = {};
function searchDlg() {
title = '综合搜索';
layer_show(title, '/database/b-search');
}
function refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/database/b-index-json",
@ -103,10 +151,27 @@ use \common\libs\MyLib;
return o;
}
});
return false;
}
$(function() {
search();
laydate({
elem:'#register_begin',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#register_end',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#insurer1_begin',
format: 'YYYY-MM-DD'
});
laydate({
elem:'#insurer1_end',
format: 'YYYY-MM-DD'
});
$('.btn-assign').click(function(){
layer.confirm('是否确认分配操作?', {
@ -181,10 +246,6 @@ use \common\libs\MyLib;
//
});
});
$('.btn-clear').click(function() {
o = {};
search();
});
$('.btn-a-invalid').click(function() {
layer.confirm('是否确认移动?', {
btn: ['确认','取消'], //按钮

@ -1,15 +1,15 @@
.mb-8 {
margin-bottom: 8px;
margin-bottom: 8px !important;
}
.mr-8 {
margin-right: 8px;
margin-right: 8px !important;
}
.mt-8 {
margin-top: 8px;
margin-top: 8px !important;
}
.ml-8 {
margin-left: 8px;
margin-left: 8px !important;
}
.m-8 {
margin: 8px;
margin: 8px !important;
}
Loading…
Cancel
Save