From f4adb528ca9991845c4475a259cee5e0aa96098a Mon Sep 17 00:00:00 2001 From: goodmice Date: Tue, 13 Dec 2022 18:28:30 +0500 Subject: [PATCH] =?UTF-8?q?*=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D1=81=D0=B8=D0=B3=D0=BD=D0=B0=D1=82=D1=83=D1=80=D0=B0?= =?UTF-8?q?=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B9=20makeNumericColu?= =?UTF-8?q?mn=20=D0=B8=20=D0=B5=D1=91=20=D0=BE=D0=B1=D1=91=D1=80=D1=82?= =?UTF-8?q?=D0=BE=D0=BA=20*=20=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=82=D0=BE=D1=80=D1=8B?= =?UTF-8?q?=D1=85=20=D1=8D=D0=BB=D0=B5=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 10 +- src/components/Table/Columns/date.tsx | 1 + src/components/Table/Columns/index.ts | 2 +- src/components/Table/Columns/numeric.tsx | 68 +++++++---- src/components/Table/Columns/plan_fact.tsx | 22 ---- src/components/Table/Columns/select.tsx | 15 ++- src/components/Table/Columns/tag.tsx | 1 + src/components/Table/Columns/text.tsx | 18 ++- src/components/Table/Columns/time.tsx | 1 + src/pages/AdminPanel/ClusterController.jsx | 17 +-- src/pages/AdminPanel/CompanyController.jsx | 17 +-- .../AdminPanel/CompanyTypeController.jsx | 9 +- src/pages/AdminPanel/DepositController.jsx | 8 +- src/pages/AdminPanel/PermissionController.jsx | 14 +-- src/pages/AdminPanel/RoleController.jsx | 4 +- .../AdminPanel/Telemetry/TelemetryViewer.jsx | 2 +- src/pages/AdminPanel/UserController/index.jsx | 10 +- src/pages/AdminPanel/WellController/index.jsx | 26 ++-- src/pages/Cluster/ClusterWells.jsx | 15 ++- src/pages/Cluster/WellOperationsTable.jsx | 8 +- src/pages/Deposit/StatisticsADW.jsx | 2 +- src/pages/Well/Analytics/Statistics.jsx | 8 +- .../WellCompositeSections.jsx | 28 ++--- .../Well/Documents/DocumentsTemplate.jsx | 2 +- src/pages/Well/Telemetry/Messages.jsx | 4 +- .../Well/Telemetry/OperationTime/index.jsx | 8 +- .../Well/Telemetry/Operations/DrillerList.jsx | 3 +- .../Telemetry/Operations/DrillerSchedule.jsx | 1 - .../Telemetry/Operations/OperationsTable.jsx | 10 +- .../Telemetry/Operations/TargetEditor.jsx | 9 +- .../Setpoints/SetpointSender.jsx | 24 +--- .../Telemetry/TelemetryView/cursorRender.jsx | 10 +- .../OperationEditor/WellOperationsEditor.jsx | 22 ++-- .../Well/WellOperations/Tvd/NptTable.jsx | 6 +- src/pages/Well/WellOperations/Tvd/TLPie.jsx | 6 +- .../Well/WellOperations/WellSectionsStat.jsx | 111 +++++++++--------- src/styles/components/loader.css | 8 +- 37 files changed, 247 insertions(+), 283 deletions(-) delete mode 100755 src/components/Table/Columns/plan_fact.tsx diff --git a/.vscode/settings.json b/.vscode/settings.json index a8ab85f..6dcba4d 100755 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,14 @@ { "cSpell.words": [ - "день" + "день", + "КНБК", + "САУБ", + "antd", + "Poprompt", + "saub", + "setpoint", + "Setpoints", + "usehooks" ], "liveServer.settings.port": 5501 } \ No newline at end of file diff --git a/src/components/Table/Columns/date.tsx b/src/components/Table/Columns/date.tsx index a401a04..dda6340 100755 --- a/src/components/Table/Columns/date.tsx +++ b/src/components/Table/Columns/date.tsx @@ -24,6 +24,7 @@ export const makeDateColumn = ( other?: ColumnProps, pickerOther?: DatePickerWrapperProps, ) => makeColumn(title, key, { + editable: true, ...other, render: (date) => (
diff --git a/src/components/Table/Columns/index.ts b/src/components/Table/Columns/index.ts index 778bffd..e21c93c 100755 --- a/src/components/Table/Columns/index.ts +++ b/src/components/Table/Columns/index.ts @@ -9,7 +9,6 @@ import { OmitExtends } from '@utils/types' export * from './date' export * from './time' export * from './numeric' -export * from './plan_fact' export * from './select' export * from './tag' export * from './text' @@ -45,6 +44,7 @@ export const makeColumn = (title: ReactNode, key: Key, other?: ColumnPr title: title, key: key, dataIndex: key, + render: (value: T) => value, ...other, }) diff --git a/src/components/Table/Columns/numeric.tsx b/src/components/Table/Columns/numeric.tsx index 36f89b2..c15ee52 100755 --- a/src/components/Table/Columns/numeric.tsx +++ b/src/components/Table/Columns/numeric.tsx @@ -1,4 +1,3 @@ -import { ColumnFilterItem } from 'antd/lib/table/interface' import { InputNumber } from 'antd' import { Key, ReactNode } from 'react' @@ -46,18 +45,17 @@ export const makeNumericColumnOptions = (fixed?: number, sorte export const makeNumericColumn = ( title: ReactNode, key: Key, - filters?: ColumnFilterItem[], - filterDelegate?: FilterGenerator, renderDelegate?: RenderMethod, + filterDelegate?: FilterGenerator, width?: string | number, other?: ColumnProps, ) => makeColumn(title, key, { - filters, + editable: true, onFilter: filterDelegate ? filterDelegate(key) : undefined, sorter: makeNumericSorter(key), width, - input: , - render: renderDelegate ?? makeNumericRender(2), + input: , + render: renderDelegate || makeNumericRender(2), align: 'right', ...other }) @@ -65,54 +63,78 @@ export const makeNumericColumn = ( export const makeNumericColumnPlanFact = ( title: ReactNode, key: Key, - filters?: ColumnFilterItem[], - filterDelegate?: FilterGenerator, renderDelegate?: RenderMethod, + filterDelegate?: FilterGenerator, + width?: string | number, + other?: ColumnProps, +) => { + return { + title, + children: [ + makeNumericColumn('План', `${key}.plan`, renderDelegate, filterDelegate, width, other), + makeNumericColumn('Факт', `${key}.fact`, renderDelegate, filterDelegate, width, other), + ] + } +} + +/** + * @deprecated Для значений типа план/факт появилась модель `PlanFactDto`, использование 2 полей с суффиксами неактуально + * @param title Заголовок столбца + * @param key Ключ столбца + * @param filters Список значений для фильтрации + * @param filterDelegate Метод фильтрации + * @param renderDelegate Render-метод отображения ячейки + * @param width Ширина столбца + * @param other Дополнительные опции + * @returns Объект-столбец для таблицы + */ +export const makeNumericColumnPlanFactOld = ( + title: ReactNode, + key: Key, + renderDelegate?: RenderMethod, + filterDelegate?: FilterGenerator, width?: string | number, other?: ColumnProps, ) => makeGroupColumn(title, [ - makeNumericColumn('п', key + 'Plan', filters, filterDelegate, renderDelegate, width, other), - makeNumericColumn('ф', key + 'Fact', filters, filterDelegate, renderDelegate, width, other), + makeNumericColumn('План', key + 'Plan', renderDelegate, filterDelegate, width, other), + makeNumericColumn('Факт', key + 'Fact', renderDelegate, filterDelegate, width, other), ]) export const makeNumericStartEnd = ( title: ReactNode, key: Key, fixed: number, - filters?: ColumnFilterItem[], - filterDelegate?: FilterGenerator, renderDelegate?: RenderMethod, + filterDelegate?: FilterGenerator, width?: string | number, ) => makeGroupColumn(title, [ - makeNumericColumn('старт', key + 'Start', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, key + 'Start')), - makeNumericColumn('конец', key + 'End', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, key + 'End')) + makeNumericColumn('старт', key + 'Start', renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, key + 'Start')), + makeNumericColumn('конец', key + 'End', renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, key + 'End')) ]) export const makeNumericMinMax = ( title: ReactNode, key: Key, fixed: number, - filters?: ColumnFilterItem[], - filterDelegate?: FilterGenerator, renderDelegate?: RenderMethod, + filterDelegate?: FilterGenerator, width?: string | number, ) => makeGroupColumn(title, [ - makeNumericColumn('мин', key + 'Min', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, key + 'Min')), - makeNumericColumn('макс', key + 'Max', filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, key + 'Max')), + makeNumericColumn('мин', key + 'Min', renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, key + 'Min')), + makeNumericColumn('макс', key + 'Max', renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, key + 'Max')), ]) export const makeNumericAvgRange = ( title: ReactNode, key: Key, fixed: number, - filters?: ColumnFilterItem[], - filterDelegate?: FilterGenerator, renderDelegate?: RenderMethod, + filterDelegate?: FilterGenerator, width?: string | number, ) => makeGroupColumn(title, [ - makeNumericColumn('мин', `${key}.min`, filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, `${key}.min`)), - makeNumericColumn('сред', `${key}.avg`, filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, `${key}.avg`)), - makeNumericColumn('макс', `${key}.max`, filters, filterDelegate, renderDelegate, width, makeNumericColumnOptions(fixed, `${key}.max`)), + makeNumericColumn('мин', `${key}.min`, renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, `${key}.min`)), + makeNumericColumn('сред', `${key}.avg`, renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, `${key}.avg`)), + makeNumericColumn('макс', `${key}.max`, renderDelegate, filterDelegate, width, makeNumericColumnOptions(fixed, `${key}.max`)), ]) export default makeNumericColumn diff --git a/src/components/Table/Columns/plan_fact.tsx b/src/components/Table/Columns/plan_fact.tsx deleted file mode 100755 index 852b9e4..0000000 --- a/src/components/Table/Columns/plan_fact.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Key, ReactNode } from 'react' - -import { ColumnProps, makeColumn } from '.' - -export const makeColumnsPlanFact = ( - title: string | ReactNode, - key: Key | [Key, Key], - columsOther?: ColumnProps | [ColumnProps, ColumnProps], -) => { - const keys = Array.isArray(key) ? key : [`${key}Plan`, `${key}Fact`] - const others = Array.isArray(columsOther) ? columsOther : [columsOther, columsOther] - - return { - title, - children: [ - makeColumn('план', keys[0], others[0]), - makeColumn('факт', keys[1], others[1]), - ] - } -} - -export default makeColumnsPlanFact diff --git a/src/components/Table/Columns/select.tsx b/src/components/Table/Columns/select.tsx index 098d983..54e948b 100755 --- a/src/components/Table/Columns/select.tsx +++ b/src/components/Table/Columns/select.tsx @@ -1,9 +1,17 @@ import { Select, SelectProps } from 'antd' import { DefaultOptionType, SelectValue } from 'antd/lib/select' -import { Key, ReactNode } from 'react' +import { Key, ReactNode, useMemo } from 'react' import { ColumnProps, makeColumn } from '.' +const findOption = (value: any, options: T[] | undefined) => + options?.find((option) => String(option?.value) === String(value)) + +const SelectWrapper = ({ value, options, ...other }: SelectProps) => { + const selectValue = useMemo(() => findOption(value, options)?.label, [value, options]) + return , + input: , render: (value, dataset, index) => { - const item = options?.find(option => String(option?.value) === String(value)) + const item = findOption(value, options) return other?.render?.(item, dataset, index) ?? item?.label ?? defaultValue?.label ?? value?.label ?? '--' } }) diff --git a/src/components/Table/Columns/tag.tsx b/src/components/Table/Columns/tag.tsx index e683f19..c83329b 100755 --- a/src/components/Table/Columns/tag.tsx +++ b/src/components/Table/Columns/tag.tsx @@ -65,6 +65,7 @@ export const makeTagColumn = ( const InputComponent = makeTagInput(value_key, label_key) return makeColumn(title, dataIndex, { + editable: true, ...other, render: (item: T[] | undefined, dataset, index) => item?.map((elm: T) => {other?.render?.(elm, dataset, index) ?? elm[label_key]}) ?? '-', input: , diff --git a/src/components/Table/Columns/text.tsx b/src/components/Table/Columns/text.tsx index 91431ad..69db9a3 100755 --- a/src/components/Table/Columns/text.tsx +++ b/src/components/Table/Columns/text.tsx @@ -1,3 +1,4 @@ +import { Tooltip } from 'antd' import { ColumnFilterItem } from 'antd/lib/table/interface' import { Key, ReactNode } from 'react' @@ -15,6 +16,18 @@ export const makeStringSorter = (key: Key): SorterMethod => return String(vA).localeCompare(String(vB)) } +export const makeTextRender = (def = '---', stringCutter?: (text: string) => string) => (value: T) => { + if (!value) return def + if (stringCutter) { + return ( + + {stringCutter(value)} + + ) + } + return value +} + export const makeFilterTextMatch = (key: keyof DataType) => (filterValue: T, dataItem: DataType) => dataItem[key] === filterValue @@ -26,10 +39,11 @@ export const makeTextColumn = ( render?: RenderMethod, other?: ColumnProps ) => makeColumn(title, key, { + editable: true, filters, onFilter: filters ? makeFilterTextMatch(key) : undefined, - sorter: sorter ?? makeStringSorter(key), - render: render, + sorter: sorter || makeStringSorter(key), + render: render || makeTextRender(), ...other }) diff --git a/src/components/Table/Columns/time.tsx b/src/components/Table/Columns/time.tsx index 7547814..116840c 100644 --- a/src/components/Table/Columns/time.tsx +++ b/src/components/Table/Columns/time.tsx @@ -24,6 +24,7 @@ export const makeTimeColumn = ( other?: ColumnProps, pickerOther?: TimePickerWrapperProps, ) => makeColumn(title, key, { + editable: true, ...other, render: (time) => (
diff --git a/src/pages/AdminPanel/ClusterController.jsx b/src/pages/AdminPanel/ClusterController.jsx index 35c9b9b..16259d3 100755 --- a/src/pages/AdminPanel/ClusterController.jsx +++ b/src/pages/AdminPanel/ClusterController.jsx @@ -3,11 +3,12 @@ import { Input } from 'antd' import { EditableTable, - makeColumn, makeSelectColumn, makeStringSorter, defaultPagination, - makeTimezoneColumn + makeTimezoneColumn, + makeNumericColumn, + makeTextColumn } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' import { AdminClusterService, AdminDepositService } from '@api' @@ -30,17 +31,11 @@ const ClusterController = memo(() => { const clusterColumns = useMemo(() => [ makeSelectColumn('Месторождение', 'idDeposit', deposits, '--', { width: 200, - editable: true, sorter: makeStringSorter('idDeposit') }), - makeColumn('Название', 'caption', { - width: 200, - editable: true, - sorter: makeStringSorter('caption'), - formItemRules: min1, - }), - makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFormat }), - makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFormat }), + makeTextColumn('Название', 'caption', undefined, undefined, undefined, { width: 200, formItemRules: min1 }), + makeNumericColumn('Широта', 'latitude', coordsFormat, undefined, 150), + makeNumericColumn('Долгота', 'longitude', coordsFormat, undefined, 150), makeTimezoneColumn('Зона', 'timezone', null, true, { width: 150 }), ], [deposits]) diff --git a/src/pages/AdminPanel/CompanyController.jsx b/src/pages/AdminPanel/CompanyController.jsx index 454b16c..5577e1f 100755 --- a/src/pages/AdminPanel/CompanyController.jsx +++ b/src/pages/AdminPanel/CompanyController.jsx @@ -3,10 +3,9 @@ import { Input } from 'antd' import { EditableTable, - makeColumn, - makeStringSorter, makeSelectColumn, - defaultPagination + defaultPagination, + makeTextColumn } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' import { AdminCompanyService, AdminCompanyTypeService } from '@api' @@ -37,16 +36,8 @@ const CompanyController = memo(() => { })) setColumns([ - makeColumn('Название', 'caption', { - width: 200, - editable: true, - sorter: makeStringSorter('caption'), - formItemRules: min1, - }), - makeSelectColumn('Тип компании', 'idCompanyType', companyTypes, null, { - width: 200, - editable: true - }), + makeTextColumn('Название', 'caption', undefined, undefined, undefined, { width: 200, formItemRules: min1 }), + makeSelectColumn('Тип компании', 'idCompanyType', companyTypes, null, { width: 200 }), ]) await updateTable() diff --git a/src/pages/AdminPanel/CompanyTypeController.jsx b/src/pages/AdminPanel/CompanyTypeController.jsx index 3debe2c..601d1aa 100755 --- a/src/pages/AdminPanel/CompanyTypeController.jsx +++ b/src/pages/AdminPanel/CompanyTypeController.jsx @@ -1,19 +1,14 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { Input } from 'antd' -import { EditableTable, makeColumn, makeStringSorter, defaultPagination } from '@components/Table' +import { EditableTable, defaultPagination, makeTextColumn } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' import { arrayOrDefault, withPermissions } from '@utils' import { min1 } from '@utils/validationRules' import { AdminCompanyTypeService } from '@api' const columns = [ - makeColumn('Название', 'caption', { - width: 200, - editable: true, - sorter: makeStringSorter('caption'), - formItemRules: min1, - }), + makeTextColumn('Название', 'caption', undefined, undefined, undefined, { width: 200, formItemRules: min1 }), ] const CompanyTypeController = memo(() => { diff --git a/src/pages/AdminPanel/DepositController.jsx b/src/pages/AdminPanel/DepositController.jsx index 748490b..974a420 100755 --- a/src/pages/AdminPanel/DepositController.jsx +++ b/src/pages/AdminPanel/DepositController.jsx @@ -2,15 +2,15 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { Input } from 'antd' import { invokeWebApiWrapperAsync } from '@components/factory' -import { EditableTable, makeColumn, defaultPagination, makeTimezoneColumn } from '@components/Table' +import { EditableTable, defaultPagination, makeTimezoneColumn, makeTextColumn, makeNumericColumn } from '@components/Table' import { arrayOrDefault, coordsFormat, withPermissions } from '@utils' import { min1 } from '@utils/validationRules' import { AdminDepositService } from '@api' const depositColumns = [ - makeColumn('Название', 'caption', { width: 200, editable: true, formItemRules: min1 }), - makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFormat }), - makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFormat }), + makeTextColumn('Название', 'caption', undefined, undefined, undefined, { width: 200, formItemRules: min1 }), + makeNumericColumn('Широта', 'latitude', coordsFormat, undefined, 150), + makeNumericColumn('Долгота', 'longitude', coordsFormat, undefined, 150), makeTimezoneColumn('Зона', 'timezone', null, true, { width: 150 }), ] diff --git a/src/pages/AdminPanel/PermissionController.jsx b/src/pages/AdminPanel/PermissionController.jsx index 73db56a..0ee736e 100755 --- a/src/pages/AdminPanel/PermissionController.jsx +++ b/src/pages/AdminPanel/PermissionController.jsx @@ -1,23 +1,15 @@ import { memo, useCallback, useEffect, useMemo, useState } from 'react' import { Input } from 'antd' -import { EditableTable, makeColumn, makeStringSorter } from '@components/Table' +import { EditableTable, makeTextColumn } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' import { arrayOrDefault, withPermissions } from '@utils' import { min1 } from '@utils/validationRules' import { AdminPermissionService } from '@api' const columns = [ - makeColumn('Название', 'name', { - editable: true, - sorter: makeStringSorter('name'), - isRequired: true, - formItemRules: min1, - }), - makeColumn('Описание', 'description', { - editable: true, - sorter: makeStringSorter('description'), - }), + makeTextColumn('Название', 'name', undefined, undefined, undefined, { isRequired: true, formItemRules: min1 }), + makeTextColumn('Описание', 'description'), ] const PermissionController = memo(() => { diff --git a/src/pages/AdminPanel/RoleController.jsx b/src/pages/AdminPanel/RoleController.jsx index b995fde..6276ac5 100755 --- a/src/pages/AdminPanel/RoleController.jsx +++ b/src/pages/AdminPanel/RoleController.jsx @@ -19,15 +19,13 @@ const RoleController = memo(() => { )), [roles, searchValue]) const columns = useMemo(() => [ - makeTextColumn('Название', 'caption', null, null, null, { width: 100, editable: true, formItemRules: min1 }), + makeTextColumn('Название', 'caption', null, null, null, { width: 100, formItemRules: min1 }), makeTagColumn('Включённые роли', 'roles', roles, 'id', 'caption', { width: 400, - editable: true, render: (role) => }, { allowClear: true }), makeTagColumn('Разрешения', 'permissions', permissions, 'id', 'name', { width: 600, - editable: true, render: (permission) => , }), ], [roles, permissions]) diff --git a/src/pages/AdminPanel/Telemetry/TelemetryViewer.jsx b/src/pages/AdminPanel/Telemetry/TelemetryViewer.jsx index f90ff30..3836aff 100755 --- a/src/pages/AdminPanel/Telemetry/TelemetryViewer.jsx +++ b/src/pages/AdminPanel/Telemetry/TelemetryViewer.jsx @@ -50,7 +50,7 @@ const TelemetryController = memo(() => { const columns = useMemo(() => [ makeColumn('', 'hasParent', { render: mergeRender }), - makeNumericColumn('ID', 'id', null, null, makeNumericRender(0)), + makeNumericColumn('ID', 'id', makeNumericRender(0)), makeTextColumn('UID', 'remoteUid'), makeTextColumn('Назначена на скважину', 'realWell'), makeDateColumn('Дата начала бурения', 'drillingStartDate'), diff --git a/src/pages/AdminPanel/UserController/index.jsx b/src/pages/AdminPanel/UserController/index.jsx index 2f6b301..5bb3ef2 100755 --- a/src/pages/AdminPanel/UserController/index.jsx +++ b/src/pages/AdminPanel/UserController/index.jsx @@ -115,7 +115,6 @@ const UserController = memo(() => { setColumns([ makeTextColumn('Логин', 'login', null, null, null, { - editable: true, formItemRules: [ { required: true }, ...createLoginRules, @@ -130,41 +129,34 @@ const UserController = memo(() => { ], }), makeTextColumn('Фамилия', 'surname', filters.surname, null, null, { - editable: true, formItemRules: [{ required: true }, ...nameRules], filterSearch: true, onFilter: makeTextOnFilter('surname'), }), makeTextColumn('Имя', 'name', filters.name, null, null, { - editable: true, formItemRules: nameRules, filterSearch: true, onFilter: makeTextOnFilter('name'), }), makeTextColumn('Отчество', 'patronymic', filters.partonymic, null, null, { - editable: true, formItemRules: nameRules, filterSearch: true, onFilter: makeTextOnFilter('patronymic'), }), makeTextColumn('E-mail', 'email', filters.email, null, null, { - editable: true, formItemRules: [{ required: true }, ...emailRules], filterSearch: true, onFilter: makeTextOnFilter('email'), }), makeTextColumn('Номер телефона', 'phone', null, null, null, { - editable: true, formItemRules: phoneRules, }), - makeTextColumn('Должность', 'position', null, null, null, { editable: true }), + makeTextColumn('Должность', 'position', null, null, null), makeTextColumn('Роли', 'roleNames', roleFilters, null, rolesRender, { - editable: true, input: , onFilter: makeArrayOnFilter('roleNames'), }), makeSelectColumn('Компания', 'idCompany', companies, '--', { - editable: true, sorter: makeNumericSorter('idCompany'), }) ]) diff --git a/src/pages/AdminPanel/WellController/index.jsx b/src/pages/AdminPanel/WellController/index.jsx index 6fe163e..ed74ca6 100755 --- a/src/pages/AdminPanel/WellController/index.jsx +++ b/src/pages/AdminPanel/WellController/index.jsx @@ -12,11 +12,12 @@ import { EditableTable, makeColumn, makeSelectColumn, - makeStringSorter, makeNumericSorter, makeTagColumn, defaultPagination, makeTimezoneColumn, + makeTextColumn, + makeNumericColumn, } from '@components/Table' import { invokeWebApiWrapperAsync } from '@components/factory' import { TelemetryView, CompanyView } from '@components/views' @@ -81,23 +82,11 @@ const WellController = memo(() => { })) setColumns([ - makeSelectColumn('Куст', 'idCluster', clusters, '--', { - width: '5rem', - editable: true, - sorter: makeNumericSorter('idCluster'), - }), - makeColumn('Название', 'caption', { - width: '5rem', - editable: true, - sorter: makeStringSorter('caption'), - }), - makeSelectColumn('Тип', 'idWellType', wellTypes, '--', { - width: 150, - editable: true, - sorter: makeNumericSorter('idWellType'), - }), - makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFormat }), - makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFormat }), + makeSelectColumn('Куст', 'idCluster', clusters, '--', { width: '5rem', sorter: makeNumericSorter('idCluster') }), + makeTextColumn('Название', 'caption', undefined, undefined, undefined, { width: '5rem' }), + makeSelectColumn('Тип', 'idWellType', wellTypes, '--', { width: 150, sorter: makeNumericSorter('idWellType') }), + makeNumericColumn('Широта', 'latitude', coordsFormat, undefined, 150), + makeNumericColumn('Долгота', 'longitude', coordsFormat, undefined, 150), makeColumn('Телеметрия', 'telemetry', { editable: true, render: (telemetry) => , @@ -105,7 +94,6 @@ const WellController = memo(() => { }, ), makeTimezoneColumn('Зона', 'timezone', null, true, { width: 170 }), makeTagColumn('Компании', 'companies', companies, 'id', 'caption', { - editable: true, render: (company) => , }), ]) diff --git a/src/pages/Cluster/ClusterWells.jsx b/src/pages/Cluster/ClusterWells.jsx index a84e9cb..81410ec 100755 --- a/src/pages/Cluster/ClusterWells.jsx +++ b/src/pages/Cluster/ClusterWells.jsx @@ -7,7 +7,7 @@ import { makeTextColumn, makeGroupColumn, makeColumn, - makeNumericColumnPlanFact, + makeNumericColumnPlanFactOld, Table, makeNumericRender, makeNumericColumn, @@ -117,7 +117,10 @@ const ClusterWells = memo(({ statsWells }) => { const columns = useMemo(() => [ makeTextColumn('скв №', 'caption', null, null, (_, item) => ( - + { makeDateColumn('начало', 'factStart'), makeDateColumn('окончание', 'factEnd'), ]), - makeNumericColumnPlanFact('Продолжительность, сут', 'period', filtersMinMax, makeFilterMinMaxFunction, numericRender), - makeNumericColumnPlanFact('МСП, м/ч', 'rateOfPenetration', filtersMinMax, makeFilterMinMaxFunction, numericRender), - makeNumericColumnPlanFact('Рейсовая скорость, м/ч', 'routeSpeed', filtersMinMax, makeFilterMinMaxFunction, numericRender), - makeNumericColumn('НПВ, ч', 'notProductiveTimeFact', filtersMinMax, makeFilterMinMaxFunction, numericRender), + makeNumericColumnPlanFactOld('Продолжительность, сут', 'period', numericRender, makeFilterMinMaxFunction, { filters: filtersMinMax }), + makeNumericColumnPlanFactOld('МСП, м/ч', 'rateOfPenetration', numericRender, makeFilterMinMaxFunction, { filters: filtersMinMax }), + makeNumericColumnPlanFactOld('Рейсовая скорость, м/ч', 'routeSpeed', numericRender, makeFilterMinMaxFunction, { filters: filtersMinMax }), + makeNumericColumn('НПВ, ч', 'notProductiveTimeFact', numericRender, makeFilterMinMaxFunction, { filters: filtersMinMax }), makeColumn('TVD', 'tvd', { align: 'center', render: (_, value) => (