fix: 首页 top 的毛利KPI显示; style: 国内外占比图的显示

feature/2.0-sales-trade
Lei OT 2 years ago
parent d4ae5407bc
commit eebfea3ed2

@ -14,7 +14,7 @@ export default observer((props) => {
const _max = Math.max(maxKPI, maxValue); const _max = Math.max(maxKPI, maxValue);
const sortData = origin.sort(sortBy(measureField)).slice(-itemLength); const sortData = origin.sort(sortBy(measureField)).slice(-itemLength);
// //
const _parseData = sortData?.map((ele) => ({ ...ele, [rangeField]: [0, Math.ceil(_max / 0.9)], [measureField]: [ele[measureField]], [targetField]: (ele?.targetField || 0) })); const _parseData = sortData?.map((ele) => ({ ...ele, [rangeField]: [0, Math.ceil(_max / 0.9)], [measureField]: [ele[measureField]], [targetField]: (ele?.[targetField] || 0) }));
return _parseData; return _parseData;
}; };

@ -13,7 +13,8 @@ export default observer((props) => {
if (containerWidth < textWidth) { if (containerWidth < textWidth) {
scale = Math.min(Math.sqrt(Math.abs(Math.pow(R, 2) / (Math.pow(textWidth / 2, 2) + Math.pow(textHeight, 2)))), 1); scale = Math.min(Math.sqrt(Math.abs(Math.pow(R, 2) / (Math.pow(textWidth / 2, 2) + Math.pow(textHeight, 2)))), 1);
} }
const textStyleStr = `width:${containerWidth}px;`; // const textStyleStr = `width:${containerWidth}px;`;
const textStyleStr = `width:auto;`;
return `<div style="${textStyleStr};font-size:${scale}em;line-height:${scale < 1 ? 1 : 'inherit'};">${text}</div>`; return `<div style="${textStyleStr};font-size:${scale}em;line-height:${scale < 1 ? 1 : 'inherit'};">${text}</div>`;
}; };

@ -261,7 +261,7 @@ export default observer(() => {
<Col {...layoutProps} key={item.key}> <Col {...layoutProps} key={item.key}>
<Spin spinning={topData[item.key]?.loading || false}> <Spin spinning={topData[item.key]?.loading || false}>
<h3 style={{ textAlign: 'center' }}>{item.label}</h3> <h3 style={{ textAlign: 'center' }}>{item.label}</h3>
<Bullet key={item.key} {...BulletConfig} dataSource={topData[item.key]?.dataSource || []} itemLength={10} /> <Bullet {...BulletConfig} dataSource={topData[item.key]?.dataSource || []} itemLength={10} key={item.key} />
</Spin> </Spin>
</Col> </Col>
) : null ) : null

Loading…
Cancel
Save