260728_01_ENH: 연구원 계정에 사업 삭제 기능 부여
This commit is contained in:
@@ -14,6 +14,7 @@ import {DataTable} from "@/components/data-table/DataTable";
|
||||
import {DataTableColumn} from "@/components/data-table/DataTable.type";
|
||||
import {useCodesQuery} from "@/query/code";
|
||||
import {
|
||||
useDeletePerformanceMutation,
|
||||
useDownloadAssignExcelTemplateMutation,
|
||||
useDownloadPerformanceExcelTemplateMutation,
|
||||
useExportPerformanceMutation,
|
||||
@@ -24,7 +25,13 @@ import {
|
||||
} from "@/query/performance";
|
||||
import {useUploadWrittenAssignExcelMutation} from "@/query/assign";
|
||||
import {useDownloadReviewOriginalByPerformanceMutation, useDownloadReviewOriginalMutation, useDownloadReviewPdfMutation} from "@/query/review";
|
||||
import {filterPerformance, getCodeLabel, isInternalRole, isWrittenReviewerRole} from "@/lib/gwcf/view";
|
||||
import {
|
||||
filterPerformance,
|
||||
getCodeLabel,
|
||||
isInternalRole,
|
||||
isResearcherRole,
|
||||
isWrittenReviewerRole
|
||||
} from "@/lib/gwcf/view";
|
||||
import {
|
||||
getMonitoringDisplayRow,
|
||||
getMonitoringDisplayStatus,
|
||||
@@ -114,12 +121,14 @@ const PerformancePage = () => {
|
||||
const userRole = auth.user?.userRole;
|
||||
const userId = auth.user?.userId;
|
||||
const canEdit = isInternalRole(userRole);
|
||||
const canDelete = isResearcherRole(userRole);
|
||||
const isWrittenReviewer = isWrittenReviewerRole(userRole);
|
||||
const {isDialogOpen, showDialog, hideDialog} = useDialog();
|
||||
|
||||
const {data: codes} = useCodesQuery();
|
||||
const {data = [], refetch: refetchPerformanceList} = usePerformanceListQuery();
|
||||
const updateMutation = useUpdatePerformanceMutation();
|
||||
const deleteMutation = useDeletePerformanceMutation();
|
||||
const performanceUploadMutation = useUploadPerformanceExcelMutation();
|
||||
const writtenAssignUploadMutation = useUploadWrittenAssignExcelMutation();
|
||||
const performanceTemplateMutation = useDownloadPerformanceExcelTemplateMutation();
|
||||
@@ -270,6 +279,14 @@ const PerformancePage = () => {
|
||||
showDialog("performanceDetailDialog");
|
||||
};
|
||||
|
||||
const deletePerformance = async (performanceId: number) => {
|
||||
if (!performanceId) return;
|
||||
await deleteMutation.mutateAsync(performanceId);
|
||||
alert("삭제되었습니다.");
|
||||
|
||||
window.location.replace("/performance");
|
||||
};
|
||||
|
||||
const downloadReviewPdf = async (performanceId: number, review?: PerformanceReview) => {
|
||||
if (!review || !isReviewComplete(review)) return;
|
||||
if (!review.regUser) return;
|
||||
@@ -630,7 +647,9 @@ const PerformancePage = () => {
|
||||
performance={detailData ?? data.find((item) => item.id === selectedId) ?? null}
|
||||
codes={codes}
|
||||
canEdit={canEdit}
|
||||
canDelete={canDelete}
|
||||
onSave={(draft) => updateMutation.mutate(draft)}
|
||||
onDelete={deletePerformance}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user