forked from ddrilling/asb_cloud_front
Отображение статуса добавлено
This commit is contained in:
parent
5c008043c5
commit
4937dddf87
@ -71,7 +71,8 @@ export default function ClusterWells({statsWells}) {
|
||||
notProductiveTimePlan: well.total?.plan?.nonProductiveHours,
|
||||
notProductiveTimeFact: well.total?.fact?.nonProductiveHours,
|
||||
companies: well.companies,
|
||||
lastTelemetryDate: well.lastTelemetryDate
|
||||
lastTelemetryDate: well.lastTelemetryDate,
|
||||
idState: well.idState
|
||||
}
|
||||
})
|
||||
|
||||
@ -97,7 +98,7 @@ export default function ClusterWells({statsWells}) {
|
||||
(_, item) => (
|
||||
<Link to={`/well/${item.id}`} style={{display: 'flex', alignItems: 'center'}}>
|
||||
<PointerIcon
|
||||
color={item.state === 'working' ? 'black' : 'gray'}
|
||||
color={item.idState === 1 ? 'black' : 'gray'}
|
||||
size={32}
|
||||
online={item.lastTelemetryDate && ((new Date()).getTime() - Date.parse(item.lastTelemetryDate)) / 1000 < ONLINE_DEADTIME}
|
||||
onlineColor={'currentColor'}
|
||||
|
@ -10,7 +10,7 @@ import { UserOfWell } from './UserOfWells'
|
||||
import LoaderPortal from '../../components/LoaderPortal'
|
||||
import { Grid, GridItem, Flex } from '../../components/Grid'
|
||||
import { Subscribe } from '../../services/signalr'
|
||||
import { TelemetryDataSaubService, TelemetryDataSpinService } from '../../services/api'
|
||||
import { TelemetryDataSaubService, TelemetryDataSpinService, WellService } from '../../services/api'
|
||||
import { invokeWebApiWrapperAsync } from '../../components/factory'
|
||||
|
||||
import MomentStabPicEnabled from '../../images/DempherOn.png'
|
||||
@ -259,6 +259,7 @@ export default function TelemetryView({ idWell }) {
|
||||
const [dataSaub, setDataSaub] = useState([])
|
||||
const [dataSpin, setDataSpin] = useState([])
|
||||
const [chartInterval, setChartInterval] = useState(defaultChartInterval)
|
||||
const [wellData, setWellData] = useState({idState: 0})
|
||||
const [showLoader, setShowLoader] = useState(false)
|
||||
|
||||
const options = timePeriodCollection.map((line) => <Option key={line.value}>{line.label}</Option>)
|
||||
@ -301,6 +302,27 @@ export default function TelemetryView({ idWell }) {
|
||||
}
|
||||
}, [idWell, chartInterval])
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const well = await WellService.get(idWell)
|
||||
setWellData(well ?? {})
|
||||
},
|
||||
setShowLoader,
|
||||
`Не удалось загрузить данные по скважине "${idWell}"`
|
||||
), [idWell])
|
||||
|
||||
const onStatusChanged = (value) => {
|
||||
invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
const well = {...wellData, idState: value}
|
||||
await WellService.updateWell(idWell, well)
|
||||
setWellData(well)
|
||||
},
|
||||
setShowLoader,
|
||||
`Не удалось задать состояние скважины "${idWell}"`
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<LoaderPortal show={showLoader}>
|
||||
<Grid style={{ gridTemplateColumns: 'auto repeat(6, 1fr)' }}>
|
||||
@ -313,6 +335,14 @@ export default function TelemetryView({ idWell }) {
|
||||
{options}
|
||||
</Select>
|
||||
</div>
|
||||
<div style={{ marginLeft: '1rem'}}>
|
||||
Статус:
|
||||
<Select value={wellData.idState} onChange={onStatusChanged}>
|
||||
<Option value={0} disabled>Неизвестно</Option>
|
||||
<Option value={1}>В работе</Option>
|
||||
<Option value={2}>Завершено</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<span style={{ flexGrow: 20 }}> </span>
|
||||
<img src={isTorqueStabEnabled(dataSpin) ? MomentStabPicEnabled : MomentStabPicDisabled} style={{ marginRight: '15px' }} alt={'TorqueMaster'} />
|
||||
<img src={isSpinEnabled(dataSpin) ? SpinPicEnabled : SpinPicDisabled} style={{ marginRight: '15px' }} alt={'SpinMaster'} />
|
||||
|
@ -10,6 +10,7 @@ export type StatWellDto = {
|
||||
id?: number;
|
||||
caption?: string | null;
|
||||
wellType?: string | null;
|
||||
idState?: number;
|
||||
state?: string | null;
|
||||
lastTelemetryDate?: string;
|
||||
sections?: Array<StatSectionDto> | null;
|
||||
|
@ -12,6 +12,7 @@ export type WellDto = {
|
||||
latitude?: number | null;
|
||||
longitude?: number | null;
|
||||
wellType?: string | null;
|
||||
idWellType?: number;
|
||||
idState?: number;
|
||||
lastTelemetryDate?: string;
|
||||
telemetry?: TelemetryDto;
|
||||
|
@ -44,6 +44,25 @@ export class WellService {
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает информацию о требуемой скважине
|
||||
* @param idWell Id требуемой скважины
|
||||
* @returns WellDto Success
|
||||
* @throws ApiError
|
||||
*/
|
||||
public static async get(
|
||||
idWell?: number,
|
||||
): Promise<WellDto> {
|
||||
const result = await __request({
|
||||
method: 'GET',
|
||||
path: `/api/well/getWell`,
|
||||
query: {
|
||||
'idWell': idWell,
|
||||
},
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Возвращает список скважин, передающих телеметрию в данный момент
|
||||
* @returns WellDto Success
|
||||
|
Loading…
Reference in New Issue
Block a user