Fixed Well Sections table

This commit is contained in:
Фролов 2021-08-20 17:59:28 +05:00 committed by KharchenkoVV
parent 2ab34efdd6
commit 6e1bb81bce
9 changed files with 34 additions and 61 deletions

View File

@ -1,12 +1,12 @@
import { useState, useEffect } from 'react' // import { useState, useEffect } from 'react'
import { EditableTable, DatePickerWrapper, SelectFromDictionary, numericColumnOptions, makeColumn } from "../../components/Table" // import { EditableTable, DatePickerWrapper, SelectFromDictionary, numericColumnOptions, makeColumn } from "../../components/Table"
import LoaderPortal from '../../components/LoaderPortal' // import LoaderPortal from '../../components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '../../components/factory' // import { invokeWebApiWrapperAsync } from '../../components/factory'
export default function LastDataTable({idWell}){ export const LastDataTable = ({idWell, columns, service}) => {
const [showLoader, setShowLoader] = useState(false) // const [showLoader, setShowLoader] = useState(false)
const update = () => {} // const update = () => {}
return <div>Open hystory</div> return <div>Open hystory</div>
} }

View File

@ -1,8 +1,16 @@
//import { useState, useEffect } from 'react' import { LastDataTable } from './LastDataTable'
import { MudDiagramService } from '../../services/api'
const columnsMud = []
export default function LastData({idWell}){ export default function LastData({idWell}){
return <> return <>
<h3>last data</h3> <h3>Замер бурового раствора</h3>
<LastDataTable
idWell={idWell}
columns={columnsMud}
service={MudDiagramService} />
<h3>Шлабограмма</h3>
<h3>ННБ</h3>
</> </>
} }

View File

@ -23,9 +23,10 @@ export const WellSectionsStat = ({idWell}) => {
useEffect(() => invokeWebApiWrapperAsync( useEffect(() => invokeWebApiWrapperAsync(
async () => { async () => {
const sectiionsPaginated = await WellSectionService.getAll(idWell, 0, 1000) const sectionsResponse = await WellSectionService.getSectionsByWellId(idWell)
if(sectiionsPaginated?.items?.length){
const sections = sectiionsPaginated.items.sort((a,b)=>a.wellDepthPlan - b.wellDepthPlan) if(sectionsResponse){
const sections = sectionsResponse.sort((a,b)=>a.wellDepthPlan - b.wellDepthPlan)
setSections(sections) setSections(sections)
} }
}, },

View File

@ -1,10 +1,11 @@
export const dictionarySectionType = new Map([ export const dictionarySectionType = new Map([
[1, 'Пилотный ствол'], [1, 'Обощенное по скважине'],
[2, 'Направление'], [2, 'Пилотный ствол'],
[3, 'Кондуктор'], [3, 'Направление'],
[4, 'Эксплуатационная колонна'], [4, 'Кондуктор'],
[5, 'Транспортный ствол'], [5, 'Эксплуатационная колонна'],
[6, 'Хвостовик'], [6, 'Транспортный ствол'],
[7, 'Хвостовик'],
]) ])
export const getByKeyOrReturnKey = (dictionary, key) => { export const getByKeyOrReturnKey = (dictionary, key) => {

View File

@ -33,7 +33,6 @@ export type { WellOperationCategoryDto } from './models/WellOperationCategoryDto
export type { WellOperationDto } from './models/WellOperationDto'; export type { WellOperationDto } from './models/WellOperationDto';
export type { WellOperationDtoPaginationContainer } from './models/WellOperationDtoPaginationContainer'; export type { WellOperationDtoPaginationContainer } from './models/WellOperationDtoPaginationContainer';
export type { WellSectionDto } from './models/WellSectionDto'; export type { WellSectionDto } from './models/WellSectionDto';
export type { WellSectionDtoPaginationContainer } from './models/WellSectionDtoPaginationContainer';
export type { WellStatDto } from './models/WellStatDto'; export type { WellStatDto } from './models/WellStatDto';
export { AuthService } from './services/AuthService'; export { AuthService } from './services/AuthService';

View File

@ -1,12 +0,0 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { WellSectionDto } from './WellSectionDto';
export type WellSectionDtoPaginationContainer = {
skip?: number;
take?: number;
count?: number;
items?: Array<WellSectionDto> | null;
}

View File

@ -85,7 +85,7 @@ fileId: number,
} }
/** /**
* Удаляет файл с диска на сервере * Помечает файл как удаленный
* @param idWell id скважины * @param idWell id скважины
* @param idFile id запрашиваемого файла * @param idFile id запрашиваемого файла
* @returns number Success * @returns number Success

View File

@ -44,7 +44,7 @@ sectionTypeIds?: Array<number>,
operationCategoryIds?: Array<number>, operationCategoryIds?: Array<number>,
begin?: string, begin?: string,
end?: string, end?: string,
skip: number = 0, skip?: number,
take: number = 32, take: number = 32,
): Promise<WellOperationDtoPaginationContainer> { ): Promise<WellOperationDtoPaginationContainer> {
const result = await __request({ const result = await __request({

View File

@ -2,45 +2,21 @@
/* tslint:disable */ /* tslint:disable */
/* eslint-disable */ /* eslint-disable */
import type { WellSectionDto } from '../models/WellSectionDto'; import type { WellSectionDto } from '../models/WellSectionDto';
import type { WellSectionDtoPaginationContainer } from '../models/WellSectionDtoPaginationContainer';
import { request as __request } from '../core/request'; import { request as __request } from '../core/request';
export class WellSectionService { export class WellSectionService {
/** /**
* @param idWell * @param idWell
* @returns string Success * @returns WellSectionDto Success
* @throws ApiError * @throws ApiError
*/ */
public static async getTypes( public static async getSectionsByWellId(
idWell: string,
): Promise<Array<string>> {
const result = await __request({
method: 'GET',
path: `/api/well/${idWell}/sections/types`,
});
return result.body;
}
/**
* @param idWell
* @param skip
* @param take
* @returns WellSectionDtoPaginationContainer Success
* @throws ApiError
*/
public static async getAll(
idWell: number, idWell: number,
skip: number, ): Promise<Array<WellSectionDto>> {
take: number = 32,
): Promise<WellSectionDtoPaginationContainer> {
const result = await __request({ const result = await __request({
method: 'GET', method: 'GET',
path: `/api/well/${idWell}/sections`, path: `/api/well/${idWell}/sections`,
query: {
'skip': skip,
'take': take,
},
}); });
return result.body; return result.body;
} }