forked from ddrilling/asb_cloud_front
fix report filter
This commit is contained in:
parent
8d46df8294
commit
4d8a62c072
@ -84,8 +84,8 @@ export default function Report({ idWell }) {
|
||||
]
|
||||
|
||||
const handleReportCreation = async (values) => {
|
||||
let begin = aviableDateRange[0].toISOString()
|
||||
let end = aviableDateRange[1].toISOString()
|
||||
let begin = filterDateRange[0].toISOString()
|
||||
let end = filterDateRange[1].toISOString()
|
||||
|
||||
try {
|
||||
const idUser = localStorage["userId"]
|
||||
@ -126,8 +126,8 @@ export default function Report({ idWell }) {
|
||||
} catch (error) {
|
||||
notify(
|
||||
`Не удалось создать отчет по скважине (${idWell}) c
|
||||
${aviableDateRange[0].format("DD.MM.YYYY hh:mm:ss")} по
|
||||
${aviableDateRange[1].format("DD.MM.YYYY hh:mm:ss")}`,
|
||||
${filterDateRange[0].format("DD.MM.YYYY hh:mm:ss")} по
|
||||
${filterDateRange[1].format("DD.MM.YYYY hh:mm:ss")}`,
|
||||
"error"
|
||||
)
|
||||
console.log(error)
|
||||
@ -159,12 +159,22 @@ export default function Report({ idWell }) {
|
||||
moment(aviableDatesRange.from),
|
||||
moment(aviableDatesRange.to)
|
||||
]
|
||||
|
||||
let from = moment(aviableDatesRange.to)
|
||||
from = from.subtract(1, "days")
|
||||
if (from < datesRange[0])
|
||||
from = datesRange[0]
|
||||
|
||||
const filterDateDefaults = [from, moment(aviableDatesRange.to)]
|
||||
setFilterDateRange(filterDateDefaults)
|
||||
setAviableDateRange(datesRange)
|
||||
}
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(async() => {
|
||||
const aviableDatesRange = await ReportService.getReportsDateRange(idWell)
|
||||
updateAviableDatesRange(aviableDatesRange)
|
||||
updateAviableDatesRange(aviableDatesRange)
|
||||
const suitableReports = await ReportService.getSuitableReportsNames(idWell, 4294967295, 3, '0001-01-01T00:00:00.000Z', '9999-01-01T00:00:00.000Z')
|
||||
updateSuitableReports(suitableReports)
|
||||
}), [idWell])
|
||||
|
||||
useEffect(() => invokeWebApiWrapperAsync(async() => {
|
||||
@ -174,8 +184,6 @@ export default function Report({ idWell }) {
|
||||
const end = filterDateRange[1].toISOString()
|
||||
const pagesCount = await ReportService.getReportSize(idWell, step, format, begin, end)
|
||||
setPagesCount(pagesCount)
|
||||
const suitableReports = await ReportService.getSuitableReportsNames(idWell, step, format, begin, end)
|
||||
updateSuitableReports(suitableReports)
|
||||
},
|
||||
setShowLoader,
|
||||
`Не удалось получить предварительные параметры отчета c
|
||||
@ -204,6 +212,7 @@ export default function Report({ idWell }) {
|
||||
onCalendarChange={(dates) => {
|
||||
setFilterDateRange(dates)
|
||||
}}
|
||||
value = {filterDateRange}
|
||||
showTime
|
||||
/>
|
||||
</Form.Item>
|
||||
|
Loading…
Reference in New Issue
Block a user