forked from ddrilling/asb_cloud_front
fix all warnings
This commit is contained in:
parent
139f73e968
commit
5038285d6d
22811
package-lock.json
generated
22811
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -14,11 +14,9 @@
|
||||
"chartjs-plugin-datalabels": "^2.0.0-rc.1",
|
||||
"chartjs-plugin-zoom": "^1.1.1",
|
||||
"craco-less": "^1.17.1",
|
||||
"immutability-helper": "^3.1.1",
|
||||
"moment": "^2.29.1",
|
||||
"pigeon-maps": "^0.19.7",
|
||||
"react": "^17.0.2",
|
||||
"react-dnd-html5-backend": "^14.0.0",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-router-dom": "^5.2.0",
|
||||
"react-scripts": "4.0.3",
|
||||
|
@ -3,7 +3,6 @@ import { UploadOutlined } from '@ant-design/icons'
|
||||
import DocumentCreationForm from './modalWindows/DocumentCreationForm'
|
||||
import { FileService } from '../services/api'
|
||||
import {useState, useEffect} from "react"
|
||||
import {useParams} from 'react-router-dom'
|
||||
import notify from './notify'
|
||||
import LoaderPortal from './LoaderPortal'
|
||||
import locale from "antd/lib/locale/ru_RU"
|
||||
@ -12,9 +11,7 @@ import moment from 'moment'
|
||||
const pageSize = 12
|
||||
const {RangePicker} = DatePicker;
|
||||
|
||||
|
||||
export default function Documents({idWell, selectedFileCategory}) {
|
||||
// let {id} = useParams()
|
||||
|
||||
const [page, setPage] = useState(1)
|
||||
const [range, setRange] = useState([])
|
||||
@ -23,14 +20,14 @@ export default function Documents({idWell, selectedFileCategory}) {
|
||||
const [isModalVisible, setIsModalVisible] = useState(false)
|
||||
const [isTableUpdating, setTableUpdating] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
|
||||
const handleFileNameCLick = async (event, row) => {
|
||||
const element = event.target
|
||||
|
||||
if(!element.href.length) {
|
||||
try {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
|
||||
await fetch(`/api/files/${idWell}/${row.id}`, {
|
||||
headers: {
|
||||
@ -46,7 +43,7 @@ export default function Documents({idWell, selectedFileCategory}) {
|
||||
element.href = e.target.result
|
||||
element.click()
|
||||
};
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
});
|
||||
} catch (error) {
|
||||
notify(`Не удалось скачать файл ${row}`, 'error')
|
||||
@ -61,7 +58,7 @@ export default function Documents({idWell, selectedFileCategory}) {
|
||||
key: 'document',
|
||||
dataIndex: 'name',
|
||||
render: (name, row) =>
|
||||
<a onClick={ev => handleFileNameCLick(ev, row)} download={name}>{name}</a>
|
||||
<Button onClick={ev => handleFileNameCLick(ev, row)} download={name}>{name}</Button>
|
||||
},
|
||||
{
|
||||
title: 'Дата загрузки',
|
||||
@ -90,7 +87,7 @@ export default function Documents({idWell, selectedFileCategory}) {
|
||||
|
||||
useEffect(() => {
|
||||
const GetDocuments = async () => {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
|
||||
try {
|
||||
let begin = null
|
||||
@ -122,7 +119,7 @@ export default function Documents({idWell, selectedFileCategory}) {
|
||||
})
|
||||
|
||||
setTableUpdating(false)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
}
|
||||
)
|
||||
} catch (ex) {
|
||||
@ -144,7 +141,7 @@ export default function Documents({idWell, selectedFileCategory}) {
|
||||
/>
|
||||
</ConfigProvider>
|
||||
</div>
|
||||
<LoaderPortal show={loader}></LoaderPortal>
|
||||
<LoaderPortal show={showLoader}></LoaderPortal>
|
||||
<div> </div>
|
||||
|
||||
<Button
|
||||
|
@ -8,13 +8,15 @@ export const SquareIndicator = ({state}) =>{
|
||||
switch (state){
|
||||
case 1:
|
||||
bgColor = "#1B1"
|
||||
break;
|
||||
break
|
||||
case 2:
|
||||
bgColor = "#DD1"
|
||||
break;
|
||||
break
|
||||
case 3:
|
||||
bgColor = "#D11"
|
||||
break;
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
return (<svg width="32" height="32" version="1.1" viewBox="0 0 13 13" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x=".25" y=".25" width="12" height="12"
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams } from "react-router-dom";
|
||||
import { Table, InputNumber, Form, Popconfirm, Typography } from 'antd'
|
||||
import { Table, InputNumber, Form, Popconfirm, Typography, Button } from 'antd'
|
||||
import LoaderPortal from '../LoaderPortal'
|
||||
import { makeColumn } from '../factory'
|
||||
import { FluidService } from '../../services/api/services/FluidService';
|
||||
import notify from "../notify"
|
||||
|
||||
|
||||
const EditableCell = ({
|
||||
editing,
|
||||
dataIndex,
|
||||
@ -41,7 +41,6 @@ const EditableCell = ({
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export function DrillingFluid() {
|
||||
let {id} = useParams()
|
||||
|
||||
@ -52,7 +51,7 @@ export function DrillingFluid() {
|
||||
const [dataFact, setDataFact] = useState({})
|
||||
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
|
||||
const isEditing = (row) => row?.key === editingKey;
|
||||
|
||||
@ -98,14 +97,14 @@ export function DrillingFluid() {
|
||||
const editable = isEditing(row);
|
||||
return editable ? (
|
||||
<span>
|
||||
<a
|
||||
<Button
|
||||
onClick={() => form.submit()}
|
||||
style={{ marginRight: 8 }}
|
||||
>
|
||||
Сохранить
|
||||
</a>
|
||||
</Button>
|
||||
<Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}>
|
||||
<a>Отменить</a>
|
||||
<Button>Отменить</Button>
|
||||
</Popconfirm>
|
||||
</span>
|
||||
) : (
|
||||
@ -119,7 +118,7 @@ export function DrillingFluid() {
|
||||
|
||||
useEffect(() => {
|
||||
const update = async () => {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
|
||||
try {
|
||||
let response = await FluidService.get(id, 8)
|
||||
@ -144,10 +143,10 @@ export function DrillingFluid() {
|
||||
}
|
||||
|
||||
setIsUpdatingData(false)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
}
|
||||
update()
|
||||
}, [isUpdatingData])
|
||||
}, [id, isUpdatingData])
|
||||
|
||||
const mergedColumns = columns.map((col) => {
|
||||
if (!col.editable) {
|
||||
@ -212,11 +211,11 @@ export function DrillingFluid() {
|
||||
}
|
||||
|
||||
try {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
await FluidService.put(`${id}`, idCategory, params)
|
||||
|
||||
setIsUpdatingData(true)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
|
||||
setEditingKey('')
|
||||
} catch (errInfo) {
|
||||
@ -224,7 +223,7 @@ export function DrillingFluid() {
|
||||
}
|
||||
};
|
||||
|
||||
return (<>
|
||||
return (<LoaderPortal show={showLoader}>
|
||||
<Form form={form} component={false} onFinish={save}>
|
||||
<Table
|
||||
components={{
|
||||
@ -245,6 +244,5 @@ export function DrillingFluid() {
|
||||
<b>План:</b> <b>{new Date(dataPlan?.lastUpdate).toLocaleString()}</b>
|
||||
<b>Факт:</b> <b>{new Date(dataFact?.lastUpdate).toLocaleString()}</b>
|
||||
</p>
|
||||
</>
|
||||
)
|
||||
</LoaderPortal>)
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useParams } from "react-router-dom";
|
||||
import { Table, InputNumber, Input, Form, Popconfirm, Typography } from 'antd'
|
||||
import { Table, InputNumber, Input, Form, Popconfirm, Typography, Button } from 'antd'
|
||||
import LoaderPortal from '../LoaderPortal'
|
||||
import { makeColumn } from '../factory'
|
||||
import { MudDiagramService } from '../../services/api/services/MudDiagramService'
|
||||
import notify from "../notify"
|
||||
|
||||
|
||||
const EditableCell = ({
|
||||
editing,
|
||||
dataIndex,
|
||||
@ -49,8 +49,7 @@ export function SludgeDiagram() {
|
||||
const [editingKey, setEditingKey] = useState('');
|
||||
const [data, setData] = useState({})
|
||||
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
|
||||
const isEditing = (row) => row.key === editingKey;
|
||||
|
||||
@ -106,14 +105,14 @@ export function SludgeDiagram() {
|
||||
const editable = isEditing(row);
|
||||
return editable ? (
|
||||
<span>
|
||||
<a
|
||||
<Button
|
||||
onClick={() => save(row.key)}
|
||||
style={{ marginRight: 8 }}
|
||||
>
|
||||
Сохранить
|
||||
</a>
|
||||
</Button>
|
||||
<Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}>
|
||||
<a>Отменить</a>
|
||||
<Button>Отменить</Button>
|
||||
</Popconfirm>
|
||||
</span>
|
||||
) : (
|
||||
@ -127,7 +126,7 @@ export function SludgeDiagram() {
|
||||
|
||||
useEffect(() => {
|
||||
const update = async () => {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
|
||||
try {
|
||||
let response = await MudDiagramService.get(id, 10)
|
||||
@ -140,10 +139,10 @@ export function SludgeDiagram() {
|
||||
}
|
||||
|
||||
setIsUpdatingData(false)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
}
|
||||
update()
|
||||
}, [isUpdatingData])
|
||||
}, [id, isUpdatingData])
|
||||
|
||||
const mapColumns = (col) => {
|
||||
if(col.children)
|
||||
@ -206,11 +205,11 @@ export function SludgeDiagram() {
|
||||
}
|
||||
|
||||
try {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
await MudDiagramService.put(`${id}`, 10, params)
|
||||
|
||||
setIsUpdatingData(true)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
|
||||
setEditingKey('')
|
||||
} catch (errInfo) {
|
||||
@ -218,7 +217,7 @@ export function SludgeDiagram() {
|
||||
}
|
||||
};
|
||||
|
||||
return (<>
|
||||
return (<LoaderPortal show={showLoader}>
|
||||
<Form form={form} component={false} onFinish={save}>
|
||||
<Table
|
||||
components={{
|
||||
@ -237,6 +236,6 @@ export function SludgeDiagram() {
|
||||
<p style={{textAlign: "right"}}>
|
||||
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
|
||||
</p>
|
||||
</>
|
||||
</LoaderPortal>
|
||||
)
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import { useState, useEffect } from 'react'
|
||||
import { useParams } from "react-router-dom";
|
||||
import {Table, InputNumber, Form, Popconfirm, Typography } from 'antd'
|
||||
import {Table, InputNumber, Form, Popconfirm, Typography, Button } from 'antd'
|
||||
import LoaderPortal from '../LoaderPortal'
|
||||
import { makeColumn } from '../factory'
|
||||
import { NnbDataService } from '../../services/api/services/NnbDataService';
|
||||
import notify from "../notify"
|
||||
@ -47,8 +48,7 @@ export function Nnb() {
|
||||
const [editingKey, setEditingKey] = useState('');
|
||||
const [data, setData] = useState({})
|
||||
const [isUpdatingData, setIsUpdatingData] = useState(false)
|
||||
|
||||
const [loader, setLoader] = useState(false)
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
|
||||
const isEditing = (row) => row.key === editingKey;
|
||||
|
||||
@ -80,14 +80,14 @@ export function Nnb() {
|
||||
const editable = isEditing(row);
|
||||
return editable ? (
|
||||
<span>
|
||||
<a
|
||||
<Button
|
||||
onClick={() => save(row.key)}
|
||||
style={{ marginRight: 8 }}
|
||||
>
|
||||
Сохранить
|
||||
</a>
|
||||
</Button>
|
||||
<Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}>
|
||||
<a>Отменить</a>
|
||||
<Button>Отменить</Button>
|
||||
</Popconfirm>
|
||||
</span>
|
||||
) : (
|
||||
@ -101,7 +101,7 @@ export function Nnb() {
|
||||
|
||||
useEffect(() => {
|
||||
const update = async () => {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
|
||||
try {
|
||||
let response = await NnbDataService.get(id,11)
|
||||
@ -114,10 +114,10 @@ export function Nnb() {
|
||||
}
|
||||
|
||||
setIsUpdatingData(false)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
}
|
||||
update()
|
||||
}, [isUpdatingData])
|
||||
}, [id, isUpdatingData])
|
||||
|
||||
const mergedColumns = columns.map((col) => {
|
||||
if (!col.editable) {
|
||||
@ -169,11 +169,11 @@ export function Nnb() {
|
||||
}
|
||||
|
||||
try {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
await NnbDataService.put(`${id}`, 11, params)
|
||||
|
||||
setIsUpdatingData(true)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
|
||||
setEditingKey('')
|
||||
} catch (errInfo) {
|
||||
@ -182,7 +182,7 @@ export function Nnb() {
|
||||
};
|
||||
|
||||
|
||||
return (<>
|
||||
return (<LoaderPortal show={showLoader}>
|
||||
<Form form={form} component={false} onFinish={save}>
|
||||
<Table
|
||||
components={{
|
||||
@ -201,5 +201,5 @@ export function Nnb() {
|
||||
<p style={{textAlign: "right"}}>
|
||||
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
|
||||
</p>
|
||||
</>)
|
||||
</LoaderPortal>)
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
import {Button, Modal, Checkbox } from "antd";
|
||||
import {DrillingFluid} from "../components/modalWindows/DrillingFluid";
|
||||
import {useState, useEffect} from "react";
|
||||
import {useState} from "react";
|
||||
import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
|
||||
import {Nnb} from "../components/modalWindows/Nnb"
|
||||
import Disposition from "../components/Disposition";
|
||||
@ -12,7 +12,7 @@ export default function LastData() {
|
||||
const [tableSludgeVisible, setTableSludgeVisible] = useState(false)
|
||||
const [tableNNBVisible, setTableNNBVisible] = useState(false)
|
||||
const [dispositionVisible, setDispositionVisible] = useState(false)
|
||||
const [loader, setLoader] = useState(false)
|
||||
//const [loader, setLoader] = useState(false)
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import LoaderPortal from '../components/LoaderPortal'
|
||||
import { useState, useEffect } from "react";
|
||||
import {makeColumn, makeColumnsPlanFact, RegExpIsFloat} from '../components/factory'
|
||||
import {WellService} from '../services/api'
|
||||
import {WellSectionService} from '../services/api'
|
||||
import notify from '../components/notify'
|
||||
import { EditableTable } from '../components/EditableTable';
|
||||
|
||||
@ -42,20 +42,21 @@ const columns = [
|
||||
|
||||
export default function WellStat({idWell}){
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
const [data, setData] = useState(null)
|
||||
const [data, setData] = useState({})
|
||||
|
||||
useEffect(()=>{
|
||||
const update = async()=>{
|
||||
setShowLoader(true)
|
||||
try{
|
||||
const data = await WellService.getSections(idWell)
|
||||
const data = await WellSectionService.getAll(idWell,0,1024)
|
||||
setData(data);
|
||||
} catch (ex) {
|
||||
console.log(ex)
|
||||
notify(`Не удалось загрузить секции по скважине "${idWell}"`, 'error')
|
||||
}
|
||||
} finally{
|
||||
setShowLoader(false)
|
||||
}
|
||||
}
|
||||
update();
|
||||
} ,[idWell])
|
||||
|
||||
@ -67,7 +68,7 @@ export default function WellStat({idWell}){
|
||||
<LoaderPortal show={showLoader}>
|
||||
<EditableTable
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
dataSource={data.items}
|
||||
size={'small'}
|
||||
bordered
|
||||
pagination={false}
|
||||
|
Loading…
Reference in New Issue
Block a user