260623_02_ENH: 엑셀 다운로드를 포함한 1차 개발 완료
This commit is contained in:
@@ -16,6 +16,7 @@ import {useCodesQuery} from "@/query/code";
|
||||
import {
|
||||
useDownloadAssignExcelTemplateMutation,
|
||||
useDownloadPerformanceExcelTemplateMutation,
|
||||
useExportPerformanceMutation,
|
||||
usePerformanceDetailQuery,
|
||||
usePerformanceListQuery,
|
||||
useUpdatePerformanceMutation,
|
||||
@@ -50,6 +51,7 @@ import {
|
||||
getReviewPdfDownloadName,
|
||||
openWrittenReviewWindow,
|
||||
} from "@/lib/gwcf/file";
|
||||
import ExcelDownloadButton from "@/components/common/ExcelDownloadButton";
|
||||
|
||||
type PerformanceFilters = {
|
||||
businessType: string[];
|
||||
@@ -88,6 +90,7 @@ const PerformancePage = () => {
|
||||
const writtenAssignUploadMutation = useUploadWrittenAssignExcelMutation();
|
||||
const performanceTemplateMutation = useDownloadPerformanceExcelTemplateMutation();
|
||||
const writtenAssignTemplateMutation = useDownloadAssignExcelTemplateMutation();
|
||||
const exportMutation = useExportPerformanceMutation();
|
||||
const reviewPdfMutation = useDownloadReviewPdfMutation();
|
||||
const reviewOriginalMutation = useDownloadReviewOriginalMutation();
|
||||
|
||||
@@ -372,6 +375,18 @@ const PerformancePage = () => {
|
||||
downloadExcelBuffer(buffer, "서면 평가 배정 template.xlsx");
|
||||
};
|
||||
|
||||
const downloadPerformance = async () => {
|
||||
const performanceIds = filteredData.map((performance) => performance.id);
|
||||
|
||||
if (performanceIds.length === 0) {
|
||||
alert("다운로드할 사업 정보가 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const buffer = await exportMutation.mutateAsync({performanceIds});
|
||||
downloadExcelBuffer(buffer, "사업 정보.xlsx");
|
||||
};
|
||||
|
||||
if(!mounted) return <LoadingOverlay force={true} />
|
||||
|
||||
return (
|
||||
@@ -402,17 +417,23 @@ const PerformancePage = () => {
|
||||
</PagePanel>
|
||||
|
||||
<PagePanel>
|
||||
{canEdit && (
|
||||
{!isWrittenReviewer && (
|
||||
<div className="mb-3 flex justify-end gap-2">
|
||||
<Button type="button" onClick={() => showDialog("performanceExcelRegisterDialog")}>
|
||||
<Upload className="h-4 w-4" />
|
||||
사업 등록
|
||||
</Button>
|
||||
<Button type="button" variant="outline" onClick={() => showDialog("assignWrittenExcelDialog")}>
|
||||
서면 평가 배정
|
||||
</Button>
|
||||
{canEdit && (
|
||||
<>
|
||||
<Button type="button" onClick={() => showDialog("performanceExcelRegisterDialog")}>
|
||||
<Upload className="h-4 w-4" />
|
||||
사업 등록
|
||||
</Button>
|
||||
<Button type="button" variant="outline" onClick={() => showDialog("assignWrittenExcelDialog")}>
|
||||
서면 평가 배정
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
<ExcelDownloadButton requestExcelExport={downloadPerformance} />
|
||||
</div>
|
||||
)}
|
||||
|
||||
<DataTable
|
||||
columns={columns}
|
||||
data={filteredData}
|
||||
|
||||
Reference in New Issue
Block a user