all(); $config = []; $config['model'] = $this->modelClass; switch ($scene) { case 'index': // ====== ====== 筛选 ====== ====== // 业务id if (isset($p['salesperson_id']) && $p['salesperson_id']) { $config['where']['salesperson_id'] = $p['salesperson_id']; } // 初、终版 $config['where']['is_final'] = $p['is_final'] ?? 0; // 关键字 if (isset($p['keyword']) && $p['keyword']) { $k = '%' . $p['keyword'] . '%'; foreach (['pi_no', 'order_no', 'customer_snapshot'] as $col) { $config['orWhere'][] = [$col, 'like', $k]; } } $config['order']['id'] = 'desc'; $config['where']['salesperson_id'] = $request->user->uid; break; case 'print': case 'approval': $config['where']['id'] = $p['id']; break; case 'detail': case 'show': $config['where']['id'] = $p['id']; $config['with'][] = 'items'; $config['with'][] = 'items.options'; $config['with'][] = 'items.moneyValues'; $config['with'][] = 'accounts'; $config['with'][] = 'moneyValues'; $config['with'][] = 'salesperson'; break; case 'store': break; case 'update': $config['where']['id'] = $p['id']; break; case 'destroy': $config['where']['id'] = $p['id']; break; } return $config; } /** * 最终审批 */ public function serviceUltimateApproval(Request $request) { $config = $this->buildQueryConfig($request, 'detail'); $item = $this->logicShow($config); foreach ($item->items as $k => $v) { if ($v->vin === '') { throw new BusinessException('存在未填写vin的车辆,无法完成提交审核'); } } $this->logicUpdateBy($config, [ 'approval_status' => 1 ]); $this->startApproval($item); return $this->postProcess('UltimateApproval', $item); } }