From b67564ec68fa3930da7f338e0b500ab376e2654a Mon Sep 17 00:00:00 2001 From: tangshaojian <63377964@qq.com> Date: Thu, 29 May 2025 16:52:09 +0800 Subject: [PATCH] =?UTF-8?q?tsj:=20DescriptionItem=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=B8=87=E7=9A=84=E8=BF=9B=E4=BD=8D=EF=BC=9BisTransferWan=20?= =?UTF-8?q?=E4=B8=BAfalse=E5=8F=96=E6=B6=88=E4=B8=87=E7=9A=84=E8=BF=9B?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DescriptionItem/index.tsx | 9 ++++++--- .../components/LeftContent/VehicleOverview/index.tsx | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/DescriptionItem/index.tsx b/src/components/DescriptionItem/index.tsx index 157307cd..de8fe1fd 100644 --- a/src/components/DescriptionItem/index.tsx +++ b/src/components/DescriptionItem/index.tsx @@ -3,6 +3,7 @@ import classNames from 'classnames'; import React, { CSSProperties, Fragment, memo } from 'react'; import CountUp from 'react-countup'; import styles from './index.less'; +import { formatDecimalsWithWan, formatDecimalsWithWanAndFixedDecimals, formatUnitWithWan, formatValueWithWan } from '@/pages/Home_v_2504/config/commonUtils'; interface DescriptionItemProps { value?: any; @@ -17,6 +18,7 @@ interface DescriptionItemProps { reverseName?: boolean; onClick?: () => void; showTextToValue?: boolean; + isTransferWan?: boolean; } /** @name 描述列表项 */ @@ -34,6 +36,7 @@ const DescriptionItem: React.FC = memo((props) => { reverseName = false, onClick, showTextToValue = false, + isTransferWan = true, } = props; const ValueAndUnit = ( @@ -47,10 +50,10 @@ const DescriptionItem: React.FC = memo((props) => { className={classNames(styles.value, { [styles.gradientValue]: !valueStyle?.color, })} - end={Number(value)} + end={isTransferWan ? formatValueWithWan(Number(value)) : Number(value)} style={valueStyle} preserveValue - decimals={decimals} + decimals={isTransferWan ? decimals ? formatDecimalsWithWanAndFixedDecimals(Number(value), decimals) : formatDecimalsWithWan(Number(value)) : decimals} /> ) : (
= memo((props) => { {unit && (
- {unit} + {isTransferWan ? formatUnitWithWan(Number(value)) + unit : unit}
)} diff --git a/src/pages/Home_v_2504/components/SubPages/ConstructionWaste/components/LeftContent/VehicleOverview/index.tsx b/src/pages/Home_v_2504/components/SubPages/ConstructionWaste/components/LeftContent/VehicleOverview/index.tsx index ed58543f..bd4e89a2 100644 --- a/src/pages/Home_v_2504/components/SubPages/ConstructionWaste/components/LeftContent/VehicleOverview/index.tsx +++ b/src/pages/Home_v_2504/components/SubPages/ConstructionWaste/components/LeftContent/VehicleOverview/index.tsx @@ -175,13 +175,17 @@ const VehicleOverview = ({ searchTime }: { searchTime: any }) => {