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

View File

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

View File

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

View File

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