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 { RangePicker } = DatePicker
|
||||||
const { Search } = Input
|
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 [page, setPage] = useState(1)
|
||||||
const [filterDataRange, setFilterDataRange] = useState([])
|
const [filterDataRange, setFilterDataRange] = useState([])
|
||||||
const [filterCompanyName, setFilterCompanyName] = useState([])
|
const [filterCompanyName, setFilterCompanyName] = useState([])
|
||||||
@ -175,7 +175,7 @@ export default function DocumentsTemplate({ idCategory, idWell, accept, headerCh
|
|||||||
|
|
||||||
{headerChild}
|
{headerChild}
|
||||||
</div>
|
</div>
|
||||||
|
{beforeTable}
|
||||||
<EditableTable
|
<EditableTable
|
||||||
columns={columns}
|
columns={columns}
|
||||||
dataSource={files}
|
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 { FileExcelOutlined } from '@ant-design/icons'
|
||||||
import { useEffect, useState } from "react"
|
import { useEffect, useState } from "react"
|
||||||
import {invokeWebApiWrapperAsync, download} from '../../components/factory'
|
import {invokeWebApiWrapperAsync, download, formatBytes} from '../../components/factory'
|
||||||
import DocumentsTemplate from './DocumentsTemplate'
|
import DocumentsTemplate from './DocumentsTemplate'
|
||||||
import LoaderPortal from '../../components/LoaderPortal'
|
import LoaderPortal from '../../components/LoaderPortal'
|
||||||
import { Flex } from '../../components/Grid'
|
import { Flex } from '../../components/Grid'
|
||||||
import {DrillingProgramService, WellService} from '../../services/api'
|
import {DrillingProgramService, WellService} from '../../services/api'
|
||||||
import {Mark} from '../../components/Mark'
|
import {Mark} from '../../components/Mark'
|
||||||
|
import {UserView} from '../../components/UserView'
|
||||||
|
|
||||||
const idFileCategoryDrillingProgramItems = 13;
|
const idFileCategoryDrillingProgramItems = 13;
|
||||||
|
const {Text} = Typography
|
||||||
|
|
||||||
export default function DrillingProgram({idWell}) {
|
export default function DrillingProgram({idWell}) {
|
||||||
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
|
const [downloadButtonEnabled, selDownloadButtonEnabled] = useState(false)
|
||||||
@ -16,6 +18,7 @@ export default function DrillingProgram({idWell}) {
|
|||||||
const [tooltip, setTooltip] = useState('нет файлов для формирования')
|
const [tooltip, setTooltip] = useState('нет файлов для формирования')
|
||||||
const [wellLabel, setWellLabel] = useState(`${idWell}`)
|
const [wellLabel, setWellLabel] = useState(`${idWell}`)
|
||||||
const [childKey, setChildKey] = useState();
|
const [childKey, setChildKey] = useState();
|
||||||
|
const [lastUpdatedFile, setLastUpdatedFile] = useState();
|
||||||
|
|
||||||
useEffect(() => invokeWebApiWrapperAsync(
|
useEffect(() => invokeWebApiWrapperAsync(
|
||||||
async () => {
|
async () => {
|
||||||
@ -61,6 +64,8 @@ export default function DrillingProgram({idWell}) {
|
|||||||
else{
|
else{
|
||||||
setTooltip('Список файлов содержит недопустимые типы файлов')
|
setTooltip('Список файлов содержит недопустимые типы файлов')
|
||||||
}
|
}
|
||||||
|
const last = files.reduce((pre, cur) => pre.uploadDate > cur.uploadDate ? pre : cur)
|
||||||
|
setLastUpdatedFile(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
const customColumns = [
|
const customColumns = [
|
||||||
@ -125,8 +130,18 @@ export default function DrillingProgram({idWell}) {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</div>
|
</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}>
|
return(<LoaderPortal show={showLoader}>
|
||||||
<DocumentsTemplate
|
<DocumentsTemplate
|
||||||
|
beforeTable={lastUpdatedFileView}
|
||||||
idWell={idWell}
|
idWell={idWell}
|
||||||
idCategory={idFileCategoryDrillingProgramItems}
|
idCategory={idFileCategoryDrillingProgramItems}
|
||||||
accept='.xlsx'
|
accept='.xlsx'
|
||||||
|
Loading…
Reference in New Issue
Block a user