From 819ad3e7f1fb66443c44d86abb6ee1fd6f352628 Mon Sep 17 00:00:00 2001 From: TianyangZhang Date: Thu, 26 Mar 2026 13:48:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(portal):=20=E4=BF=AE=E5=A4=8D=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9E=B6=E6=9E=84=E5=9B=BE=E8=BF=9E=E6=8E=A5=E7=BA=BF?= =?UTF-8?q?=E5=8F=8A=E5=AD=90=E5=85=AC=E5=8F=B8=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 架构图横线改用 border-top 方式,连线准确对齐 - 后端 OrganizationPublicViewSet 支持按 ID 查询任意组织(不限顶级) - CompanyDetailView 添加 try-catch 防止 Promise.all 失败导致空白 Co-Authored-By: Claude Sonnet 4.6 --- offer_backend/apps/organizations/views.py | 8 ++++- .../src/views/portal/CompanyDetailView.vue | 16 +++++---- .../src/views/portal/CompanyListView.vue | 35 +++++++------------ 3 files changed, 29 insertions(+), 30 deletions(-) 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;