forked from ddrilling/asb_cloud_front
Косметические изменения и удаление лишнего кода
This commit is contained in:
parent
9e8648d33e
commit
dd2315d53e
@ -1,9 +0,0 @@
|
||||
# Вопрос Олегу: Какой бит и в каком регистре (или значение регистра) контроллера спинмастера сигнализирует что система спинмастер активана/работает?
|
||||
Ответ: Такого бита нет, но можно понять если etap %MW1600: INT; не равен 6 и не равен 0 тогда система в работе
|
||||
|
||||
# Вопрос Олегу: Какой бит и в каком регистре (или значение регистра) контроллера спинмастера сигнализирует что система стабилизации крутящего момента активна/работает?
|
||||
Ответ: Такого бита по сути тоже нет но можно понять что
|
||||
когда stik_sleep %MX2802.01: BOOL; =true
|
||||
и
|
||||
etap %MW1600: INT; =7
|
||||
тогда торк мастер работает
|
40
src/components/Display.jsx → src/components/Display.tsx
Executable file → Normal file
40
src/components/Display.jsx → src/components/Display.tsx
Executable file → Normal file
@ -1,19 +1,33 @@
|
||||
import moment from 'moment'
|
||||
import { useState, useEffect, memo } from 'react'
|
||||
import { useState, useEffect, memo, ReactNode } from 'react'
|
||||
import {CaretUpOutlined, CaretDownOutlined, CaretRightOutlined} from '@ant-design/icons'
|
||||
|
||||
import '@styles/display.css'
|
||||
|
||||
export const formatNumber = (value, format) =>
|
||||
export const formatNumber = (value?: unknown, format?: number) =>
|
||||
Number.isInteger(format) && Number.isFinite(value)
|
||||
? (+value).toFixed(format)
|
||||
: (+value).toPrecision(4)
|
||||
? Number(value).toFixed(format)
|
||||
: Number(value).toPrecision(4)
|
||||
|
||||
const iconStyle = { color:'#0008' }
|
||||
const displayValueStyle = { display: 'flex', flexGrow: 1 }
|
||||
|
||||
export const ValueDisplay = ({ prefix, value, suffix, isArrowVisible, format, enumeration }) => {
|
||||
const [val, setVal] = useState('---')
|
||||
export type ValueDisplayProps = {
|
||||
prefix?: ReactNode
|
||||
suffix?: ReactNode
|
||||
format?: number | string
|
||||
isArrowVisible?: boolean
|
||||
enumeration?: Record<string, string>
|
||||
value: string
|
||||
}
|
||||
|
||||
export type DisplayProps = ValueDisplayProps & {
|
||||
className?: string
|
||||
label?: ReactNode
|
||||
}
|
||||
|
||||
export const ValueDisplay = memo<ValueDisplayProps>(({ prefix, value, suffix, isArrowVisible, format, enumeration }) => {
|
||||
const [val, setVal] = useState<string>('---')
|
||||
const [arrowState, setArrowState] = useState({
|
||||
preVal: NaN,
|
||||
preTimestamp: Date.now(),
|
||||
@ -28,25 +42,25 @@ export const ValueDisplay = ({ prefix, value, suffix, isArrowVisible, format, en
|
||||
if (Number.isFinite(+value)) {
|
||||
if (isArrowVisible && (arrowState.preTimestamp + 1000 < Date.now())) {
|
||||
let direction = 0
|
||||
if (value > arrowState.preVal)
|
||||
if (+value > arrowState.preVal)
|
||||
direction = 1
|
||||
if (value < arrowState.preVal)
|
||||
if (+value < arrowState.preVal)
|
||||
direction = -1
|
||||
|
||||
setArrowState({
|
||||
preVal: value,
|
||||
preVal: +value,
|
||||
preTimestamp: Date.now(),
|
||||
direction: direction,
|
||||
})
|
||||
}
|
||||
|
||||
return formatNumber(value, format)
|
||||
return formatNumber(value, Number(format))
|
||||
}
|
||||
|
||||
if (value.length > 4) {
|
||||
const valueDate = moment(value)
|
||||
if (valueDate.isValid())
|
||||
return valueDate.format(format)
|
||||
return valueDate.format(String(format))
|
||||
}
|
||||
|
||||
return value
|
||||
@ -74,9 +88,9 @@ export const ValueDisplay = ({ prefix, value, suffix, isArrowVisible, format, en
|
||||
{prefix} {val} {suffix}{arrow}
|
||||
</span>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
export const Display = memo(({ className, label, ...other })=> (
|
||||
export const Display = memo<DisplayProps>(({ className, label, ...other })=> (
|
||||
<div className={className}>
|
||||
<div className={'display_label'}>{label}</div>
|
||||
<div style={displayValueStyle}>
|
4
src/components/ErrorFetch.js → src/components/ErrorFetch.ts
Executable file → Normal file
4
src/components/ErrorFetch.js → src/components/ErrorFetch.ts
Executable file → Normal file
@ -1,5 +1,7 @@
|
||||
export class ErrorFetch extends Error {
|
||||
constructor(status, message) {
|
||||
public status: number
|
||||
|
||||
constructor(status: number, message?: string) {
|
||||
super(message)
|
||||
this.name = 'ErrorFetch'
|
||||
this.status = status
|
21
src/components/UploadForm.jsx → src/components/UploadForm.tsx
Executable file → Normal file
21
src/components/UploadForm.jsx → src/components/UploadForm.tsx
Executable file → Normal file
@ -1,22 +1,35 @@
|
||||
import { memo, useCallback, useState } from 'react'
|
||||
import { Upload, Button } from 'antd'
|
||||
import { UploadOutlined } from '@ant-design/icons'
|
||||
import { UploadFile } from 'antd/lib/upload/interface'
|
||||
|
||||
import { upload } from './factory'
|
||||
import { ErrorFetch } from './ErrorFetch'
|
||||
|
||||
export const UploadForm = memo(({ url, disabled, accept, style, formData, onUploadStart, onUploadSuccess, onUploadComplete, onUploadError }) => {
|
||||
const [fileList, setfileList] = useState([])
|
||||
export type UploadFormProps = {
|
||||
url: string
|
||||
disabled?: boolean
|
||||
accept?: string
|
||||
style?: CSSStyleSheet
|
||||
formData: FormData
|
||||
onUploadStart?: () => void
|
||||
onUploadSuccess?: () => void
|
||||
onUploadComplete?: () => void
|
||||
onUploadError?: (error: unknown) => void
|
||||
}
|
||||
|
||||
export const UploadForm = memo<UploadFormProps>(({ url, disabled, accept, style, formData, onUploadStart, onUploadSuccess, onUploadComplete, onUploadError }) => {
|
||||
const [fileList, setfileList] = useState<UploadFile<any>[]>([])
|
||||
|
||||
const handleFileSend = useCallback(async () => {
|
||||
onUploadStart?.()
|
||||
try {
|
||||
const formDataLocal = new FormData()
|
||||
fileList.forEach((val) => formDataLocal.append('files', val.originFileObj))
|
||||
fileList.forEach((val) => formDataLocal.append('files', String(val.originFileObj)))
|
||||
|
||||
if(formData)
|
||||
for(const propName in formData)
|
||||
formDataLocal.append(propName, formData[propName])
|
||||
formDataLocal.append(propName, String(formData.get(propName)))
|
||||
|
||||
const response = await upload(url, formDataLocal)
|
||||
if (!response.ok) {
|
@ -1,5 +0,0 @@
|
||||
import {createContext} from 'react'
|
||||
|
||||
const Context = createContext()
|
||||
|
||||
export default Context
|
@ -19,7 +19,6 @@ import Documents from './Documents'
|
||||
import Telemetry from './Telemetry'
|
||||
import WellOperations from './WellOperations'
|
||||
import DrillingProgram from './DrillingProgram'
|
||||
import TelemetryAnalysis from './TelemetryAnalysis'
|
||||
|
||||
import '@styles/index.css'
|
||||
|
||||
@ -38,7 +37,6 @@ export const Well = memo(() => {
|
||||
<PrivateMenu.Link key={'report'} icon={<FilePdfOutlined />} title={'Рапорт'} />
|
||||
<PrivateMenu.Link key={'analytics'} icon={<DeploymentUnitOutlined />} title={'Аналитика'} />
|
||||
<PrivateMenu.Link key={'operations'} icon={<FolderOutlined />} title={'Операции по скважине'} />
|
||||
{/* <PrivateMenu.Link key={'telemetryAnalysis'} icon={<FundProjectionScreenOutlined />} title={'Операции по телеметрии'} /> */}
|
||||
<PrivateMenu.Link key={'document'} icon={<FolderOutlined />} title={'Документы'} />
|
||||
<PrivateMenu.Link key={'measure'} icon={<ExperimentOutlined />} title={'Измерения'} />
|
||||
<PrivateMenu.Link key={'drillingProgram'} icon={<FolderOutlined />} title={'Программа бурения'} />
|
||||
@ -52,7 +50,6 @@ export const Well = memo(() => {
|
||||
<Report key={'report'} />
|
||||
<Analytics key={'analytics/:tab?'} />
|
||||
<WellOperations key={'operations/:tab?'} />
|
||||
<TelemetryAnalysis key={'telemetryAnalysis/:tab?'} />
|
||||
<Documents key={'document/:category?'} />
|
||||
<Measure key={'measure'} />
|
||||
<DrillingProgram key={'drillingProgram'} />
|
||||
|
Loading…
Reference in New Issue
Block a user