Skip to content
Snippets Groups Projects
Commit b67564ec authored by 汤绍坚's avatar 汤绍坚
Browse files

tsj: DescriptionItem 支持万的进位;isTransferWan 为false取消万的进位

parent 1fca9b87
Branches
Tags
No related merge requests found
......@@ -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<DescriptionItemProps> = memo((props) => {
reverseName = false,
onClick,
showTextToValue = false,
isTransferWan = true,
} = props;
const ValueAndUnit = (
......@@ -47,10 +50,10 @@ const DescriptionItem: React.FC<DescriptionItemProps> = 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}
/>
) : (
<div
......@@ -64,7 +67,7 @@ const DescriptionItem: React.FC<DescriptionItemProps> = memo((props) => {
{unit && (
<div className={styles.unit} style={unitStyle}>
{unit}
{isTransferWan ? formatUnitWithWan(Number(value)) + unit : unit}
</div>
)}
</Space>
......
......@@ -175,13 +175,17 @@ const VehicleOverview = ({ searchTime }: { searchTime: any }) => {
<DescriptionItem
direction="horizontal"
name={'总共'}
unit={formatUnitWithWan(item?.value) + ''}
unit={''}
// unit={formatUnitWithWan(item?.value) + '辆'}
valueStyle={commonValueStyle}
labelStyle={commonLabelStyle}
unitStyle={commonUnitStyle}
style={{ justifyContent: 'start' }}
decimals={formatDecimalsWithWan(item?.value)}
value={formatValueWithWan(item?.value)}
decimals={0}
// decimals={formatDecimalsWithWan(item?.value)}
value={item?.value}
// value={formatValueWithWan(item?.value)}
// isTransferWan={false}
/>
<DescriptionItem
direction="horizontal"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment