오류수정, 암호화 추가

This commit is contained in:
2025-06-09 22:45:55 +09:00
parent 912e6e1033
commit 7e1bbcede0
6 changed files with 248 additions and 36 deletions
+104
View File
@@ -34,6 +34,7 @@
"vue-chartjs": "^5.3.2",
"vue-router": "^4.5.0",
"vuedraggable": "^4.1.0",
"xlsx": "^0.18.5",
"yup": "^1.3.3"
},
"devDependencies": {
@@ -1828,6 +1829,15 @@
}
}
},
"node_modules/adler-32": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/adler-32/-/adler-32-1.3.1.tgz",
"integrity": "sha512-ynZ4w/nUUv5rrsR8UUGoe1VC9hZj6V5hU9Qw1HlMDJGEJw5S7TfTErWTjMys6M7vr0YWcPqs3qAr4ss0nDfP+A==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@@ -1937,6 +1947,19 @@
],
"license": "CC-BY-4.0"
},
"node_modules/cfb": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/cfb/-/cfb-1.2.2.tgz",
"integrity": "sha512-KfdUZsSOw19/ObEWasvBP/Ac4reZvAGauZhs6S/gqNhXhI7cKwvlH7ulj+dOEYnca4bm4SGo8C1bTAQvnTjgQA==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"crc-32": "~1.2.0"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/chart.js": {
"version": "4.4.9",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.9.tgz",
@@ -1949,6 +1972,15 @@
"pnpm": ">=8"
}
},
"node_modules/codepage": {
"version": "1.15.0",
"resolved": "https://registry.npmjs.org/codepage/-/codepage-1.15.0.tgz",
"integrity": "sha512-3g6NUTPd/YtuuGrhMnOMRjFc+LJw/bnMp3+0r/Wcz3IXUuCosKRJvMphm5+Q+bvTVGcJJuRvVLuYba+WojaFaA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
@@ -1983,6 +2015,18 @@
"url": "https://github.com/sponsors/mesqueeb"
}
},
"node_modules/crc-32": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz",
"integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==",
"license": "Apache-2.0",
"bin": {
"crc32": "bin/crc32.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
@@ -2339,6 +2383,15 @@
"node": ">= 6"
}
},
"node_modules/frac": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/frac/-/frac-1.1.2.tgz",
"integrity": "sha512-w/XBfkibaTl3YDqASwfDUqkna4Z2p9cFSr1aHDt0WoMTECnRfBOv2WArlZILlqgWlmdIlALXGpM2AOhEk5W3IA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/fs-extra": {
"version": "11.3.0",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.0.tgz",
@@ -3201,6 +3254,18 @@
"node": ">=0.10.0"
}
},
"node_modules/ssf": {
"version": "0.11.2",
"resolved": "https://registry.npmjs.org/ssf/-/ssf-0.11.2.tgz",
"integrity": "sha512-+idbmIXoYET47hH+d7dfm2epdOMUDjqcB4648sTZ+t2JwoyBFL/insLfB/racrDmsKB3diwsDA696pZMieAC5g==",
"license": "Apache-2.0",
"dependencies": {
"frac": "~1.1.2"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/strip-final-newline": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-4.0.0.tgz",
@@ -3616,6 +3681,24 @@
"node": ">= 8"
}
},
"node_modules/wmf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wmf/-/wmf-1.0.2.tgz",
"integrity": "sha512-/p9K7bEh0Dj6WbXg4JG0xvLQmIadrner1bi45VMJTfnbVHsc7yIajZyoSoK60/dtVBs12Fm6WkUI5/3WAVsNMw==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/word": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/word/-/word-0.3.0.tgz",
"integrity": "sha512-OELeY0Q61OXpdUfTp+oweA/vtLVg5VDOXh+3he3PNzLGG/y0oylSOC1xRVj0+l4vQ3tj/bB1HVHv1ocXkQceFA==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.8"
}
},
"node_modules/ws": {
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
@@ -3637,6 +3720,27 @@
}
}
},
"node_modules/xlsx": {
"version": "0.18.5",
"resolved": "https://registry.npmjs.org/xlsx/-/xlsx-0.18.5.tgz",
"integrity": "sha512-dmg3LCjBPHZnQp5/F/+nnTa+miPJxUXB6vtk42YjBBKayDNagxGEeIdWApkYPOf3Z3pm3k62Knjzp7lMeTEtFQ==",
"license": "Apache-2.0",
"dependencies": {
"adler-32": "~1.3.0",
"cfb": "~1.2.1",
"codepage": "~1.15.0",
"crc-32": "~1.2.1",
"ssf": "~0.11.2",
"wmf": "~1.0.1",
"word": "~0.3.0"
},
"bin": {
"xlsx": "bin/xlsx.njs"
},
"engines": {
"node": ">=0.8"
}
},
"node_modules/xmlhttprequest-ssl": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.1.2.tgz",
+1
View File
@@ -36,6 +36,7 @@
"vue-chartjs": "^5.3.2",
"vue-router": "^4.5.0",
"vuedraggable": "^4.1.0",
"xlsx": "^0.18.5",
"yup": "^1.3.3"
},
"devDependencies": {
@@ -28,6 +28,7 @@
<div class="file-upload-wrapper">
<FileUpload
ref="fileUploadRef"
name="file"
:url="uploadUrl"
@upload="onUpload"
@@ -68,7 +69,14 @@
</template>
</FileUpload>
</div>
<!-- 시트 선택 UI -->
<div v-if="sheetNames.length > 0" class="mt-3">
<label for="sheet-select" class="field-label">엑셀 시트 선택</label>
<Select id="sheet-select" v-model="selectedSheetName" :options="sheetNames" placeholder="시트 선택" class="p-inputtext" />
<Button label="시트 데이터 불러오기" class="ml-2" @click="parseFile" :disabled="!selectedSheetName || loading" />
</div>
<div v-if="uploadError" class="error-message">
<i class="pi pi-exclamation-triangle"></i>
{{ uploadError }}
@@ -498,7 +506,7 @@
<div class="field col-6 mb-3">
<label for="newMemberType" class="mb-1">회원 유형</label>
<Select id="newMemberType" v-model="newMember.memberType" :options="MEMBER_TYPE_OPTIONS" optionLabel="name" optionValue="code" placeholder="회원 유형 선택" class="w-full" :disabled="newMemberMode === 'guest'" />
<Select id="newMemberType" v-model="newMember.memberType" :options="MEMBER_TYPE_OPTIONS" optionLabel="name" optionValue="value" placeholder="회원 유형 선택" class="w-full" :disabled="newMemberMode === 'guest'" />
</div>
<div class="field col-6 mb-3">
@@ -518,7 +526,7 @@
<div class="field col-6 mb-3">
<label for="newMemberStatus" class="mb-1">상태</label>
<Select id="newMemberStatus" v-model="newMember.status" :options="STATUS_OPTIONS" optionLabel="label" optionValue="value" placeholder="상태 선택" class="w-full" />
<Select id="newMemberStatus" v-model="newMember.status" :options="STATUS_OPTIONS" optionLabel="name" optionValue="value" placeholder="상태 선택" class="w-full" />
</div>
</div>
@@ -548,6 +556,7 @@ import dayjs from 'dayjs';
import { useClubStore } from '@/stores/clubStore';
import eventService from '@/services/eventService';
import clubService from '@/services/clubService';
import * as XLSX from 'xlsx';
// 기존 이벤트 선택 관련 상태
const selectedEventId = ref(null);
@@ -591,9 +600,7 @@ const loadSelectedEvent = async () => {
}
};
onMounted(() => {
loadEventOptions();
});
// onMounted 훅은 아래에서 한 번만 사용
// PrimeVue 컴포넌트 임포트
@@ -626,9 +633,13 @@ const steps = ref([
{ label: '최종 확인' }
]);
// FileUpload 컴포넌트 참조
const fileUploadRef = ref(null);
const uploadedFile = ref(null);
const uploadError = ref('');
const loading = ref(false);
const uploading = ref(false);
const saving = ref(false);
const submitted = ref(false);
@@ -638,6 +649,10 @@ const parsedData = ref({
gameCount: 0
});
// 엑셀 시트 관련 상태
const sheetNames = ref([]);
const selectedSheetName = ref('');
// 이벤트 데이터
const eventData = ref({
title: '',
@@ -684,8 +699,9 @@ const uploadUrl = computed(() => {
return `${import.meta.env.VITE_API_URL}${eventService.getFileUploadUrl(props.clubId)}`;
});
// 컴포넌트 마운트 시 클럽 회원 목록 로드
// 컴포넌트 마운트 시 초기화 작업 수행
onMounted(async () => {
loadEventOptions();
await loadClubMembers();
});
@@ -716,9 +732,6 @@ const loadClubMembers = async () => {
}
};
// 업로드 상태 변수 추가
const uploading = ref(false);
// 이미지 파일 여부 체크
const isImageFile = (file) => {
const ext = file.name.split('.').pop().toLowerCase();
@@ -760,21 +773,31 @@ const uploadFile = async (event) => {
uploadError.value = '업로드할 파일을 선택해주세요.';
return;
}
// 프론트에서 시트명 추출
const file = event.files[0];
const reader = new FileReader();
reader.onload = (e) => {
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array' });
sheetNames.value = workbook.SheetNames;
// 기본값: 첫 번째 시트 선택
selectedSheetName.value = workbook.SheetNames[0] || '';
};
reader.readAsArrayBuffer(file);
const formData = new FormData();
formData.append('file', event.files[0]);
formData.append('file', file);
formData.append('clubId', props.clubId);
try {
loading.value = true;
uploading.value = true;
const data = await eventService.uploadFile(event.files[0], props.clubId);
const data = await eventService.uploadFile(file, props.clubId);
uploadedFile.value = data.file;
uploadError.value = '';
// 파일 파싱 요청
parseFile();
// 파일 파싱은 시트 선택 후 별도로 진행
// parseFile();
// 업로드 완료 후 파일 목록 초기화
if (event.clear) {
event.clear();
@@ -808,40 +831,41 @@ const parseFile = async () => {
if (!uploadedFile.value) {
return;
}
if (!selectedSheetName.value) {
uploadError.value = '시트를 선택해주세요.';
return;
}
loading.value = true;
try {
const response = await eventService.parseEventFile({
filename: uploadedFile.value.filename,
clubId: props.clubId
clubId: props.clubId,
sheetName: selectedSheetName.value
});
parsedData.value = response.data;
eventData.value.gameCount = parsedData.value.gameCount || 3;
// 추론된 이벤트 정보가 있는 경우 이를 활용
if (parsedData.value.inferredEventInfo) {
const inferredInfo = parsedData.value.inferredEventInfo;
// 제목이 추론되었다면 적용
if (inferredInfo.title) {
eventData.value.title = inferredInfo.title;
}
// 시작일이 추론되었다면 적용
if (inferredInfo.startDate) {
eventData.value.startDate = new Date(inferredInfo.startDate);
}
// 장소가 추론되었다면 적용
if (inferredInfo.location) {
eventData.value.location = inferredInfo.location;
}
}
// 다음 단계로 이동
activeStep.value = 1;
// 파일 파싱이 완료되면 파일 업로드 컴포넌트 초기화
if (fileUploadRef.value && fileUploadRef.value.clear) {
fileUploadRef.value.clear();
}
// 업로드 파일 정보는 유지 (파일명은 백엔드에서 사용하기 때문)
} catch (error) {
console.error('파일 파싱 오류:', error);
uploadError.value = error.message || '파일 파싱 중 오류가 발생했습니다.';
@@ -1231,6 +1255,8 @@ watch(() => props.visible, (newValue) => {
status: '활성'
};
submitted.value = false;
sheetNames.value = [];
selectedSheetName.value = '';
}
});
</script>