From af7e6c87e22d4aae3e418b1d0e702213f92aa1d7 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 11 Oct 2019 11:45:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90A=E5=BA=93=E3=80=81B=E5=BA=93?= =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/DatabaseController.php | 64 ++++----- frontend/views/database/a-index-search.php | 121 ----------------- frontend/views/database/a-index.php | 142 +++++++++++++++----- frontend/views/database/b-index.php | 89 ++++++++++-- frontend/web/assets/css/custom.css | 10 +- 5 files changed, 219 insertions(+), 207 deletions(-) delete mode 100644 frontend/views/database/a-index-search.php diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index 981ad12..5028be4 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -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) { diff --git a/frontend/views/database/a-index-search.php b/frontend/views/database/a-index-search.php deleted file mode 100644 index 3589d8c..0000000 --- a/frontend/views/database/a-index-search.php +++ /dev/null @@ -1,121 +0,0 @@ - -beginBlock('header_css'); ?> -endBlock(); ?> - -
-
-
-
-
- -
- -
- -
- -
- -
- -
-
-
- -
- -
- -
- -
- -
- -
-
-
- -
-
- - - -
-
- -
-
- - - -
-
-
-
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
-
-
-
- -
-
-
-
-
-
- -beginBlock('footer_js'); ?> - -endBlock('footer_js'); ?> diff --git a/frontend/views/database/a-index.php b/frontend/views/database/a-index.php index 4802729..0a83549 100644 --- a/frontend/views/database/a-index.php +++ b/frontend/views/database/a-index.php @@ -13,37 +13,99 @@ use \common\libs\MyLib; 添加 - - 搜索 - 刷新
-
-
-
- - - - + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + + +
+
+
+ +
+ + + +
+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+ +
-
-
- -
-
- -
+
+ +
+
+ + +
+
+ + +
+ +
+
+ + + +
+
+ +
@@ -78,6 +140,7 @@ use \common\libs\MyLib; + +