完成业务界面设计

dev
曾超新 5 years ago
parent 43fc5dca5a
commit 1fdd48ee27
  1. 1
      .gitignore
  2. 4
      common/models/CarT.php
  3. 3
      common/models/LinkmanT.php
  4. 56
      frontend/controllers/AppointmentController.php
  5. 483
      frontend/controllers/CarController.php
  6. 2
      frontend/controllers/DatabaseController.php
  7. 47
      frontend/controllers/FinanceController.php
  8. 129
      frontend/views/appointment/add.php
  9. 55
      frontend/views/car/history.php
  10. 1867
      frontend/views/car/info.php
  11. 89
      frontend/views/car/linkman-add.php
  12. 2
      frontend/views/database/a-index.php
  13. 2
      frontend/views/database/b-index.php
  14. 179
      frontend/views/finance/car-update-frame.php
  15. 36
      frontend/views/user/edit.php

1
.gitignore vendored

@ -28,3 +28,4 @@ composer.phar
phpunit.phar phpunit.phar
# local phpunit config # local phpunit config
/phpunit.xml /phpunit.xml
frontend/web/upload

@ -121,6 +121,10 @@ class CarT extends \common\models\Base
]; ];
} }
public function getLinkmen() {
return $this->hasMany(LinkmanT::className(),['car_id'=>'id']);
}
public function getUser() public function getUser()
{ {
return $this->hasOne(UserT::className(),['id'=>'user_id']); return $this->hasOne(UserT::className(),['id'=>'user_id']);

@ -36,7 +36,7 @@ class LinkmanT extends \common\models\Base
[['car_id'], 'integer'], [['car_id'], 'integer'],
[['created_at', 'updated_at'], 'safe'], [['created_at', 'updated_at'], 'safe'],
[['name'], 'string', 'max' => 100], [['name'], 'string', 'max' => 100],
[['phone', 'type', 'id_number'], 'string', 'max' => 50], [['phone', 'type', 'id_type', 'id_number'], 'string', 'max' => 50],
]; ];
} }
@ -51,6 +51,7 @@ class LinkmanT extends \common\models\Base
'name' => 'Name', 'name' => 'Name',
'phone' => 'Phone', 'phone' => 'Phone',
'type' => 'Type', 'type' => 'Type',
'id_type' => 'Id Type',
'id_number' => 'Id Number', 'id_number' => 'Id Number',
'created_at' => 'Created At', 'created_at' => 'Created At',
'updated_at' => 'Updated At', 'updated_at' => 'Updated At',

@ -88,12 +88,43 @@ class AppointmentController extends BaseController
return $result; return $result;
} }
public function actionHistoryJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_id = $request->get('car_id');
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
$pdate = date("Y-m-d",strtotime("-6 months"));
$query = AppointmentHistoryT::find()
->where(['car_id'=>$car_id])
->andWhere('pdate>"'.$pdate.'"')
->orderBy('pdate DESC,id DESC');
//echo $query->createCommand()->rawSql;
$total = $query->count();
$query = $query->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
$data['total'] = count($items);
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['user'] = $item->user?$item->user->getShowName():'';
$data['rows'][] = $row;
}
return $data;
}
public function actionAdd() public function actionAdd()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;
$car_id = $request->get('car_id',0); $car_id = $request->get('car_id',0);
return $this->renderPartial('add',[ return $this->render('add', [
'car_id' => $car_id 'car_id' => $car_id
]); ]);
} }
@ -111,16 +142,15 @@ class AppointmentController extends BaseController
$pdate = $request->post('pdate'); $pdate = $request->post('pdate');
$ptime = $request->post('ptime'); $ptime = $request->post('ptime');
$remark = $request->post('remark'); $remark = $request->post('remark');
$ptype = $request->post('ptype'); $ptype = $request->post('ptype',0);
$business_group_id = $request->post('business_group_id', 0); $business_group_id = $request->post('business_group_id', 0);
if($pdate == '') { if($pdate == '') {
$result['msg'] = '请选择预约时间!'; $result['msg'] = '请选择预约日期!';
return $result; return $result;
} }
if($ptime == '') {
if($ptype == '0') { $result['msg'] = '请选择预约时间!';
$result['msg'] = '请选择预约类型!';
return $result; return $result;
} }
@ -175,7 +205,9 @@ class AppointmentController extends BaseController
$row->remark = $remark; $row->remark = $remark;
$row->business_group_id = $business_group_id; $row->business_group_id = $business_group_id;
$row->is_first = 0; $row->is_first = 0;
$row->save(); if(!$row->save()) {
throw new \Exception(print_r($row->getErrors(), true));
}
$h_row = new AppointmentHistoryT(); $h_row = new AppointmentHistoryT();
$h_row->car_id = $car_id; $h_row->car_id = $car_id;
@ -185,7 +217,9 @@ class AppointmentController extends BaseController
$h_row->ptype = $ptype; $h_row->ptype = $ptype;
$h_row->remark = $remark; $h_row->remark = $remark;
$h_row->business_group_id = $business_group_id; $h_row->business_group_id = $business_group_id;
$h_row->save(); if(!$h_row->save()) {
throw new \Exception(print_r($h_row->getErrors(), true));
}
$log_txt = ''; $log_txt = '';
if($old_user_id > 0) { if($old_user_id > 0) {
@ -195,13 +229,13 @@ class AppointmentController extends BaseController
$tran->commit(); $tran->commit();
$result['success'] = true;
$result['msg'] = '保存成功';
} catch(\Exception $e) { } catch(\Exception $e) {
$tran->rollBack(); $tran->rollBack();
throw $e; $result['msg'] = $e->getMessage();
} }
$result['success'] = true;
$result['msg'] = '保存成功';
} }
return $result; return $result;
} }

@ -89,14 +89,6 @@ class CarController extends BaseController
// set_time_limit(0); // set_time_limit(0);
// $begin_time = time(); // $begin_time = time();
// $file_path = \Yii::getAlias('@console').'/controllers/'; // $file_path = \Yii::getAlias('@console').'/controllers/';
// var_dump($row); // var_dump($row);
//加上级别筛选 //加上级别筛选
@ -718,260 +710,10 @@ class CarController extends BaseController
} }
// public function actionInfo()
// {
// $request = Yii::$app->request;
// $id = $request->get('id',0);
// $type = $request->get('type',0);
// $car_man = $request->get('car_man');
// $phone = $request->get('phone');
// $car_no = $request->get('car_no');
// $page = $request->get('page',1);
// $sort_key = $request->get('sort_key','appointment_t.pdate');
// $sort_value = $request->get('sort_value','ASC');
// $next_index = $request->get('next_index',0);
// $back_params = $request->get('back_params');
// $my_path = $this->my->group?$this->my->group->getPath():'';
//
// $car_info = CarT::findOne(['id'=>$id]);
// $order_info = $car_info->getOrders()->orderBy('id DESC')->one();
// if(!$order_info) {
// $user_id = 0;
// if($car_info->location == 2) {
// $b_info = CarBT::findOne(['id'=>$car_info->id]);
// $user_id = $b_info->user_id;
// }
// if($car_info->location == 3) {
// $c_info = CarCT::findOne(['id'=>$car_info->id]);
// $user_id = $c_info->user_id;
// }
// if($car_info->location == 4) {
// $d_info = CarDT::findOne(['id'=>$car_info->id]);
// $user_id = $d_info->user_id;
// }
// $order_info = new OrderT();
// $order_info->car_id = $car_info->id;
// $order_info->car_no = $car_info->car_no;
// $order_info->engine_no = $car_info->engine_no;
// $order_info->car_frame_no = $car_info->car_frame_no;
// $order_info->car_man = $car_info->car_man;
// $order_info->user_id = $user_id;
// $order_info->status_id = 1;
// $order_info->id_man = $car_info->car_man;
// $order_info->link_man = $car_info->car_man;
// $order_info->link_phone = $car_info->phone;
// $order_info->save();
// }
// $insurer_type_items = InsurerTypeT::find()->all();
// $insurer_company_items = InsurerCompanyT::find()->all();
// $insurer_company2_items = InsurerCompany2T::find()->all();
// $pay_type_items = PayTypeT::find()->all();
// $car_use_items = CarUseT::find()->all();
// $car_type_items = CarTypeT::find()->all();
// $brand_items = BrandT::find()->all();
// $series_items = SeriesT::find()
// ->where('brand_id='.intval($car_info->brand_id))
// ->all();
// $displacement_items = DisplacementT::find()
// ->where('series_id='.intval($car_info->series_id))
// ->all();
// $direction_items = DirectionT::find()
// ->all();
// $range_items = RangeT::find()
// ->all();
// $city_items = CityT::find()
// ->all();
// $district_items = DistrictT::find()
// ->orderBy('order_id ASC')
// ->all();
// $gift_items = GiftT::find()
// ->where('type_id=1')
// ->all();
// $success_items = InvalidT::getTree(1);
// $failure_items = InvalidT::getTreeXinbaoNew(2);
//
// //下一辆
// $next_id = 0;
// if($type == 1) {
// $query = AppointmentT::find()
// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
// ->where('appointment_t.is_first=1 and car_t.is_track=0')
// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
//
// $user_ids = $this->getChildrenUserIDs();
// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
//
// if($car_man != '') {
// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('car_t.phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
// }
// if($sort_key != '') {
// $query = $query->orderBy($sort_key.' '.$sort_value);
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
// if($type == 2) {
// $query = AppointmentT::find()
// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
// ->where('appointment_t.is_first=0 and car_t.is_track=0')
// ->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
//
// $user_ids = $this->getChildrenUserIDs();
// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
//
// if($car_man != '') {
// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('car_t.phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
// }
// if($sort_key != '') {
// $query = $query->orderBy($sort_key.' '.$sort_value);
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
// if($type == 3) {
// $query = AppointmentT::find()
// ->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
// ->where('appointment_t.is_first=0 and car_t.is_track=0');
//
// $user_ids = $this->getChildrenUserIDs();
// $query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
//
// if($car_man != '') {
// $query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('car_t.phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
// }
// if($sort_key != '') {
// $query = $query->orderBy($sort_key.' '.$sort_value);
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
// if($type == 4) {
// $query = OrderT::find()
// ->where('status_id=1 and return_status_id>0')
// ->orderBy('submit_date DESC, id DESC');
// $user_items = $this->my->getChildren();
// $user_ids[] = $this->my->id;
// if($user_items) {
// foreach($user_items as $user_item) {
// $user_ids[] = $user_item->id;
// }
// }
// $query = $query->andWhere(['in','user_id',$user_ids]);
// if($car_man != '') {
// $query = $query->andWhere('car_man="'.$car_man.'"');
// }
// if($phone != '') {
// $query = $query->andWhere('link_phone="'.$phone.'"');
// }
// if($car_no != '') {
// $query = $query->andWhere('car_no="'.$car_no.'"');
// }
// $next_item = $query->offset($next_index)->one();
// if($next_item) {
// $next_id = $next_item->car_id;
// }
// $next_index++;
// }
//
//// $gift_type_items = GiftType2T::find()->all();
// $gift_group_items = GiftGroupT::find()
// ->where('is_free=0')
// ->all();
// $gift_free_group_items = GiftGroupT::find()
// ->where('is_free=1')
// ->all();
// //获取礼品数据
// $sel_gifts = array();
// $tmp_items = OrderGiftT::find()
// ->where('order_id='.$order_info->id)
// ->all();
// foreach($tmp_items as $item) {
// $sel_gifts[$item->group_id] = $item;
// }
//
// $list = MeetT::getAllData(1);
//
// $business_group = BusinessGroupT::find()->all();
//
// return $this->render('info',[
// 'type' => $type,
// 'car_info' => $car_info,
// 'insurer_type_items' => $insurer_type_items,
// 'order_info' => $order_info,
// 'insurer_company_items' => $insurer_company_items,
// 'insurer_company2_items' => $insurer_company2_items,
// 'list' => $list,
// 'pay_type_items' => $pay_type_items,
// 'car_use_items' => $car_use_items,
// 'car_type_items' => $car_type_items,
// 'brand_items' => $brand_items,
// 'series_items' => $series_items,
// 'displacement_items' => $displacement_items,
// 'direction_items' => $direction_items,
// 'range_items' => $range_items,
// 'city_items' => $city_items,
// 'district_items' => $district_items,
// 'gift_items' => $gift_items,
// 'success_items' => $success_items,
// 'failure_items' => $failure_items,
// 'next_id' => $next_id,
// 'next_index' => $next_index,
// 'car_man' => $car_man,
// 'car_no' => $car_no,
// 'phone' => $phone,
// 'page' => $page,
// 'sort_key' => $sort_key,
// 'sort_value' => $sort_value,
// 'back_params' => $back_params,
//// 'gift_type_items' => $gift_type_items,
// 'gift_group_items' => $gift_group_items,
// 'gift_free_group_items' => $gift_free_group_items,
// 'sel_gifts' => $sel_gifts,
// 'business_group' => $business_group,
// 'business_group_id' => $this->my->business_group_id,
// ]);
// }
public function actionInfo() public function actionInfo()
{ {
$request = Yii::$app->request; $request = Yii::$app->request;
$id = $request->get('id',0); $id = $request->get('id',0);
$type = $request->get('type',0);
$car_man = $request->get('car_man');
$phone = $request->get('phone');
$car_no = $request->get('car_no');
$page = $request->get('page',1);
$sort_key = $request->get('sort_key','appointment_t.pdate');
$sort_value = $request->get('sort_value','ASC');
$next_index = $request->get('next_index',0);
$back_params = $request->get('back_params');
$my_path = $this->my->group?$this->my->group->getPath():'';
$car_info = CarT::findOne(['id'=>$id]); $car_info = CarT::findOne(['id'=>$id]);
$order_info = $car_info->getOrders()->orderBy('id DESC')->one(); $order_info = $car_info->getOrders()->orderBy('id DESC')->one();
@ -1030,132 +772,6 @@ class CarController extends BaseController
$success_items = InvalidT::getTree(1); $success_items = InvalidT::getTree(1);
$failure_items = InvalidT::getTreeXinbaoNew(2); $failure_items = InvalidT::getTreeXinbaoNew(2);
//下一辆
$next_id = 0;
if($type == 1) {
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
->where('appointment_t.is_first=1 and car_t.is_track=0')
->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
$user_ids = $this->getChildrenUserIDs();
$query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
if($car_man != '') {
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
}
if($phone != '') {
$query = $query->andWhere('car_t.phone="'.$phone.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
}
if($sort_key != '') {
$query = $query->orderBy($sort_key.' '.$sort_value);
}
$next_item = $query->offset($next_index)->one();
if($next_item) {
$next_id = $next_item->car_id;
}
$next_index++;
}
if($type == 2) {
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
->where('appointment_t.is_first=0 and car_t.is_track=0')
->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"');
$user_ids = $this->getChildrenUserIDs();
$query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
if($car_man != '') {
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
}
if($phone != '') {
$query = $query->andWhere('car_t.phone="'.$phone.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
}
if($sort_key != '') {
$query = $query->orderBy($sort_key.' '.$sort_value);
}
$next_item = $query->offset($next_index)->one();
if($next_item) {
$next_id = $next_item->car_id;
}
$next_index++;
}
if($type == 3) {
$query = AppointmentT::find()
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`')
->where('appointment_t.is_first=0 and car_t.is_track=0');
$user_ids = $this->getChildrenUserIDs();
$query = $query->andWhere(['in','appointment_t.user_id',$user_ids]);
if($car_man != '') {
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"');
}
if($phone != '') {
$query = $query->andWhere('car_t.phone="'.$phone.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_t.car_no like "'.$car_no.'"');
}
if($sort_key != '') {
$query = $query->orderBy($sort_key.' '.$sort_value);
}
$next_item = $query->offset($next_index)->one();
if($next_item) {
$next_id = $next_item->car_id;
}
$next_index++;
}
if($type == 4) {
$query = OrderT::find()
->where('status_id=1 and return_status_id>0')
->orderBy('submit_date DESC, id DESC');
$user_items = $this->my->getChildren();
$user_ids[] = $this->my->id;
if($user_items) {
foreach($user_items as $user_item) {
$user_ids[] = $user_item->id;
}
}
$query = $query->andWhere(['in','user_id',$user_ids]);
if($car_man != '') {
$query = $query->andWhere('car_man="'.$car_man.'"');
}
if($phone != '') {
$query = $query->andWhere('link_phone="'.$phone.'"');
}
if($car_no != '') {
$query = $query->andWhere('car_no="'.$car_no.'"');
}
$next_item = $query->offset($next_index)->one();
if($next_item) {
$next_id = $next_item->car_id;
}
$next_index++;
}
// $gift_type_items = GiftType2T::find()->all();
$gift_group_items = GiftGroupT::find()
->where('is_free=0')
->all();
$gift_free_group_items = GiftGroupT::find()
->where('is_free=1')
->all();
//获取礼品数据
$sel_gifts = array();
$tmp_items = OrderGiftT::find()
->where('order_id='.$order_info->id)
->all();
foreach($tmp_items as $item) {
$sel_gifts[$item->group_id] = $item;
}
$list = MeetT::getAllData(1); $list = MeetT::getAllData(1);
$business_group = BusinessGroupT::find()->all(); $business_group = BusinessGroupT::find()->all();
@ -1163,37 +779,19 @@ class CarController extends BaseController
$order_ad=OrderAddress::findOne(['id'=>$order_info->addr_id]); $order_ad=OrderAddress::findOne(['id'=>$order_info->addr_id]);
//非车险方案表 //非车险方案表
// $scheme_items=Scheme::find()->all();
$province = Region::find()->asArray()->where(['parent_id'=>0])->andWhere(['level'=>1])->all(); $province = Region::find()->asArray()->where(['parent_id'=>0])->andWhere(['level'=>1])->all();
// if($order_ad){
// $c = Region::find()->asArray()->where(['parent_id'=>$order_ad->province])->andWhere(['level'=>2])->all();
// $d = Region::find()->asArray()->where(['parent_id'=>$order_ad->city,'level'=>3])->all();
// $e = Region::find()->asArray()->where(['parent_id'=>$order_ad->district,'level'=>4])->all();
//
// }else{
// $c = Region::find()->asArray()->andWhere(['level'=>2])->all();
// $d = Region::find()->asArray()->where(['level'=>3])->all();
// $e = Region::find()->asArray()->where(['level'=>4])->all();
// }
$c=[]; $c=[];
$d=[]; $d=[];
$e=[]; $e=[];
// if($order_ad){
// $c = Region::find()->asArray()->where(['parent_id'=>$order_ad->province])->andWhere(['level'=>2])->all();
// $d = Region::find()->asArray()->where(['parent_id'=>$order_ad->city,'level'=>3])->all();
// $e = Region::find()->asArray()->where(['parent_id'=>$order_ad->district,'level'=>4])->all();
//
// }else{
// $c = Region::find()->asArray()->andWhere(['level'=>2])->all();
// $d = Region::find()->asArray()->where(['level'=>3])->all();
// $e = Region::find()->asArray()->where(['level'=>4])->all();
// }
$linkMan_items = $car_info->getLinkmen()
->orderBy('created_at desc')
->all();
return $this->render('info',[ return $this->render('info',[
'type' => $type,
'car_info' => $car_info, 'car_info' => $car_info,
'link_men' => $linkMan_items,
'insurer_type_items' => $insurer_type_items, 'insurer_type_items' => $insurer_type_items,
'order_info' => $order_info, 'order_info' => $order_info,
'insurer_company_items' => $insurer_company_items, 'insurer_company_items' => $insurer_company_items,
@ -1212,21 +810,6 @@ class CarController extends BaseController
'gift_items' => $gift_items, 'gift_items' => $gift_items,
'success_items' => $success_items, 'success_items' => $success_items,
'failure_items' => $failure_items, 'failure_items' => $failure_items,
'next_id' => $next_id,
'next_index' => $next_index,
'car_man' => $car_man,
'car_no' => $car_no,
'phone' => $phone,
'page' => $page,
'sort_key' => $sort_key,
'sort_value' => $sort_value,
'back_params' => $back_params,
// 'gift_type_items' => $gift_type_items,
'gift_group_items' => $gift_group_items,
'gift_free_group_items' => $gift_free_group_items,
'sel_gifts' => $sel_gifts,
'business_group' => $business_group,
'business_group_id' => $this->my->business_group_id,
'province' => $province, 'province' => $province,
'city' =>$c, 'city' =>$c,
'district' =>$d, 'district' =>$d,
@ -6160,6 +5743,15 @@ class CarController extends BaseController
return $result; return $result;
} }
public function actionLinkmanAdd()
{
$request = Yii::$app->request;
$car_id = $request->get('car_id',0);
return $this->render('linkman-add',[
'car_id' => $car_id
]);
}
public function actionLinkmanSave() public function actionLinkmanSave()
{ {
Yii::$app->response->format = Response::FORMAT_JSON; Yii::$app->response->format = Response::FORMAT_JSON;
@ -6173,6 +5765,7 @@ class CarController extends BaseController
$name = $request->post('name'); $name = $request->post('name');
$phone = $request->post('phone'); $phone = $request->post('phone');
$id_number = $request->post('id_number'); $id_number = $request->post('id_number');
$id_type = $request->post('id_type');
$type = $request->post('type'); $type = $request->post('type');
if($name == '' || $phone == '') { if($name == '' || $phone == '') {
@ -6186,13 +5779,14 @@ class CarController extends BaseController
$linkman_info->name = $name; $linkman_info->name = $name;
$linkman_info->phone = $phone; $linkman_info->phone = $phone;
$linkman_info->type = $type; $linkman_info->type = $type;
$linkman_info->id_type = $id_type;
$linkman_info->id_number = $id_number; $linkman_info->id_number = $id_number;
if(!$linkman_info->save()) { if(!$linkman_info->save()) {
var_dump($linkman_info->errors); $result['msg'] = print_r($linkman_info->getErrors(),true);
} else {
$result['success'] = true;
$result['msg'] = '保存成功';
} }
$result['success'] = true;
$result['msg'] = '保存成功';
} }
return $result; return $result;
} }
@ -6220,4 +5814,43 @@ class CarController extends BaseController
$result['html'] = $html; $result['html'] = $html;
return $result; return $result;
} }
public function actionHistory() {
$request = Yii::$app->request;
$car_id = $request->get('car_id');
return $this->render('history',[
'car_id' => $car_id
]);
}
public function actionHistoryJson()
{
Yii::$app->response->format = Response::FORMAT_JSON;
$request = Yii::$app->request;
$car_id = $request->get('car_id');
$offset = $request->get('offset', 0);
$limit = $request->get('limit', 10);
$query = CarLogT::find()
->where(['car_id'=>$car_id,'type'=>1])
->andWhere('op_time>='.strtotime("-6 months"))
->orderBy('op_time DESC');
//echo $query->createCommand()->rawSql;
$total = $query->count();
$query = $query->offset($offset)->limit($limit);
$items = $query->all();
$data = [];
$data['total'] = count($items);
$data['rows'] = [];
foreach($items as $item) {
$row = $item->toArray();
$row['op_time'] = date('Y-m-d H:i:s', $item->op_time);
$data['rows'][] = $row;
}
return $data;
}
} }

@ -254,7 +254,7 @@ class DatabaseController extends BaseController
$row = $item->toArray(); $row = $item->toArray();
$row['factory_model'] = MyLib::substr_cut($item->factory_model, 8); $row['factory_model'] = MyLib::substr_cut($item->factory_model, 8);
$row['car_man'] = MyLib::substr_cut($item->car_man, 8); $row['car_man'] = MyLib::substr_cut($item->car_man, 8);
$row['location'] = $item->getLocation(); $row['location_name'] = $item->getLocation();
$data['rows'][] = $row; $data['rows'][] = $row;
} }
return $data; return $data;

@ -6361,7 +6361,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
public function actionCarUpdateFrame() public function actionCarUpdateFrame()
{ {
return $this->render('car-update-frame', []); return $this->render('car-update-frame');
} }
public function actionCarUpdateFrameInfo() public function actionCarUpdateFrameInfo()
@ -6371,24 +6371,11 @@ class FinanceController extends \frontend\controllers\UserBaseController
$result = array(); $result = array();
$result['success'] = false; $result['success'] = false;
$result['msg'] = '操作失败'; $result['msg'] = '操作失败';
// $company = $request->post('company', '');
$web_path = Yii::$app->getBasePath() . '/../frontend/web'; $web_path = Yii::$app->getBasePath() . '/../frontend/web';
$filename = $web_path . $request->post('urlfile'); $filename = $web_path . $request->post('urlfile');
$base_filename=$request->post('urlfile'); $base_filename=$request->post('file');
//
// $file_path = \Yii::getAlias('@console').'/controllers/';
// $yearname='wash12.xlsx';
// $filename = $file_path.$yearname;
// $basename=$yearname;
// $company = $request->post('company', '');
//
// $web_path = Yii::$app->getBasePath() . '/../frontend/web';
//
// $urlfile = $web_path . $request->post('urlfile');
// if(file_exists($filename)) {
// echo 'OK'."\r\n";
// }
//读取Excel 2007 //读取Excel 2007
$PHPReader = new \PHPExcel_Reader_Excel2007(); $PHPReader = new \PHPExcel_Reader_Excel2007();
if (!$PHPReader->canRead($filename)) { if (!$PHPReader->canRead($filename)) {
@ -6403,22 +6390,8 @@ class FinanceController extends \frontend\controllers\UserBaseController
$currentSheet = $PHPExcel->getSheet(0); $currentSheet = $PHPExcel->getSheet(0);
$rowCount = $currentSheet->getHighestRow(); $rowCount = $currentSheet->getHighestRow();
//$data = $currentSheet->toArray('', true, true);
//创建新的xlsx表 //创建新的xlsx表
// $objectPHPExcel = new \PHPExcel();
// $index = 1;
$insert_total = 0; $insert_total = 0;
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('A'.$index,'车牌号');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('B'.$index,'车架号');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('C'.$index,'发动机号');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('D'.$index,'品牌车型');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('E'.$index,'车主');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('F'.$index,'证件号');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('G'.$index,'联系方式');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('H'.$index,'保险到期日');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('I'.$index,'初登日期');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('J'.$index,'标准初登日期');
// $objectPHPExcel->setActiveSheetIndex(0)->setCellValue('K'.$index,'车牌号不匹配');
for ($i = 2; $i <= $rowCount; $i++) { for ($i = 2; $i <= $rowCount; $i++) {
// echo $i.'/'.$rowCount."..."; // echo $i.'/'.$rowCount."...";
@ -6462,16 +6435,6 @@ class FinanceController extends \frontend\controllers\UserBaseController
if ($car_info) { if ($car_info) {
//
// $car_c_info = CarCT::findOne(['id' => $car_info->id]);
// $car_d_info = CarDT::findOne(['id' => $car_info->id]);
// $car_e_info = CarET::findOne(['id' => $car_info->id]);
//
// if ($car_c_info || $car_d_info || $car_e_info) {
// continue;
// }
if($car_no != ''){ if($car_no != ''){
$car_info->car_no = $car_no; $car_info->car_no = $car_no;
} }
@ -6525,7 +6488,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
// $car_info->save(); // $car_info->save();
if(!$car_info->save(false)) { if(!$car_info->save(false)) {
var_dump($car_info->errors); var_dump($car_info->errors);
exit; exit;
} }
@ -6585,7 +6548,7 @@ class FinanceController extends \frontend\controllers\UserBaseController
// $car_info->save(); // $car_info->save();
if(!$car_info->save(false)) { if(!$car_info->save(false)) {
var_dump($car_info->errors); var_dump($car_info->errors);
exit; exit;
} }

@ -1,42 +1,87 @@
<form id="appointmentFrm" method="post"> <?php
<input type="hidden" name="car_id" value="<?=$car_id?>"> use \common\libs\MyLib;
<input name="_csrf" type="hidden" id="_csrf" value="<?=Yii::$app->request->csrfToken ?>"> ?>
<table cellpadding="5" width="90%"> <?php $this->beginBlock('header_css'); ?>
<tbody> <link href="/assets/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<tr> <?php $this->endBlock(); ?>
<td width="75">预约日期</td>
<td> <div class="wrapper wrapper-content animated fadeInRight">
<input class="easyui-datebox" type="text" id="pdate" name="pdate" value="" style="width:95%;"> <div class="ibox float-e-margins">
</td> <div class="ibox-content">
</tr> <div class="row">
<tr> <div class="col-md-12">
<td width="75">预约时间</td> <form role="form" class="form-horizontal data-from" id="theFrm">
<td> <input type="hidden" name="car_id" value="<?=$car_id?>">
<select class="easyui-combo" name="ptime" id="ptime"> <div class="form-group">
<option>09:00</option> <label class="col-md-1 control-label">预约日期</label>
<option>09:30</option> <div class="col-md-5">
<option>10:00</option> <div class="input-group date">
<option>10:30</option> <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<option>11:00</option> <input type="text" name="pdate" class="form-control" value="">
<option>11:30</option> </div>
<option>13:30</option> </div>
<option>14:00</option> <label class="col-md-1 control-label">预约时间</label>
<option>14:30</option> <div class="col-md-5">
<option>15:00</option> <div class="input-group clockpicker" data-autoclose="true">
<option>15:30</option> <input type="text" name="ptime" class="form-control" value="09:30">
<option>16:00</option> <span class="input-group-addon"><span class="fa fa-clock-o"></span></span>
<option>16:30</option> </div>
<option>17:00</option> </div>
<option>17:30</option> </div>
</select> <div class="form-group">
</td> <label class="col-md-1 control-label">备注</label>
</tr> <div class="col-md-11">
<tr> <textarea name="remark" id="remark" class="form-control"></textarea>
<td width="75">备注</td> </div>
<td> </div>
<textarea id="remark" name="remark" style="width:95%; height:100px;"></textarea> <div>
</td> <div class="row">
</tr> <div class="col-md-5 col-md-offset-5">
</tbody> <button class="btn btn-primary btn-save" type="button">
</table> <strong>添 加</strong>
</form> </button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
$('.input-group.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true
});
$('.clockpicker').clockpicker();
//提交按钮
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/appointment/save',params,function(obj){
if(obj.success) {
parent.layer.msg('保存成功');
parent.refreshList();
layer_close();
} else {
parent.layer.msg(data.msg);
}
},'json');
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -0,0 +1,55 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<table id="listTable">
<thead>
<tr>
<th data-field="op_man">操作者</th>
<th data-field="op_time">操作时间</th>
<th data-field="remark">操作内容</th>
</tr>
</thead>
</table>
</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 refreshList() {
$('#listTable').bootstrapTable('refresh');
}
function search() {
$('#listTable').bootstrapTable('destroy');
$('#listTable').bootstrapTable({
url: "/car/history-json",
pagination: true,
sidePagination: 'server',
multipleSelectRow: true,
queryParams: function(params) {
o['car_id'] = '<?=$car_id?>';
o['limit'] = params['limit'];
o['offset'] = params['offset'];
return o;
}
});
}
$(function() {
search();
});
</script>
<?php $this->endBlock('footer_js'); ?>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,89 @@
<?php
use \common\libs\MyLib;
?>
<?php $this->beginBlock('header_css'); ?>
<link href="/assets/css/plugins/clockpicker/clockpicker.css" rel="stylesheet">
<?php $this->endBlock(); ?>
<div class="wrapper wrapper-content animated fadeInRight">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="row">
<div class="col-md-12">
<form role="form" class="form-horizontal data-from" id="theFrm">
<input type="hidden" name="car_id" value="<?=$car_id?>">
<div class="form-group">
<label class="col-md-1 control-label">名称</label>
<div class="col-md-5">
<input type="text" name="name" class="form-control" value="">
</div>
<label class="col-md-1 control-label">电话</label>
<div class="col-md-5">
<input type="text" name="phone" class="form-control" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">证件类型</label>
<div class="col-md-5">
<select name="id_type" class="form-control">
<option value="身份证">身份证</option>
<option value="营业执照">营业执照</option>
</select>
</div>
<label class="col-md-1 control-label">证件号码</label>
<div class="col-md-5">
<input type="text" name="id_number" class="form-control" value="">
</div>
</div>
<div class="form-group">
<label class="col-md-1 control-label">关系</label>
<div class="col-md-5">
<select name="type" class="form-control">
<option value="其他联系人">其他联系人</option>
<option value="车主">车主</option>
<option value="被保险人">被保险人</option>
<option value="投保人">投保人</option>
</select>
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>添 加</strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script src="/assets/js/plugins/clockpicker/clockpicker.js"></script>
<script type="text/javascript" language="javascript">
$(function () {
//提交按钮
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/car/linkman-save',params,function(data){
parent.layer.msg(data.msg);
if(data.success) {
parent.location.reload();
layer_close();
}
},'json');
}, function(){
//
});
});
})
</script>
<?php $this->endBlock('footer_js'); ?>

@ -62,7 +62,7 @@ use \common\libs\MyLib;
<th data-field="company">保险公司</th> <th data-field="company">保险公司</th>
<th data-field="engine_no">发动机号</th> <th data-field="engine_no">发动机号</th>
<th data-field="car_frame_no">车架号</th> <th data-field="car_frame_no">车架号</th>
<th data-field="location">位置</th> <th data-field="location_name">位置</th>
<th data-formatter="opFormatter">操作</th> <th data-formatter="opFormatter">操作</th>
</tr> </tr>
</thead> </thead>

@ -38,7 +38,7 @@ use \common\libs\MyLib;
<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-primary btn-assign-all-return">批量收回</button> <button type="button" class="btn btn-primary btn-assign-all-return">批量收回</button>
<button type="button" class="btn btn-danger btn-clear">清空搜索条件</button> <button type="button" class="btn btn-danger btn-clear">清空搜索条件</button>
<select class="form-control" id="invalid_id" name="invalid_id"> <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>';

@ -1,70 +1,51 @@
<?php <?php
use \common\libs\MyLib; use \common\libs\MyLib;
?> ?>
<link rel="stylesheet" href="/js/fileupload/css/jquery.fileupload.css"> <?php $this->beginBlock('header_css'); ?>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table"> <link rel="stylesheet" type="text/css" href="/assets/css/plugins/webuploader/webuploader.css">
<form id="theFrm"> <?php $this->endBlock(); ?>
<tr>
<td align="center" width="100" height="25" class="td_bg">导入类型</td>
<td height="25" class="td_bg">数据导入</td>
</tr>
<tr> <div class="wrapper wrapper-content animated fadeInRight">
<td align="center" width="100" height="25" class="td_bg">批对日期</td> <div class="ibox float-e-margins">
<td height="25" class="td_bg"> <div class="ibox-title">
<input type="text" name="urlfile" id="urlfile" style="width: 300px;"> <h5>批量导入</h5>
<input id="fileupload" type="file" name="file"> </div>
</td> <div class="ibox-content">
</tr> <div class="row">
</form> <div class="col-md-12">
<tr> <form role="form" class="form-horizontal data-from" id="theFrm">
<td height="22" colspan="2" align="center" class="td_bg"> <div class="form-group">
<input id="submit-btn" type=button class="ACT_btn" name=Submit1 value=" 提交 "/> <label class="control-label col-sm-1">图片</label>
&nbsp;&nbsp; <div id="uploader" class="wu-example col-sm-10 col-md-10">
<input type="button" class="ACT_btn" name="Submit3" value=" 刷新 " onclick="window.location.reload();"> <div class="col-sm-6">
</td> <input type="text" name="file" id="file" value="" class="form-control">
</tr> </div>
</table> <div class="col-sm-6">
<div id="picker" style="float: left;">选择文件</div>
<div id="ctlBtn" class="btn btn-primary" style="margin-left:5px; height: 38px">开始上传</div>
</div>
</div>
</div>
<div>
<div class="row">
<div class="col-md-5 col-md-offset-5">
<button class="btn btn-primary btn-save" type="button">
<strong>提 交</strong>
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php $this->beginBlock('footer_js'); ?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script> <script src="/assets/js/plugins/webuploader/webuploader.min.js"></script>
<script type="text/javascript" language="javascript" src="/js/datepicker/WdatePicker.js"></script>
<script type="text/javascript" language="javascript" src="/js/fileupload/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" language="javascript" src="/js/fileupload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" language="javascript" src="/js/fileupload/js/jquery.fileupload.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js?v=2019"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
//编辑
$(function () { $(function () {
//上传按钮
$('#upload-btn').click(function(){
$('#fileupload').click();
});
//提交按钮
$("#submit-btn").click(function(){
if(confirm('是否确认提交?')) {
var urlfile = $("#urlfile").val();
var import_type = $(".import_type").val();
if(urlfile == ''){
alert('请先选择文件!');
return false;
}
var last_url = '/finance/car-update-frame-info';
var params = $("#theFrm").serialize();
$.post(last_url,params,function(obj){
alert(obj.msg);
if(obj.success){
$('#theFrm')[0].reset();
window.location.reload();
}
},'json');
}
});
//上传 //上传
$('#fileupload').fileupload({ $('#fileupload').fileupload({
url: '/finance/receipt-upload', url: '/finance/receipt-upload',
@ -75,13 +56,79 @@ use \common\libs\MyLib;
$('#submit-btn').removeAttr('disabled'); $('#submit-btn').removeAttr('disabled');
} }
}); });
//提交按钮
$(".btn-save").click(function(){
parent.layer.confirm('是否确认提交?', {
btn: ['确认','取消'], //按钮
shade: false //不显示遮罩
}, function(){
var params = $("#theFrm").serialize();
$.post('/finance/car-update-frame-info',params,function(obj){
parent.layer.msg(data.msg);
if(obj.success) {
window.location.reload();
}
},'json');
}, function(){
//
});
});
})
var uploader = WebUploader.create({
auto:false,
// swf文件路径
swf: "/assets/js/plugins/webuploader/Uploader.swf) ",
// 文件接收服务端。
server: "/common/upload",
// 选择文件的按钮。可选。
// 内部根据当前运行是创建,可能是input元素,也可能是flash.
pick: {
id:'#picker',
multiple:false //限制多文件上传
},
accept:{
title:'Excel',
extentions: "xls,xlsx"
},
fileVal:"img",
fileNumLimit: 1
});
uploader.on( 'fileQueued', function( file ) {
//删除错误的第一个文件
$("#picker").on("click",function () {
uploader.removeFile(file);
})
});
//点击上传
$("#ctlBtn").on("click",function () {
uploader.upload();
}) })
</script> // 文件上传成功,给item添加成功class, 用样式标记上传成功。
<style> uploader.on( 'uploadSuccess', function( file , msg ) {
input[type="text"] { $( '#'+file.id ).addClass('upload-state-done');
width: 134px; // 把服务器返回的图片地址保存到隐藏域
} if(msg.status ="SUCCESS"){
layer.msg('上传成功',{icon:1,time:2000});
$('input[name=file]').val( msg.fileUrl );
}else{
layer.msg("上传失败",{icon:2,time:3000});
}
</style> });
// 文件上传失败,显示上传出错。
uploader.on( 'uploadError', function( file ) {
var $li = $( '#'+file.id ),
$error = $li.find('div.error');
// 避免重复创建
if ( !$error.length ) {
$error = $('<div class="error"></div>').appendTo( $li );
}
$error.text('上传失败');
});
</script>
<?php $this->endBlock('footer_js'); ?>

@ -67,22 +67,25 @@ use \common\libs\MyLib;
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-md-1 control-label">允许登录</label> <label class="col-md-1 control-label">允许登录</label>
<div class="checkbox col-md-3"> <div class="col-md-3">
<label class="i-checks"> <div class="checkbox checkbox-inline">
<input name="is_login" type="checkbox" value="1" <?=$info->is_login==1?'checked':''?>/> <input type="checkbox" id="is_login" name="is_login" value="1" <?=$info->is_login==1?'checked':''?>>
</label> <label for="is_login"></label>
</div>
</div> </div>
<label class="col-md-1 control-label">外网登陆</label> <label class="col-md-1 control-label">外网登陆</label>
<div class="checkbox col-md-3"> <div class="col-md-3">
<label class="i-checks"> <div class="checkbox checkbox-inline">
<input name="is_outer" type="checkbox" value="1" <?= $info->is_outer==1?'checked':'' ?> />允许 <input type="checkbox" id="is_outer" name="is_outer" value="1" <?=$info->is_outer==1?'checked':''?>>
</label> <label for="is_outer"> 允许 </label>
</div>
</div> </div>
<label class="col-md-1 control-label">是否离职</label> <label class="col-md-1 control-label">是否离职</label>
<div class="checkbox col-md-3"> <div class="col-md-3">
<label class="i-checks"> <div class="checkbox checkbox-inline">
<input name="is_leave" type="checkbox" value="1" <?= $info->is_leave==1?'checked':'' ?> /> <input type="checkbox" id="is_leave" name="is_leave" value="1" <?=$info->is_leave==1?'checked':''?>>
</label> <label for="is_leave"></label>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -139,10 +142,11 @@ use \common\libs\MyLib;
</select> </select>
</div> </div>
<label class="col-md-1 control-label">是否双休</label> <label class="col-md-1 control-label">是否双休</label>
<div class="checkbox col-md-3"> <div class="col-md-3">
<label class="i-checks"> <div class="checkbox checkbox-inline">
<input type="checkbox" name="is_double" value="1" <?=$info->is_double == 1 ? 'checked' : ''?> /> <input type="checkbox" id="is_double" name="is_double" value="1" <?=$info->is_double==1?'checked':''?>>
</label> <label for="is_double"></label>
</div>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save