-
+
Фильтр по компании
- {DataListCompanies}
-
+ list={'listCompanies'}
+ placeholder={'Фильтр по компании'}
+ onSearch={hanleCompanySearch}
+ />
+
+
Фильтр по имени файла
- {DataListFileNames}
+ list={'listFileNames'}
+ placeholder={'Фильтр по имени файла'}
+ onSearch={hanleFileNameSearch}
+ />
+
@@ -170,16 +151,17 @@ export default function DocumentsTemplate({ idCategory, idWell, accept, headerCh
url={uploadUrl}
accept={accept}
onUploadStart={() => setShowLoader(true)}
- onUploadComplete={handleUploadComplete}/>
+ onUploadComplete={handleUploadComplete}
+ />
{headerChild}
{beforeTable}
invokeWebApiWrapperAsync(
async () => {
@@ -26,73 +26,76 @@ export default function DrillingProgram({idWell}) {
setWellLabel(well.caption ?? `${idWell}`)
},
setShowLoader,
- `Не удалось загрузить название скважины "${idWell}"`
+ `Не удалось загрузить название скважины '${idWell}'`
), [idWell])
-
- const urlDownloadProgram =`/api/well/${idWell}/drillingProgram`
- const downloadProgram = () => invokeWebApiWrapperAsync(async()=>{
- await download(urlDownloadProgram)
- },
- setShowLoader,
- "Не удалось загрузить программу бурения")
+ const urlDownloadProgram = `/api/well/${idWell}/drillingProgram`
- const openProgramPreview = () => invokeWebApiWrapperAsync(async()=>{
+ const downloadProgram = () => invokeWebApiWrapperAsync(
+ async () => await download(urlDownloadProgram),
+ setShowLoader,
+ 'Не удалось загрузить программу бурения'
+ )
+
+ const openProgramPreview = () => invokeWebApiWrapperAsync(
+ async() => {
const filWebUrl = await DrillingProgramService.getOrCreateSharedUrl(idWell)
if(filWebUrl && filWebUrl.length > 0)
- window.open(filWebUrl, '_blank');
+ window.open(filWebUrl, '_blank')
else
- throw new Error("Сервер вернул плохую ссылку")
- },
- setShowLoader,
- "Не удалось создать быстрый просмотр программы")
+ throw new Error('Сервер вернул плохую ссылку')
+ },
+ setShowLoader,
+ 'Не удалось создать быстрый просмотр программы'
+ )
- const filesUpdated = (files) =>{
- if(!files || files.length === 0){
+ const filesUpdated = (files) => {
+ if (!files || files.length === 0) {
setTooltip('Нет файлов для формирования программы')
selDownloadButtonEnabled(false)
return
}
-
+
const isAllFilesAreExcel = files.every(fileInfo => fileInfo?.name.toLowerCase().endsWith('.xlsx'))
const isAnyFileMarked = files.some(file => file?.fileMarks.some(m => m?.idMarkType === 1 && !m?.isDeleted))
- if(isAllFilesAreExcel && isAnyFileMarked){
+ if (isAllFilesAreExcel && isAnyFileMarked) {
setTooltip('Программа доступна для скачивания')
selDownloadButtonEnabled(true)
- }
- else{
+ } else {
setTooltip('Список файлов содержит недопустимые типы файлов')
}
const last = files.reduce((pre, cur) => pre.uploadDate > cur.uploadDate ? pre : cur)
- setLastUpdatedFile(last);
+ setLastUpdatedFile(last)
}
const customColumns = [
{
- title: "Метки",
- key: "fileMarks",
+ title: 'Метки',
+ key: 'fileMarks',
render: (_, record) => renderMarksColumn(record?.id, record?.fileMarks)
},
]
-
+
const renderMarksColumn=(idFile, marks)=>{
const validMarks = marks?.filter(m => !(m?.isDeleted))
if(validMarks?.length)
return validMarks.map(mark => deleteMark(mark.id)}/>)
- return true &&
- addMarkToFile(idFile)}>
-
+ return (
+ addMarkToFile(idFile)}>
+
+ )
}
const addMarkToFile = async (idFile) => {
const mark = {
idFile: idFile,
idMarkType: 1,
- isDeleted:false,
- comment: ''}
+ isDeleted: false,
+ comment: '',
+ }
await DrillingProgramService.createFileMark(idWell, mark)
selDownloadButtonEnabled(true)
setChildKey(Date.now())
@@ -103,51 +106,59 @@ export default function DrillingProgram({idWell}) {
setChildKey(Date.now())
}
- const downloadButton =
-
Программа бурения
-
-
-
-
-
-
-
+
+
+
+
+ Программа бурения {wellLabel}.xlsx
+
+
+
+
+
+ )
const lastUpdatedFileView = lastUpdatedFile &&
Последнее изменние:
- "{lastUpdatedFile.name}"
+ '{lastUpdatedFile.name}'
[{formatBytes(lastUpdatedFile.size)}]
загружен: {new Date(lastUpdatedFile.uploadDate).toLocaleString()}
автор:
-
+
- return(
+ return (
+
- )
-}
\ No newline at end of file
+ key = {childKey}
+ />
+
+ )
+}
diff --git a/src/pages/Documents/index.jsx b/src/pages/Documents/index.jsx
index c873118..08a3c63 100644
--- a/src/pages/Documents/index.jsx
+++ b/src/pages/Documents/index.jsx
@@ -1,27 +1,68 @@
-import {Layout, Menu} from "antd";
-import {Switch, useParams} from "react-router-dom";
-import {makeMenuItems, makeRouteItems} from './menuItems'
+import path from 'path'
+import { memo } from 'react'
+import { Layout, Menu } from 'antd'
+import { FolderOutlined } from '@ant-design/icons'
+import { Switch, useParams, Link, Route } from 'react-router-dom'
+import { PrivateMenuItem } from '../../components/Private'
+import { isInRole } from '../../utils/PermissionService'
+import DocumentsTemplate from './DocumentsTemplate'
const { Content } = Layout
-export default function MenuDocuments({idWell}) {
- let {category} = useParams()
+export const documentCategories = [
+ { id: 1, key: 'fluidService', title: 'Растворный сервис' },
+ { id: 2, key: 'cementing', title: 'Цементирование' },
+ { id: 3, key: 'nnb', title: 'ННБ' },
+ { id: 4, key: 'gti', title: 'ГТИ' },
+ { id: 5, key: 'documentsForWell', title: 'Документы по скважине' },
+ { id: 6, key: 'supervisor', title: 'Супервайзер' },
+ { id: 7, key: 'master', title: 'Мастер' },
+ { id: 8, key: 'toolService', title: 'Долотный сервис' },
+ { id: 9, key: 'drillService', title: 'Буровой подрядчик' },
+ { id: 9, key: 'closingService', title: 'Сервис по заканчиванию скважины' },
+]
+
+const getUserCategories = () => documentCategories.filter(cat => isInRole(cat.roles))
+
+export const makeMenuItems = (root, cats) => {
+ const categories = cats ?? getUserCategories()
+ return categories.map(category => (
+ }>
+ {category.title}
+
+ ))
+}
+
+export const MenuDocuments = memo(({ idWell }) => {
+ const { category } = useParams()
const rootPath = `/well/${idWell}`
- return(<>
-
-
-
-
- {makeRouteItems(rootPath, idWell)}
+ const root = path.join(rootPath, '/document')
+ const categories = getUserCategories()
+
+ return (
+ <>
+
+
+
+
+ {categories.map(category => (
+
+
+
+ ))}
- >)
-}
+ >
+ )
+})
+
+export default MenuDocuments
diff --git a/src/pages/Documents/menuItems.jsx b/src/pages/Documents/menuItems.jsx
deleted file mode 100644
index 976d34b..0000000
--- a/src/pages/Documents/menuItems.jsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import path from 'path'
-import { FolderOutlined } from '@ant-design/icons'
-import { Link, Route } from 'react-router-dom'
-import { PrivateMenuItem } from '../../components/Private'
-import { getUserRoles, isInRole } from "../../utils/PermissionService";
-import DocumentsTemplate from './DocumentsTemplate'
-
-export const documentCategories = [
- { id: 1, key: 'fluidService', title: 'Растворный сервис' },
- { id: 2, key: 'cementing', title: 'Цементирование' },
- { id: 3, key: 'nnb', title: 'ННБ' },
- { id: 4, key: 'gti', title: 'ГТИ' },
- { id: 5, key: 'documentsForWell', title: 'Документы по скважине' },
- { id: 6, key: 'supervisor', title: 'Супервайзер' },
- { id: 7, key: 'master', title: 'Мастер' },
-]
-
-const makeMenuItem = (keyValue, rootPath, title, other) => (
-
- {title}
-
-)
-
-const makeRouteItem = (keyValue, rootPath, other) => (
-
-
-
-)
-
-const getCategoriesByUserRole = (role) => documentCategories.filter(cat => isInRole(cat.roles))
-
-export const makeMenuItems = (rootPath) => {
- const root = path.join(rootPath, '/document')
- const categories = getCategoriesByUserRole(getUserRoles())
- return categories.map(category =>
- makeMenuItem(category.key, root, category.title, {icon:}))
-}
-
-export const makeRouteItems = (rootPath, idWell) => {
- const root = path.join(rootPath, '/document')
- const categories = getCategoriesByUserRole(getUserRoles())
- const routes = categories.map(category => makeRouteItem(category.key, root, {
- idCategory: category.id,
- idWell: idWell
- }))
- return routes
-}
diff --git a/src/pages/TelemetryView/SetpointSender.jsx b/src/pages/TelemetryView/SetpointSender.jsx
index 6ad3b2e..8757e5d 100644
--- a/src/pages/TelemetryView/SetpointSender.jsx
+++ b/src/pages/TelemetryView/SetpointSender.jsx
@@ -3,7 +3,7 @@ import { Select, Modal, Input, InputNumber } from 'antd'
import { SetpointsService } from '../../services/api'
import LoaderPortal from '../../components/LoaderPortal'
import { invokeWebApiWrapperAsync } from '../../components/factory'
-import { makeNumericRender, EditableTable, makeNumericInput } from '../../components/Table'
+import { makeNumericRender, EditableTable } from '../../components/Table'
import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker'
import { Grid, GridItem } from '../../components/Grid'
@@ -54,6 +54,7 @@ export const SetpointSender = ({ idWell, onClose, visible, setpointNames }) => {
const onModalOk = () => invokeWebApiWrapperAsync(
async () => {
+ // eslint-disable-next-line no-sequences
const setpointsObject = setpoints.reduce((obj, sp) => (obj[sp.name] = sp.value, obj), {})
const request = {
uploadDate: new Date(),
diff --git a/src/pages/Well.jsx b/src/pages/Well.jsx
index f5ac3a0..2567b63 100644
--- a/src/pages/Well.jsx
+++ b/src/pages/Well.jsx
@@ -1,4 +1,4 @@
-import { Layout, Menu } from "antd";
+import { Layout, Menu } from 'antd'
import {
FolderOutlined,
FundViewOutlined,
@@ -6,112 +6,111 @@ import {
FilePdfOutlined,
DatabaseOutlined,
ExperimentOutlined,
- //FundProjectionScreenOutlined
-} from "@ant-design/icons";
-import { Link, Redirect, Route, Switch, useParams } from "react-router-dom";
-import TelemetryView from "./TelemetryView";
-import Messages from "./Messages";
-import Report from "./Report";
-import Archive from "./Archive";
-import Documents from "./Documents";
-import Measure from "./Measure";
-import { makeMenuItems } from "./Documents/menuItems";
-import WellOperations from "./WellOperations";
-import DrillingProgram from "./Documents/DrillingProgram";
-import TelemetryAnalysis from "./TelemetryAnalysis"
-import {PrivateMenuItem} from '../components/Private'
+ FundProjectionScreenOutlined,
+} from '@ant-design/icons'
+import { Link, Redirect, Route, Switch, useParams } from 'react-router-dom'
+import { PrivateMenuItem } from '../components/Private'
+import TelemetryView from './TelemetryView'
+import Messages from './Messages'
+import Report from './Report'
+import Archive from './Archive'
+import Documents from './Documents'
+import Measure from './Measure'
+import WellOperations from './WellOperations'
+import TelemetryAnalysis from './TelemetryAnalysis'
+import { makeMenuItems } from './Documents/'
+import DrillingProgram from './Documents/DrillingProgram'
-const { Content } = Layout;
+const { Content } = Layout
export default function Well() {
- let { idWell, tab } = useParams();
- const rootPath = `/well/${idWell}`;
+ const { idWell, tab } = useParams()
+ const rootPath = `/well/${idWell}`
- const { SubMenu } = Menu;
+ const { SubMenu } = Menu
- return
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
}