исправлены желтые ячейки

This commit is contained in:
2025-07-18 15:20:04 +03:00
parent a52d57fd46
commit 3b6c59e705

View File

@@ -711,6 +711,7 @@ const DualSpreadsheet: FC<DualSpreadsheetProps> = ({
useEffect(() => {
const reportTemplate = templateData?.[SHEET_NAMES.report]
if (reportTemplate) {
// Очищаем старые значения
initialTemplateValues.current = {}
@@ -774,10 +775,23 @@ const DualSpreadsheet: FC<DualSpreadsheetProps> = ({
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,