260623_02_ENH: 엑셀 다운로드를 포함한 1차 개발 완료
This commit is contained in:
@@ -16,6 +16,7 @@ import {useAssignUserCountsQuery} from "@/query/assign";
|
||||
import {
|
||||
useDeleteUserMutation,
|
||||
useDownloadUserExcelTemplateMutation,
|
||||
useExportUserMutation,
|
||||
useUpdateUserMutation,
|
||||
useUploadUsersExcelMutation,
|
||||
useUsersQuery,
|
||||
@@ -27,6 +28,7 @@ import {useDialog} from "@/hooks/useDialog";
|
||||
import {useMounted} from "@/hooks/useMounted";
|
||||
import {LoadingOverlay} from "@/components/common/LoadingOverlay";
|
||||
import {downloadExcelBuffer} from "@/lib/gwcf/file";
|
||||
import ExcelDownloadButton from "@/components/common/ExcelDownloadButton";
|
||||
|
||||
type UserTab = "monitoring" | "written";
|
||||
type UserFilters = {area: string[]; gender: string[]; genre: string[]; keyword: string};
|
||||
@@ -64,6 +66,7 @@ const UserPage = () => {
|
||||
const deleteMutation = useDeleteUserMutation();
|
||||
const uploadMutation = useUploadUsersExcelMutation(userRole);
|
||||
const templateMutation = useDownloadUserExcelTemplateMutation(userRole);
|
||||
const exportMutation = useExportUserMutation();
|
||||
|
||||
const assignCountMap = useMemo(() => new Map(assignCounts.map((item) => [item.assignUser, item.assignCount])), [assignCounts]);
|
||||
|
||||
@@ -131,6 +134,18 @@ const UserPage = () => {
|
||||
downloadExcelBuffer(buffer, tab === "monitoring" ? "모니터링 요원 template.xlsx" : "서면 평가위원 template.xlsx");
|
||||
};
|
||||
|
||||
const downloadUsers = async () => {
|
||||
const userIds = filteredData.map((user) => user.userId);
|
||||
|
||||
if (userIds.length === 0) {
|
||||
alert("다운로드할 사용자가 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const buffer = await exportMutation.mutateAsync({userRole, userIds});
|
||||
downloadExcelBuffer(buffer, tab === "monitoring" ? "모니터링 요원.xlsx" : "서면 평가위원.xlsx");
|
||||
};
|
||||
|
||||
const renderEditableCell = (user: UserFull, key: string, fallbackKeys: string[], type: "text" | "select" = "text", options: Code[] = []) => {
|
||||
const draft = draftRef.current;
|
||||
const isEditing = editingId === user.userId && draft;
|
||||
@@ -255,6 +270,7 @@ const UserPage = () => {
|
||||
<Upload className="h-4 w-4" />
|
||||
계정 등록
|
||||
</Button>
|
||||
<ExcelDownloadButton requestExcelExport={downloadUsers} />
|
||||
</div>
|
||||
<DataTable
|
||||
columns={columns}
|
||||
|
||||
Reference in New Issue
Block a user