diff --git a/src/components/DualSpreadsheet/DualSpreadsheet.tsx b/src/components/DualSpreadsheet/DualSpreadsheet.tsx index 663e129..ec0c892 100644 --- a/src/components/DualSpreadsheet/DualSpreadsheet.tsx +++ b/src/components/DualSpreadsheet/DualSpreadsheet.tsx @@ -711,6 +711,7 @@ const DualSpreadsheet: FC = ({ useEffect(() => { const reportTemplate = templateData?.[SHEET_NAMES.report] + if (reportTemplate) { // Очищаем старые значения initialTemplateValues.current = {} @@ -774,10 +775,23 @@ const DualSpreadsheet: FC = ({ const cellName = getColumnLabel(col) + (row + 1) const templateValue = initialTemplateValues.current[cellName] ?? '' + + // Нормализуем значения для сравнения + const normalizeValue = (value: any): string => { + if (value === null || value === undefined) return '' + const str = String(value).trim() + // Считаем "0" и пустую строку эквивалентными + if (str === '0' || str === '') return '' + return str + } + + const normalizedTemplate = normalizeValue(templateValue) + const normalizedRaw = normalizeValue(rawValue) + const isModified = sheetType === 'report' && - templateValue !== '' && - rawValue !== templateValue + normalizedTemplate !== '' && + normalizedRaw !== normalizedTemplate cachedData[cellKey] = { displayValue,