forked from ddrilling/asb_cloud_front
fix WellSectionsStat and WellOperationsEditor data mapping
This commit is contained in:
parent
f39e550ac7
commit
2a6a53a1ce
@ -31,7 +31,7 @@ export const WellOperationsEditor = ({idWell, idType}) => {
|
|||||||
async () => {
|
async () => {
|
||||||
const skip = ((pageNumAndPageSize.current - 1) * pageNumAndPageSize.pageSize) || 0
|
const skip = ((pageNumAndPageSize.current - 1) * pageNumAndPageSize.pageSize) || 0
|
||||||
const take = pageNumAndPageSize.pageSize
|
const take = pageNumAndPageSize.pageSize
|
||||||
const paginatedOperations = await WellOperationService.getOperations(idWell, idType, undefined, undefined, undefined, undefined, skip, take )
|
const paginatedOperations = await WellOperationService.getOperations(idWell, idType, undefined, undefined, undefined, undefined, undefined, undefined, skip, take )
|
||||||
const operations = paginatedOperations?.items ?? []
|
const operations = paginatedOperations?.items ?? []
|
||||||
setOperations(operations)
|
setOperations(operations)
|
||||||
const total = paginatedOperations.count?? paginatedOperations.items?.length ?? 0
|
const total = paginatedOperations.count?? paginatedOperations.items?.length ?? 0
|
||||||
|
@ -10,23 +10,51 @@ const columns = [
|
|||||||
makeColumn('Тип секции','sectionType'),
|
makeColumn('Тип секции','sectionType'),
|
||||||
makeColumnsPlanFact('Глубина' ,'wellDepth', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('Глубина' ,'wellDepth', {render:makeNumberRender(2)}),
|
||||||
makeColumnsPlanFact('Часы' ,'duration', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('Часы' ,'duration', {render:makeNumberRender(2)}),
|
||||||
makeColumnsPlanFact('МСП' ,'mechSpeed', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('МСП' ,'rop', {render:makeNumberRender(2)}),
|
||||||
makeColumnsPlanFact('Рейсовая скорость' ,'routeSpeed', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('Рейсовая скорость' ,'routeSpeed', {render:makeNumberRender(2)}),
|
||||||
makeColumnsPlanFact('Подъем КНБК' ,'bhaUpSpeed', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('Подъем КНБК' ,'bhaUpSpeed', {render:makeNumberRender(2)}),
|
||||||
makeColumnsPlanFact('Спуск КНБК' ,'bhaDownSpeed', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('Спуск КНБК' ,'bhaDownSpeed', {render:makeNumberRender(2)}),
|
||||||
makeColumnsPlanFact('Спуск ОК' ,'casingDownSpeed', {render:makeNumberRender(2)}),
|
makeColumnsPlanFact('Спуск ОК' ,'casingDownSpeed', {render:makeNumberRender(2)}),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const calcDuration = (start, end) => {
|
||||||
|
const msInDay = 1000*60*60*24
|
||||||
|
const startD = new Date(start)
|
||||||
|
const endD = new Date(end)
|
||||||
|
const ms = endD - startD
|
||||||
|
return ms / msInDay
|
||||||
|
}
|
||||||
|
|
||||||
export const WellSectionsStat = ({idWell}) => {
|
export const WellSectionsStat = ({idWell}) => {
|
||||||
const [sections, setSections] = useState([])
|
const [sections, setSections] = useState([])
|
||||||
const [showLoader, setShowLoader] = useState(false)
|
const [showLoader, setShowLoader] = useState(false)
|
||||||
|
|
||||||
useEffect(() => invokeWebApiWrapperAsync(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
const sectionsResponse = await WellOperationStatService.getSectionsByWellId(idWell)
|
const sectionsResponse = await WellOperationStatService.getStatWell(idWell)
|
||||||
|
|
||||||
if(sectionsResponse){
|
if(sectionsResponse?.sections){
|
||||||
const sections = sectionsResponse.sort((a,b)=>a.wellDepthPlan - b.wellDepthPlan)
|
const sections = sectionsResponse.sections
|
||||||
|
.map(s=>({
|
||||||
|
key: s.id,
|
||||||
|
sectionType: s.caption,
|
||||||
|
wellDepthPlan: s.plan?.wellDepthEnd,
|
||||||
|
durationPlan: calcDuration(s.plan?.start, s.plan?.end),
|
||||||
|
ropPlan: s.plan?.rop,
|
||||||
|
routeSpeedPlan: s.plan?.routeSpeed,
|
||||||
|
bhaUpSpeedPlan: s.plan?.bhaUpSpeed,
|
||||||
|
bhaDownSpeedPlan: s.plan?.bhaDownSpeed,
|
||||||
|
casingDownSpeedPlan: s.plan?.casingDownSpeed,
|
||||||
|
|
||||||
|
wellDepthFact : s.fact?.wellDepthEnd,
|
||||||
|
durationFact : calcDuration(s.fact?.start, s.fact?.end),
|
||||||
|
ropFact : s.fact?.rop,
|
||||||
|
routeSpeedFact : s.fact?.routeSpeed,
|
||||||
|
bhaUpSpeedFact : s.fact?.bhaUpSpeed,
|
||||||
|
bhaDownSpeedFact : s.fact?.bhaDownSpeed,
|
||||||
|
casingDownSpeedFact : s.fact?.casingDownSpeed,
|
||||||
|
}))
|
||||||
|
.sort((a,b) => a.wellDepthPlan - b.wellDepthPlan)
|
||||||
setSections(sections)
|
setSections(sections)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
export const dictionarySectionType = new Map([
|
export const dictionarySectionType = new Map([
|
||||||
[1, 'Обощенное по скважине'],
|
[1, 'Пилотный ствол'],
|
||||||
[2, 'Пилотный ствол'],
|
[2, 'Направление'],
|
||||||
[3, 'Направление'],
|
[3, 'Кондуктор'],
|
||||||
[4, 'Кондуктор'],
|
[4, 'Эксплуатационная колонна'],
|
||||||
[5, 'Эксплуатационная колонна'],
|
[5, 'Транспортный ствол'],
|
||||||
[6, 'Транспортный ствол'],
|
[6, 'Хвостовик'],
|
||||||
[7, 'Хвостовик'],
|
|
||||||
])
|
])
|
||||||
|
|
||||||
export const getByKeyOrReturnKey = (dictionary, key) => {
|
export const getByKeyOrReturnKey = (dictionary, key) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user