Кнопка отправить заблокирована при отсутствии уставок

This commit is contained in:
avsirotkin 2022-04-05 11:25:57 +05:00
parent b94561aa62
commit fcb264b122

View File

@ -37,20 +37,19 @@ export const SetpointSender = memo(({ idWell, onClose, visible, setpointNames })
const onAdd = useCallback(async (sp) => setSetpoints((prevSp) => {
sp.key = Date.now()
prevSp.push(sp)
return prevSp
return [...prevSp, sp]
}), [])
const onEdit = useCallback(async (sp) => setSetpoints((prevSp) => {
const idx = prevSp.findIndex((val) => val.key === sp.key)
prevSp[idx] = sp
return prevSp
return [...prevSp]
}), [])
const onDelete = useCallback(async (sp) => setSetpoints((prevSp) => {
const idx = prevSp.findIndex((val) => val.key === sp.key)
prevSp.splice(idx, 1)
return prevSp
return [...prevSp]
}), [])
const onModalOk = useCallback(() => invokeWebApiWrapperAsync(
@ -81,6 +80,7 @@ export const SetpointSender = memo(({ idWell, onClose, visible, setpointNames })
onCancel={onClose}
onOk={onModalOk}
okText={'Отправить'}
okButtonProps={{ disabled: setpoints.length <= 0 }}
>
<LoaderPortal show={isLoading}>
<Grid>