From f9ddf172f5e75b899959b4a4206d70c0f3663b97 Mon Sep 17 00:00:00 2001 From: goodmice Date: Tue, 19 Apr 2022 19:09:05 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B0=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=81=D1=83=D1=82=D0=BE=D1=87=D0=BD=D1=8B?= =?UTF-8?q?=D1=85=20=D1=80=D0=B0=D0=BF=D0=BE=D1=80=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D0=B4=D0=B0=D1=82=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Reports/DailyReport/index.jsx | 27 ++++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/pages/Reports/DailyReport/index.jsx b/src/pages/Reports/DailyReport/index.jsx index 64241af..4c9dca5 100644 --- a/src/pages/Reports/DailyReport/index.jsx +++ b/src/pages/Reports/DailyReport/index.jsx @@ -1,10 +1,9 @@ import moment from 'moment' -import { Button } from 'antd' -import { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react' +import { Button, DatePicker } from 'antd' import { FileExcelOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons' +import { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react' import LoaderPortal from '@components/LoaderPortal' -import DateRangeWrapper from '@components/Table/DateRangeWrapper' import { Table, makeDateColumn, makeColumn } from '@components/Table' import { download, invokeWebApiWrapperAsync } from '@components/factory' import { DailyReportService } from '@api' @@ -16,7 +15,7 @@ import { IdWellContext } from '@pages/Well' export const DailyReport = memo(() => { const [data, setData] = useState([]) const [isLoading, setIsLoading] = useState(false) - const [searchDate, setSearchDate] = useState(null) + const [searchDate, setSearchDate] = useState([moment().subtract(1, 'week'), moment()]) const [selectedReport, setSelectedReport] = useState(null) const [isEditorVisible, setIsEditorVisible] = useState(false) @@ -42,9 +41,8 @@ export const DailyReport = memo(() => { type={'link'} icon={} onClick={async () => await download(`/api/well/${idWell}/DailyReport/${report.reportDate}/excel`)} - > - Скачать XLSX - + children={'Скачать XLSX'} + /> + children={'Редактировать'} + /> )}), ], [idWell]) const filteredData = useMemo(() => { if (!searchDate) return data - return data.filter((row) => moment(row.date).isBetween(...searchDate)) + return data.filter((row) => moment.utc(row.reportDate).local().isBetween(...searchDate)) }, [data, searchDate]) return ( @@ -71,7 +68,13 @@ export const DailyReport = memo(() => {
Диапозон дат отчёта
- + date.isAfter(moment())} + />