forked from ddrilling/asb_cloud_front
Общий метод форматирования координат вынесен в утилиты
This commit is contained in:
parent
847cfce2b6
commit
93e6d2171d
@ -11,11 +11,9 @@ import {
|
|||||||
} from '@components/Table'
|
} from '@components/Table'
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { AdminClusterService, AdminDepositService } from '@api'
|
import { AdminClusterService, AdminDepositService } from '@api'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, coordsFormat, wrapPrivateComponent } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
|
|
||||||
import { coordsFixed } from './DepositController'
|
|
||||||
|
|
||||||
const ClusterController = memo(() => {
|
const ClusterController = memo(() => {
|
||||||
const [deposits, setDeposits] = useState([])
|
const [deposits, setDeposits] = useState([])
|
||||||
const [clusters, setClusters] = useState([])
|
const [clusters, setClusters] = useState([])
|
||||||
@ -41,8 +39,8 @@ const ClusterController = memo(() => {
|
|||||||
sorter: makeStringSorter('caption'),
|
sorter: makeStringSorter('caption'),
|
||||||
formItemRules: min1,
|
formItemRules: min1,
|
||||||
}),
|
}),
|
||||||
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFixed }),
|
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFormat }),
|
||||||
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed }),
|
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFormat }),
|
||||||
makeTimezoneColumn('Зона', 'timezone', null, true, { width: 150 }),
|
makeTimezoneColumn('Зона', 'timezone', null, true, { width: 150 }),
|
||||||
], [deposits])
|
], [deposits])
|
||||||
|
|
||||||
|
@ -3,16 +3,14 @@ import { Input } from 'antd'
|
|||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { EditableTable, makeColumn, defaultPagination, makeTimezoneColumn } from '@components/Table'
|
import { EditableTable, makeColumn, defaultPagination, makeTimezoneColumn } from '@components/Table'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, coordsFormat, wrapPrivateComponent } from '@utils'
|
||||||
import { min1 } from '@utils/validationRules'
|
import { min1 } from '@utils/validationRules'
|
||||||
import { AdminDepositService } from '@api'
|
import { AdminDepositService } from '@api'
|
||||||
|
|
||||||
export const coordsFixed = (coords) => coords && isFinite(coords) ? (+coords).toPrecision(10) : '-'
|
|
||||||
|
|
||||||
const depositColumns = [
|
const depositColumns = [
|
||||||
makeColumn('Название', 'caption', { width: 200, editable: true, formItemRules: min1 }),
|
makeColumn('Название', 'caption', { width: 200, editable: true, formItemRules: min1 }),
|
||||||
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFixed }),
|
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFormat }),
|
||||||
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed }),
|
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFormat }),
|
||||||
makeTimezoneColumn('Зона', 'timezone', null, true, { width: 150 }),
|
makeTimezoneColumn('Зона', 'timezone', null, true, { width: 150 }),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@ import {
|
|||||||
import { invokeWebApiWrapperAsync } from '@components/factory'
|
import { invokeWebApiWrapperAsync } from '@components/factory'
|
||||||
import { TelemetryView, CompanyView } from '@components/views'
|
import { TelemetryView, CompanyView } from '@components/views'
|
||||||
import TelemetrySelect from '@components/selectors/TelemetrySelect'
|
import TelemetrySelect from '@components/selectors/TelemetrySelect'
|
||||||
import { arrayOrDefault, wrapPrivateComponent } from '@utils'
|
import { arrayOrDefault, coordsFormat, wrapPrivateComponent } from '@utils'
|
||||||
|
|
||||||
import { coordsFixed } from '../DepositController'
|
|
||||||
|
|
||||||
const wellTypes = [
|
const wellTypes = [
|
||||||
{ value: 1, label: 'Наклонно-направленная' },
|
{ value: 1, label: 'Наклонно-направленная' },
|
||||||
@ -98,8 +96,8 @@ const WellController = memo(() => {
|
|||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeNumericSorter('idWellType'),
|
sorter: makeNumericSorter('idWellType'),
|
||||||
}),
|
}),
|
||||||
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFixed }),
|
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFormat }),
|
||||||
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed }),
|
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFormat }),
|
||||||
makeColumn('Телеметрия', 'telemetry', {
|
makeColumn('Телеметрия', 'telemetry', {
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
||||||
|
@ -59,3 +59,5 @@ export const makeDisplayValue = ({
|
|||||||
if (Number.isFinite(f)) return f.toFixed(fixed)
|
if (Number.isFinite(f)) return f.toFixed(fixed)
|
||||||
return typeof inf === 'function' ? inf(f) : inf
|
return typeof inf === 'function' ? inf(f) : inf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const coordsFormat = (coords?: string) => (typeof coords === 'string') && isFinite(Number(coords)) ? Number(coords).toPrecision(10) : '-'
|
||||||
|
Loading…
Reference in New Issue
Block a user