파일 업로드기능 완료
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
<h2>이벤트 관리</h2>
|
||||
<div class="header-buttons">
|
||||
<Button label="캘린더 보기" icon="pi pi-calendar" class="p-button-outlined mr-2" @click="navigateToCalendar" />
|
||||
<Button label="파일에서 생성" icon="pi pi-file-import" class="p-button-outlined mr-2" @click="openFileUploadDialog" />
|
||||
<Button label="이벤트 추가" icon="pi pi-plus" @click="openNewEventDialog" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -93,16 +94,28 @@
|
||||
/>
|
||||
|
||||
<!-- 삭제 확인 다이얼로그 -->
|
||||
<Dialog v-model:visible="deleteEventDialog" :style="{ width: '450px' }" header="확인" :modal="true">
|
||||
<Dialog
|
||||
v-model:visible="deleteEventDialog"
|
||||
:style="{ width: '450px' }"
|
||||
header="이벤트 삭제"
|
||||
:modal="true"
|
||||
>
|
||||
<div class="confirmation-content">
|
||||
<i class="pi pi-exclamation-triangle mr-3" style="font-size: 2rem" />
|
||||
<span v-if="event">{{ event.title }} 이벤트를 삭제하시겠습니까?</span>
|
||||
<span>정말 이 이벤트를 삭제하시겠습니까?</span>
|
||||
</div>
|
||||
<template #footer>
|
||||
<Button label="아니오" icon="pi pi-times" class="p-button-text" @click="deleteEventDialog = false" />
|
||||
<Button label="예" icon="pi pi-check" class="p-button-danger" @click="deleteEvent" />
|
||||
</template>
|
||||
</Dialog>
|
||||
|
||||
<!-- 파일 업로드 다이얼로그 -->
|
||||
<FileUploadDialog
|
||||
v-model:visible="fileUploadDialog"
|
||||
:clubId="clubId"
|
||||
@event-created="onEventCreated"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -111,6 +124,7 @@ import { ref, onMounted, computed } from 'vue';
|
||||
import { useToast } from 'primevue/usetoast';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useClubStore } from '@/stores/clubStore';
|
||||
import FileUploadDialog from '@/components/event/FileUploadDialog.vue';
|
||||
import eventService from '@/services/eventService';
|
||||
import apiClient from '@/services/api';
|
||||
import dayjs from 'dayjs';
|
||||
@@ -132,10 +146,12 @@ const clubStore = useClubStore();
|
||||
const events = ref([]);
|
||||
const event = ref({});
|
||||
const eventDialog = ref(false);
|
||||
const deleteEventDialog = ref(false);
|
||||
const detailsDialog = ref(false);
|
||||
const deleteEventDialog = ref(false);
|
||||
const fileUploadDialog = ref(false);
|
||||
const loading = ref(false);
|
||||
const submitted = ref(false);
|
||||
// localStorage에서 가져온 clubId를 숫자로 변환 시도
|
||||
const clubId = ref(localStorage.getItem('clubId') || null);
|
||||
|
||||
// 필터 상태
|
||||
@@ -434,6 +450,22 @@ const navigateToCalendar = () => {
|
||||
const url = `/club/calendar?clubId=${clubId.value}`;
|
||||
window.location.href = url;
|
||||
};
|
||||
|
||||
// 파일 업로드 다이얼로그 열기
|
||||
const openFileUploadDialog = () => {
|
||||
fileUploadDialog.value = true;
|
||||
};
|
||||
|
||||
// 파일 업로드로 이벤트 생성 완료 처리
|
||||
const onEventCreated = async (eventData) => {
|
||||
toast.add({
|
||||
severity: 'success',
|
||||
summary: '성공',
|
||||
detail: '파일에서 이벤트가 생성되었습니다.',
|
||||
life: 3000
|
||||
});
|
||||
await fetchEvents();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</div>
|
||||
<div class="field col-6 mb-3">
|
||||
<label for="handicap" class="mb-1">핸디캡</label>
|
||||
<InputText id="handicap" v-model="member.handicap" type="number" min="0" max="50" class="w-full" />
|
||||
<InputText id="handicap" v-model="member.handicap" type="number" min="-300" max="300" class="w-full" />
|
||||
</div>
|
||||
<div class="field col-6 mb-3">
|
||||
<label for="status" class="mb-1">상태</label>
|
||||
|
||||
@@ -597,6 +597,29 @@ const sortedParticipants = computed(() => {
|
||||
// 점수 입력용 프록시 (v-model에서 계산식 사용 회피)
|
||||
const scoresProxy = ref({});
|
||||
|
||||
// 점수 입력 프록시를 숫자만으로 초기화
|
||||
function initScoresProxy() {
|
||||
if (!participants.value || !event.value?.gameCount) return;
|
||||
participants.value.forEach(member => {
|
||||
for (let n = 1; n <= event.value.gameCount; n++) {
|
||||
const key = member.participantId + '-' + n;
|
||||
// 객체 구조면 .score, 아니면 빈칸
|
||||
let score = '';
|
||||
if (member.scores && member.scores[n-1] && typeof member.scores[n-1] === 'object' && 'score' in member.scores[n-1]) {
|
||||
score = member.scores[n-1].score ?? '';
|
||||
} else if (member.scores && typeof member.scores[n-1] === 'number') {
|
||||
score = member.scores[n-1];
|
||||
}
|
||||
scoresProxy.value[key] = score;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// fetchEventData 등 데이터 로딩 후 반드시 호출
|
||||
watch([participants, () => event.value?.gameCount], () => {
|
||||
initScoresProxy();
|
||||
});
|
||||
|
||||
// 팀 미배정 인원 (백엔드 응답을 그대로 사용)
|
||||
const unassignedMembers = ref([]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user