From 8299d0825d611eb75f78b064f9e36976f7d6ffe3 Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Sun, 4 Oct 2026 02:01:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9B=AE=E5=BD=95=20F2b=20/?= =?UTF-8?q?=20C9=EF=BC=9A=E6=A6=82=E8=A7=88=E7=9A=84=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1=E8=89=B2=E6=AE=B5=E6=94=B9=E6=88=90=E5=92=8C=E4=B8=8A?= =?UTF-8?q?=E6=96=B9=E6=96=87=E5=AD=97=E5=90=8C=E4=B8=80=E4=B8=AA=E5=85=88?= =?UTF-8?q?=E5=90=8E=EF=BC=88=E6=9C=89=E5=BE=85=E7=A1=AE=E8=AE=A4=E9=A1=B9?= =?UTF-8?q?=E3=80=81=E6=B2=A1=E6=9C=89=E5=BE=85=E7=A1=AE=E8=AE=A4=E9=A1=B9?= =?UTF-8?q?=E3=80=81=E6=B2=A1=E6=9C=89=E7=9B=AE=E5=BD=95=EF=BC=89=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E9=9D=A2=E5=8A=A0=E5=9B=BE=E4=BE=8B=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E6=AF=8F=E7=A7=8D=E9=A2=9C=E8=89=B2=EF=BC=9B=E8=89=B2=E6=9D=A1?= =?UTF-8?q?=E5=92=8C=E5=9B=BE=E4=BE=8B=E5=8F=AA=E7=BB=99=E7=9C=BC=E7=9D=9B?= =?UTF-8?q?=E7=9C=8B=EF=BC=8C=E6=95=B0=E5=AD=97=E7=94=B1=E9=82=A3=E5=8F=A5?= =?UTF-8?q?=E8=AF=9D=E5=BF=B5=EF=BC=9B=E8=A1=A5=E6=A3=80=E6=9F=A5=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/catalog/CatalogPage.tsx | 37 ++++++++++++++++------ scripts/check-catalog.mjs | 12 +++++++ 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/catalog/CatalogPage.tsx b/frontend/src/pages/catalog/CatalogPage.tsx index 0846a546..28095a40 100644 --- a/frontend/src/pages/catalog/CatalogPage.tsx +++ b/frontend/src/pages/catalog/CatalogPage.tsx @@ -498,17 +498,34 @@ function Overview({ rows, empty, systemNotes, draft, onOpen }: { ) } -/** 审阅进度:有待确认项 / 没有待确认项 / 没有目录的表各占多少 */ -function ProgressBar({ pending, done, none }: { pending: number; done: number; none: number }) { - const total = pending + done + none || 1 - const seg = (n: number, color: string, label: string) => (n > 0 - ? - : null) +/** + * 审阅进度:有待确认项 / 没有待确认项 / 没有目录的表各占多少。色段的先后和上面那句话一致(有待确认项在前), + * 下面挂图例说明每种颜色。数字已经写在那句话里,色条和图例只给眼睛看,读屏不重复念 + */ +const PROGRESS: { key: 'pending' | 'done' | 'none'; color: string }[] = [ + { key: 'pending', color: 'var(--st-waiting)' }, + { key: 'done', color: 'var(--st-done)' }, + { key: 'none', color: 'var(--border-strong)' }, +] + +function ProgressBar(counts: { pending: number; done: number; none: number }) { + const total = counts.pending + counts.done + counts.none || 1 return ( -
- {seg(done, 'var(--st-done)', CT.filter.done)} - {seg(pending, 'var(--st-waiting)', CT.filter.pending)} - {seg(none, 'var(--border-strong)', CT.filter.none)} +
+
p.key).join(',')}> + {PROGRESS.map(({ key, color }) => (counts[key] > 0 + ? + : null))} +
+
    + {PROGRESS.map(({ key, color }) => ( +
  • + + {CT.filter[key]} +
  • + ))} +
) } diff --git a/scripts/check-catalog.mjs b/scripts/check-catalog.mjs index 467c69fa..39b233fc 100644 --- a/scripts/check-catalog.mjs +++ b/scripts/check-catalog.mjs @@ -1174,6 +1174,18 @@ await section('数据目录 · 空状态与导入表格', async () => { const ovt = await page.locator('[data-catalog-overview]').innerText() check('有目录、没选表时:写审阅进度,给出使用最多、还有推断项的表', ovt.includes('共 152 张表:5 张有待确认项,3 张没有待确认项,144 张没有目录') && (await page.locator('[data-catalog-review-next]').getAttribute('data-catalog-review-next')) === 'visits', ovt.replace(/\s+/g, ' ').slice(0, 120)) + // 进度条的色段和那句话同一个先后(有待确认项、没有待确认项、没有目录),下面有图例说明每种颜色 + const segs = await page.locator('[data-catalog-overview] [data-progress-seg]').evaluateAll((els) => els.map((e) => e.getAttribute('data-progress-seg'))) + const legend = await page.locator('[data-catalog-progress-legend] [data-legend]').evaluateAll((els) => els.map((e) => [e.getAttribute('data-legend'), e.innerText.trim()])) + check('进度条的色段按「有待确认项、没有待确认项、没有目录」排,和文字的先后一致', segs.join(',') === 'pending,done,none', segs.join(',')) + check('……下面有图例,先后和文字一致', legend.map(([k]) => k).join(',') === 'pending,done,none' + && legend.map(([, t]) => t).join('|') === '有待确认项|没有待确认项|没有目录', JSON.stringify(legend)) + const swatch = await page.evaluate(() => [...document.querySelectorAll('[data-catalog-progress-legend] [data-legend]')].map((li) => { + const key = li.getAttribute('data-legend') + const seg = document.querySelector(`[data-progress-seg="${key}"]`) + return getComputedStyle(li.querySelector('span')).backgroundColor === (seg ? getComputedStyle(seg).backgroundColor : '') + })) + check('……图例的色块和色段同色', swatch.length === 3 && swatch.every(Boolean), JSON.stringify(swatch)) // 导入表格的源:说明由系统生成,只读 await goto(page, `/data/catalog/${S2}`)