forked from ddrilling/asb_cloud_front
Добавлена кнопка оповещения ответственных по категориям на странице "Дело скважины"
This commit is contained in:
parent
7acb7ce2b2
commit
7731dfe8e7
@ -23,7 +23,7 @@ export const HistoryTable = memo(({ category }) => {
|
||||
async () => {
|
||||
const result = await WellFinalDocumentsService.getFilesHistoryByIdCategory(well.id, category.idCategory)
|
||||
if (!result) return
|
||||
const files = result.file
|
||||
const files = result.files
|
||||
files.sort((a, b) => moment(a.uploadDate) - moment(b.uploadDate))
|
||||
const fileSource = files.map((file) => ({
|
||||
file,
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { Alert, Button } from 'antd'
|
||||
import { NotificationOutlined } from '@ant-design/icons'
|
||||
import { Alert, Button, Popconfirm } from 'antd'
|
||||
|
||||
import { useWell } from '@asb/context'
|
||||
import { UserView } from '@components/views'
|
||||
@ -42,6 +43,17 @@ const WellCase = memo(() => {
|
||||
)
|
||||
}, [well])
|
||||
|
||||
const notifyPublisher = useCallback((category) => {
|
||||
invokeWebApiWrapperAsync(
|
||||
async () => {
|
||||
await fetch(`/api/WellFinalDocuments/${well.id}/reNotifyPublishers?idCategory=${category.idCategory}`)
|
||||
},
|
||||
setIsLoading,
|
||||
`Не удалось повторно оповестить ответственного по "${category.nameCategory}"`,
|
||||
{ actionName: `Повторное оповещение ответственного по "${category.nameCategory}"`, well },
|
||||
)
|
||||
}, [well])
|
||||
|
||||
const columns = useMemo(() => [
|
||||
makeTextColumn('Категория', 'nameCategory', undefined, undefined, undefined, { width: 300 }),
|
||||
makeColumn('Файл', 'file', {
|
||||
@ -49,6 +61,16 @@ const WellCase = memo(() => {
|
||||
<div className={'file-cell'}>
|
||||
{file ? <DownloadLink file={file} /> : <span style={{ marginLeft: 15 }}>Файл не загружен</span>}
|
||||
|
||||
<div style={{ display: 'flex', gap: 5 }}>
|
||||
{!file && canEdit && (
|
||||
<Popconfirm
|
||||
onConfirm={() => notifyPublisher(category)}
|
||||
title={'Повторно оповестить ответственного о необходимости подгрузки документа'}
|
||||
>
|
||||
<Button icon={<NotificationOutlined />}></Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
|
||||
{category.permissionToUpload && (
|
||||
<UploadForm
|
||||
url={`/api/WellFinalDocuments/${well.id}?idCategory=${category.idCategory}`}
|
||||
@ -58,6 +80,7 @@ const WellCase = memo(() => {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
width: 300,
|
||||
}),
|
||||
@ -66,7 +89,7 @@ const WellCase = memo(() => {
|
||||
render: (publishers) => publishers?.map((user, i) => <UserView key={`${i}`} user={user} style={{ marginLeft: 10 }} />),
|
||||
width: 200,
|
||||
}),
|
||||
], [well, updateTable])
|
||||
], [well, canEdit, updateTable])
|
||||
|
||||
const onEditClose = useCallback((changed = false) => {
|
||||
setShowEdit(false)
|
||||
|
Loading…
Reference in New Issue
Block a user