From 7731dfe8e71716fdece4751925f3b3ea7b9cc676 Mon Sep 17 00:00:00 2001 From: goodmice Date: Mon, 28 Nov 2022 05:52:24 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=BE?= =?UTF-8?q?=D0=BF=D0=BE=D0=B2=D0=B5=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BE?= =?UTF-8?q?=D1=82=D0=B2=D0=B5=D1=82=D1=81=D1=82=D0=B2=D0=B5=D0=BD=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=BF=D0=BE=20=D0=BA=D0=B0=D1=82=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=8F=D0=BC=20=D0=BD=D0=B0=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D0=B5=20"=D0=94=D0=B5=D0=BB?= =?UTF-8?q?=D0=BE=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D1=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Well/WellCase/HistoryTable.jsx | 2 +- src/pages/Well/WellCase/index.jsx | 43 ++++++++++++++++++------ 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/src/pages/Well/WellCase/HistoryTable.jsx b/src/pages/Well/WellCase/HistoryTable.jsx index dd9ce30..8bbb56a 100644 --- a/src/pages/Well/WellCase/HistoryTable.jsx +++ b/src/pages/Well/WellCase/HistoryTable.jsx @@ -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, diff --git a/src/pages/Well/WellCase/index.jsx b/src/pages/Well/WellCase/index.jsx index 1eb9709..db08348 100644 --- a/src/pages/Well/WellCase/index.jsx +++ b/src/pages/Well/WellCase/index.jsx @@ -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,14 +61,25 @@ const WellCase = memo(() => {
{file ? : Файл не загружен} - {category.permissionToUpload && ( - setIsLoading(true)} - onUploadComplete={updateTable} - onUploadError={() => setIsLoading(false)} - /> - )} +
+ {!file && canEdit && ( + notifyPublisher(category)} + title={'Повторно оповестить ответственного о необходимости подгрузки документа'} + > + + + )} + + {category.permissionToUpload && ( + setIsLoading(true)} + onUploadComplete={updateTable} + onUploadError={() => setIsLoading(false)} + /> + )} +
), width: 300, @@ -66,7 +89,7 @@ const WellCase = memo(() => { render: (publishers) => publishers?.map((user, i) => ), width: 200, }), - ], [well, updateTable]) + ], [well, canEdit, updateTable]) const onEditClose = useCallback((changed = false) => { setShowEdit(false)