오류 수정

This commit is contained in:
2025-06-09 16:12:59 +09:00
parent 05312c7d93
commit 2244a525b3
8 changed files with 98 additions and 156 deletions
@@ -77,7 +77,7 @@
</Column>
<Column field="status" header="상태">
<template #body="subProps">
<Badge :value="getStatusName(subProps.data.status)" :severity="getStatusSeverity(subProps.data.status)" />
<Badge :value="getSubscriptionStatusLabel(subProps.data.status)" :severity="getSubscriptionStatusSeverity(subProps.data.status)" />
</template>
</Column>
<Column header="작업">
@@ -126,7 +126,7 @@
<div class="field">
<label for="status">상태</label>
<Dropdown id="status" v-model="plan.status" :options="statusOptions" optionLabel="name" optionValue="value" />
<Select id="status" v-model="plan.status" :options="SUBSCRIPTION_STATUS_OPTIONS" optionLabel="name" optionValue="value" />
</div>
<template #footer>
@@ -139,28 +139,28 @@
<Dialog v-model:visible="subscriptionDialog" :header="subscriptionDialogTitle" :style="{ width: '500px' }" :modal="true" class="p-fluid">
<div class="field">
<label for="club">클럽</label>
<Dropdown id="club" v-model="subscription.clubId" :options="availableClubs" optionLabel="name" optionValue="id"
<Select id="club" v-model="subscription.clubId" :options="availableClubs" optionLabel="name" optionValue="id"
:class="{'p-invalid': subscriptionSubmitted && !subscription.clubId}" placeholder="클럽 선택" />
<small class="p-error" v-if="subscriptionSubmitted && !subscription.clubId">클럽을 선택해주세요.</small>
</div>
<div class="field">
<label for="startDate">시작일</label>
<Calendar id="startDate" v-model="subscription.startDate" :showIcon="true" dateFormat="yy-mm-dd"
<DatePicker id="startDate" v-model="subscription.startDate" :showIcon="true" dateFormat="yy-mm-dd"
:class="{'p-invalid': subscriptionSubmitted && !subscription.startDate}" />
<small class="p-error" v-if="subscriptionSubmitted && !subscription.startDate">시작일을 선택해주세요.</small>
</div>
<div class="field">
<label for="expiryDate">만료일</label>
<Calendar id="expiryDate" v-model="subscription.expiryDate" :showIcon="true" dateFormat="yy-mm-dd"
<DatePicker id="expiryDate" v-model="subscription.expiryDate" :showIcon="true" dateFormat="yy-mm-dd"
:class="{'p-invalid': subscriptionSubmitted && !subscription.expiryDate}" :minDate="subscription.startDate" />
<small class="p-error" v-if="subscriptionSubmitted && !subscription.expiryDate">만료일을 선택해주세요.</small>
</div>
<div class="field">
<label for="status">상태</label>
<Dropdown id="status" v-model="subscription.status" :options="subscriptionStatusOptions" optionLabel="name" optionValue="value" />
<Select id="status" v-model="subscription.status" :options="SUBSCRIPTION_STATUS_OPTIONS" optionLabel="name" optionValue="value" />
</div>
<template #footer>
@@ -198,26 +198,12 @@
</template>
<script setup>
import { getStatusLabel } from '@/utils/enumMappings';
import { getStatusLabel, getStatusSeverity, getSubscriptionStatusLabel, getSubscriptionStatusSeverity, SUBSCRIPTION_STATUS_OPTIONS, SUBSCRIPTION_STATUS_LABELS } from '@/utils/enumMappings';
import { ref, onMounted, computed } from 'vue';
import { useToast } from 'primevue/usetoast';
import axios from 'axios';
import adminService from '@/services/adminService';
// PrimeVue 컴포넌트
import MultiSelect from 'primevue/multiselect';
import InputNumber from 'primevue/inputnumber';
import Textarea from 'primevue/textarea';
import InputText from 'primevue/inputtext';
import Button from 'primevue/button';
import Dialog from 'primevue/dialog';
import DataTable from 'primevue/datatable';
import Column from 'primevue/column';
import Dropdown from 'primevue/dropdown';
import Badge from 'primevue/badge';
import Toast from 'primevue/toast';
import Calendar from 'primevue/calendar';
const toast = useToast();
const API_URL = 'http://localhost:3030/api';
@@ -245,18 +231,6 @@ const subscriptionSubmitted = ref(false);
const availableClubs = ref([]);
const selectedPlan = ref(null);
// 상태 옵션
const statusOptions = [
{ name: '활성', value: 'active' },
{ name: '비활성', value: 'inactive' }
];
const subscriptionStatusOptions = [
{ name: '활성', value: 'active' },
{ name: '만료', value: 'expired' },
{ name: '일시중지', value: 'paused' }
];
// 다이얼로그 제목
const dialogTitle = computed(() => {
return isNewPlan.value ? '구독 플랜 추가' : '구독 플랜 수정';
@@ -498,30 +472,6 @@ const deleteSubscription = async () => {
}
};
// 상태 이름 가져오기
// getStatusName 함수 제거(일원화)
switch (status) {
case 'active':
return '활성';
case 'inactive':
return '비활성';
default:
return status;
}
};
// 상태 심각도 가져오기
const getStatusSeverity = (status) => {
switch (status) {
case 'active':
return 'success';
case 'inactive':
return 'danger';
default:
return 'info';
}
};
// 금액 포맷팅
const formatCurrency = (amount) => {
return new Intl.NumberFormat('ko-KR', {
+5 -80
View File
@@ -36,7 +36,7 @@
<Badge :value="getRoleName(slotProps.data.role)" :severity="getRoleSeverity(slotProps.data.role)" />
</template>
<template #filter="{ filterModel, filterCallback }">
<Select v-model="filterModel.value" @change="filterCallback()" :options="roleOptions" optionLabel="name" optionValue="value" placeholder="역할 선택" class="p-column-filter" />
<Select v-model="filterModel.value" @change="filterCallback()" :options="ROLE_OPTIONS" optionLabel="name" optionValue="value" placeholder="역할 선택" class="p-column-filter" />
</template>
</Column>
<Column field="status" header="상태" sortable style="width: 10%">
@@ -44,7 +44,7 @@
<Badge :value="getStatusLabel(slotProps.data.status)" :severity="getStatusSeverity(slotProps.data.status)" />
</template>
<template #filter="{ filterModel, filterCallback }">
<Select v-model="filterModel.value" @change="filterCallback()" :options="statusOptions" optionLabel="name" optionValue="value" placeholder="상태 선택" class="p-column-filter" />
<Select v-model="filterModel.value" @change="filterCallback()" :options="STATUS_OPTIONS" optionLabel="name" optionValue="value" placeholder="상태 선택" class="p-column-filter" />
</template>
</Column>
<Column field="createdAt" header="가입일" sortable style="width: 12%">
@@ -90,13 +90,13 @@
<div class="field mb-3">
<label for="role">역할</label>
<Select id="role" v-model="user.role" :options="roleOptions" optionLabel="name" optionValue="value" placeholder="역할 선택" required class="w-full" />
<Select id="role" v-model="user.role" :options="ROLE_OPTIONS" optionLabel="name" optionValue="value" placeholder="역할 선택" required class="w-full" />
<small class="p-error" v-if="submitted && !user.role">역할은 필수입니다.</small>
</div>
<div class="field mb-3">
<label for="status">상태</label>
<Select id="status" v-model="user.status" :options="statusOptions" optionLabel="name" optionValue="value" placeholder="상태 선택" required class="w-full" />
<Select id="status" v-model="user.status" :options="STATUS_OPTIONS" optionLabel="name" optionValue="value" placeholder="상태 선택" required class="w-full" />
<small class="p-error" v-if="submitted && !user.status">상태는 필수입니다.</small>
</div>
@@ -123,7 +123,7 @@
</template>
<script setup>
import { getStatusLabel } from '@/utils/enumMappings';
import { getStatusLabel, getRoleName, getRoleSeverity, getStatusSeverity, STATUS_OPTIONS, ROLE_OPTIONS } from '@/utils/enumMappings';
import { ref, onMounted, reactive, computed } from 'vue';
import { useToast } from 'primevue/usetoast';
import adminService from '@/services/adminService';
@@ -147,25 +147,6 @@ const filters = ref({
status: { value: null, matchMode: 'equals' }
});
// 역할 옵션
const roleOptions = [
{ name: '관리자', value: 'admin' },
{ name: '클럽 관리자', value: 'clubadmin' },
{ name: '일반 사용자', value: 'user' }
];
// 상태 옵션
const statusOptions = [
{ name: getStatusLabel('active'), value: 'active' },
{ name: getStatusLabel('inactive'), value: 'inactive' },
{ name: getStatusLabel('pending'), value: 'pending' },
{ name: getStatusLabel('suspended'), value: 'suspended' }
];
{ name: '활성', value: 'active' },
{ name: '비활성', value: 'inactive' },
{ name: '정지', value: 'suspended' }
];
// 다이얼로그 제목
const dialogTitle = computed(() => {
return isNewUser.value ? '사용자 추가' : '사용자 수정';
@@ -273,62 +254,6 @@ const deleteUser = async () => {
}
};
// 역할 이름 가져오기
const getRoleName = (role) => {
switch (role) {
case 'admin':
return '관리자';
case 'clubadmin':
return '클럽 관리자';
case 'user':
return '일반 사용자';
default:
return role;
}
};
// 역할 심각도 가져오기
const getRoleSeverity = (role) => {
switch (role) {
case 'admin':
return 'danger';
case 'clubadmin':
return 'warning';
case 'user':
return 'info';
default:
return 'info';
}
};
// 상태 이름 가져오기
// getStatusName 함수 제거(일원화)
switch (status) {
case 'active':
return '활성';
case 'inactive':
return '비활성';
case 'suspended':
return '정지';
default:
return status;
}
};
// 상태 심각도 가져오기
const getStatusSeverity = (status) => {
switch (status) {
case 'active':
return 'success';
case 'inactive':
return 'secondary';
case 'suspended':
return 'danger';
default:
return 'info';
}
};
// 날짜 포맷팅
const formatDate = (date) => {
return date ? dayjs(date).format('YYYY-MM-DD') : '-';
+1 -1
View File
@@ -45,7 +45,7 @@
{{ formatDate(slotProps.data.startDate) }}
</template>
<template #filter="{ filterModel, filterCallback }">
<Datepicker v-model="filterModel.value" @date-select="filterCallback()" dateFormat="yy-mm-dd" placeholder="날짜 선택" />
<DatePicker v-model="filterModel.value" @date-select="filterCallback()" dateFormat="yy-mm-dd" placeholder="날짜 선택" />
</template>
</Column>
<Column field="location" header="장소" sortable style="width: 15%"></Column>