forked from ddrilling/asb_cloud_front
Merge branch 'master' of https://bitbucket.org/frolovng/asb_cloud_front_react
This commit is contained in:
commit
a75e6d8cef
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,7 @@ 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 { useParams } from "react-router-dom"
|
||||
import notify from './notify'
|
||||
import LoaderPortal from './LoaderPortal'
|
||||
import locale from "antd/lib/locale/ru_RU"
|
||||
@ -12,7 +12,6 @@ import moment from 'moment'
|
||||
const pageSize = 12
|
||||
const {RangePicker} = DatePicker;
|
||||
|
||||
|
||||
export default function Documents({selectedFileCategory}) {
|
||||
let {id} = useParams()
|
||||
|
||||
@ -23,14 +22,14 @@ export default function Documents({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/${id}/${row.id}`, {
|
||||
headers: {
|
||||
@ -46,7 +45,7 @@ export default function Documents({selectedFileCategory}) {
|
||||
element.href = e.target.result
|
||||
element.click()
|
||||
};
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
});
|
||||
} catch (error) {
|
||||
notify(`Не удалось скачать файл ${row}`, 'error')
|
||||
@ -61,7 +60,7 @@ export default function Documents({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 +89,7 @@ export default function Documents({selectedFileCategory}) {
|
||||
|
||||
useEffect(() => {
|
||||
const GetDocuments = async () => {
|
||||
setLoader(true)
|
||||
setShowLoader(true)
|
||||
|
||||
try {
|
||||
let begin = null
|
||||
@ -122,7 +121,7 @@ export default function Documents({selectedFileCategory}) {
|
||||
})
|
||||
|
||||
setTableUpdating(false)
|
||||
setLoader(false)
|
||||
setShowLoader(false)
|
||||
}
|
||||
)
|
||||
} catch (ex) {
|
||||
@ -144,7 +143,7 @@ export default function Documents({selectedFileCategory}) {
|
||||
/>
|
||||
</ConfigProvider>
|
||||
</div>
|
||||
<LoaderPortal show={loader}></LoaderPortal>
|
||||
<LoaderPortal show={showLoader}></LoaderPortal>
|
||||
<div> </div>
|
||||
|
||||
<Button
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Form, Input, Table, Button, Popconfirm } from "antd"
|
||||
import { EditOutlined, SaveOutlined, PlusOutlined, CloseCircleOutlined, DeleteOutlined } from '@ant-design/icons'
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
const newRowKeyValue = 'newRow'
|
||||
|
||||
@ -48,6 +48,10 @@ export const EditableTable = ({
|
||||
const [data, setData] = useState(dataSource?? [])
|
||||
const [editingKey, setEditingKey] = useState('')
|
||||
|
||||
useEffect(()=>{
|
||||
setData(dataSource??[])
|
||||
},[dataSource])
|
||||
|
||||
const isEditing = (record) => record.key === editingKey
|
||||
|
||||
const edit = (record) => {
|
||||
@ -56,7 +60,7 @@ export const EditableTable = ({
|
||||
}
|
||||
|
||||
const cancel = () => {
|
||||
if(editingKey == newRowKeyValue)
|
||||
if(editingKey === newRowKeyValue)
|
||||
{
|
||||
const newData = [...data]
|
||||
const index = newData.findIndex((item) => newRowKeyValue === item.key)
|
||||
|
@ -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,19 +42,20 @@ 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)
|
||||
}
|
||||
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}
|
||||
|
@ -11,7 +11,7 @@ import { request as __request } from '../core/request';
|
||||
export class TelemetryService {
|
||||
|
||||
/**
|
||||
* Принимает общую информацию по скважин<EFBFBD><EFBFBD>
|
||||
* Принимает общую информацию по скважине
|
||||
* @param uid Уникальный идентификатор отправителя
|
||||
* @param requestBody нформация об отправителе
|
||||
* @returns any Success
|
||||
|
@ -8,15 +8,23 @@ export class WellSectionService {
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @param skip
|
||||
* @param take
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async getAll(
|
||||
idWell: string,
|
||||
idWell: number,
|
||||
skip: number,
|
||||
take: number = 32,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/well/${idWell}`,
|
||||
path: `/api/well/${idWell}/sections`,
|
||||
query: {
|
||||
'skip': skip,
|
||||
'take': take,
|
||||
},
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
@ -28,30 +36,30 @@ idWell: string,
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async insert(
|
||||
idWell: string,
|
||||
requestBody?: WellSectionDto,
|
||||
idWell: number,
|
||||
requestBody?: Array<WellSectionDto>,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'POST',
|
||||
path: `/api/well/${idWell}`,
|
||||
path: `/api/well/${idWell}/sections`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param idSection
|
||||
* @param idWell
|
||||
* @returns any Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async get(
|
||||
id: number,
|
||||
idWell: string,
|
||||
idSection: number,
|
||||
idWell: number,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/well/${idWell}/${id}`,
|
||||
path: `/api/well/${idWell}/sections/${idSection}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
@ -65,12 +73,12 @@ idWell: string,
|
||||
*/
|
||||
public static async put(
|
||||
id: number,
|
||||
idWell: string,
|
||||
idWell: number,
|
||||
requestBody?: WellSectionDto,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'PUT',
|
||||
path: `/api/well/${idWell}/${id}`,
|
||||
path: `/api/well/${idWell}/sections/${id}`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
@ -84,11 +92,11 @@ requestBody?: WellSectionDto,
|
||||
*/
|
||||
public static async delete(
|
||||
id: number,
|
||||
idWell: string,
|
||||
idWell: number,
|
||||
): Promise<any> {
|
||||
const result = await __request({
|
||||
method: 'DELETE',
|
||||
path: `/api/well/${idWell}/${id}`,
|
||||
path: `/api/well/${idWell}/sections/${id}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
/* eslint-disable */
|
||||
import type { WellDto } from '../models/WellDto';
|
||||
import type { WellOperationDto } from '../models/WellOperationDto';
|
||||
import type { WellSectionDto } from '../models/WellSectionDto';
|
||||
import { request as __request } from '../core/request';
|
||||
|
||||
export class WellService {
|
||||
@ -20,21 +19,6 @@ export class WellService {
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @returns WellSectionDto Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async getSections(
|
||||
idWell: number,
|
||||
): Promise<Array<WellSectionDto>> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/well/${idWell}/sections`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param idWell
|
||||
* @returns WellOperationDto Success
|
||||
|
Loading…
Reference in New Issue
Block a user