diff --git a/src/pages/DrillingProgram/CategoryAdder.jsx b/src/pages/DrillingProgram/CategoryAdder.jsx index c180457..390f8f9 100644 --- a/src/pages/DrillingProgram/CategoryAdder.jsx +++ b/src/pages/DrillingProgram/CategoryAdder.jsx @@ -1,12 +1,18 @@ -import { Button, Select } from 'antd' +import { Form, Select } from 'antd' import { FileAddOutlined } from '@ant-design/icons' import { memo, useCallback, useEffect, useState } from 'react' -import { DrillingProgramService } from '@api' +import Poprompt from '@components/Poprompt' import { invokeWebApiWrapperAsync } from '@components/factory' +import { DrillingProgramService } from '@api' import '@styles/drilling_program.less' +const catSelectorRules = [{ + required: true, + message: 'Пожалуйста, выберите категории' +}] + export const CategoryAdder = memo(({ categories, idWell, onUpdate, className, ...other }) => { const [options, setOptions] = useState([]) const [value, setValue] = useState([]) @@ -24,37 +30,47 @@ export const CategoryAdder = memo(({ categories, idWell, onUpdate, className, .. `Не удалось установить список доступных категорий для добавления` ), [categories]) - const onAddClick = useCallback(() => invokeWebApiWrapperAsync( + const onFinish = useCallback(({ categories }) => invokeWebApiWrapperAsync( async () => { - await DrillingProgramService.addParts(idWell, value) + if (!categories) return + await DrillingProgramService.addParts(idWell, categories) setValue([]) onUpdate?.() }, setShowLoader, `Не удалось добавить новые категорий программы бурения`, `Добавление категорий программы бурения` - ), [onUpdate, idWell, value]) + ), [onUpdate, idWell]) return ( -
- + + ) }) diff --git a/src/pages/DrillingProgram/index.jsx b/src/pages/DrillingProgram/index.jsx index 7e617d9..9f4a6d1 100644 --- a/src/pages/DrillingProgram/index.jsx +++ b/src/pages/DrillingProgram/index.jsx @@ -1,4 +1,4 @@ -import { Button, Layout } from 'antd' +import { Button, Layout, Menu } from 'antd' import { CheckOutlined, CloseOutlined, @@ -57,8 +57,6 @@ export const DrillingProgram = memo(({ idWell }) => { const state = stateString[stateId] const StateIcon = state.icon - console.log(parts) - const updateData = useCallback(async () => await invokeWebApiWrapperAsync( async () => { const data = await DrillingProgramService.getState(idWell) @@ -100,13 +98,11 @@ export const DrillingProgram = memo(({ idWell }) => {

Программа бурения

{permissionToEdit && (
- +
)}
@@ -117,10 +113,20 @@ export const DrillingProgram = memo(({ idWell }) => {
Размер: {program?.size}
Загружен: {formatDate(program?.uploadDate)}
+ ) : stateId === idStateError ? ( + <> +

+ + {error?.message ?? state.text} +

+ + ) : ( -

+

- {(stateId === idStateError && error?.message) ? error.message : state.text} + {state.text}

)} @@ -139,12 +145,6 @@ export const DrillingProgram = memo(({ idWell }) => { {permissionToEdit && ( <> - -