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
|
break
|
||||||
default: break
|
default: break
|
||||||
}
|
}
|
||||||
return value
|
return 'Ошибка! Скважина не найдена!'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WellTreeSelector = memo(({ ...other }) => {
|
export const WellTreeSelector = memo(({ ...other }) => {
|
||||||
@ -100,14 +100,9 @@ export const WellTreeSelector = memo(({ ...other }) => {
|
|||||||
)
|
)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => setValue(getLabel(wellsTree, routeMatch?.url)), [wellsTree, routeMatch])
|
||||||
setValue(getLabel(wellsTree, routeMatch?.url))
|
|
||||||
}, [wellsTree, routeMatch])
|
|
||||||
|
|
||||||
const onChange = useCallback((value: string): void => {
|
const onChange = useCallback((value?: string): void => setValue(getLabel(wellsTree, value)), [wellsTree])
|
||||||
if (wellsTree)
|
|
||||||
setValue(getLabel(wellsTree, value))
|
|
||||||
}, [wellsTree])
|
|
||||||
|
|
||||||
const onSelect = useCallback((value: RawValueType | LabelInValueType): void => {
|
const onSelect = useCallback((value: RawValueType | LabelInValueType): void => {
|
||||||
if (['number', 'string'].includes(typeof value))
|
if (['number', 'string'].includes(typeof value))
|
||||||
|
Loading…
Reference in New Issue
Block a user