форматирование

This commit is contained in:
Grog 2026-10-22 14:36:18 +03:00
parent ea9cb4a084
commit 601a125349
6 changed files with 10 additions and 15 deletions

View File

@ -1,6 +1,6 @@
import { SearchOutlined } from '@ant-design/icons'; import { SearchOutlined } from '@ant-design/icons';
import { Button, Input, Space, Tree } from 'antd'; import { Button, Input, Space, Tree } from 'antd';
import { ReactNode, useEffect, useMemo, useState } from 'react'; import { type ReactNode, useEffect, useMemo, useState } from 'react';
import './TreeFilterDropdown.css'; import './TreeFilterDropdown.css';
export type OptionType = { export type OptionType = {
@ -17,7 +17,7 @@ interface TreeFilterDropdownProps {
selectedKeys: string[]; selectedKeys: string[];
onChange: (keys: string[]) => void; onChange: (keys: string[]) => void;
onClose: () => void; onClose: () => void;
warningBlock?: ReactNode warningBlock?: ReactNode;
} }
export const TreeFilterDropdown: React.FC<TreeFilterDropdownProps> = ({ export const TreeFilterDropdown: React.FC<TreeFilterDropdownProps> = ({

View File

@ -1,8 +1,4 @@
export const chessTableCellFormatValue = ( export const chessTableCellFormatValue = (val: string | number | null | undefined, units: string, decimals: number) => {
val: string | number | null | undefined,
units: string,
decimals: number
) => {
if (val === undefined || val === null || val === '') return ''; if (val === undefined || val === null || val === '') return '';
let strVal = String(val); let strVal = String(val);
@ -46,7 +42,7 @@ export const chessTableCellFormatValue = (
maximumFractionDigits: decimals, maximumFractionDigits: decimals,
}).format(strVal as any); }).format(strVal as any);
const zeroString = `0${decimals > 0 ? ',' + '0'.repeat(decimals) : ''}`; const zeroString = `0${decimals > 0 ? `,${'0'.repeat(decimals)}` : ''}`;
if (formatted === `-${zeroString}`) { if (formatted === `-${zeroString}`) {
return zeroString; return zeroString;
} }

View File

@ -122,7 +122,7 @@ export const ConsolidationChessResTable: React.FC<ConsolidationChessResTableI> =
); );
})} })}
<Table.Summary.Cell index={data.companies.length + 1} align='right' > <Table.Summary.Cell index={data.companies.length + 1} align='right'>
<Text strong>{chessTableCellFormatValue(sumAmounts(data.articles.map((a) => a.group_total)) ?? '0', units, decimals)}</Text> <Text strong>{chessTableCellFormatValue(sumAmounts(data.articles.map((a) => a.group_total)) ?? '0', units, decimals)}</Text>
</Table.Summary.Cell> </Table.Summary.Cell>
</Table.Summary.Row> </Table.Summary.Row>

View File

@ -18,7 +18,6 @@ interface ConsolidationChessTableI {
isFullscreen?: boolean; isFullscreen?: boolean;
} }
type TotalRow = { type TotalRow = {
id: string; id: string;
name: string; name: string;

View File

@ -18,7 +18,7 @@ interface ConsolidationChessTableFilterI {
} }
const buildTree = (items: Account[]): OptionType[] => { const buildTree = (items: Account[]): OptionType[] => {
const map: Record<string, OptionType> = {}; const map: Record<string, OptionType> = {};
const roots: OptionType[] = []; const roots: OptionType[] = [];
items.forEach((item) => { items.forEach((item) => {