bomService = $bomService; } #[RequiresPermission(BomPermissions::VIEW)] public function get(array $params): Response { $projectId = (int) session('currentProject'); $bomId = isset($params['id']) ? (int) $params['id'] : 0; // ?type=bom|process|tooling(query string,经 incomingRequest 读取) $type = (string) $this->incomingRequest->query('type', 'bom'); if (! in_array($type, ['bom', 'process', 'tooling'], true)) { $type = 'bom'; } if ($bomId > 0) { $detail = $this->bomService->getBomDetail($bomId); if ($detail === false) { $this->tpl->setNotification($this->language->__('notification.bom_not_found', 'BOM 不存在'), 'error'); return $this->tpl->display('bom.show', 'app', 404); } $this->tpl->assign('detail', $detail); $this->tpl->assign('fixedColumns', BomService::FIXED_COLUMNS); $this->tpl->assign('projectId', $projectId); return $this->tpl->display('bom.detail'); } // 三类主数据(bom/process/tooling)共用列表,type 参数切换 $masters = $this->bomService->getMasters($type, $projectId); $this->tpl->assign('boms', $masters); $this->tpl->assign('type', $type); $this->tpl->assign('projectId', $projectId); $this->tpl->assign('fixedColumns', BomService::FIXED_COLUMNS); return $this->tpl->display('bom.show'); } }