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