From 6b20b9190eafca91390be4bd9309f980c7e95f32 Mon Sep 17 00:00:00 2001 From: wintsa <770775984@qq.com> Date: Tue, 12 May 2026 17:47:25 +0800 Subject: [PATCH] fix --- src/App.tsx | 29 +++++++++++++++++++++++++++-- src/styles.css | 24 ++++++++++++++++++++++++ vite-dev.log | 4 ++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e707e96..f102ea9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -168,6 +168,8 @@ type TreeNode = { expanded: boolean; loading: boolean; loaded: boolean; + hasData?: boolean; + dataStatus?: 'normal' | 'empty'; }; type SelectedContentNode = { id: string; @@ -269,6 +271,24 @@ function readText(row: Record, keys: string[]) { return ''; } +function readIndicatorDataStatus(row: Record) { + const rawStatus = readText(row, ['dataStatus', 'datastatus']).toLowerCase(); + const rawHasData = row.hasData ?? row.hasdata; + const hasDataField = rawStatus === 'normal' || rawStatus === 'empty' || rawHasData !== undefined; + const hasData = + !hasDataField || + rawStatus === 'normal' || + rawHasData === true || + rawHasData === 1 || + rawHasData === '1' || + rawHasData === 'true'; + + return { + hasData, + dataStatus: rawStatus === 'empty' || !hasData ? 'empty' as const : 'normal' as const, + }; +} + function normalizeTreeRows(rows: unknown[]): TreeNode[] { return rows .filter((row): row is Record => !!row && typeof row === 'object') @@ -331,6 +351,7 @@ function normalizeFlatIndicatorRows(rows: unknown[]): TreeNode[] { .filter((childId) => rowsById.has(childId)) .map(buildNode); const label = readText(row, ['label', 'name', 'title', 'text', 'zbbh', 'mbmc']) || id; + const dataStatus = readIndicatorDataStatus(row); return { id, label, @@ -340,6 +361,8 @@ function normalizeFlatIndicatorRows(rows: unknown[]): TreeNode[] { expanded: children.length > 0, loading: false, loaded: true, + hasData: dataStatus.hasData, + dataStatus: dataStatus.dataStatus, }; }; @@ -579,6 +602,7 @@ function renderFilterTreeNodes(
    {nodes.map((node) => { const selected = selectedNodeKeys.has(getFilterSelectionKey(filterKey, node.id)); + const showNoData = filterKey === 'indicatorTree' && node.dataStatus === 'empty'; return (
  • @@ -591,14 +615,15 @@ function renderFilterTreeNodes( )} {node.loading ? 加载中 : null} diff --git a/src/styles.css b/src/styles.css index 8cb3e55..d62a484 100644 --- a/src/styles.css +++ b/src/styles.css @@ -899,6 +899,30 @@ button { content: ""; } +.filter-tree-select.is-empty-data { + color: #8a8279; +} + +.filter-tree-select.is-empty-data .content-tree-label { + opacity: 0.58; +} + +.filter-tree-select.is-empty-data .filter-tree-check { + opacity: 0.62; +} + +.filter-tree-empty-badge { + flex: 0 0 auto; + padding: 1px 5px; + border: 1px solid rgba(122, 112, 103, 0.22); + border-radius: 3px; + color: #7a7067; + background: rgba(255, 252, 248, 0.72); + font-size: 12px; + line-height: 18px; + white-space: nowrap; +} + .filter-modal-actions { display: flex; justify-content: flex-end; diff --git a/vite-dev.log b/vite-dev.log index b0f2211..8f1a096 100644 --- a/vite-dev.log +++ b/vite-dev.log @@ -231,3 +231,7 @@ Port 5173 is in use, trying another one... 12:22:51 [vite] (client) hmr update /src/App.tsx 12:44:18 [vite] (client) hmr update /src/App.tsx 12:45:27 [vite] (client) hmr update /src/App.tsx +14:35:53 [vite] (client) hmr update /src/App.tsx +15:23:18 [vite] (client) hmr update /src/App.tsx +15:23:36 [vite] (client) hmr update /src/App.tsx +15:41:18 [vite] (client) hmr update /src/App.tsx