From f7bb10f744fae71423ce07944d31ea556c9f3859 Mon Sep 17 00:00:00 2001 From: zou Date: Sat, 8 Aug 2026 08:55:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(F006):=20DashboardView+AppLayout=20?= =?UTF-8?q?=E6=94=B9=E8=B0=83=E7=9C=9F=20API=20/supplier/inquiry/page=20(?= =?UTF-8?q?=E5=81=87=E6=95=B0=E6=8D=AE=E2=86=92=E7=9C=9F=E6=95=B0=E6=8D=AE?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AppLayout/AppLayout.vue | 4 ++-- src/modules/dashboard/DashboardView.vue | 22 ++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/components/AppLayout/AppLayout.vue b/src/components/AppLayout/AppLayout.vue index 7a2cea3..02dd25b 100644 --- a/src/components/AppLayout/AppLayout.vue +++ b/src/components/AppLayout/AppLayout.vue @@ -273,12 +273,12 @@ const badges = ref>({}) async function loadBadges() { try { - const data = await fetch('/sys/openapi/inquiry/list?page=1&limit=1', { + const data = await fetch('/supplier/inquiry/page?page=1&limit=1', { headers: { Authorization: `Bearer ${userStore.token}` }, credentials: 'omit' }).then(r => r.json()).catch(() => null) if (data?.code === 0) { - const total = data.total ?? data.data?.length ?? 0 + const total = data.data?.total ?? data.total ?? 0 badges.value['询价管理'] = String(total) } } catch {} diff --git a/src/modules/dashboard/DashboardView.vue b/src/modules/dashboard/DashboardView.vue index eb9bbfa..fb76e83 100644 --- a/src/modules/dashboard/DashboardView.vue +++ b/src/modules/dashboard/DashboardView.vue @@ -89,8 +89,9 @@ const FALLBACK_STATUS = [ */ async function loadRecentInquiries(): Promise { try { - const data = await httpGet('/sys/openapi/inquiry/list', { page: 1, limit: 5 }) - if (!Array.isArray(data)) throw new Error('inquiry list not array') + const resp = await httpGet('/supplier/inquiry/page', { page: 1, limit: 5 }) + const data = Array.isArray(resp) ? resp : (resp?.list || []) + if (!data.length) throw new Error('inquiry list empty') return data.slice(0, 5).map((it: any) => { const s = it.apprStatus === 0 ? 'pending' : it.apprStatus === 1 ? 'quoting' @@ -127,13 +128,14 @@ async function loadRecentInquiries(): Promise { */ async function loadStats(): Promise { try { - const data = await httpGet('/sys/openapi/inquiry/list', { page: 1, limit: 500 }) - if (!Array.isArray(data)) throw new Error('inquiry list not array') + const resp = await httpGet('/supplier/inquiry/page', { page: 1, limit: 500 }) + const data = Array.isArray(resp) ? resp : (resp?.list || []) + if (!data.length) throw new Error('inquiry list empty') - const total = data.length - const pending = data.filter((it: any) => it.apprStatus === 0).length - const quoting = data.filter((it: any) => it.apprStatus === 1).length - const done = data.filter((it: any) => it.apprStatus === 2).length + const total = Number(resp?.total || data.length) + const pending = data.filter((it: any) => it.apprStatus === 0 || it.status === 0).length + const quoting = data.filter((it: any) => it.apprStatus === 1 || it.status === 1).length + const done = data.filter((it: any) => it.apprStatus === 2 || it.status === 2).length return [ { label: '询价总数', value: String(total), delta: '', trend: 'up', icon: 'ChatDotRound' }, @@ -221,8 +223,8 @@ onMounted(async () => { // 拉一次全量算图表 + 较昨日 let allInquiries: any[] = [] try { - allInquiries = await httpGet('/sys/openapi/inquiry/list', { page: 1, limit: 500 }) - if (!Array.isArray(allInquiries)) allInquiries = [] + const resp = await httpGet('/supplier/inquiry/page', { page: 1, limit: 500 }) + allInquiries = Array.isArray(resp) ? resp : (resp?.list || []) } catch { allInquiries = [] } const isLive = allInquiries.length > 0