完成D库功能整理

dev
曾超新 5 years ago
parent 2f48862f07
commit 14d481451e
  1. 93
      frontend/controllers/DatabaseController.php
  2. 92
      frontend/views/database/c-index-search.php
  3. 84
      frontend/views/database/d-index-search.php
  4. 73
      frontend/views/database/d-index.php

@ -1533,6 +1533,7 @@ class DatabaseController extends BaseController
return $result; return $result;
} }
//D库
//D库列表页 //D库列表页
private function getDQuery($request) private function getDQuery($request)
{ {
@ -1657,9 +1658,6 @@ class DatabaseController extends BaseController
'invalid_items' => $invalid_items 'invalid_items' => $invalid_items
]); ]);
} }
public function actionDSearch() {
return $this->render('d-index-search');
}
public function actionDIndexJson() public function actionDIndexJson()
{ {
Yii::$app->response->format = Response::FORMAT_JSON; Yii::$app->response->format = Response::FORMAT_JSON;
@ -1729,11 +1727,15 @@ class DatabaseController extends BaseController
$order_row->engine_no = $d_info->car->engine_no; $order_row->engine_no = $d_info->car->engine_no;
$order_row->car_frame_no = $d_info->car->car_frame_no; $order_row->car_frame_no = $d_info->car->car_frame_no;
$order_row->car_man = $d_info->car->car_man; $order_row->car_man = $d_info->car->car_man;
$order_row->car_man_number = $d_info->car->car_man_number;
$order_row->car_man_phone = $d_info->car->phone;
$order_row->user_id = $user_id; $order_row->user_id = $user_id;
$order_row->status_id = 1; $order_row->status_id = 1;
$order_row->id_man = $d_info->car->car_man; $order_row->id_man = $d_info->car->car_man;
$order_row->id_man_number = $d_info->car->id_number;
$order_row->link_man = $d_info->car->car_man; $order_row->link_man = $d_info->car->car_man;
$order_row->link_phone = $d_info->car->phone; $order_row->link_man_phone = $d_info->car->phone;
$order_row->link_man_number = $d_info->car->id_number;
if(!$order_row->save()) { if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true)); throw new \Exception(print_r($order_row->getErrors(),true));
} }
@ -1896,13 +1898,15 @@ class DatabaseController extends BaseController
$order_row->engine_no = $d_info->car->engine_no; $order_row->engine_no = $d_info->car->engine_no;
$order_row->car_frame_no = $d_info->car->car_frame_no; $order_row->car_frame_no = $d_info->car->car_frame_no;
$order_row->car_man = $d_info->car->car_man; $order_row->car_man = $d_info->car->car_man;
$order_row->car_man_number = $d_info->car->car_man_number;
$order_row->car_man_phone = $d_info->car->phone;
$order_row->user_id = $d_info->user_id; $order_row->user_id = $d_info->user_id;
$order_row->status_id = 1; $order_row->status_id = 1;
$order_row->id_man = $d_info->car->car_man; $order_row->id_man = $d_info->car->car_man;
$order_row->id_man_number = $d_info->car->id_number;
$order_row->link_man = $d_info->car->car_man; $order_row->link_man = $d_info->car->car_man;
$order_row->link_phone = $d_info->car->phone; $order_row->link_man_phone = $d_info->car->phone;
$order_row->return_status_id = 0; $order_row->link_man_number = $d_info->car->id_number;
$order_row->return_remark = '';
if(!$order_row->save()) { if(!$order_row->save()) {
throw new \Exception(print_r($order_row->getErrors(),true)); throw new \Exception(print_r($order_row->getErrors(),true));
} }
@ -1929,8 +1933,9 @@ class DatabaseController extends BaseController
$row->is_first = 1; $row->is_first = 1;
$row->xdate = date('Y-m-d'); $row->xdate = date('Y-m-d');
$row->xtime = '09:00'; $row->xtime = '09:00';
$row->xbao = 2;
if(!$row->save()) { if(!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true)); throw new \Exception(print_r($row->getErrors(),true));
} }
//添加历史预约 //添加历史预约
@ -1943,8 +1948,9 @@ class DatabaseController extends BaseController
$h_row->remark = '首次分配'; $h_row->remark = '首次分配';
$h_row->xdate = date('Y-m-d'); $h_row->xdate = date('Y-m-d');
$h_row->xtime = '09:00'; $h_row->xtime = '09:00';
$h_row->xbao = 2;
if(!$h_row->save()) { if(!$h_row->save()) {
throw new \Exception(print_r($h_row->getErrors(), true)); throw new \Exception(print_r($h_row->getErrors(),true));
} }
$this->addLog($d_info->id,'从D库分配数据给业务员:'.$d_info->user->getShowName(),1); $this->addLog($d_info->id,'从D库分配数据给业务员:'.$d_info->user->getShowName(),1);
@ -1961,6 +1967,75 @@ class DatabaseController extends BaseController
} }
return $result; return $result;
} }
public function actionDReturnAll()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$result = array();
$result['success'] = false;
$result['msg'] = '操作失败';
if($request->isPost) {
$status = $request->post('status');
$register_begin = $request->post('register_begin');
$register_end = $request->post('register_end');
$insurer1_begin = $request->post('insurer1_begin');
$insurer1_end = $request->post('insurer1_end');
$query = CarDT::find()
->leftJoin('car_t','`car_t`.`id`=`car_d_t`.`id`');
if($register_begin != '') {
$query->andWhere('car_t.register_date>="'.$register_begin.'"');
}
if($register_end != '') {
$query->andWhere('car_t.register_date<="'.$register_end.'"');
}
if($insurer1_begin != '') {
$query->andWhere('car_t.insurer1_date>="'.$insurer1_begin.'"');
}
if($insurer1_end != '') {
$query->andWhere('car_t.insurer1_end<="'.$insurer1_end.'"');
}
$tran = CarT::getDb()->beginTransaction();
try {
foreach($query->each(1000) as $item) {
//删除预约
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->user_id = 0;
if(!$item->save()) {
throw new \Exception(print_r($item->getErrors(), true));
}
// FiltrationT
//删除预约拨打
// FiltrationT::deleteAll('car_id='.$c_info->id);
$this->addLog($item->id,'从D库业务员手中批量回收数据',1);
}
$result['success'] = true;
$result['msg'] = '操作成功';
$tran->commit();
} catch (\Exception $e) {
$tran->rollBack();
$result['msg'] = $e->getMessage();
}
}
return $result;
}
//无效库列表页 //无效库列表页
private function getInvalidQuery($request) private function getInvalidQuery($request)

@ -1,92 +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="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>
</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="print_begin" value="" autocomplete="off" />
<span class="input-group-addon"></span>
<input type="text" class="input-sm form-control" name="print_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>
<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">
<select name="status" class="form-control">
<option value="0">全部</option>
<option value="1">未分配</option>
<option value="2">已分配</option>
</select>
</div>
<label class="control-label col-sm-1">业务员</label>
<div class="col-sm-3">
<input type="text" id="username" name="username" class="form-control">
</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'); ?>

@ -1,84 +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="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>
</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="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>
<label class="control-label col-sm-1">保险公司</label>
<div class="col-sm-3">
<input type="text" id="company" name="company" class="form-control">
</div>
<label class="control-label col-sm-1">状态</label>
<div class="col-sm-3">
<select name="status" class="form-control">
<option value="0">全部</option>
<option value="1">未分配</option>
<option value="2">已分配</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-1">业务员</label>
<div class="col-sm-3">
<input type="text" id="username" name="username" class="form-control">
</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'); ?>

@ -10,16 +10,50 @@ use \common\libs\MyLib;
<div class="ibox-title"> <div class="ibox-title">
<h5>D库</h5> <h5>D库</h5>
<div class="ibox-tools"> <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');"> <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> 刷新 <i class="fa fa-refresh"></i> 刷新
</a> </a>
</div> </div>
</div> </div>
<div class="ibox-content"> <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="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"> <div class="form-group">
<select class="form-control" id="user_id" name="user_id"> <select class="form-control" id="user_id" name="user_id">
<option value="0">请选择业务员</option> <option value="0">请选择业务员</option>
@ -30,14 +64,18 @@ use \common\libs\MyLib;
</select> </select>
<button type="button" class="btn btn-primary btn-assign">勾选分配</button> <button type="button" class="btn btn-primary btn-assign">勾选分配</button>
<button type="button" class="btn btn-primary btn-assign-return">勾选收回</button> <button type="button" class="btn btn-primary btn-assign-return">勾选收回</button>
</div>
<div class="form-group">
<label class="form-control-static">分配给业务员</label> <label class="form-control-static">分配给业务员</label>
<input type="text" name="assign_users" id="assign_users" class="form-control"> <input type="text" name="assign_users" id="assign_users" class="form-control">
<label class="form-control-static">每个业务员分配</label> <label class="form-control-static">每个业务员分配</label>
<input type="text" name="assign_count" id="assign_count" class="form-control"> <input type="text" name="assign_count" id="assign_count" class="form-control">
<label class="form-control-static">条记录</label> <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">批量分配</button>
<button type="button" class="btn btn-danger btn-clear">清空搜索条件</button> <button type="button" class="btn btn-primary btn-assign-all-return">批量收回</button>
<select class="form-control" id="invalid_id" name="invalid_id"> </div>
<div class="form-group">
<select class="form-control" id="invalid_id" name="invalid_id" style="width:200px;">
<option value="0">请选择无效理由</option> <option value="0">请选择无效理由</option>
<?php foreach($invalid_items as $item) { <?php foreach($invalid_items as $item) {
echo '<option value="'.$item->id.'">'.$item->name.'</option>'; echo '<option value="'.$item->id.'">'.$item->name.'</option>';
@ -89,6 +127,11 @@ use \common\libs\MyLib;
} }
function search() { function search() {
o = {};
var params = $("#searchFrm").serializeArray();
$.each(params, function(index) {
o[this['name']] = this['value'];
});
$('#listTable').bootstrapTable('destroy'); $('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({ $('#listTable').bootstrapTable({
url: "/database/d-index-json", url: "/database/d-index-json",
@ -101,6 +144,7 @@ use \common\libs\MyLib;
return o; return o;
} }
}); });
return false;
} }
$(function() { $(function() {
@ -164,9 +208,20 @@ use \common\libs\MyLib;
// //
}); });
}); });
$('.btn-clear').click(function() { $('.btn-assign-all-return').click(function() {
o = {}; layer.confirm('是否确认批量收回操作?', {
search(); btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
$.post('/database/d-return-all',o,function(obj){
layer.msg(obj.msg);
if(obj.success) {
search();
}
},'json');
}, function(){
//
});
}); });
$('.btn-a-invalid').click(function() { $('.btn-a-invalid').click(function() {
layer.confirm('是否确认移动?', { layer.confirm('是否确认移动?', {

Loading…
Cancel
Save