|
@@ -551,7 +551,7 @@ class ConstructionService extends Service
|
|
|
$model = $model->where('del_time',0)
|
|
|
->orderby('id', 'desc');
|
|
|
if(empty($data['select_field'])){
|
|
|
- $model->select('title','id','model_type','order_number','customer_id','customer_contact_id','install_method','install_position','sales_order_id','construction_fee','construction_time','handover_time','urgency','crt_id','crt_time','mark','state','address1','address2','introduction','service_price','storehouse_id','start_time','end_time','pq_state','day_start_stamp','day_end_stamp');
|
|
|
+ $model->select('title','id','model_type','order_number','customer_id','customer_contact_id','install_method','install_position','sales_order_id','construction_fee','construction_time','handover_time','urgency','crt_id','crt_time','mark','state','address1','address2','introduction','service_price','storehouse_id','start_time','end_time','pq_state','day_start_stamp','day_end_stamp','vin_no');
|
|
|
}else{
|
|
|
$model->select('sales_order_id');
|
|
|
}
|
|
@@ -773,6 +773,9 @@ class ConstructionService extends Service
|
|
|
//订单状态数据组织
|
|
|
$state_array = $this->getStateMake($data['data']);
|
|
|
|
|
|
+ //负责人
|
|
|
+ $construction_info_map = $this->getFzEmployee(array_column($data['data'],'id'));
|
|
|
+
|
|
|
$address_map = config('address');
|
|
|
foreach ($data['data'] as $key => $value){
|
|
|
$address_str = [];
|
|
@@ -806,6 +809,7 @@ class ConstructionService extends Service
|
|
|
$data['data'][$key]['handover_time'] = $value['handover_time'] ? date("Y-m-d",$value['handover_time']) : "";
|
|
|
$data['data'][$key]['storehouse_title'] = $storehouse[$value['storehouse_id']] ?? '';
|
|
|
$data['data'][$key]['dispatch_company'] = $dispatch[$value['sales_order_id']] ?? '';
|
|
|
+ $data['data'][$key]['fz'] = $construction_info_map[$value['id']] ?? "";
|
|
|
// $data['data'][$key]['pq_state_title'] = Construction::$pq_name[$value['pq_state']] ?? '';
|
|
|
// $str = "";
|
|
|
// $start_time = $value['day_start_stamp'] ? date("Y-m-d H:i",$value['day_start_stamp']) : '';
|
|
@@ -817,6 +821,31 @@ class ConstructionService extends Service
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ public function getFzEmployee($construction_id = []){
|
|
|
+ if(empty($construction_id)) return [];
|
|
|
+
|
|
|
+ $construction_info = ConstructionInfo::where('del_time',0)
|
|
|
+ ->where('type',ConstructionInfo::type_three)
|
|
|
+ ->whereIn('construction_id',$construction_id)
|
|
|
+ ->select('construction_id','employee_id')
|
|
|
+ ->get()->toArray();
|
|
|
+ $emp_map2 = Employee::whereIn('id',array_unique(array_column($construction_info,'employee_id')))
|
|
|
+ ->pluck('emp_name','id')
|
|
|
+ ->toArray();
|
|
|
+ $construction_info_map = [];
|
|
|
+ foreach ($construction_info as $value){
|
|
|
+ $emp = $emp_map2[$value['employee_id']] ?? "";
|
|
|
+ if(! $emp) continue;
|
|
|
+ if(isset($construction_info_map[$value['construction_id']])){
|
|
|
+ $construction_info_map[$value['construction_id']] .= ',' . $emp;
|
|
|
+ }else{
|
|
|
+ $construction_info_map[$value['construction_id']] = $emp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $construction_info_map;
|
|
|
+ }
|
|
|
+
|
|
|
public function getStateMake($data){
|
|
|
if(empty($data)) return [];
|
|
|
|