This commit is contained in:
ngfrolov 2022-03-29 14:16:49 +05:00
parent fd6c36b6d5
commit 9dd6423a63
4 changed files with 12 additions and 9 deletions

View File

@ -39,11 +39,10 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection
const [isTVDModalVisible, setIsTVDModalVisible] = useState(false) const [isTVDModalVisible, setIsTVDModalVisible] = useState(false)
const [isOpsModalVisible, setIsOpsModalVisible] = useState(false) const [isOpsModalVisible, setIsOpsModalVisible] = useState(false)
const [isParamsModalVisible, setIsParamsModalVisible] = useState(false) const [isParamsModalVisible, setIsParamsModalVisible] = useState(false)
const [paramsColumns, setParamsColumns] = useState([])
const location = useLocation() const location = useLocation()
const paramsColumns = useMemo(async() => await getColumns(idWell), [idWell])
const rows = useMemo(() => { const rows = useMemo(() => {
const rows = [] const rows = []
statsWells?.forEach((well) => { statsWells?.forEach((well) => {
@ -102,6 +101,10 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection
return rows return rows
}, [statsWells]) }, [statsWells])
useEffect(() => invokeWebApiWrapperAsync(
async () => setParamsColumns(await getColumns(idWell))
), [idWell])
useEffect(() => { useEffect(() => {
if (isOpsModalVisible || selectedWellId <= 0) return if (isOpsModalVisible || selectedWellId <= 0) return
invokeWebApiWrapperAsync( invokeWebApiWrapperAsync(
@ -252,7 +255,7 @@ export const WellCompositeSections = memo(({ idWell, statsWells, selectedSection
width={1500} width={1500}
footer={null} footer={null}
> >
<Tvd idWell={selectedWellId}/> <Tvd idWell={selectedWellId} style={{ height: '80vh' }} />
</Modal> </Modal>
<Modal <Modal

View File

@ -93,7 +93,7 @@ export const CategoryEditor = memo(({ idWell, visible, category, onClosed }) =>
const changeUserStatus = useCallback((user, status) => invokeWebApiWrapperAsync( const changeUserStatus = useCallback((user, status) => invokeWebApiWrapperAsync(
async () => { async () => {
const userIdx = users?.findIndex(({ user: u }) => u.id === user.id) const userIdx = users?.findIndex(({ user: u }) => u.id === user.id)
if (!userIdx) return if (userIdx <= -1) return
if (status === 0) { if (status === 0) {
await DrillingProgramService.removeUser(idWell, user.id, category.idFileCategory, users[userIdx].status) 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) => { setUsers((prevUsers) => {
prevUsers[userIdx].status = status prevUsers[userIdx].status = status
return prevUsers return [...prevUsers]
}) })
}, },
setShowLoader, setShowLoader,

View File

@ -114,7 +114,7 @@ const makeDataset = (data, label, color, borderWidth = 1.5, borderDash) => ({
borderDash, borderDash,
}) })
export const Tvd = memo(({ idWell, title }) => { export const Tvd = memo(({ idWell, title, ...other }) => {
const [chart, setChart] = useState() const [chart, setChart] = useState()
const [xLabel, setXLabel] = useState('day') const [xLabel, setXLabel] = useState('day')
const [operations, setOperations] = useState({}) const [operations, setOperations] = useState({})
@ -187,7 +187,7 @@ export const Tvd = memo(({ idWell, title }) => {
chart.canvas.parentNode.style.width = '0' chart.canvas.parentNode.style.width = '0'
chart.resize() chart.resize()
} }
}, [chart, operations, xLabel, onPointClick]) }, [chart, operations, xLabel, onPointClick, other])
const toogleTable = useCallback(() => { const toogleTable = useCallback(() => {
setOperations(pre => ({ ...pre })) setOperations(pre => ({ ...pre }))
@ -195,7 +195,7 @@ export const Tvd = memo(({ idWell, title }) => {
}, []) }, [])
return ( return (
<div className={'container tvd-page'}> <div className={'container tvd-page'} {...other}>
<div className={'tvd-top'}> <div className={'tvd-top'}>
<h2>{title || 'График Глубина-день'}</h2> <h2>{title || 'График Глубина-день'}</h2>
<div> <div>

View File

@ -25,7 +25,7 @@
> div { > div {
position: absolute; position: absolute;
//pointer-events: none; //pointer-events: none;
transition: all .25s ease-out; transition: opacity .25s ease-out;
opacity: 1; opacity: 1;
&:hover { &:hover {