CF2-90 Реализовать во вкладке программа бурения информационное сообщение о дате, времени и ФИО последнего дабавленного изменения

This commit is contained in:
Фролов 2021-11-11 12:22:21 +05:00
parent 497d106a9d
commit 421143a77c
2 changed files with 19 additions and 4 deletions

View File

@ -17,7 +17,7 @@ const pageSize = 12
const { RangePicker } = DatePicker
const { Search } = Input
export default function DocumentsTemplate({ idCategory, idWell, accept, headerChild, customColumns, onChange}) {
export default function DocumentsTemplate({ idCategory, idWell, accept, headerChild, customColumns, beforeTable, onChange}) {
const [page, setPage] = useState(1)
const [filterDataRange, setFilterDataRange] = useState([])
const [filterCompanyName, setFilterCompanyName] = useState([])
@ -175,7 +175,7 @@ export default function DocumentsTemplate({ idCategory, idWell, accept, headerCh
  
{headerChild}
</div>
{beforeTable}
<EditableTable
columns={columns}
dataSource={files}

View File

@ -1,14 +1,16 @@
import {Popconfirm, Button, Tooltip} from 'antd'
import {Popconfirm, Button, Tooltip, Typography} from 'antd'
import { FileExcelOutlined } from '@ant-design/icons'
import { useEffect, useState } from "react"
import {invokeWebApiWrapperAsync, download} from '../../components/factory'
import {invokeWebApiWrapperAsync, download, formatBytes} from '../../components/factory'
import DocumentsTemplate from './DocumentsTemplate'
import LoaderPortal from '../../components/LoaderPortal'
import { Flex } from '../../components/Grid'
import {DrillingProgramService, WellService} from '../../services/api'
import {Mark} from '../../components/Mark'
import {UserView} from '../../components/UserView'
const idFileCategoryDrillingProgramItems = 13;
const {Text} = Typography
export default function DrillingProgram({idWell}) {
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
@ -16,6 +18,7 @@ export default function DrillingProgram({idWell}) {
const [tooltip, setTooltip] = useState('нет файлов для формирования')
const [wellLabel, setWellLabel] = useState(`${idWell}`)
const [childKey, setChildKey] = useState();
const [lastUpdatedFile, setLastUpdatedFile] = useState();
useEffect(() => invokeWebApiWrapperAsync(
async () => {
@ -61,6 +64,8 @@ export default function DrillingProgram({idWell}) {
else{
setTooltip('Список файлов содержит недопустимые типы файлов')
}
const last = files.reduce((pre, cur) => pre.uploadDate > cur.uploadDate ? pre : cur)
setLastUpdatedFile(last);
}
const customColumns = [
@ -125,8 +130,18 @@ export default function DrillingProgram({idWell}) {
</Flex>
</div>
const lastUpdatedFileView = lastUpdatedFile &&
<Text type="secondary">
<b>Последнее изменние:</b>
&nbsp;"{lastUpdatedFile.name}"
&nbsp;[{formatBytes(lastUpdatedFile.size)}]
&nbsp;загружен: {new Date(lastUpdatedFile.uploadDate).toLocaleString()}
&nbsp;автор: <UserView user={lastUpdatedFile.author}/>
</Text>
return(<LoaderPortal show={showLoader}>
<DocumentsTemplate
beforeTable={lastUpdatedFileView}
idWell={idWell}
idCategory={idFileCategoryDrillingProgramItems}
accept='.xlsx'