bomService = $bomService; $this->masterRefService = $masterRefService; } #[RequiresPermission(BomPermissions::VIEW)] public function get(array $params): Response { $projectId = (int) session('currentProject'); $refId = isset($params['id']) ? (int) $params['id'] : 0; // 单个引用视图 if ($refId > 0) { $refDetail = $this->masterRefService->getRefDetail($refId); if ($refDetail === false) { $this->tpl->setNotification($this->language->__('notification.bom_not_found', '引用不存在'), 'error'); return $this->tpl->display('bom.refs', 'app', 404); } $master = $this->bomService->getBomDetail((int) $refDetail['ref']['masterId']); $this->tpl->assign('ref', $refDetail['ref']); $this->tpl->assign('refColumns', $refDetail['columns']); $this->tpl->assign('refValues', $refDetail['values']); $this->tpl->assign('master', $master); $this->tpl->assign('fixedColumns', BomService::FIXED_COLUMNS); $this->tpl->assign('projectId', $projectId); return $this->tpl->display('bom.refDetail'); } // 项目已引用列表 $refs = $this->masterRefService->getRefs($projectId); $list = []; foreach ($refs as $ref) { $master = $this->bomService->getBom((int) $ref['masterId']); if ($master !== false) { $ref['master'] = $master; $list[] = $ref; } } $this->tpl->assign('refs', $list); $this->tpl->assign('projectId', $projectId); return $this->tpl->display('bom.refs'); } }