diff --git a/空气质量预测/源码/用户端/iapip-web/src/common/types.ts b/空气质量预测/源码/用户端/iapip-web/src/common/types.ts index a7a1b3a..9e64fd9 100644 --- a/空气质量预测/源码/用户端/iapip-web/src/common/types.ts +++ b/空气质量预测/源码/用户端/iapip-web/src/common/types.ts @@ -131,7 +131,6 @@ export type Material = { eco_level?: ECO_LEVEL health_level?: string ypt?: number | null - health_tier?: 'A' | 'B' | 'C' | null sort_order?: number unit?: MTRL_UNIT qty?: number diff --git a/空气质量预测/源码/用户端/iapip-web/src/components/material-card/index.tsx b/空气质量预测/源码/用户端/iapip-web/src/components/material-card/index.tsx index a1644e6..a221225 100644 --- a/空气质量预测/源码/用户端/iapip-web/src/components/material-card/index.tsx +++ b/空气质量预测/源码/用户端/iapip-web/src/components/material-card/index.tsx @@ -34,7 +34,7 @@ const MaterialCard: React.FC<{ const [filterConditions, setFilterConditions] = useState() const [details, setDetails] = useState>() const [selected, setSelected] = useState() - // 材料排序依据(默认综合 Ypt 升序)与是否按健康档分组显示 + // 材料排序依据(默认综合 Ypt 升序)与是否按健康等级分组显示 const [sortKey, setSortKey] = useState('ypt') const [groupByTier, setGroupByTier] = useState(false) const { initialState } = useModel('@@initialState') @@ -412,18 +412,14 @@ const MaterialCard: React.FC<{ dataIndex: 'health_level', align: 'center', width: 90, - render: (_, { health_level }) => (health_level ? {health_level} : '-') - }, - { - title: '健康档', - dataIndex: 'health_tier', - align: 'center', - width: 70, - render: (_, m) => { - const color = - m.health_tier === 'A' ? 'green' : m.health_tier === 'B' ? 'gold' : m.health_tier === 'C' ? 'red' : 'default' - return {m.health_tier ?? '—'} - } + render: (_, { health_level }) => + health_level ? ( + + {health_level} + + ) : ( + '—' + ) }, { title: '最近更新时间', @@ -581,12 +577,12 @@ const MaterialCard: React.FC<{ data.sort((a, b) => (a.category ?? '').localeCompare(b.category ?? '')) } if (gbtParam) { - // 分组开时后端已按档排序;为每档第一条打标,供「材料名称」列渲染分区小标题 + // 分组开时后端已按健康等级排序;为每档第一条打标,供「材料名称」列渲染分区小标题 let last: string | null | undefined = undefined data.forEach((m) => { - if (m.health_tier !== last) { - ;(m as Material & { __tierHead?: string }).__tierHead = m.health_tier ?? '数据不全' - last = m.health_tier + if (m.health_level !== last) { + ;(m as Material & { __tierHead?: string }).__tierHead = m.health_level ?? '未定级' + last = m.health_level } }) } diff --git a/空气质量预测/源码/管理端/iapip-ms/src/common/types.ts b/空气质量预测/源码/管理端/iapip-ms/src/common/types.ts index 395d169..9bb4d72 100644 --- a/空气质量预测/源码/管理端/iapip-ms/src/common/types.ts +++ b/空气质量预测/源码/管理端/iapip-ms/src/common/types.ts @@ -141,7 +141,7 @@ export type Material = { qty?: number display?: number ypt?: number | null - health_tier?: 'A' | 'B' | 'C' | null + health_level?: 'A' | 'B' | 'C' | null collectors?: { user_id: string; project_id: string }[] methanal?: number methanal_min_be?: number diff --git a/空气质量预测/源码/管理端/iapip-ms/src/components/material-card/index.tsx b/空气质量预测/源码/管理端/iapip-ms/src/components/material-card/index.tsx index be0a67d..d60f781 100644 --- a/空气质量预测/源码/管理端/iapip-ms/src/components/material-card/index.tsx +++ b/空气质量预测/源码/管理端/iapip-ms/src/components/material-card/index.tsx @@ -35,7 +35,7 @@ const MaterialCard: React.FC<{ const [details, setDetails] = useState() const [selected, setSelected] = useState() const [content, setContent] = useState() - // 材料排序依据(默认综合 Ypt 升序)与是否按健康档分组显示 + // 材料排序依据(默认综合 Ypt 升序)与是否按健康等级分组显示 const [sortKey, setSortKey] = useState('ypt') const [groupByTier, setGroupByTier] = useState(false) const page = ( @@ -328,20 +328,20 @@ const MaterialCard: React.FC<{ render: (_, { eco_level }) => (eco_level ? {eco_level} : '-') }, { - title: '健康档', - dataIndex: 'health_tier', + title: '健康等级', + dataIndex: 'health_level', align: 'center', - width: 70, + width: 90, render: (_, m) => { const color = - m.health_tier === 'A' + m.health_level === 'A' ? 'green' - : m.health_tier === 'B' + : m.health_level === 'B' ? 'gold' - : m.health_tier === 'C' + : m.health_level === 'C' ? 'red' : 'default' - return {m.health_tier ?? '—'} + return m.health_level ? {m.health_level} : '—' } }, { @@ -446,12 +446,12 @@ const MaterialCard: React.FC<{ data.sort((a, b) => (a.category ?? '').localeCompare(b.category ?? '')) } if (gbtParam) { - // 分组开时后端已按档排序;为每档第一条打标,供「材料名称」列渲染分区小标题 + // 分组开时后端已按健康等级排序;为每档第一条打标,供「材料名称」列渲染分区小标题 let last: string | null | undefined = undefined data.forEach((m) => { - if (m.health_tier !== last) { - ;(m as Material & { __tierHead?: string }).__tierHead = m.health_tier ?? '数据不全' - last = m.health_tier + if (m.health_level !== last) { + ;(m as Material & { __tierHead?: string }).__tierHead = m.health_level ?? '未定级' + last = m.health_level } }) }