From 37889cb6ceb4c98b3fe89c65b7353fd6879b43d8 Mon Sep 17 00:00:00 2001 From: goodm2ice Date: Wed, 29 Dec 2021 14:56:53 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B0=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D1=82=D0=B8=D0=BF?= =?UTF-8?q?=D0=BE=D0=B2=20=D1=81=D0=B5=D0=BA=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WellCompositeEditor/WellCompositeSections.jsx | 2 +- src/pages/WellOperations/WellDrillParams.jsx | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx b/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx index 0dc49f0..4480628 100644 --- a/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx +++ b/src/pages/WellOperations/WellCompositeEditor/WellCompositeSections.jsx @@ -42,7 +42,7 @@ export const WellCompositeSections = ({ idWell, statsWells, selectedSections }) const [params, setParams] = useState([]) const [paramsColumns, setParamsColumns] = useState([]) - useEffect(() => setParamsColumns(getColumns(idWell)), [idWell]) + useEffect(() => (async() => setParamsColumns(await getColumns(idWell)))(), [idWell]) useEffect(() => { if (isOpsModalVisible || selectedWellId <= 0) return diff --git a/src/pages/WellOperations/WellDrillParams.jsx b/src/pages/WellOperations/WellDrillParams.jsx index 0c4524c..5af5355 100644 --- a/src/pages/WellOperations/WellDrillParams.jsx +++ b/src/pages/WellOperations/WellDrillParams.jsx @@ -39,16 +39,18 @@ export const WellDrillParams = ({ idWell }) => { const updateParams = useCallback(async () => await invokeWebApiWrapperAsync( async () => { const params = arrayOrDefault(await DrillParamsService.getAll(idWell)) + // Typescript против использования числа в качестве типа значения select + params.forEach((param) => param.idWellSectionType = `${param.idWellSectionType}`) setParams(params) }, setShowLoader, 'Не удалось загрузить список режимов бурения скважины' ), [idWell]) - useEffect(() => { - setColumns(getColumns(idWell)) - updateParams() - }, [idWell, updateParams]) + useEffect(() => (async () => { + setColumns(await getColumns(idWell)) + await updateParams() + })(), [idWell, updateParams]) const handlerProps = { service: DrillParamsService,