Commit 788f01c2 by 李伟康

refactor(validation-stats): 调整布局并移除运营成本统计项

删除了 calcOperatingCost 计算函数及对应的运营成本合计统计项
将固定4列的网格布局调整为基于实际统计项数量的动态列布局
1 parent 62a6af25
Pipeline #348 for 788f01c2 failed in 0 seconds
...@@ -82,22 +82,10 @@ export interface ValidationStatsProps { ...@@ -82,22 +82,10 @@ export interface ValidationStatsProps {
checkResult?: StoreImportCheckVO; checkResult?: StoreImportCheckVO;
} }
function calcOperatingCost(vo: StoreImportCheckVO): number {
const rows = vo.previewRows ?? [];
if (rows.length === 0) return 0;
const first = rows[0];
return (
Math.round(first.costDecoration ?? 0) +
Math.round(first.costMonthly ?? 0) +
Math.round(first.costLabor ?? 0)
);
}
function buildStatsFromCheckResult(vo: StoreImportCheckVO): StatItem[] { function buildStatsFromCheckResult(vo: StoreImportCheckVO): StatItem[] {
const rows = vo.productCategoryRowCount ?? vo.totalRows; const rows = vo.productCategoryRowCount ?? vo.totalRows;
const storeCount = 1; const storeCount = 1;
const sceneCount = vo.distinctBusinessSceneCount; const sceneCount = vo.distinctBusinessSceneCount;
const operating = calcOperatingCost(vo);
const items: StatItem[] = [ const items: StatItem[] = [
{ {
...@@ -123,13 +111,6 @@ function buildStatsFromCheckResult(vo: StoreImportCheckVO): StatItem[] { ...@@ -123,13 +111,6 @@ function buildStatsFromCheckResult(vo: StoreImportCheckVO): StatItem[] {
}); });
} }
items.push({
label: '运营成本合计',
value: operating > 0 ? `¥ ${operating.toLocaleString('en-US')}` : '-',
desc: '门店维度(装修设备 + 当月产生 + 人工成本)',
tone: 'default',
});
return items; return items;
} }
...@@ -151,11 +132,13 @@ const defaultStats: StatItem[] = [ ...@@ -151,11 +132,13 @@ const defaultStats: StatItem[] = [
export function ValidationStats({ stats, checkResult }: ValidationStatsProps) { export function ValidationStats({ stats, checkResult }: ValidationStatsProps) {
const finalStats: StatItem[] = const finalStats: StatItem[] =
stats ?? (checkResult ? buildStatsFromCheckResult(checkResult) : defaultStats); stats ?? (checkResult ? buildStatsFromCheckResult(checkResult) : defaultStats);
// 按实际卡片数量平分整行宽度
const colCount = Math.max(1, finalStats.length);
return ( return (
<div <div
style={{ style={{
display: 'grid', display: 'grid',
gridTemplateColumns: 'repeat(4, minmax(0, 1fr))', gridTemplateColumns: `repeat(${colCount}, minmax(0, 1fr))`,
gap: 16, gap: 16,
marginBottom: 20, marginBottom: 20,
}} }}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!