From 9dd6423a63af7efda5b904689baa00a661b4f3ec Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Tue, 29 Mar 2022 14:16:49 +0500 Subject: [PATCH] hofix --- .../WellCompositeEditor/WellCompositeSections.jsx | 9 ++++++--- src/pages/DrillingProgram/CategoryEditor.jsx | 4 ++-- src/pages/WellOperations/Tvd/index.jsx | 6 +++--- src/styles/tvd.less | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/pages/Analytics/WellCompositeEditor/WellCompositeSections.jsx b/src/pages/Analytics/WellCompositeEditor/WellCompositeSections.jsx index 6276ecf..0c55a33 100644 --- a/src/pages/Analytics/WellCompositeEditor/WellCompositeSections.jsx +++ b/src/pages/Analytics/WellCompositeEditor/WellCompositeSections.jsx @@ -39,11 +39,10 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection const [isTVDModalVisible, setIsTVDModalVisible] = useState(false) const [isOpsModalVisible, setIsOpsModalVisible] = useState(false) const [isParamsModalVisible, setIsParamsModalVisible] = useState(false) + const [paramsColumns, setParamsColumns] = useState([]) const location = useLocation() - const paramsColumns = useMemo(async() => await getColumns(idWell), [idWell]) - const rows = useMemo(() => { const rows = [] statsWells?.forEach((well) => { @@ -102,6 +101,10 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection return rows }, [statsWells]) + useEffect(() => invokeWebApiWrapperAsync( + async () => setParamsColumns(await getColumns(idWell)) + ), [idWell]) + useEffect(() => { if (isOpsModalVisible || selectedWellId <= 0) return invokeWebApiWrapperAsync( @@ -252,7 +255,7 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection width={1500} footer={null} > - + const changeUserStatus = useCallback((user, status) => invokeWebApiWrapperAsync( async () => { const userIdx = users?.findIndex(({ user: u }) => u.id === user.id) - if (!userIdx) return + if (userIdx <= -1) return if (status === 0) { await DrillingProgramService.removeUser(idWell, user.id, category.idFileCategory, users[userIdx].status) @@ -102,7 +102,7 @@ export const CategoryEditor = memo(({ idWell, visible, category, onClosed }) => } setUsers((prevUsers) => { prevUsers[userIdx].status = status - return prevUsers + return [...prevUsers] }) }, setShowLoader, diff --git a/src/pages/WellOperations/Tvd/index.jsx b/src/pages/WellOperations/Tvd/index.jsx index e0e2784..c35a2d3 100644 --- a/src/pages/WellOperations/Tvd/index.jsx +++ b/src/pages/WellOperations/Tvd/index.jsx @@ -114,7 +114,7 @@ const makeDataset = (data, label, color, borderWidth = 1.5, borderDash) => ({ borderDash, }) -export const Tvd = memo(({ idWell, title }) => { +export const Tvd = memo(({ idWell, title, ...other }) => { const [chart, setChart] = useState() const [xLabel, setXLabel] = useState('day') const [operations, setOperations] = useState({}) @@ -187,7 +187,7 @@ export const Tvd = memo(({ idWell, title }) => { chart.canvas.parentNode.style.width = '0' chart.resize() } - }, [chart, operations, xLabel, onPointClick]) + }, [chart, operations, xLabel, onPointClick, other]) const toogleTable = useCallback(() => { setOperations(pre => ({ ...pre })) @@ -195,7 +195,7 @@ export const Tvd = memo(({ idWell, title }) => { }, []) return ( -
+

{title || 'График Глубина-день'}

diff --git a/src/styles/tvd.less b/src/styles/tvd.less index 2b51e90..a1d51b0 100644 --- a/src/styles/tvd.less +++ b/src/styles/tvd.less @@ -25,7 +25,7 @@ > div { position: absolute; //pointer-events: none; - transition: all .25s ease-out; + transition: opacity .25s ease-out; opacity: 1; &:hover {