forked from ddrilling/asb_cloud_front
CF2-90 Реализовать во вкладке программа бурения информационное сообщение о дате, времени и ФИО последнего дабавленного изменения
This commit is contained in:
parent
497d106a9d
commit
421143a77c
@ -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}
|
||||
|
@ -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>
|
||||
"{lastUpdatedFile.name}"
|
||||
[{formatBytes(lastUpdatedFile.size)}]
|
||||
загружен: {new Date(lastUpdatedFile.uploadDate).toLocaleString()}
|
||||
автор: <UserView user={lastUpdatedFile.author}/>
|
||||
</Text>
|
||||
|
||||
return(<LoaderPortal show={showLoader}>
|
||||
<DocumentsTemplate
|
||||
beforeTable={lastUpdatedFileView}
|
||||
idWell={idWell}
|
||||
idCategory={idFileCategoryDrillingProgramItems}
|
||||
accept='.xlsx'
|
||||
|
Loading…
Reference in New Issue
Block a user