CF2-55: Fixed filters

This commit is contained in:
KharchenkoVV 2021-08-26 17:45:36 +05:00
parent ed4fe093e0
commit a4cd429737
3 changed files with 21 additions and 35 deletions

View File

@ -120,10 +120,10 @@ export const makeNumericColumn = (title: any, dataIndex: any, filters: any, widt
width: width width: width
}) })
export const makeNumericColumnPlanFact = (title: any, dataIndex: any, filters: any) => export const makeNumericColumnPlanFact = (title: any, dataIndex: any, filters: any, width: string) =>
makeGroupColumn( title, [ makeGroupColumn( title, [
makeNumericColumn('п', dataIndex + 'Plan', filters, ''), makeNumericColumn('п', dataIndex + 'Plan', filters, width),
makeNumericColumn('ф', dataIndex + 'Fact', filters, ''), makeNumericColumn('ф', dataIndex + 'Fact', filters, width),
]) ])
export const calcAndUpdateStats = (data: any, keys: any) => { export const calcAndUpdateStats = (data: any, keys: any) => {

View File

@ -16,24 +16,7 @@ const filtersMinMax = [
}, },
] ]
const filtersSectionsType = [ const filtersSectionsType = [ ]
{
text: "Направление",
value: "Направление",
},
{
text: "Кондуктор",
value: "Кондуктор",
},
{
text: "Транспорт. ствол",
value: "Транспорт. Ствол",
},
{
text: "Хвостовик",
value: "Хвостовик",
},
]
const ModalWindowButton = ({buttonIcon, buttonText, modalTitle, modalContent}) =>{ const ModalWindowButton = ({buttonIcon, buttonText, modalTitle, modalContent}) =>{
const [isModalVisible, setIsModalVisible] = useState(false) const [isModalVisible, setIsModalVisible] = useState(false)
@ -72,7 +55,7 @@ const columns = [
makeNumericColumnPlanFact('Спуск КНБК', 'sectionBhaDownSpeed', filtersMinMax),//Скорость спуска КНБК makeNumericColumnPlanFact('Спуск КНБК', 'sectionBhaDownSpeed', filtersMinMax),//Скорость спуска КНБК
makeNumericColumnPlanFact('Подъем КНБК', 'sectionBhaUpSpeed', filtersMinMax),//Скорость подъема КНБК makeNumericColumnPlanFact('Подъем КНБК', 'sectionBhaUpSpeed', filtersMinMax),//Скорость подъема КНБК
makeNumericColumnPlanFact('Скорость спуска ОК', 'sectionCasingDownSpeed', filtersMinMax), makeNumericColumnPlanFact('Скорость спуска ОК', 'sectionCasingDownSpeed', filtersMinMax),
makeNumericColumnPlanFact('НПВ, сут', 'notProductiveTime', filtersMinMax), makeNumericColumnPlanFact('НПВ, сут', 'nonProductiveTime', filtersMinMax, '70px'),
{ {
title: "TVD", title: "TVD",
render: (_, record) => <ModalWindowButton render: (_, record) => <ModalWindowButton
@ -117,18 +100,18 @@ export default function ClusterSections({clusterData}) {
"sectionBhaUpSpeedFact", "sectionBhaUpSpeedFact",
"sectionCasingDownSpeedPlan", "sectionCasingDownSpeedPlan",
"sectionCasingDownSpeedFact", "sectionCasingDownSpeedFact",
"notProductiveTimePlan", "nonProductiveTimePlan",
"notProductiveTimeFact" "nonProductiveTimeFact"
]) ])
useEffect(() => { useEffect(() => {
let resArr = [] let rows = []
let i = 1;
clusterData.statsWells?.forEach(el => { clusterData.statsWells?.forEach(el => {
el.sections.forEach(section => { el.sections.forEach(section => {
let row = { let row = {
key: section.id + i++, key: el.caption + section.id,
id: section.id + i++, id: el.caption + section.id,
caption: el.caption, caption: el.caption,
sectionType: section.caption, sectionType: section.caption,
sectionWellDepthPlan: section.plan.wellDepthEnd, sectionWellDepthPlan: section.plan.wellDepthEnd,
@ -147,16 +130,19 @@ export default function ClusterSections({clusterData}) {
sectionBhaUpSpeedFact: section.fact.bhaUpSpeed.toFixed(2), sectionBhaUpSpeedFact: section.fact.bhaUpSpeed.toFixed(2),
sectionCasingDownSpeedPlan: section.plan.casingDownSpeed.toFixed(2), sectionCasingDownSpeedPlan: section.plan.casingDownSpeed.toFixed(2),
sectionCasingDownSpeedFact: section.fact.casingDownSpeed.toFixed(2), sectionCasingDownSpeedFact: section.fact.casingDownSpeed.toFixed(2),
notProductiveTimePlan: section.plan.nonProductiveHours.toFixed(2), nonProductiveTimePlan: section.plan.nonProductiveHours.toFixed(2),
notProductiveTimeFact: section.fact.nonProductiveHours.toFixed(2), nonProductiveTimeFact: section.fact.nonProductiveHours.toFixed(2),
companies: el.companies companies: el.companies
} }
resArr.push(row) rows.push(row)
if(!filtersSectionsType.some(el => el.text === section.caption))
filtersSectionsType.push({text: section.caption, value: section.caption})
}) })
}) })
setWellsStat(resArr) setWellsStat(rows)
}, [id, clusterData]) }, [id, clusterData])

View File

@ -77,8 +77,8 @@ export default function ClusterWells({clusterData}) {
(_, item) => <Link to={`/well/${item.id}`}>{item.caption}</Link>), (_, item) => <Link to={`/well/${item.id}`}>{item.caption}</Link>),
makeTextColumn('Тип скв.', 'wellType', filtersWellsType), makeTextColumn('Тип скв.', 'wellType', filtersWellsType),
makeGroupColumn( 'Фактические сроки', [ makeGroupColumn( 'Фактические сроки', [
makeNumericColumn('начало', 'factStart', filtersMinMax), makeNumericColumn('начало', 'factStart'),
makeNumericColumn('окончание', 'factEnd', filtersMinMax), makeNumericColumn('окончание', 'factEnd'),
]), ]),
makeNumericColumnPlanFact('Продолжительность', 'period', filtersMinMax), makeNumericColumnPlanFact('Продолжительность', 'period', filtersMinMax),
makeNumericColumnPlanFact('МСП', 'rateOfPenetration', filtersMinMax), makeNumericColumnPlanFact('МСП', 'rateOfPenetration', filtersMinMax),