From 793c5da7833bd24ddf92943f296f5306280f13d4 Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Sat, 12 Oct 2019 15:52:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/controllers/DatabaseController.php | 253 ++++++++++++++++-- frontend/views/common/index.php | 12 +- frontend/views/database/a-index.php | 2 +- frontend/views/database/b-index.php | 10 +- frontend/views/database/c-index.php | 12 +- frontend/views/database/d-index.php | 8 +- frontend/views/database/invalid-index.php | 30 +-- frontend/views/insurer-company/edit.php | 12 +- frontend/views/insurer-company/index.php | 1 - frontend/views/marketing-strategy/add.php | 18 +- frontend/views/marketing-strategy/edit.php | 16 +- frontend/views/work-day/edit.php | 37 +-- .../laydate/theme/default/font/iconfont.eot | Bin 0 -> 2456 bytes .../laydate/theme/default/font/iconfont.svg | 45 ++++ .../laydate/theme/default/font/iconfont.ttf | Bin 0 -> 2272 bytes .../laydate/theme/default/font/iconfont.woff | Bin 0 -> 1492 bytes .../layer/laydate/theme/default/laydate.css | 2 + 17 files changed, 359 insertions(+), 99 deletions(-) create mode 100644 frontend/web/assets/js/plugins/layer/laydate/theme/default/font/iconfont.eot create mode 100644 frontend/web/assets/js/plugins/layer/laydate/theme/default/font/iconfont.svg create mode 100644 frontend/web/assets/js/plugins/layer/laydate/theme/default/font/iconfont.ttf create mode 100644 frontend/web/assets/js/plugins/layer/laydate/theme/default/font/iconfont.woff create mode 100644 frontend/web/assets/js/plugins/layer/laydate/theme/default/laydate.css diff --git a/frontend/controllers/DatabaseController.php b/frontend/controllers/DatabaseController.php index 496d21c..ed2578d 100644 --- a/frontend/controllers/DatabaseController.php +++ b/frontend/controllers/DatabaseController.php @@ -437,7 +437,7 @@ class DatabaseController extends BaseController if(!$invalid_info) { $invalid_info = new CarInvalidT(false); $invalid_info->id = $car_info->id; - $invalid_info->user_id = 0; + $invalid_info->user_id = $this->my->id; $invalid_info->invalid_id = $invalid_id; if(!$invalid_info->save(false)) { throw new Exception(print_r($invalid_info->getFirstErrors(),true)); @@ -934,6 +934,79 @@ class DatabaseController extends BaseController } return $result; } + //钩选B库到无效库 + public function actionBInvalid() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '操作失败'; + + if($request->isPost) { + $ids = explode(',',$request->post('ids')); + $invalid_id = $request->post('invalid_id',0); + if($invalid_id == 0) { + $result['msg'] = '请选择无效理由'; + return $result; + } + if($ids[0] == '') { + $result['msg'] = '请先钩选车辆'; + return $result; + } + + $tran = CarT::getDb()->beginTransaction(); + try { + foreach($ids as $id) { + $car_info = CarT::findOne(['id'=>$id]); + if($car_info->location == 2) { + $car_info->location = 5; + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } + + $invalid_info = CarInvalidT::findOne(['id'=>$car_info->id]); + if(!$invalid_info) { + $invalid_info = new CarInvalidT(false); + $invalid_info->id = $car_info->id; + $invalid_info->user_id = $this->my->id; + $invalid_info->invalid_id = $invalid_id; + if(!$invalid_info->save(false)) { + throw new Exception(print_r($invalid_info->getFirstErrors(),true)); + } + } + + $b_info = CarBT::findOne(['id'=>$id]); + if($b_info->user_id > 0) { + //删除预约 + AppointmentT::deleteAll('car_id='.$b_info->id); + + //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作 + //删除操作人员 + $orders = OrderT::find() + ->where('car_id='.$b_info->id.' and status_id<5') + ->all(); + foreach($orders as $order_info) { + OrderUserT::deleteAll('order_id='.$order_info->id); + //删除保单 + $order_info->delete(); + } + } + $this->addLog($car_info->id,'从B库移动到无效库',1); + } + } + + $result['success'] = true; + $result['msg'] = '操作成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + } + return $result; + } //C库 //C库列表页 @@ -1532,6 +1605,79 @@ class DatabaseController extends BaseController } return $result; } + //钩选C库到无效库 + public function actionCInvalid() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '操作失败'; + + if($request->isPost) { + $ids = explode(',',$request->post('ids')); + $invalid_id = $request->post('invalid_id',0); + if($invalid_id == 0) { + $result['msg'] = '请选择无效理由'; + return $result; + } + if($ids[0] == '') { + $result['msg'] = '请先钩选车辆'; + return $result; + } + + $tran = CarT::getDb()->beginTransaction(); + try { + foreach($ids as $id) { + $car_info = CarT::findOne(['id'=>$id]); + if($car_info->location == 3) { + $car_info->location = 5; + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } + + $invalid_info = CarInvalidT::findOne(['id'=>$car_info->id]); + if(!$invalid_info) { + $invalid_info = new CarInvalidT(false); + $invalid_info->id = $car_info->id; + $invalid_info->user_id = $this->my->id; + $invalid_info->invalid_id = $invalid_id; + if(!$invalid_info->save(false)) { + throw new Exception(print_r($invalid_info->getFirstErrors(),true)); + } + } + + $c_info = CarCT::findOne(['id'=>$id]); + if($c_info->user_id > 0) { + //删除预约 + AppointmentT::deleteAll('car_id='.$c_info->id); + + //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作 + //删除操作人员 + $orders = OrderT::find() + ->where('car_id='.$c_info->id.' and status_id<5') + ->all(); + foreach($orders as $order_info) { + OrderUserT::deleteAll('order_id='.$order_info->id); + //删除保单 + $order_info->delete(); + } + } + $this->addLog($car_info->id,'从C库移动到无效库',1); + } + } + + $result['success'] = true; + $result['msg'] = '操作成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + } + return $result; + } //D库 //D库列表页 @@ -2036,6 +2182,79 @@ class DatabaseController extends BaseController } return $result; } + //钩选C库到无效库 + public function actionDInvalid() + { + Yii::$app->response->format = Response::FORMAT_JSON; + $request = Yii::$app->request; + $result = array(); + $result['success'] = false; + $result['msg'] = '操作失败'; + + if($request->isPost) { + $ids = explode(',',$request->post('ids')); + $invalid_id = $request->post('invalid_id',0); + if($invalid_id == 0) { + $result['msg'] = '请选择无效理由'; + return $result; + } + if($ids[0] == '') { + $result['msg'] = '请先钩选车辆'; + return $result; + } + + $tran = CarT::getDb()->beginTransaction(); + try { + foreach($ids as $id) { + $car_info = CarT::findOne(['id'=>$id]); + if($car_info->location == 4) { + $car_info->location = 5; + if(!$car_info->save(false)) { + throw new Exception(print_r($car_info->getFirstErrors(),true)); + } + + $invalid_info = CarInvalidT::findOne(['id'=>$car_info->id]); + if(!$invalid_info) { + $invalid_info = new CarInvalidT(false); + $invalid_info->id = $car_info->id; + $invalid_info->user_id = $this->my->id; + $invalid_info->invalid_id = $invalid_id; + if(!$invalid_info->save(false)) { + throw new Exception(print_r($invalid_info->getFirstErrors(),true)); + } + } + + $d_info = CarDT::findOne(['id'=>$id]); + if($d_info->user_id > 0) { + //删除预约 + AppointmentT::deleteAll('car_id='.$d_info->id); + + //删除保单 还没有正本生成的保单可以直接删除,正本生成后,需要退单操作 + //删除操作人员 + $orders = OrderT::find() + ->where('car_id='.$d_info->id.' and status_id<5') + ->all(); + foreach($orders as $order_info) { + OrderUserT::deleteAll('order_id='.$order_info->id); + //删除保单 + $order_info->delete(); + } + } + $this->addLog($car_info->id,'从C库移动到无效库',1); + } + } + + $result['success'] = true; + $result['msg'] = '操作成功'; + + $tran->commit(); + } catch (\Exception $e) { + $tran->rollBack(); + $result['msg'] = $e->getMessage(); + } + } + return $result; + } //无效库列表页 private function getInvalidQuery($request) @@ -2125,13 +2344,7 @@ class DatabaseController extends BaseController { $invalid_items = InvalidT::getTree(); return $this->render('invalid-index',[ - 'invalid_items' - ]); - } - public function actionInvalidSearch() { - $invalid_items = InvalidT::getTree(); - return $this->render('invalid-index-search',[ - 'invalid_items' => $invalid_items + 'invalid_items'=>$invalid_items ]); } public function actionInvalidIndexJson() @@ -2160,6 +2373,8 @@ class DatabaseController extends BaseController $row['factory_model'] = MyLib::substr_cut($car_info->factory_model, 8); $row['car_man'] = MyLib::substr_cut($car_info->car_man, 8); $row['op_user'] = $item->user?$item->user->getShowName():''; + $row['invalid_info'] = $item->invalid->getPath(); + $row['invalid_time'] = $item->invalid->created_at; $data['rows'][] = $row; } return $data; @@ -2638,14 +2853,16 @@ class DatabaseController extends BaseController $result['msg'] = '操作失败'; if($request->isPost) { - $ids = $request->post('ids',array()); + $ids = explode(',',$request->post('ids')); $tran = CarT::getDb()->beginTransaction(); try { foreach($ids as $id) { $car_info = CarT::findOne(['id'=>$id]); $car_info->location = 1; - $car_info->save(); + if(!$car_info->save()) { + throw new \Exception(print_r($car_info->getErrors(), true)); + } CarInvalidT::deleteAll('id='.$id); AppointmentHistoryT::deleteAll('car_id='.$id); @@ -2657,7 +2874,7 @@ class DatabaseController extends BaseController $tran->commit(); } catch (\Exception $e) { $tran->rollBack(); - echo $e->getMessage(); + $result['msg'] = $e->getMessage(); } } return $result; @@ -2674,10 +2891,10 @@ class DatabaseController extends BaseController if($request->isPost) { $invalid_id = $request->post('invalid_id'); - if($invalid_id == 0) { - $result['msg'] = '请先选择无效理由'; - return $result; - } +// if($invalid_id == 0) { +// $result['msg'] = '请先选择无效理由'; +// return $result; +// } $data = $this->getInvalidQuery($request); $query = $data['query']; @@ -2686,7 +2903,9 @@ class DatabaseController extends BaseController foreach($query->each(1000) as $item) { $car_info = $item->car; $car_info->location = 1; - $car_info->save(); + if(!$car_info->save()) { + throw new \Exception(print_r($car_info->getErrors(), true)); + } AppointmentHistoryT::deleteAll('car_id='.$item->id); $item->delete(); $this->addLog($item->id,'从无效数据中恢复数据',1); @@ -2698,7 +2917,7 @@ class DatabaseController extends BaseController $tran->commit(); } catch (\Exception $e) { $tran->rollBack(); - throw $e; + $result['msg'] = $e->getMessage(); } } return $result; diff --git a/frontend/views/common/index.php b/frontend/views/common/index.php index 0420637..195d3ef 100644 --- a/frontend/views/common/index.php +++ b/frontend/views/common/index.php @@ -64,6 +64,8 @@
+
diff --git a/frontend/views/database/a-index.php b/frontend/views/database/a-index.php index 5466871..f685abe 100644 --- a/frontend/views/database/a-index.php +++ b/frontend/views/database/a-index.php @@ -97,7 +97,7 @@ use \common\libs\MyLib;
-
+
-
+
-
+
@@ -84,7 +84,7 @@ use \common\libs\MyLib;
-
+
勾选收回
-
+
@@ -86,7 +84,7 @@ use \common\libs\MyLib;
-
+
勾选分配
-
+
@@ -74,7 +74,7 @@ use \common\libs\MyLib;
-
+
@@ -50,7 +47,7 @@ use \common\libs\MyLib;
- id.'">'.$item->name.''; @@ -59,10 +56,8 @@ use \common\libs\MyLib;
-
- - -
+ +
@@ -75,11 +70,11 @@ use \common\libs\MyLib; 车型 车主 联系电话 - 初登日期 出单日期 保险日期 - 保险公司 - 业务员 + 无效理由 + 无效时间 + 操作者 @@ -107,6 +102,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/invalid-index-json", @@ -150,7 +150,7 @@ use \common\libs\MyLib; rows.forEach(function(item,index,array){ params.push(item.id); }); - $.post('/database/d-return',{ids:params.join(',')},function(obj){ + $.post('/database/invalid-a',{ids:params.join(',')},function(obj){ layer.msg(obj.msg); if(obj.success) { search(); @@ -165,9 +165,7 @@ use \common\libs\MyLib; btn: ['确认','取消'], //按钮 shade: false //不显示遮罩 }, function(){ - o.assign_users = $('#assign_users').val(); - o.assign_count = $('#assign_count').val(); - $.post('/database/d-all-assign',o,function(obj){ + $.post('/database/invalid-all-a',o,function(obj){ layer.msg(obj.msg); if(obj.success) { search(); diff --git a/frontend/views/insurer-company/edit.php b/frontend/views/insurer-company/edit.php index a44bc38..29a6a45 100644 --- a/frontend/views/insurer-company/edit.php +++ b/frontend/views/insurer-company/edit.php @@ -13,20 +13,14 @@ use \common\libs\MyLib;
- -
+ +
-
- -
- -
-
-
+
diff --git a/frontend/views/insurer-company/index.php b/frontend/views/insurer-company/index.php index cd84eae..3467acc 100644 --- a/frontend/views/insurer-company/index.php +++ b/frontend/views/insurer-company/index.php @@ -26,7 +26,6 @@ use \common\libs\MyLib; ID 公司名称 - SAM 操作 diff --git a/frontend/views/marketing-strategy/add.php b/frontend/views/marketing-strategy/add.php index 6513994..ab73ea8 100644 --- a/frontend/views/marketing-strategy/add.php +++ b/frontend/views/marketing-strategy/add.php @@ -13,19 +13,19 @@ use \common\libs\MyLib;
- -
+ +
- -
+ +
日期
- -
+ +
日期 @@ -33,14 +33,14 @@ use \common\libs\MyLib;
- -
+ +
-
+
diff --git a/frontend/views/marketing-strategy/edit.php b/frontend/views/marketing-strategy/edit.php index 761199c..3040161 100644 --- a/frontend/views/marketing-strategy/edit.php +++ b/frontend/views/marketing-strategy/edit.php @@ -28,19 +28,19 @@ use \common\libs\MyLib;
- -
+ +
- -
+ +
日期
- -
+ +
日期 @@ -48,8 +48,8 @@ use \common\libs\MyLib;
- -
+ +
diff --git a/frontend/views/work-day/edit.php b/frontend/views/work-day/edit.php index e711cad..37f5357 100644 --- a/frontend/views/work-day/edit.php +++ b/frontend/views/work-day/edit.php @@ -14,27 +14,27 @@ use \common\libs\MyLib;
- -
+ +
- +
- -
+ +
- -
+ +
-
+
@@ -50,17 +50,22 @@ use \common\libs\MyLib; beginBlock('footer_js'); ?> +