forked from ddrilling/asb_cloud_front
Добавлена проверка на некорректно выбранную скважину
This commit is contained in:
parent
9d6e5b0687
commit
fb82815cbc
@ -54,7 +54,7 @@ const getLabel = (wellsTree: TreeNodeData[], value?: string): string | undefined
|
||||
break
|
||||
default: break
|
||||
}
|
||||
return value
|
||||
return 'Ошибка! Скважина не найдена!'
|
||||
}
|
||||
|
||||
export const WellTreeSelector = memo(({ ...other }) => {
|
||||
@ -100,14 +100,9 @@ export const WellTreeSelector = memo(({ ...other }) => {
|
||||
)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
setValue(getLabel(wellsTree, routeMatch?.url))
|
||||
}, [wellsTree, routeMatch])
|
||||
useEffect(() => setValue(getLabel(wellsTree, routeMatch?.url)), [wellsTree, routeMatch])
|
||||
|
||||
const onChange = useCallback((value: string): void => {
|
||||
if (wellsTree)
|
||||
setValue(getLabel(wellsTree, value))
|
||||
}, [wellsTree])
|
||||
const onChange = useCallback((value?: string): void => setValue(getLabel(wellsTree, value)), [wellsTree])
|
||||
|
||||
const onSelect = useCallback((value: RawValueType | LabelInValueType): void => {
|
||||
if (['number', 'string'].includes(typeof value))
|
||||
|
Loading…
Reference in New Issue
Block a user