aurora-1799 отображение ошибки в случае выбора только дт или кт

This commit is contained in:
Grog 2026-10-29 10:59:54 +03:00
parent dcb92e197c
commit b0a6cdedd0
5 changed files with 52 additions and 28 deletions

View File

@ -76,10 +76,6 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => {
const loadData = useCallback(
async (vId: string, dIds: string[], cIds: string[], isActual: () => boolean) => {
if (isHalfFiltered) {
notification.info({ description: 'Для сравнений по Дт и Кт нужно заполнить оба фильтра' });
return;
}
setLoading(true);
try {
let res: IntercompanyMatrixResponse;
@ -206,7 +202,7 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => {
style={{
backgroundColor: isChessFullscreen ? '#fff' : 'transparent',
padding: isChessFullscreen ? 6 : 0,
height: isChessFullscreen ? '100vh' : 'auto',
height: isChessFullscreen ? '100vh' : '100%',
overflow: isChessFullscreen ? 'hidden' : 'visible',
display: 'flex',
flexDirection: 'column',
@ -217,6 +213,7 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => {
decimals={decimals}
units={units}
isFullscreen={isChessFullscreen}
isHalfFiltered={isHalfFiltered}
toolbar={
<div
style={{
@ -284,6 +281,7 @@ export const ChessContent = ({ card }: { card: VersionCard | null }) => {
decimals={chessResDecimals}
units={chessResUnits}
isFullscreen={isResFullscreen}
toolbar={
<div
style={{

View File

@ -1,11 +1,11 @@
.chessTable .ant-table-summary {
.chessResTable .ant-table-summary {
border-end-end-radius: 8px !important;
border-end-start-radius: 8px !important;
}
.chessTable .ant-table-cell-fix {
.chessResTable .ant-table-cell-fix {
background-color: #f8fafc !important;
}
.chessTable .resRow {
.chessResTable .resRow {
background-color: #e6f4ea !important ;
}

View File

@ -81,7 +81,7 @@ export const ConsolidationChessResTable: React.FC<ConsolidationChessResTableI> =
return (
<Table<MatrixResCell>
className='chessTable'
className='chessResTable'
dataSource={data?.articles || []}
columns={columns}
rowKey='code'

View File

@ -16,3 +16,19 @@
.chessTable .resRow {
background-color: #e6f4ea !important ;
}
.chessTable .ant-table-container{
display: flex;
flex-direction: column;
}
.chessTable.customHeight .ant-table-container{
height: 550px !important;
}
.chessTable .ant-table-summary{
margin-top: auto;
}

View File

@ -17,6 +17,7 @@ interface ConsolidationChessTableI {
units: string;
toolbar?: React.ReactNode;
isFullscreen?: boolean;
isHalfFiltered?: boolean;
}
type TotalRow = {
@ -32,6 +33,7 @@ export const ConsolidationChessTable: React.FC<ConsolidationChessTableI> = ({
units,
toolbar,
isFullscreen = false,
isHalfFiltered = false,
}) => {
const matrixData = useMemo(() => {
if (!data?.cells) return {};
@ -109,20 +111,19 @@ export const ConsolidationChessTable: React.FC<ConsolidationChessTableI> = ({
}
});
// сумму, которую не удалось сложить, не выдумываем нулём — ячейка покажет «—»
totalRow[colCompany.id] = sumAmounts(amountsToSum) ?? '';
});
return totalRow as MatrixCompany;
}, [data?.companies, matrixData]);
const scrollY = isFullscreen ? 'calc(100vh - 150px)' : 436;
const scrollY = isFullscreen ? 'calc(100vh - 200px)' : 436;
return (
<Table<MatrixCompany>
className='chessTable'
dataSource={data?.companies || []}
columns={columns}
className={!isFullscreen ? 'chessTable customHeight' : 'chessTable'}
dataSource={isHalfFiltered ? [] : data?.companies || []}
columns={isHalfFiltered ? [] : columns || []}
rowKey='id'
pagination={false}
loading={loading}
@ -130,26 +131,35 @@ export const ConsolidationChessTable: React.FC<ConsolidationChessTableI> = ({
size='small'
bordered
title={() => toolbar}
locale={{
emptyText: isHalfFiltered ? (
<div style={{ padding: '40px 0', color: '#8c8c8c', fontSize: 16 }}>Для получения данных выберите счета по Дт и Кт</div>
) : (
'Нет данных'
),
}}
summary={() => {
if (!totalRowData) return null;
return (
<Table.Summary fixed>
<Table.Summary.Row className='resRow'>
<Table.Summary.Cell className='resRow' index={0} align='left'>
<div style={{ backgroundColor: '#e6f4ea', width: '100%', height: '100%' }}>
<Text strong>Итого</Text>
</div>
</Table.Summary.Cell>
{data?.companies.map((company, index) => (
<Table.Summary.Cell className='resRow' key={company.id} index={index + 1} align='right'>
<div>
<Text strong>{chessTableCellFormatValue((totalRowData as TotalRow)[company.id], units, decimals) || '—'}</Text>
<Table.Summary fixed>
{!isHalfFiltered && (
<Table.Summary.Row className='resRow'>
<Table.Summary.Cell className='resRow' index={0} align='left'>
<div style={{ backgroundColor: '#e6f4ea', width: '100%', height: '100%' }}>
<Text strong>Итого</Text>
</div>
</Table.Summary.Cell>
))}
</Table.Summary.Row>
{data?.companies.map((company, index) => (
<Table.Summary.Cell className='resRow' key={company.id} index={index + 1} align='right'>
<div>
<Text strong>{chessTableCellFormatValue((totalRowData as TotalRow)[company.id], units, decimals) || '—'}</Text>
</div>
</Table.Summary.Cell>
))}
</Table.Summary.Row>
)}
</Table.Summary>
);
}}