fix all warnings

This commit is contained in:
Фролов 2021-08-11 17:39:27 +05:00
parent 139f73e968
commit 5038285d6d
9 changed files with 125 additions and 22809 deletions

22811
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,11 +14,9 @@
"chartjs-plugin-datalabels": "^2.0.0-rc.1", "chartjs-plugin-datalabels": "^2.0.0-rc.1",
"chartjs-plugin-zoom": "^1.1.1", "chartjs-plugin-zoom": "^1.1.1",
"craco-less": "^1.17.1", "craco-less": "^1.17.1",
"immutability-helper": "^3.1.1",
"moment": "^2.29.1", "moment": "^2.29.1",
"pigeon-maps": "^0.19.7", "pigeon-maps": "^0.19.7",
"react": "^17.0.2", "react": "^17.0.2",
"react-dnd-html5-backend": "^14.0.0",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-scripts": "4.0.3", "react-scripts": "4.0.3",

View File

@ -3,7 +3,6 @@ import { UploadOutlined } from '@ant-design/icons'
import DocumentCreationForm from './modalWindows/DocumentCreationForm' import DocumentCreationForm from './modalWindows/DocumentCreationForm'
import { FileService } from '../services/api' import { FileService } from '../services/api'
import {useState, useEffect} from "react" import {useState, useEffect} from "react"
import {useParams} from 'react-router-dom'
import notify from './notify' import notify from './notify'
import LoaderPortal from './LoaderPortal' import LoaderPortal from './LoaderPortal'
import locale from "antd/lib/locale/ru_RU" import locale from "antd/lib/locale/ru_RU"
@ -12,9 +11,7 @@ import moment from 'moment'
const pageSize = 12 const pageSize = 12
const {RangePicker} = DatePicker; const {RangePicker} = DatePicker;
export default function Documents({idWell, selectedFileCategory}) { export default function Documents({idWell, selectedFileCategory}) {
// let {id} = useParams()
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [range, setRange] = useState([]) const [range, setRange] = useState([])
@ -23,14 +20,14 @@ export default function Documents({idWell, selectedFileCategory}) {
const [isModalVisible, setIsModalVisible] = useState(false) const [isModalVisible, setIsModalVisible] = useState(false)
const [isTableUpdating, setTableUpdating] = useState(false) const [isTableUpdating, setTableUpdating] = useState(false)
const [loader, setLoader] = useState(false) const [showLoader, setShowLoader] = useState(false)
const handleFileNameCLick = async (event, row) => { const handleFileNameCLick = async (event, row) => {
const element = event.target const element = event.target
if(!element.href.length) { if(!element.href.length) {
try { try {
setLoader(true) setShowLoader(true)
await fetch(`/api/files/${idWell}/${row.id}`, { await fetch(`/api/files/${idWell}/${row.id}`, {
headers: { headers: {
@ -46,7 +43,7 @@ export default function Documents({idWell, selectedFileCategory}) {
element.href = e.target.result element.href = e.target.result
element.click() element.click()
}; };
setLoader(false) setShowLoader(false)
}); });
} catch (error) { } catch (error) {
notify(`Не удалось скачать файл ${row}`, 'error') notify(`Не удалось скачать файл ${row}`, 'error')
@ -61,7 +58,7 @@ export default function Documents({idWell, selectedFileCategory}) {
key: 'document', key: 'document',
dataIndex: 'name', dataIndex: 'name',
render: (name, row) => render: (name, row) =>
<a onClick={ev => handleFileNameCLick(ev, row)} download={name}>{name}</a> <Button onClick={ev => handleFileNameCLick(ev, row)} download={name}>{name}</Button>
}, },
{ {
title: 'Дата загрузки', title: 'Дата загрузки',
@ -90,7 +87,7 @@ export default function Documents({idWell, selectedFileCategory}) {
useEffect(() => { useEffect(() => {
const GetDocuments = async () => { const GetDocuments = async () => {
setLoader(true) setShowLoader(true)
try { try {
let begin = null let begin = null
@ -122,7 +119,7 @@ export default function Documents({idWell, selectedFileCategory}) {
}) })
setTableUpdating(false) setTableUpdating(false)
setLoader(false) setShowLoader(false)
} }
) )
} catch (ex) { } catch (ex) {
@ -144,7 +141,7 @@ export default function Documents({idWell, selectedFileCategory}) {
/> />
</ConfigProvider> </ConfigProvider>
</div> </div>
<LoaderPortal show={loader}></LoaderPortal> <LoaderPortal show={showLoader}></LoaderPortal>
<div>&nbsp;</div> <div>&nbsp;</div>
<Button <Button

View File

@ -8,13 +8,15 @@ export const SquareIndicator = ({state}) =>{
switch (state){ switch (state){
case 1: case 1:
bgColor = "#1B1" bgColor = "#1B1"
break; break
case 2: case 2:
bgColor = "#DD1" bgColor = "#DD1"
break; break
case 3: case 3:
bgColor = "#D11" 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"> 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" <rect x=".25" y=".25" width="12" height="12"

View File

@ -1,11 +1,11 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useParams } from "react-router-dom"; 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 { makeColumn } from '../factory'
import { FluidService } from '../../services/api/services/FluidService'; import { FluidService } from '../../services/api/services/FluidService';
import notify from "../notify" import notify from "../notify"
const EditableCell = ({ const EditableCell = ({
editing, editing,
dataIndex, dataIndex,
@ -41,7 +41,6 @@ const EditableCell = ({
); );
}; };
export function DrillingFluid() { export function DrillingFluid() {
let {id} = useParams() let {id} = useParams()
@ -52,7 +51,7 @@ export function DrillingFluid() {
const [dataFact, setDataFact] = useState({}) const [dataFact, setDataFact] = useState({})
const [isUpdatingData, setIsUpdatingData] = useState(false) const [isUpdatingData, setIsUpdatingData] = useState(false)
const [loader, setLoader] = useState(false) const [showLoader, setShowLoader] = useState(false)
const isEditing = (row) => row?.key === editingKey; const isEditing = (row) => row?.key === editingKey;
@ -98,14 +97,14 @@ export function DrillingFluid() {
const editable = isEditing(row); const editable = isEditing(row);
return editable ? ( return editable ? (
<span> <span>
<a <Button
onClick={() => form.submit()} onClick={() => form.submit()}
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
> >
Сохранить Сохранить
</a> </Button>
<Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}> <Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}>
<a>Отменить</a> <Button>Отменить</Button>
</Popconfirm> </Popconfirm>
</span> </span>
) : ( ) : (
@ -119,7 +118,7 @@ export function DrillingFluid() {
useEffect(() => { useEffect(() => {
const update = async () => { const update = async () => {
setLoader(true) setShowLoader(true)
try { try {
let response = await FluidService.get(id, 8) let response = await FluidService.get(id, 8)
@ -144,10 +143,10 @@ export function DrillingFluid() {
} }
setIsUpdatingData(false) setIsUpdatingData(false)
setLoader(false) setShowLoader(false)
} }
update() update()
}, [isUpdatingData]) }, [id, isUpdatingData])
const mergedColumns = columns.map((col) => { const mergedColumns = columns.map((col) => {
if (!col.editable) { if (!col.editable) {
@ -212,11 +211,11 @@ export function DrillingFluid() {
} }
try { try {
setLoader(true) setShowLoader(true)
await FluidService.put(`${id}`, idCategory, params) await FluidService.put(`${id}`, idCategory, params)
setIsUpdatingData(true) setIsUpdatingData(true)
setLoader(false) setShowLoader(false)
setEditingKey('') setEditingKey('')
} catch (errInfo) { } catch (errInfo) {
@ -224,7 +223,7 @@ export function DrillingFluid() {
} }
}; };
return (<> return (<LoaderPortal show={showLoader}>
<Form form={form} component={false} onFinish={save}> <Form form={form} component={false} onFinish={save}>
<Table <Table
components={{ components={{
@ -245,6 +244,5 @@ export function DrillingFluid() {
&nbsp;<b>План:</b>&nbsp;<b>{new Date(dataPlan?.lastUpdate).toLocaleString()}</b> &nbsp; &nbsp;<b>План:</b>&nbsp;<b>{new Date(dataPlan?.lastUpdate).toLocaleString()}</b> &nbsp;
&nbsp;<b>Факт:</b>&nbsp;<b>{new Date(dataFact?.lastUpdate).toLocaleString()}</b>&nbsp; &nbsp;<b>Факт:</b>&nbsp;<b>{new Date(dataFact?.lastUpdate).toLocaleString()}</b>&nbsp;
</p> </p>
</> </LoaderPortal>)
)
} }

View File

@ -1,11 +1,11 @@
import { useState, useEffect } from 'react'; import { useState, useEffect } from 'react';
import { useParams } from "react-router-dom"; 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 { makeColumn } from '../factory'
import { MudDiagramService } from '../../services/api/services/MudDiagramService' import { MudDiagramService } from '../../services/api/services/MudDiagramService'
import notify from "../notify" import notify from "../notify"
const EditableCell = ({ const EditableCell = ({
editing, editing,
dataIndex, dataIndex,
@ -49,8 +49,7 @@ export function SludgeDiagram() {
const [editingKey, setEditingKey] = useState(''); const [editingKey, setEditingKey] = useState('');
const [data, setData] = useState({}) const [data, setData] = useState({})
const [isUpdatingData, setIsUpdatingData] = useState(false) const [isUpdatingData, setIsUpdatingData] = useState(false)
const [showLoader, setShowLoader] = useState(false)
const [loader, setLoader] = useState(false)
const isEditing = (row) => row.key === editingKey; const isEditing = (row) => row.key === editingKey;
@ -106,14 +105,14 @@ export function SludgeDiagram() {
const editable = isEditing(row); const editable = isEditing(row);
return editable ? ( return editable ? (
<span> <span>
<a <Button
onClick={() => save(row.key)} onClick={() => save(row.key)}
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
> >
Сохранить Сохранить
</a> </Button>
<Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}> <Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}>
<a>Отменить</a> <Button>Отменить</Button>
</Popconfirm> </Popconfirm>
</span> </span>
) : ( ) : (
@ -127,7 +126,7 @@ export function SludgeDiagram() {
useEffect(() => { useEffect(() => {
const update = async () => { const update = async () => {
setLoader(true) setShowLoader(true)
try { try {
let response = await MudDiagramService.get(id, 10) let response = await MudDiagramService.get(id, 10)
@ -140,10 +139,10 @@ export function SludgeDiagram() {
} }
setIsUpdatingData(false) setIsUpdatingData(false)
setLoader(false) setShowLoader(false)
} }
update() update()
}, [isUpdatingData]) }, [id, isUpdatingData])
const mapColumns = (col) => { const mapColumns = (col) => {
if(col.children) if(col.children)
@ -206,11 +205,11 @@ export function SludgeDiagram() {
} }
try { try {
setLoader(true) setShowLoader(true)
await MudDiagramService.put(`${id}`, 10, params) await MudDiagramService.put(`${id}`, 10, params)
setIsUpdatingData(true) setIsUpdatingData(true)
setLoader(false) setShowLoader(false)
setEditingKey('') setEditingKey('')
} catch (errInfo) { } catch (errInfo) {
@ -218,7 +217,7 @@ export function SludgeDiagram() {
} }
}; };
return (<> return (<LoaderPortal show={showLoader}>
<Form form={form} component={false} onFinish={save}> <Form form={form} component={false} onFinish={save}>
<Table <Table
components={{ components={{
@ -237,6 +236,6 @@ export function SludgeDiagram() {
<p style={{textAlign: "right"}}> <p style={{textAlign: "right"}}>
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b> Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
</p> </p>
</> </LoaderPortal>
) )
} }

View File

@ -1,6 +1,7 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { useParams } from "react-router-dom"; 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 { makeColumn } from '../factory'
import { NnbDataService } from '../../services/api/services/NnbDataService'; import { NnbDataService } from '../../services/api/services/NnbDataService';
import notify from "../notify" import notify from "../notify"
@ -47,8 +48,7 @@ export function Nnb() {
const [editingKey, setEditingKey] = useState(''); const [editingKey, setEditingKey] = useState('');
const [data, setData] = useState({}) const [data, setData] = useState({})
const [isUpdatingData, setIsUpdatingData] = useState(false) const [isUpdatingData, setIsUpdatingData] = useState(false)
const [showLoader, setShowLoader] = useState(false)
const [loader, setLoader] = useState(false)
const isEditing = (row) => row.key === editingKey; const isEditing = (row) => row.key === editingKey;
@ -80,14 +80,14 @@ export function Nnb() {
const editable = isEditing(row); const editable = isEditing(row);
return editable ? ( return editable ? (
<span> <span>
<a <Button
onClick={() => save(row.key)} onClick={() => save(row.key)}
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
> >
Сохранить Сохранить
</a> </Button>
<Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}> <Popconfirm style={{width: '100px'}} title={<span>Отменить<br />редактирование?</span>} onConfirm={cancel}>
<a>Отменить</a> <Button>Отменить</Button>
</Popconfirm> </Popconfirm>
</span> </span>
) : ( ) : (
@ -101,7 +101,7 @@ export function Nnb() {
useEffect(() => { useEffect(() => {
const update = async () => { const update = async () => {
setLoader(true) setShowLoader(true)
try { try {
let response = await NnbDataService.get(id,11) let response = await NnbDataService.get(id,11)
@ -114,10 +114,10 @@ export function Nnb() {
} }
setIsUpdatingData(false) setIsUpdatingData(false)
setLoader(false) setShowLoader(false)
} }
update() update()
}, [isUpdatingData]) }, [id, isUpdatingData])
const mergedColumns = columns.map((col) => { const mergedColumns = columns.map((col) => {
if (!col.editable) { if (!col.editable) {
@ -169,11 +169,11 @@ export function Nnb() {
} }
try { try {
setLoader(true) setShowLoader(true)
await NnbDataService.put(`${id}`, 11, params) await NnbDataService.put(`${id}`, 11, params)
setIsUpdatingData(true) setIsUpdatingData(true)
setLoader(false) setShowLoader(false)
setEditingKey('') setEditingKey('')
} catch (errInfo) { } catch (errInfo) {
@ -182,7 +182,7 @@ export function Nnb() {
}; };
return (<> return (<LoaderPortal show={showLoader}>
<Form form={form} component={false} onFinish={save}> <Form form={form} component={false} onFinish={save}>
<Table <Table
components={{ components={{
@ -201,5 +201,5 @@ export function Nnb() {
<p style={{textAlign: "right"}}> <p style={{textAlign: "right"}}>
Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b> Дата последнего обновления: <b>{new Date(data?.lastUpdate).toLocaleString()}</b>
</p> </p>
</>) </LoaderPortal>)
} }

View File

@ -1,6 +1,6 @@
import {Button, Modal, Checkbox } from "antd"; import {Button, Modal, Checkbox } from "antd";
import {DrillingFluid} from "../components/modalWindows/DrillingFluid"; import {DrillingFluid} from "../components/modalWindows/DrillingFluid";
import {useState, useEffect} from "react"; import {useState} from "react";
import {SludgeDiagram} from "../components/modalWindows/MudDiagram"; import {SludgeDiagram} from "../components/modalWindows/MudDiagram";
import {Nnb} from "../components/modalWindows/Nnb" import {Nnb} from "../components/modalWindows/Nnb"
import Disposition from "../components/Disposition"; import Disposition from "../components/Disposition";
@ -12,7 +12,7 @@ export default function LastData() {
const [tableSludgeVisible, setTableSludgeVisible] = useState(false) const [tableSludgeVisible, setTableSludgeVisible] = useState(false)
const [tableNNBVisible, setTableNNBVisible] = useState(false) const [tableNNBVisible, setTableNNBVisible] = useState(false)
const [dispositionVisible, setDispositionVisible] = useState(false) const [dispositionVisible, setDispositionVisible] = useState(false)
const [loader, setLoader] = useState(false) //const [loader, setLoader] = useState(false)
return ( return (
<> <>

View File

@ -1,7 +1,7 @@
import LoaderPortal from '../components/LoaderPortal' import LoaderPortal from '../components/LoaderPortal'
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import {makeColumn, makeColumnsPlanFact, RegExpIsFloat} from '../components/factory' import {makeColumn, makeColumnsPlanFact, RegExpIsFloat} from '../components/factory'
import {WellService} from '../services/api' import {WellSectionService} from '../services/api'
import notify from '../components/notify' import notify from '../components/notify'
import { EditableTable } from '../components/EditableTable'; import { EditableTable } from '../components/EditableTable';
@ -42,20 +42,21 @@ const columns = [
export default function WellStat({idWell}){ export default function WellStat({idWell}){
const [showLoader, setShowLoader] = useState(false) const [showLoader, setShowLoader] = useState(false)
const [data, setData] = useState(null) const [data, setData] = useState({})
useEffect(()=>{ useEffect(()=>{
const update = async()=>{ const update = async()=>{
setShowLoader(true) setShowLoader(true)
try{ try{
const data = await WellService.getSections(idWell) const data = await WellSectionService.getAll(idWell,0,1024)
setData(data); setData(data);
} catch (ex) { } catch (ex) {
console.log(ex) console.log(ex)
notify(`Не удалось загрузить секции по скважине "${idWell}"`, 'error') notify(`Не удалось загрузить секции по скважине "${idWell}"`, 'error')
} } finally{
setShowLoader(false) setShowLoader(false)
} }
}
update(); update();
} ,[idWell]) } ,[idWell])
@ -67,7 +68,7 @@ export default function WellStat({idWell}){
<LoaderPortal show={showLoader}> <LoaderPortal show={showLoader}>
<EditableTable <EditableTable
columns={columns} columns={columns}
dataSource={data} dataSource={data.items}
size={'small'} size={'small'}
bordered bordered
pagination={false} pagination={false}