diff --git a/offer_backend/apps/organizations/views.py b/offer_backend/apps/organizations/views.py index f1c6c7c..8144a01 100644 --- a/offer_backend/apps/organizations/views.py +++ b/offer_backend/apps/organizations/views.py @@ -7,8 +7,14 @@ from apps.accounts.permissions import IsSuperAdmin class OrganizationPublicViewSet(viewsets.ReadOnlyModelViewSet): """公开只读:门户展示用,返回顶级组织(集团)及其子公司树""" - queryset = Organization.objects.filter(is_active=True, parent__isnull=True) + queryset = Organization.objects.filter(is_active=True) serializer_class = OrganizationTreeSerializer + + def get_queryset(self): + # 列表只返回顶级,详情可查任意 + if self.action == 'list': + return Organization.objects.filter(is_active=True, parent__isnull=True) + return Organization.objects.filter(is_active=True) permission_classes = [AllowAny] diff --git a/offer_frontend/src/views/portal/CompanyDetailView.vue b/offer_frontend/src/views/portal/CompanyDetailView.vue index 6cecc34..67bcbe7 100644 --- a/offer_frontend/src/views/portal/CompanyDetailView.vue +++ b/offer_frontend/src/views/portal/CompanyDetailView.vue @@ -21,11 +21,15 @@ const route = useRoute() const org = ref(null) const jobs = ref([]) onMounted(async () => { - const [orgRes, jobRes] = await Promise.all([ - getOrganization(route.params.id), - getJobs({ organization: route.params.id }) - ]) - org.value = orgRes.data - jobs.value = jobRes.data.results + try { + const [orgRes, jobRes] = await Promise.all([ + getOrganization(route.params.id), + getJobs({ organization: route.params.id }) + ]) + org.value = orgRes.data + jobs.value = jobRes.data.results ?? [] + } catch (e) { + console.error('加载公司详情失败', e) + } }) diff --git a/offer_frontend/src/views/portal/CompanyListView.vue b/offer_frontend/src/views/portal/CompanyListView.vue index cffbe62..8c86ce5 100644 --- a/offer_frontend/src/views/portal/CompanyListView.vue +++ b/offer_frontend/src/views/portal/CompanyListView.vue @@ -47,13 +47,10 @@
{{ group.name }}
集团总院
+ +
- -
-
-
-
- +
{ } .org-root { display: flex; - justify-content: center; + flex-direction: column; + align-items: center; margin-bottom: 0; } +.root-v-line { + width: 2px; + height: 24px; + background: #d0d0d0; +} .org-node { border-radius: 8px; padding: 10px 16px; @@ -293,27 +296,13 @@ onMounted(async () => { color: #c9a84c; margin-top: 4px; } -.org-connector { - display: flex; - flex-direction: column; - align-items: center; -} -.v-line { - width: 2px; - height: 24px; - background: #d0d0d0; -} -.h-line { - width: calc(100% - 40px); - height: 2px; - background: #d0d0d0; - min-width: 600px; -} +/* 子节点行 */ .org-children { display: flex; justify-content: space-between; gap: 8px; min-width: 900px; + border-top: 2px solid #d0d0d0; } .org-child-wrap { display: flex;