forked from ddrilling/asb_cloud_front
Добавлена валидация названий
Координаты округлены до 8 знаков после запятой На журнале посещений кол-во записей изменено на 16 и добавлен селектор кол-ва строк
This commit is contained in:
parent
604ecd346b
commit
da382ba9c8
@ -1,4 +1,5 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
import {
|
import {
|
||||||
@ -10,6 +11,9 @@ import {
|
|||||||
} from '../../components/Table'
|
} from '../../components/Table'
|
||||||
import { AdminClusterService, AdminDepositService } from '../../services/api'
|
import { AdminClusterService, AdminDepositService } from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
|
import { min3 } from '../../utils/validationRules'
|
||||||
|
|
||||||
|
import { coordsFixed } from './DepositController'
|
||||||
|
|
||||||
export default function ClusterController() {
|
export default function ClusterController() {
|
||||||
const [deposits, setDeposits] = useState([])
|
const [deposits, setDeposits] = useState([])
|
||||||
@ -25,10 +29,11 @@ export default function ClusterController() {
|
|||||||
makeColumn('Название', 'caption', {
|
makeColumn('Название', 'caption', {
|
||||||
width: 200,
|
width: 200,
|
||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeStringSorter('caption')
|
sorter: makeStringSorter('caption'),
|
||||||
|
formItemRules: min3,
|
||||||
}),
|
}),
|
||||||
makeColumn('Широта', 'latitude', { width: 150, editable: true }),
|
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFixed }),
|
||||||
makeColumn('Долгота', 'longitude', { width: 150, editable: true })
|
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed }),
|
||||||
]
|
]
|
||||||
|
|
||||||
const updateTable = () => invokeWebApiWrapperAsync(
|
const updateTable = () => invokeWebApiWrapperAsync(
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
import { EditableTable, makeColumn, makeActionHandler, makeStringSorter } from '../../components/Table'
|
import { EditableTable, makeColumn, makeActionHandler, makeStringSorter } from '../../components/Table'
|
||||||
import { AdminCompanyService } from '../../services/api'
|
import { AdminCompanyService } from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
|
import { min3 } from '../../utils/validationRules'
|
||||||
|
|
||||||
const companyColumns = [
|
const companyColumns = [
|
||||||
makeColumn('Название', 'caption', {
|
makeColumn('Название', 'caption', {
|
||||||
width: 200,
|
width: 200,
|
||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeStringSorter('caption')
|
sorter: makeStringSorter('caption'),
|
||||||
|
formItemRules: min3,
|
||||||
}),
|
}),
|
||||||
makeColumn('Тип компании', 'companyTypeCaption', {
|
makeColumn('Тип компании', 'companyTypeCaption', {
|
||||||
width: 200,
|
width: 200,
|
||||||
|
@ -4,11 +4,14 @@ import LoaderPortal from '../../components/LoaderPortal'
|
|||||||
import { EditableTable, makeColumn, makeActionHandler } from '../../components/Table'
|
import { EditableTable, makeColumn, makeActionHandler } from '../../components/Table'
|
||||||
import { AdminDepositService } from '../../services/api'
|
import { AdminDepositService } from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
|
import { min3 } from '../../utils/validationRules'
|
||||||
|
|
||||||
|
export const coordsFixed = (coords) => coords?.toPrecision(10)
|
||||||
|
|
||||||
const depositColumns = [
|
const depositColumns = [
|
||||||
makeColumn('Название', 'caption', { width: 200, editable: true }),
|
makeColumn('Название', 'caption', { width: 200, editable: true, formItemRules: min3 }),
|
||||||
makeColumn('Широта', 'latitude', { width: 150, editable: true }),
|
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFixed }),
|
||||||
makeColumn('Долгота', 'longitude', { width: 150, editable: true })
|
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed })
|
||||||
]
|
]
|
||||||
|
|
||||||
export default function DepositController() {
|
export default function DepositController() {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
import {
|
import {
|
||||||
@ -9,11 +10,13 @@ import {
|
|||||||
} from '../../components/Table'
|
} from '../../components/Table'
|
||||||
import { AdminPermissionService } from '../../services/api'
|
import { AdminPermissionService } from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
|
import { min3 } from '../../utils/validationRules'
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
makeColumn('Название', 'name', {
|
makeColumn('Название', 'name', {
|
||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeStringSorter('name'),
|
sorter: makeStringSorter('name'),
|
||||||
|
formItemRules: min3,
|
||||||
}),
|
}),
|
||||||
makeColumn('Описание', 'description', {
|
makeColumn('Описание', 'description', {
|
||||||
editable: true,
|
editable: true,
|
||||||
|
@ -6,6 +6,7 @@ import { invokeWebApiWrapperAsync } from '../../components/factory'
|
|||||||
import { EditableTable, makeActionHandler, makeColumn, makeSelectColumn, makeTagColumn } from '../../components/Table'
|
import { EditableTable, makeActionHandler, makeColumn, makeSelectColumn, makeTagColumn } from '../../components/Table'
|
||||||
import { AdminPermissionService, AdminUserRoleService } from '../../services/api'
|
import { AdminPermissionService, AdminUserRoleService } from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
|
import { min3 } from '../../utils/validationRules'
|
||||||
|
|
||||||
export const RoleController = memo(() => {
|
export const RoleController = memo(() => {
|
||||||
const [permissions, setPermissions] = useState([])
|
const [permissions, setPermissions] = useState([])
|
||||||
@ -21,7 +22,7 @@ export const RoleController = memo(() => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const options = roles?.map((r) => ({ value: r.id, label: r.caption })) ?? []
|
const options = roles?.map((r) => ({ value: r.id, label: r.caption })) ?? []
|
||||||
setColumns([
|
setColumns([
|
||||||
makeColumn('Название', 'caption', { width: 200, editable: true }),
|
makeColumn('Название', 'caption', { width: 200, editable: true, formItemRules: min3 }),
|
||||||
makeSelectColumn('Роль-родитель', 'idParent', options, options[0], {
|
makeSelectColumn('Роль-родитель', 'idParent', options, options[0], {
|
||||||
width: 200,
|
width: 200,
|
||||||
editable: true
|
editable: true
|
||||||
|
@ -1,27 +1,34 @@
|
|||||||
import moment from 'moment'
|
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
|
|
||||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
import { makeColumn, makeDateSorter, makeStringSorter, Table } from '../../components/Table'
|
import { makeColumn, makeDateSorter, makeStringSorter, Table } from '../../components/Table'
|
||||||
import { RequerstTrackerService } from '../../services/api'
|
import { RequerstTrackerService } from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault, formatDate } from '../../utils'
|
||||||
|
|
||||||
|
const logRecordCount = 1000
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
makeColumn('Логин', 'login', { sorter: makeStringSorter('login') }),
|
makeColumn('Логин', 'login', { sorter: makeStringSorter('login') }),
|
||||||
makeColumn('IP', 'ip', { sorter: makeStringSorter('ip') }),
|
makeColumn('IP', 'ip', { sorter: makeStringSorter('ip') }),
|
||||||
makeColumn('Дата посещения', 'lastDate', {
|
makeColumn('Дата посещения', 'lastDate', {
|
||||||
render: (date) => moment(date).format('DD MMM YYYY, HH:mm:ss'),
|
render: (date) => formatDate(date, false, 'DD MMM YYYY, HH:mm:ss'),
|
||||||
sorter: makeDateSorter('lastDate'),
|
sorter: makeDateSorter('lastDate'),
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const pagination = {
|
||||||
|
pageSize: 16,
|
||||||
|
showSizeChanger: true,
|
||||||
|
}
|
||||||
|
|
||||||
export const VisitLog = () => {
|
export const VisitLog = () => {
|
||||||
const [logData, setLogData] = useState([])
|
const [logData, setLogData] = useState([])
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
useEffect(() => invokeWebApiWrapperAsync(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const logData = arrayOrDefault(await RequerstTrackerService.getUsersStat(1000))
|
const logData = arrayOrDefault(await RequerstTrackerService.getUsersStat(logRecordCount))
|
||||||
logData.forEach((log) => log.key = `${log.login}${log.ip}`)
|
logData.forEach((log) => log.key = `${log.login}${log.ip}`)
|
||||||
setLogData(logData)
|
setLogData(logData)
|
||||||
},
|
},
|
||||||
@ -37,6 +44,7 @@ export const VisitLog = () => {
|
|||||||
bordered
|
bordered
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={logData}
|
dataSource={logData}
|
||||||
|
pagination={pagination}
|
||||||
/>
|
/>
|
||||||
</LoaderPortal>
|
</LoaderPortal>
|
||||||
)
|
)
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
AdminWellService,
|
AdminWellService,
|
||||||
} from '../../services/api'
|
} from '../../services/api'
|
||||||
import { arrayOrDefault } from '../../utils'
|
import { arrayOrDefault } from '../../utils'
|
||||||
|
import { coordsFixed } from './DepositController'
|
||||||
|
|
||||||
const wellTypes = [
|
const wellTypes = [
|
||||||
{ value: 1, label: 'Наклонно-направленная' },
|
{ value: 1, label: 'Наклонно-направленная' },
|
||||||
@ -83,12 +84,12 @@ export default function WellController() {
|
|||||||
|
|
||||||
setColumns([
|
setColumns([
|
||||||
makeSelectColumn('Куст', 'idCluster', clusters, '--', {
|
makeSelectColumn('Куст', 'idCluster', clusters, '--', {
|
||||||
width: 200,
|
width: '5rem',
|
||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeNumericSorter('idCluster'),
|
sorter: makeNumericSorter('idCluster'),
|
||||||
}),
|
}),
|
||||||
makeColumn('Название', 'caption', {
|
makeColumn('Название', 'caption', {
|
||||||
width: 200,
|
width: '5rem',
|
||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeStringSorter('caption'),
|
sorter: makeStringSorter('caption'),
|
||||||
}),
|
}),
|
||||||
@ -97,16 +98,14 @@ export default function WellController() {
|
|||||||
editable: true,
|
editable: true,
|
||||||
sorter: makeNumericSorter('idWellType'),
|
sorter: makeNumericSorter('idWellType'),
|
||||||
}),
|
}),
|
||||||
makeColumn('Широта', 'latitude', { width: 150, editable: true }),
|
makeColumn('Широта', 'latitude', { width: 150, editable: true, render: coordsFixed }),
|
||||||
makeColumn('Долгота', 'longitude', { width: 150, editable: true }),
|
makeColumn('Долгота', 'longitude', { width: 150, editable: true, render: coordsFixed }),
|
||||||
makeColumn('Телеметрия', 'telemetry', {
|
makeColumn('Телеметрия', 'telemetry', {
|
||||||
width: 150,
|
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
render: (telemetry) => <TelemetryView telemetry={telemetry} />,
|
||||||
input: <TelemetrySelect telemetry={telemetry}/>,
|
input: <TelemetrySelect telemetry={telemetry}/>,
|
||||||
}),
|
}),
|
||||||
makeTagColumn('Компании', 'companies', companies, 'id', 'caption', {
|
makeTagColumn('Компании', 'companies', companies, 'id', 'caption', {
|
||||||
width: 400,
|
|
||||||
editable: true,
|
editable: true,
|
||||||
render: (company) => <CompanyView company={company} />,
|
render: (company) => <CompanyView company={company} />,
|
||||||
}),
|
}),
|
||||||
|
@ -2,14 +2,16 @@
|
|||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { DatePicker } from 'antd'
|
import { DatePicker } from 'antd'
|
||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { TelemetryDataSaubService } from '../../services/api'
|
|
||||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
|
||||||
import { Flex } from '../../components/Grid'
|
import { Flex } from '../../components/Grid'
|
||||||
import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker'
|
|
||||||
import { ArchiveDisplay, cutData } from './ArchiveDisplay'
|
|
||||||
import { normalizeData } from '../TelemetryView'
|
|
||||||
import { makeDateSorter } from '../../components/Table'
|
import { makeDateSorter } from '../../components/Table'
|
||||||
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
|
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||||
|
import { PeriodPicker, defaultPeriod } from '../../components/PeriodPicker'
|
||||||
|
import { TelemetryDataSaubService } from '../../services/api'
|
||||||
|
|
||||||
|
import { normalizeData } from '../TelemetryView'
|
||||||
|
import { ArchiveDisplay, cutData } from './ArchiveDisplay'
|
||||||
|
|
||||||
const DATA_COUNT = 2048 // Колличество точек на подгрузку графика
|
const DATA_COUNT = 2048 // Колличество точек на подгрузку графика
|
||||||
const ADDITIVE_PAGES = 2 // Дополнительные данные для графиков
|
const ADDITIVE_PAGES = 2 // Дополнительные данные для графиков
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import { Rule } from 'rc-field-form/lib/interface'
|
import { Rule } from 'rc-field-form/lib/interface'
|
||||||
|
|
||||||
export const createLoginRules: Rule[] = [{
|
export const min3: Rule[] = [{
|
||||||
min: 3,
|
min: 3,
|
||||||
max: 255,
|
max: 255,
|
||||||
message: 'Допустимая длина 3-255 символов'
|
message: 'Допустимая длина 3-255 символов'
|
||||||
}, {
|
}]
|
||||||
|
|
||||||
|
export const createLoginRules: Rule[] = [...min3, {
|
||||||
pattern: /^[A-Za-zА-Яа-я][А-Яа-я\w.-]+$/,
|
pattern: /^[A-Za-zА-Яа-я][А-Яа-я\w.-]+$/,
|
||||||
whitespace: true,
|
whitespace: true,
|
||||||
message: 'Логин должен начинаться с русской или латинской буквы, содержать только (А-яA-z0-9_-.)!'
|
message: 'Логин должен начинаться с русской или латинской буквы, содержать только (А-яA-z0-9_-.)!'
|
||||||
|
Loading…
Reference in New Issue
Block a user