From 46dddceae480891ca3535e873566fa125f7adccc Mon Sep 17 00:00:00 2001 From: cult Date: Thu, 28 Oct 2021 15:46:18 +0500 Subject: [PATCH] Changed Drilling program downloading to opening it for view in new tab --- src/pages/Documents/DrillingProgram.jsx | 16 ++++++++++------ .../api/services/DrillingProgramService.ts | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/pages/Documents/DrillingProgram.jsx b/src/pages/Documents/DrillingProgram.jsx index 4c23f49..23f8fe9 100644 --- a/src/pages/Documents/DrillingProgram.jsx +++ b/src/pages/Documents/DrillingProgram.jsx @@ -1,11 +1,11 @@ import {Button, Tooltip} from 'antd' import { FileExcelOutlined } from '@ant-design/icons' import { useEffect, useState } from "react" -import {invokeWebApiWrapperAsync, download} from '../../components/factory' +import {invokeWebApiWrapperAsync} from '../../components/factory' import DocumentsTemplate from './DocumentsTemplate' import LoaderPortal from '../../components/LoaderPortal' import { Flex } from '../../components/Grid' -import { WellService } from '../../services/api' +import {DrillingProgramService, WellService} from '../../services/api' const idFileCategoryDrillingProgramItems = 13; @@ -24,11 +24,15 @@ export default function DrillingProgram({idWell}) { `Не удалось загрузить название скважины "${idWell}"` ), [idWell]) - const urlDownloadProgram =`/api/well/${idWell}/drillingProgram` + //const urlDownloadProgram =`/api/well/${idWell}/drillingProgram` const downloadProgram = () => invokeWebApiWrapperAsync(async()=>{ - await download(urlDownloadProgram) - }, + //await download(urlDownloadProgram) + // Это временный функционал по просмотру программы бурения без скачивания. + // Наверняка его попросят убрать и нужно вернуть закомменченое скачивание файла выше. + var filWebUrl = await DrillingProgramService.get(idWell) + window.open(filWebUrl, '_blank') + }, setShowLoader, "Не удалось загрузить программу бурения") @@ -56,7 +60,7 @@ export default function DrillingProgram({idWell}) { type="primary" onClick={downloadProgram} disabled={!downloadButtonEnabled}> - Сформировать и скачать + Сформировать и просмотреть diff --git a/src/services/api/services/DrillingProgramService.ts b/src/services/api/services/DrillingProgramService.ts index 9aaaea1..284346c 100644 --- a/src/services/api/services/DrillingProgramService.ts +++ b/src/services/api/services/DrillingProgramService.ts @@ -6,7 +6,8 @@ import { request as __request } from '../core/request'; export class DrillingProgramService { /** - * @param idWell + * Создает программу бурения + * @param idWell id скважины * @returns string Success * @throws ApiError */