diff --git a/.vscode/settings.json b/.vscode/settings.json index 52097f0..01228b7 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,5 +12,6 @@ "Setpoints", "usehooks" ], - "liveServer.settings.port": 5501 + "liveServer.settings.port": 5501, + "cSpell.language": "en,ru" } \ No newline at end of file diff --git a/src/pages/Well/Telemetry/Operations/TargetEditor.jsx b/src/pages/Well/Telemetry/Operations/TargetEditor.jsx index dc1dfd1..e4daf5f 100644 --- a/src/pages/Well/Telemetry/Operations/TargetEditor.jsx +++ b/src/pages/Well/Telemetry/Operations/TargetEditor.jsx @@ -4,7 +4,7 @@ import { Button, Modal } from 'antd' import { useWell } from '@asb/context' import { invokeWebApiWrapperAsync } from '@components/factory' import { EditableTable, makeGroupColumn, makeNumericColumn, makeNumericRender, makeSelectColumn } from '@components/Table' -import { DetectedOperationService, OperationValueService } from '@api' +import { OperationValueService } from '@api' import { arrayOrDefault } from '@utils' const columnOptions = { @@ -14,7 +14,7 @@ const columnOptions = { const scroll = { y: '75vh', scrollToFirstRowOnChange: true } const numericRender = makeNumericRender(2) -export const TargetEditor = memo(({ loading, onChange }) => { +export const TargetEditor = memo(({ loading, onChange, options }) => { const [targets, setTargets] = useState([]) const [showModal, setShowModal] = useState(false) const [showLoader, setShowLoader] = useState(false) @@ -62,9 +62,6 @@ export const TargetEditor = memo(({ loading, onChange }) => { useEffect(() => { invokeWebApiWrapperAsync( async () => { - const categories = arrayOrDefault(await DetectedOperationService.getCategories()) - const options = categories.map(({ id, name }) => ({ value: id, label: name })) - setTargetColumns([ makeSelectColumn('Название', 'idOperationCategory', options, undefined, { ...columnOptions, width: 200 }, { showSearch: true, @@ -83,7 +80,7 @@ export const TargetEditor = memo(({ loading, onChange }) => { `Не удалось получить список категорий целей`, { actionName: 'Получение списка категорий целей', well } ) - }, [well]) + }, [options]) useEffect(() => { updateTable() diff --git a/src/pages/Well/Telemetry/Operations/index.jsx b/src/pages/Well/Telemetry/Operations/index.jsx index fca16f6..7aa6329 100644 --- a/src/pages/Well/Telemetry/Operations/index.jsx +++ b/src/pages/Well/Telemetry/Operations/index.jsx @@ -8,7 +8,7 @@ import { DateRangeWrapper } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' import { unique } from '@utils/filters' import { getPermissions, arrayOrDefault, range, withPermissions, prettify } from '@utils' -import { DetectedOperationService, DrillerService, TelemetryDataSaubService } from '@api' +import { DetectedOperationService, DrillerService, TelemetryDataSaubService, WellOperationService } from '@api' import DrillerList from './DrillerList' import TargetEditor from './TargetEditor' @@ -26,7 +26,7 @@ const Operations = memo(() => { const [data, setData] = useState({}) const [drillers, setDrillers] = useState([]) const [drillersLoader, setDrillersLoader] = useState(false) - const [selectedCategory, setSelectedCategory] = useState(14) + const [selectedCategory, setSelectedCategory] = useState(5011) const [categories, setCategories] = useState() const [well] = useWell() @@ -78,7 +78,7 @@ const Operations = memo(() => { useEffect(() => { invokeWebApiWrapperAsync( async () => { - const categories = arrayOrDefault(await DetectedOperationService.getCategories()) + const categories = arrayOrDefault(await WellOperationService.getCategories(well.id)) setCategories(categories.map((category) => ({ ...category, value: category.id, @@ -86,10 +86,10 @@ const Operations = memo(() => { }))) }, setIsLoading, - 'Не удалось загрзуить категории операций', + 'Не удалось загрузить категории операций', { actionName: 'Получение категорий операций' } ) - }, []) + }, [well]) useEffect(() => { invokeWebApiWrapperAsync( @@ -135,6 +135,7 @@ const Operations = memo(() => { onChange={setYDomain} addonAfter={'мин'} addonBefore={'Верхняя граница'} + style={{width: '20em'}} /> {permissions.driller.get && ( <> @@ -142,8 +143,8 @@ const Operations = memo(() => { )} - {permissions.detectedOperation.get && permissions.operationValue.get && ( - + {permissions.detectedOperation.get && permissions.operationValue.get && categories && ( + )}