작업계획서대로 진행
This commit is contained in:
204
frontend/business-report/[id].vue
Normal file
204
frontend/business-report/[id].vue
Normal file
@@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<NuxtLink to="/business-report" class="text-decoration-none text-muted me-2"><i class="bi bi-arrow-left"></i></NuxtLink>
|
||||
<i class="bi bi-file-earmark-text me-2"></i>{{ report?.businessName }} - {{ report?.reportYear }}-W{{ String(report?.reportWeek || 0).padStart(2, '0') }}
|
||||
</h4>
|
||||
<div v-if="report">
|
||||
<span :class="report.status === 'confirmed' ? 'badge bg-success me-3' : 'badge bg-warning me-3'">
|
||||
{{ report.status === 'confirmed' ? '확정' : '작성중' }}
|
||||
</span>
|
||||
<button class="btn btn-success" @click="confirmReport" v-if="report.status !== 'confirmed'" :disabled="isConfirming">
|
||||
<i class="bi bi-check-lg me-1"></i>확정
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="text-center py-5">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="report" class="row">
|
||||
<div class="col-md-8">
|
||||
<!-- 요약 -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>취합 요약</strong>
|
||||
<button class="btn btn-sm btn-outline-primary" @click="toggleEdit" v-if="report.status !== 'confirmed'">
|
||||
{{ isEditing ? '취소' : '수정' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div v-if="!isEditing">
|
||||
<div class="mb-3" v-if="report.manualSummary">
|
||||
<label class="text-muted small">최종 요약 (수정됨)</label>
|
||||
<div style="white-space: pre-wrap;">{{ report.manualSummary }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="text-muted small">AI 생성 요약</label>
|
||||
<div style="white-space: pre-wrap;" :class="{ 'text-muted': report.manualSummary }">{{ report.aiSummary }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<label class="form-label">요약 수정</label>
|
||||
<textarea class="form-control" v-model="editSummary" rows="8" placeholder="AI 요약을 수정하세요..."></textarea>
|
||||
<div class="mt-2">
|
||||
<button class="btn btn-primary btn-sm" @click="saveSummary" :disabled="isSaving">
|
||||
<span v-if="isSaving"><span class="spinner-border spinner-border-sm me-1"></span></span>
|
||||
저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 실적 목록 -->
|
||||
<div class="card">
|
||||
<div class="card-header"><strong>포함된 실적 목록</strong></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 120px">프로젝트</th>
|
||||
<th style="width: 80px">담당자</th>
|
||||
<th>실적 내용</th>
|
||||
<th style="width: 60px" class="text-center">시간</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="t in tasks" :key="t.taskId">
|
||||
<td>{{ t.projectName }}</td>
|
||||
<td>{{ t.employeeName }}</td>
|
||||
<td>{{ t.taskDescription }}</td>
|
||||
<td class="text-center">{{ t.taskHours || '-' }}</td>
|
||||
</tr>
|
||||
<tr v-if="tasks.length === 0">
|
||||
<td colspan="4" class="text-center py-3 text-muted">실적이 없습니다.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<!-- 정보 -->
|
||||
<div class="card">
|
||||
<div class="card-header"><strong>보고서 정보</strong></div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">사업</span>
|
||||
<NuxtLink :to="`/business/${report.businessId}`">{{ report.businessName }}</NuxtLink>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">주차</span>
|
||||
<span>{{ report.reportYear }}-W{{ String(report.reportWeek).padStart(2, '0') }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">기간</span>
|
||||
<span>{{ formatDate(report.weekStartDate) }} ~ {{ formatDate(report.weekEndDate) }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">실적 건수</span>
|
||||
<span>{{ tasks.length }}건</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">생성자</span>
|
||||
<span>{{ report.createdByName || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">생성일</span>
|
||||
<span>{{ formatDateTime(report.createdAt) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const report = ref<any>(null)
|
||||
const tasks = ref<any[]>([])
|
||||
const isLoading = ref(true)
|
||||
const isEditing = ref(false)
|
||||
const isSaving = ref(false)
|
||||
const isConfirming = ref(false)
|
||||
const editSummary = ref('')
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) { router.push('/login'); return }
|
||||
await loadReport()
|
||||
})
|
||||
|
||||
async function loadReport() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<{ report: any; tasks: any[] }>(`/api/business-report/${route.params.id}/detail`)
|
||||
report.value = res.report
|
||||
tasks.value = res.tasks || []
|
||||
} catch (e: any) {
|
||||
alert('보고서를 불러올 수 없습니다.')
|
||||
router.push('/business-report')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function toggleEdit() {
|
||||
if (!isEditing.value) {
|
||||
editSummary.value = report.value.manualSummary || report.value.aiSummary || ''
|
||||
}
|
||||
isEditing.value = !isEditing.value
|
||||
}
|
||||
|
||||
async function saveSummary() {
|
||||
isSaving.value = true
|
||||
try {
|
||||
await $fetch(`/api/business-report/${route.params.id}/update`, {
|
||||
method: 'PUT',
|
||||
body: { manualSummary: editSummary.value }
|
||||
})
|
||||
isEditing.value = false
|
||||
await loadReport()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '저장에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmReport() {
|
||||
if (!confirm('보고서를 확정하시겠습니까? 확정 후에는 수정할 수 없습니다.')) return
|
||||
isConfirming.value = true
|
||||
try {
|
||||
await $fetch(`/api/business-report/${route.params.id}/confirm`, { method: 'PUT' })
|
||||
await loadReport()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '확정에 실패했습니다.')
|
||||
} finally {
|
||||
isConfirming.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(d: string) {
|
||||
if (!d) return '-'
|
||||
return d.split('T')[0]
|
||||
}
|
||||
|
||||
function formatDateTime(d: string) {
|
||||
if (!d) return '-'
|
||||
const dt = new Date(d)
|
||||
return `${dt.getFullYear()}-${String(dt.getMonth()+1).padStart(2,'0')}-${String(dt.getDate()).padStart(2,'0')} ${String(dt.getHours()).padStart(2,'0')}:${String(dt.getMinutes()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
272
frontend/business-report/index.vue
Normal file
272
frontend/business-report/index.vue
Normal file
@@ -0,0 +1,272 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0"><i class="bi bi-file-earmark-text me-2"></i>사업 주간보고 취합</h4>
|
||||
</div>
|
||||
|
||||
<!-- 조건 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body py-2">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col-1 text-end"><label class="col-form-label">사업</label></div>
|
||||
<div class="col-3">
|
||||
<select class="form-select form-select-sm" v-model="filter.businessId" @change="loadReports">
|
||||
<option value="">전체</option>
|
||||
<option v-for="b in businesses" :key="b.businessId" :value="b.businessId">{{ b.businessName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">년도</label></div>
|
||||
<div class="col-1">
|
||||
<select class="form-select form-select-sm" v-model="filter.year" @change="loadReports">
|
||||
<option v-for="y in years" :key="y" :value="y">{{ y }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-primary btn-sm" @click="showGenerateModal = true" :disabled="!filter.businessId">
|
||||
<i class="bi bi-plus-lg me-1"></i>취합 생성
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 목록 -->
|
||||
<div class="card">
|
||||
<div class="card-header">취합 목록</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 50px" class="text-center">No</th>
|
||||
<th>사업명</th>
|
||||
<th style="width: 100px" class="text-center">주차</th>
|
||||
<th style="width: 180px">기간</th>
|
||||
<th>AI 요약 (미리보기)</th>
|
||||
<th style="width: 80px" class="text-center">상태</th>
|
||||
<th style="width: 100px">생성일</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="isLoading">
|
||||
<td colspan="7" class="text-center py-4"><span class="spinner-border spinner-border-sm me-2"></span>로딩 중...</td>
|
||||
</tr>
|
||||
<tr v-else-if="reports.length === 0">
|
||||
<td colspan="7" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2 mb-0">취합된 보고서가 없습니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else v-for="(r, idx) in reports" :key="r.businessReportId">
|
||||
<td class="text-center">{{ idx + 1 }}</td>
|
||||
<td>
|
||||
<NuxtLink :to="`/business-report/${r.businessReportId}`" class="text-decoration-none">
|
||||
{{ r.businessName }}
|
||||
</NuxtLink>
|
||||
</td>
|
||||
<td class="text-center">{{ r.reportYear }}-W{{ String(r.reportWeek).padStart(2, '0') }}</td>
|
||||
<td>{{ formatDate(r.weekStartDate) }} ~ {{ formatDate(r.weekEndDate) }}</td>
|
||||
<td><small class="text-muted">{{ truncate(r.manualSummary || r.aiSummary, 50) }}</small></td>
|
||||
<td class="text-center">
|
||||
<span :class="r.status === 'confirmed' ? 'badge bg-success' : 'badge bg-warning'">
|
||||
{{ r.status === 'confirmed' ? '확정' : '작성중' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ formatDate(r.createdAt) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 취합 생성 모달 -->
|
||||
<div class="modal fade" :class="{ show: showGenerateModal }" :style="{ display: showGenerateModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">주간보고 취합 생성</h5>
|
||||
<button type="button" class="btn-close" @click="showGenerateModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">사업 <span class="text-danger">*</span></label>
|
||||
<select class="form-select" v-model="generateForm.businessId" disabled>
|
||||
<option v-for="b in businesses" :key="b.businessId" :value="b.businessId">{{ b.businessName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">주차 <span class="text-danger">*</span></label>
|
||||
<select class="form-select" v-model="generateForm.week">
|
||||
<option v-for="w in weeks" :key="w.week" :value="w">
|
||||
{{ w.year }}-W{{ String(w.week).padStart(2, '0') }} ({{ w.startDate }} ~ {{ w.endDate }})
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="alert alert-info mb-0">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
선택한 주차에 해당하는 프로젝트 실적을 AI가 요약합니다.
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showGenerateModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="generateReport" :disabled="isGenerating">
|
||||
<span v-if="isGenerating"><span class="spinner-border spinner-border-sm me-1"></span>생성 중...</span>
|
||||
<span v-else><i class="bi bi-magic me-1"></i>AI 취합 생성</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showGenerateModal"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Business { businessId: number; businessName: string }
|
||||
interface Report {
|
||||
businessReportId: number
|
||||
businessId: number
|
||||
businessName: string
|
||||
reportYear: number
|
||||
reportWeek: number
|
||||
weekStartDate: string
|
||||
weekEndDate: string
|
||||
aiSummary: string
|
||||
manualSummary: string
|
||||
status: string
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
const businesses = ref<Business[]>([])
|
||||
const reports = ref<Report[]>([])
|
||||
const isLoading = ref(false)
|
||||
const showGenerateModal = ref(false)
|
||||
const isGenerating = ref(false)
|
||||
|
||||
const currentYear = new Date().getFullYear()
|
||||
const years = [currentYear, currentYear - 1]
|
||||
|
||||
const filter = ref({
|
||||
businessId: '',
|
||||
year: currentYear
|
||||
})
|
||||
|
||||
const weeks = computed(() => {
|
||||
const result = []
|
||||
const now = new Date()
|
||||
for (let i = 0; i < 8; i++) {
|
||||
const d = new Date(now.getTime() - i * 7 * 24 * 60 * 60 * 1000)
|
||||
const { year, week, startDate, endDate } = getWeekInfo(d)
|
||||
result.push({ year, week, startDate, endDate })
|
||||
}
|
||||
return result
|
||||
})
|
||||
|
||||
const generateForm = ref({
|
||||
businessId: '',
|
||||
week: null as any
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) { router.push('/login'); return }
|
||||
await loadBusinesses()
|
||||
await loadReports()
|
||||
})
|
||||
|
||||
watch(() => filter.value.businessId, (v) => {
|
||||
generateForm.value.businessId = v
|
||||
if (weeks.value.length > 0) {
|
||||
generateForm.value.week = weeks.value[0]
|
||||
}
|
||||
})
|
||||
|
||||
async function loadBusinesses() {
|
||||
try {
|
||||
const res = await $fetch<{ businesses: Business[] }>('/api/business/list')
|
||||
businesses.value = res.businesses || []
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
async function loadReports() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<{ reports: Report[] }>('/api/business-report/list', {
|
||||
query: {
|
||||
businessId: filter.value.businessId || undefined,
|
||||
year: filter.value.year
|
||||
}
|
||||
})
|
||||
reports.value = res.reports || []
|
||||
} catch (e) { console.error(e) }
|
||||
finally { isLoading.value = false }
|
||||
}
|
||||
|
||||
async function generateReport() {
|
||||
if (!generateForm.value.businessId || !generateForm.value.week) {
|
||||
alert('사업과 주차를 선택하세요.')
|
||||
return
|
||||
}
|
||||
isGenerating.value = true
|
||||
try {
|
||||
const w = generateForm.value.week
|
||||
const res = await $fetch<{ report: any }>('/api/business-report/generate', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
businessId: Number(generateForm.value.businessId),
|
||||
reportYear: w.year,
|
||||
reportWeek: w.week,
|
||||
weekStartDate: w.startDate,
|
||||
weekEndDate: w.endDate
|
||||
}
|
||||
})
|
||||
showGenerateModal.value = false
|
||||
await loadReports()
|
||||
router.push(`/business-report/${res.report.businessReportId}`)
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '취합 생성에 실패했습니다.')
|
||||
} finally {
|
||||
isGenerating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function getWeekInfo(date: Date) {
|
||||
const d = new Date(date)
|
||||
d.setHours(0, 0, 0, 0)
|
||||
d.setDate(d.getDate() + 3 - (d.getDay() + 6) % 7)
|
||||
const week1 = new Date(d.getFullYear(), 0, 4)
|
||||
const week = 1 + Math.round(((d.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7)
|
||||
|
||||
const monday = new Date(date)
|
||||
monday.setDate(monday.getDate() - (monday.getDay() + 6) % 7)
|
||||
const sunday = new Date(monday)
|
||||
sunday.setDate(sunday.getDate() + 6)
|
||||
|
||||
return {
|
||||
year: d.getFullYear(),
|
||||
week,
|
||||
startDate: monday.toISOString().split('T')[0],
|
||||
endDate: sunday.toISOString().split('T')[0]
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(d: string) {
|
||||
if (!d) return '-'
|
||||
return d.split('T')[0]
|
||||
}
|
||||
|
||||
function truncate(s: string, len: number) {
|
||||
if (!s) return '-'
|
||||
return s.length > len ? s.substring(0, len) + '...' : s
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show { background: rgba(0, 0, 0, 0.5); }
|
||||
</style>
|
||||
335
frontend/business/[id].vue
Normal file
335
frontend/business/[id].vue
Normal file
@@ -0,0 +1,335 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4>
|
||||
<i class="bi bi-briefcase me-2"></i>
|
||||
{{ business?.businessName }}
|
||||
</h4>
|
||||
<p class="text-muted mb-0">
|
||||
<span :class="getStatusBadgeClass(business?.businessStatus || '')">
|
||||
{{ getStatusText(business?.businessStatus || '') }}
|
||||
</span>
|
||||
<span v-if="business?.businessCode" class="ms-2">
|
||||
<code>{{ business.businessCode }}</code>
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<NuxtLink to="/business" class="btn btn-outline-secondary me-2">
|
||||
<i class="bi bi-arrow-left me-1"></i> 목록
|
||||
</NuxtLink>
|
||||
<button class="btn btn-primary me-2" @click="openEditModal">
|
||||
<i class="bi bi-pencil me-1"></i> 수정
|
||||
</button>
|
||||
<button class="btn btn-outline-danger" @click="deleteBusiness">
|
||||
<i class="bi bi-trash me-1"></i> 삭제
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="text-center py-5">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="business" class="row">
|
||||
<!-- 왼쪽: 기본 정보 -->
|
||||
<div class="col-md-4">
|
||||
<div class="card">
|
||||
<div class="card-header"><strong>기본 정보</strong></div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">사업코드</span>
|
||||
<span>{{ business.businessCode || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">발주처</span>
|
||||
<span>{{ business.clientName || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">계약 시작일</span>
|
||||
<span>{{ formatDate(business.contractStartDate) || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">계약 종료일</span>
|
||||
<span>{{ formatDate(business.contractEndDate) || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">등록자</span>
|
||||
<span>{{ business.createdByName || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">등록일</span>
|
||||
<span>{{ formatDateTime(business.createdAt) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="card-body" v-if="business.description">
|
||||
<label class="form-label text-muted">설명</label>
|
||||
<p class="mb-0">{{ business.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 오른쪽: 소속 프로젝트 -->
|
||||
<div class="col-md-8">
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>소속 프로젝트 ({{ projects.length }}개)</strong>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>프로젝트명</th>
|
||||
<th style="width: 80px">유형</th>
|
||||
<th style="width: 150px">기간</th>
|
||||
<th style="width: 100px">상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="p in projects" :key="p.projectId">
|
||||
<td>
|
||||
<NuxtLink :to="`/project/${p.projectId}`" class="text-decoration-none">
|
||||
{{ p.projectName }}
|
||||
</NuxtLink>
|
||||
<small v-if="p.projectCode" class="text-muted ms-1">({{ p.projectCode }})</small>
|
||||
</td>
|
||||
<td>
|
||||
<span :class="p.projectType === 'SM' ? 'badge bg-info' : 'badge bg-primary'">
|
||||
{{ p.projectType || 'SI' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<small v-if="p.startDate">
|
||||
{{ formatDate(p.startDate) }} ~ {{ formatDate(p.endDate) || '진행중' }}
|
||||
</small>
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span :class="getProjectStatusClass(p.projectStatus)">
|
||||
{{ getProjectStatusText(p.projectStatus) }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="projects.length === 0">
|
||||
<td colspan="4" class="text-center py-4 text-muted">
|
||||
소속된 프로젝트가 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 수정 모달 -->
|
||||
<div class="modal fade" :class="{ show: showModal }" :style="{ display: showModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">사업 수정</h5>
|
||||
<button type="button" class="btn-close" @click="showModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">사업명 <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" v-model="form.businessName" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">사업코드</label>
|
||||
<input type="text" class="form-control" v-model="form.businessCode" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">발주처</label>
|
||||
<input type="text" class="form-control" v-model="form.clientName" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">상태</label>
|
||||
<select class="form-select" v-model="form.businessStatus">
|
||||
<option value="active">진행중</option>
|
||||
<option value="completed">완료</option>
|
||||
<option value="suspended">중단</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">계약 시작일</label>
|
||||
<input type="date" class="form-control" v-model="form.contractStartDate" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">계약 종료일</label>
|
||||
<input type="date" class="form-control" v-model="form.contractEndDate" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">설명</label>
|
||||
<textarea class="form-control" v-model="form.description" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="updateBusiness" :disabled="isSaving">
|
||||
<span v-if="isSaving">
|
||||
<span class="spinner-border spinner-border-sm me-1"></span>저장 중...
|
||||
</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>저장</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showModal"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const businessId = computed(() => Number(route.params.id))
|
||||
|
||||
const business = ref<any>(null)
|
||||
const projects = ref<any[]>([])
|
||||
const isLoading = ref(true)
|
||||
const showModal = ref(false)
|
||||
const isSaving = ref(false)
|
||||
|
||||
const form = ref({
|
||||
businessName: '',
|
||||
businessCode: '',
|
||||
clientName: '',
|
||||
contractStartDate: '',
|
||||
contractEndDate: '',
|
||||
businessStatus: 'active',
|
||||
description: ''
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
await loadBusiness()
|
||||
})
|
||||
|
||||
async function loadBusiness() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<any>(`/api/business/${businessId.value}/detail`)
|
||||
business.value = res.business
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error('Load business error:', e)
|
||||
alert('사업 정보를 불러올 수 없습니다.')
|
||||
router.push('/business')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openEditModal() {
|
||||
form.value = {
|
||||
businessName: business.value.businessName,
|
||||
businessCode: business.value.businessCode || '',
|
||||
clientName: business.value.clientName || '',
|
||||
contractStartDate: business.value.contractStartDate?.split('T')[0] || '',
|
||||
contractEndDate: business.value.contractEndDate?.split('T')[0] || '',
|
||||
businessStatus: business.value.businessStatus || 'active',
|
||||
description: business.value.description || ''
|
||||
}
|
||||
showModal.value = true
|
||||
}
|
||||
|
||||
async function updateBusiness() {
|
||||
if (!form.value.businessName) {
|
||||
alert('사업명을 입력하세요.')
|
||||
return
|
||||
}
|
||||
|
||||
isSaving.value = true
|
||||
try {
|
||||
await $fetch(`/api/business/${businessId.value}/update`, {
|
||||
method: 'PUT',
|
||||
body: form.value
|
||||
})
|
||||
showModal.value = false
|
||||
await loadBusiness()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '수정에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteBusiness() {
|
||||
if (!confirm('정말 삭제(중단)하시겠습니까?')) return
|
||||
|
||||
try {
|
||||
await $fetch(`/api/business/${businessId.value}/delete`, { method: 'DELETE' })
|
||||
router.push('/business')
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '삭제에 실패했습니다.')
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusBadgeClass(status: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'active': 'badge bg-success',
|
||||
'completed': 'badge bg-secondary',
|
||||
'suspended': 'badge bg-danger'
|
||||
}
|
||||
return classes[status] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getStatusText(status: string) {
|
||||
const texts: Record<string, string> = {
|
||||
'active': '진행중',
|
||||
'completed': '완료',
|
||||
'suspended': '중단'
|
||||
}
|
||||
return texts[status] || status
|
||||
}
|
||||
|
||||
function getProjectStatusClass(status: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'ACTIVE': 'badge bg-success',
|
||||
'COMPLETED': 'badge bg-secondary',
|
||||
'HOLD': 'badge bg-warning'
|
||||
}
|
||||
return classes[status] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getProjectStatusText(status: string) {
|
||||
const texts: Record<string, string> = {
|
||||
'ACTIVE': '진행중',
|
||||
'COMPLETED': '완료',
|
||||
'HOLD': '보류'
|
||||
}
|
||||
return texts[status] || status
|
||||
}
|
||||
|
||||
function formatDate(dateStr: string | null) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`
|
||||
}
|
||||
|
||||
function formatDateTime(dateStr: string | null) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')} ${String(d.getHours()).padStart(2,'0')}:${String(d.getMinutes()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
</style>
|
||||
321
frontend/business/index.vue
Normal file
321
frontend/business/index.vue
Normal file
@@ -0,0 +1,321 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<!-- 헤더 -->
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-briefcase me-2"></i>사업 관리
|
||||
</h4>
|
||||
<button class="btn btn-primary" @click="openCreateModal">
|
||||
<i class="bi bi-plus-lg me-1"></i>새 사업
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 검색 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body py-2">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col-1 text-end"><label class="col-form-label">사업명</label></div>
|
||||
<div class="col-2">
|
||||
<input type="text" class="form-control form-control-sm" v-model="filter.businessName" @keyup.enter="loadBusinesses" />
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">발주처</label></div>
|
||||
<div class="col-2">
|
||||
<input type="text" class="form-control form-control-sm" v-model="filter.clientName" @keyup.enter="loadBusinesses" />
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">상태</label></div>
|
||||
<div class="col-3">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="status" id="statusAll" value="" v-model="filter.status" @change="loadBusinesses">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusAll">전체</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusActive" value="active" v-model="filter.status" @change="loadBusinesses">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusActive">진행중</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusCompleted" value="completed" v-model="filter.status" @change="loadBusinesses">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusCompleted">완료</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusSuspended" value="suspended" v-model="filter.status" @change="loadBusinesses">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusSuspended">중단</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-primary btn-sm me-1" @click="loadBusinesses">
|
||||
<i class="bi bi-search me-1"></i>조회
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @click="resetSearch">
|
||||
<i class="bi bi-arrow-counterclockwise"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 사업 목록 -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>사업 목록 총 <strong>{{ businesses.length }}</strong>건</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 50px" class="text-center">No</th>
|
||||
<th style="width: 120px">사업코드</th>
|
||||
<th>사업명</th>
|
||||
<th style="width: 150px">발주처</th>
|
||||
<th style="width: 200px">계약기간</th>
|
||||
<th style="width: 80px" class="text-center">프로젝트</th>
|
||||
<th style="width: 80px" class="text-center">상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="isLoading">
|
||||
<td colspan="7" class="text-center py-4">
|
||||
<span class="spinner-border spinner-border-sm me-2"></span>로딩 중...
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else-if="businesses.length === 0">
|
||||
<td colspan="7" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2 mb-0">조회된 사업이 없습니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else v-for="(biz, idx) in businesses" :key="biz.businessId">
|
||||
<td class="text-center">{{ idx + 1 }}</td>
|
||||
<td><code>{{ biz.businessCode || '-' }}</code></td>
|
||||
<td>
|
||||
<NuxtLink :to="`/business/${biz.businessId}`" class="text-decoration-none">
|
||||
{{ biz.businessName }}
|
||||
</NuxtLink>
|
||||
</td>
|
||||
<td>{{ biz.clientName || '-' }}</td>
|
||||
<td>
|
||||
<span v-if="biz.contractStartDate">
|
||||
{{ formatDate(biz.contractStartDate) }} ~ {{ formatDate(biz.contractEndDate) || '진행중' }}
|
||||
</span>
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span class="badge bg-light text-dark">{{ biz.projectCount }}개</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span :class="getStatusBadgeClass(biz.businessStatus)">
|
||||
{{ getStatusText(biz.businessStatus) }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 사업 등록/수정 모달 -->
|
||||
<div class="modal fade" :class="{ show: showModal }" :style="{ display: showModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{{ isEdit ? '사업 수정' : '새 사업 등록' }}</h5>
|
||||
<button type="button" class="btn-close" @click="showModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">사업명 <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" v-model="form.businessName" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">사업코드</label>
|
||||
<input type="text" class="form-control" v-model="form.businessCode" placeholder="BIZ-2026-001" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">발주처</label>
|
||||
<input type="text" class="form-control" v-model="form.clientName" />
|
||||
</div>
|
||||
<div class="col-md-6" v-if="isEdit">
|
||||
<label class="form-label">상태</label>
|
||||
<select class="form-select" v-model="form.businessStatus">
|
||||
<option value="active">진행중</option>
|
||||
<option value="completed">완료</option>
|
||||
<option value="suspended">중단</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">계약 시작일</label>
|
||||
<input type="date" class="form-control" v-model="form.contractStartDate" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">계약 종료일</label>
|
||||
<input type="date" class="form-control" v-model="form.contractEndDate" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">설명</label>
|
||||
<textarea class="form-control" v-model="form.description" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="saveBusiness" :disabled="isSaving">
|
||||
<span v-if="isSaving">
|
||||
<span class="spinner-border spinner-border-sm me-1"></span>저장 중...
|
||||
</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>저장</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showModal"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Business {
|
||||
businessId: number
|
||||
businessName: string
|
||||
businessCode: string | null
|
||||
clientName: string | null
|
||||
contractStartDate: string | null
|
||||
contractEndDate: string | null
|
||||
businessStatus: string
|
||||
projectCount: number
|
||||
}
|
||||
|
||||
const businesses = ref<Business[]>([])
|
||||
const isLoading = ref(false)
|
||||
const showModal = ref(false)
|
||||
const isEdit = ref(false)
|
||||
const isSaving = ref(false)
|
||||
const editId = ref<number | null>(null)
|
||||
|
||||
const filter = ref({
|
||||
businessName: '',
|
||||
clientName: '',
|
||||
status: ''
|
||||
})
|
||||
|
||||
const form = ref({
|
||||
businessName: '',
|
||||
businessCode: '',
|
||||
clientName: '',
|
||||
contractStartDate: '',
|
||||
contractEndDate: '',
|
||||
businessStatus: 'active',
|
||||
description: ''
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
await loadBusinesses()
|
||||
})
|
||||
|
||||
async function loadBusinesses() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<{ businesses: Business[] }>('/api/business/list', {
|
||||
query: {
|
||||
businessName: filter.value.businessName || undefined,
|
||||
clientName: filter.value.clientName || undefined,
|
||||
status: filter.value.status || undefined
|
||||
}
|
||||
})
|
||||
businesses.value = res.businesses || []
|
||||
} catch (e) {
|
||||
console.error('Load businesses error:', e)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetSearch() {
|
||||
filter.value = {
|
||||
businessName: '',
|
||||
clientName: '',
|
||||
status: ''
|
||||
}
|
||||
loadBusinesses()
|
||||
}
|
||||
|
||||
function openCreateModal() {
|
||||
isEdit.value = false
|
||||
editId.value = null
|
||||
form.value = {
|
||||
businessName: '',
|
||||
businessCode: '',
|
||||
clientName: '',
|
||||
contractStartDate: '',
|
||||
contractEndDate: '',
|
||||
businessStatus: 'active',
|
||||
description: ''
|
||||
}
|
||||
showModal.value = true
|
||||
}
|
||||
|
||||
async function saveBusiness() {
|
||||
if (!form.value.businessName) {
|
||||
alert('사업명을 입력하세요.')
|
||||
return
|
||||
}
|
||||
|
||||
isSaving.value = true
|
||||
try {
|
||||
if (isEdit.value && editId.value) {
|
||||
await $fetch(`/api/business/${editId.value}/update`, {
|
||||
method: 'PUT',
|
||||
body: form.value
|
||||
})
|
||||
} else {
|
||||
await $fetch('/api/business/create', {
|
||||
method: 'POST',
|
||||
body: form.value
|
||||
})
|
||||
}
|
||||
showModal.value = false
|
||||
await loadBusinesses()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '저장에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function getStatusBadgeClass(status: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'active': 'badge bg-success',
|
||||
'completed': 'badge bg-secondary',
|
||||
'suspended': 'badge bg-danger'
|
||||
}
|
||||
return classes[status] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getStatusText(status: string) {
|
||||
const texts: Record<string, string> = {
|
||||
'active': '진행중',
|
||||
'completed': '완료',
|
||||
'suspended': '중단'
|
||||
}
|
||||
return texts[status] || status
|
||||
}
|
||||
|
||||
function formatDate(dateStr: string | null) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
</style>
|
||||
468
frontend/maintenance/[id].vue
Normal file
468
frontend/maintenance/[id].vue
Normal file
@@ -0,0 +1,468 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-tools me-2"></i>유지보수 업무 상세
|
||||
</h4>
|
||||
<div>
|
||||
<NuxtLink to="/maintenance" class="btn btn-outline-secondary me-2">
|
||||
<i class="bi bi-arrow-left me-1"></i>목록
|
||||
</NuxtLink>
|
||||
<button class="btn btn-danger" @click="deleteTask" v-if="!isEditing">
|
||||
<i class="bi bi-trash me-1"></i>삭제
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="text-center py-5">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="task" class="row">
|
||||
<!-- 왼쪽: 기본 정보 -->
|
||||
<div class="col-md-8">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>업무 정보</strong>
|
||||
<button
|
||||
class="btn btn-sm"
|
||||
:class="isEditing ? 'btn-secondary' : 'btn-outline-primary'"
|
||||
@click="toggleEdit"
|
||||
>
|
||||
<i :class="isEditing ? 'bi bi-x-lg' : 'bi bi-pencil'" class="me-1"></i>
|
||||
{{ isEditing ? '취소' : '수정' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- 보기 모드 -->
|
||||
<div v-if="!isEditing">
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4">
|
||||
<label class="text-muted small">프로젝트</label>
|
||||
<p class="mb-0">{{ task.projectName || '-' }}</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="text-muted small">요청일</label>
|
||||
<p class="mb-0">{{ formatDate(task.requestDate) }}</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="text-muted small">담당자</label>
|
||||
<p class="mb-0">{{ task.assigneeName || '미배정' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-8">
|
||||
<label class="text-muted small">제목</label>
|
||||
<p class="mb-0 fw-bold">{{ task.requestTitle }}</p>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="text-muted small">우선순위</label>
|
||||
<p class="mb-0">
|
||||
<span :class="getPriorityBadgeClass(task.priority)">{{ getPriorityText(task.priority) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="text-muted small">상태</label>
|
||||
<p class="mb-0">
|
||||
<span :class="getStatusBadgeClass(task.status)">{{ getStatusText(task.status) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="text-muted small">요청자</label>
|
||||
<p class="mb-0">{{ task.requesterName || '-' }} {{ task.requesterContact ? `(${task.requesterContact})` : '' }}</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="text-muted small">업무유형</label>
|
||||
<p class="mb-0">{{ getTaskTypeText(task.taskType) }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3" v-if="task.requestContent">
|
||||
<label class="text-muted small">요청 내용</label>
|
||||
<div class="border rounded p-3 bg-light" style="white-space: pre-wrap;">{{ task.requestContent }}</div>
|
||||
</div>
|
||||
<div class="mb-0" v-if="task.resolutionContent">
|
||||
<label class="text-muted small">처리 내용</label>
|
||||
<div class="border rounded p-3 bg-light" style="white-space: pre-wrap;">{{ task.resolutionContent }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 수정 모드 -->
|
||||
<div v-else>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">프로젝트</label>
|
||||
<select class="form-select" v-model="form.projectId">
|
||||
<option value="">선택 안함</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">{{ p.projectName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">요청일</label>
|
||||
<input type="date" class="form-control" v-model="form.requestDate" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">담당자</label>
|
||||
<select class="form-select" v-model="form.assigneeId">
|
||||
<option value="">미배정</option>
|
||||
<option v-for="e in employees" :key="e.employeeId" :value="e.employeeId">{{ e.employeeName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">제목</label>
|
||||
<input type="text" class="form-control" v-model="form.requestTitle" />
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">우선순위</label>
|
||||
<select class="form-select" v-model="form.priority">
|
||||
<option value="HIGH">높음</option>
|
||||
<option value="MEDIUM">보통</option>
|
||||
<option value="LOW">낮음</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">상태</label>
|
||||
<select class="form-select" v-model="form.status">
|
||||
<option value="PENDING">미진행</option>
|
||||
<option value="IN_PROGRESS">진행중</option>
|
||||
<option value="COMPLETED">완료</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">요청자명</label>
|
||||
<input type="text" class="form-control" v-model="form.requesterName" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">요청자 연락처</label>
|
||||
<input type="text" class="form-control" v-model="form.requesterContact" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">업무유형</label>
|
||||
<select class="form-select" v-model="form.taskType">
|
||||
<option value="GENERAL">일반</option>
|
||||
<option value="BUG">버그수정</option>
|
||||
<option value="ENHANCEMENT">기능개선</option>
|
||||
<option value="DATA">데이터</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">요청 내용</label>
|
||||
<textarea class="form-control" v-model="form.requestContent" rows="4"></textarea>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">처리 내용</label>
|
||||
<textarea class="form-control" v-model="form.resolutionContent" rows="4"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 text-end">
|
||||
<button class="btn btn-primary" @click="saveTask" :disabled="isSaving">
|
||||
<span v-if="isSaving"><span class="spinner-border spinner-border-sm me-1"></span>저장 중...</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>저장</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 오른쪽: 반영 상태 + 메타 -->
|
||||
<div class="col-md-4">
|
||||
<!-- 상태 변경 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><strong>상태 변경</strong></div>
|
||||
<div class="card-body">
|
||||
<div class="btn-group w-100" role="group">
|
||||
<button
|
||||
v-for="s in statusOptions"
|
||||
:key="s.value"
|
||||
class="btn"
|
||||
:class="task.status === s.value ? 'btn-primary' : 'btn-outline-secondary'"
|
||||
@click="changeStatus(s.value)"
|
||||
:disabled="isChangingStatus"
|
||||
>
|
||||
{{ s.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 반영 체크 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header"><strong>반영 현황</strong></div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span><i class="bi bi-server me-2"></i>개발서버 반영</span>
|
||||
<div>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="form-check-input me-2"
|
||||
:checked="!!task.devCompletedAt"
|
||||
@change="toggleDeploy('dev', $event)"
|
||||
/>
|
||||
<small class="text-muted">{{ formatDate(task.devCompletedAt) || '-' }}</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span><i class="bi bi-cloud me-2"></i>운영서버 반영</span>
|
||||
<div>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="form-check-input me-2"
|
||||
:checked="!!task.opsCompletedAt"
|
||||
@change="toggleDeploy('ops', $event)"
|
||||
/>
|
||||
<small class="text-muted">{{ formatDate(task.opsCompletedAt) || '-' }}</small>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
||||
<span><i class="bi bi-person-check me-2"></i>고객 확인</span>
|
||||
<div>
|
||||
<input
|
||||
type="checkbox"
|
||||
class="form-check-input me-2"
|
||||
:checked="!!task.clientConfirmedAt"
|
||||
@change="toggleDeploy('client', $event)"
|
||||
/>
|
||||
<small class="text-muted">{{ formatDate(task.clientConfirmedAt) || '-' }}</small>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 메타 정보 -->
|
||||
<div class="card">
|
||||
<div class="card-header"><strong>등록 정보</strong></div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">등록자</span>
|
||||
<span>{{ task.createdByName || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">등록일</span>
|
||||
<span>{{ formatDateTime(task.createdAt) }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">수정자</span>
|
||||
<span>{{ task.updatedByName || '-' }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">수정일</span>
|
||||
<span>{{ formatDateTime(task.updatedAt) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const taskId = computed(() => Number(route.params.id))
|
||||
|
||||
const task = ref<any>(null)
|
||||
const projects = ref<any[]>([])
|
||||
const employees = ref<any[]>([])
|
||||
const isLoading = ref(true)
|
||||
const isEditing = ref(false)
|
||||
const isSaving = ref(false)
|
||||
const isChangingStatus = ref(false)
|
||||
|
||||
const statusOptions = [
|
||||
{ value: 'PENDING', label: '미진행' },
|
||||
{ value: 'IN_PROGRESS', label: '진행중' },
|
||||
{ value: 'COMPLETED', label: '완료' }
|
||||
]
|
||||
|
||||
const form = ref({
|
||||
projectId: '',
|
||||
requestDate: '',
|
||||
requestTitle: '',
|
||||
requestContent: '',
|
||||
requesterName: '',
|
||||
requesterContact: '',
|
||||
taskType: 'GENERAL',
|
||||
priority: 'MEDIUM',
|
||||
status: 'PENDING',
|
||||
assigneeId: '',
|
||||
resolutionContent: '',
|
||||
devCompletedAt: '',
|
||||
opsCompletedAt: '',
|
||||
clientConfirmedAt: ''
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
await Promise.all([loadTask(), loadProjects(), loadEmployees()])
|
||||
})
|
||||
|
||||
async function loadTask() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<any>(`/api/maintenance/${taskId.value}/detail`)
|
||||
task.value = res.task
|
||||
} catch (e) {
|
||||
console.error('Load task error:', e)
|
||||
alert('업무 정보를 불러올 수 없습니다.')
|
||||
router.push('/maintenance')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<any>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
async function loadEmployees() {
|
||||
try {
|
||||
const res = await $fetch<any>('/api/employee/list')
|
||||
employees.value = res.employees || []
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
function toggleEdit() {
|
||||
if (!isEditing.value) {
|
||||
form.value = {
|
||||
projectId: task.value.projectId?.toString() || '',
|
||||
requestDate: task.value.requestDate?.split('T')[0] || '',
|
||||
requestTitle: task.value.requestTitle || '',
|
||||
requestContent: task.value.requestContent || '',
|
||||
requesterName: task.value.requesterName || '',
|
||||
requesterContact: task.value.requesterContact || '',
|
||||
taskType: task.value.taskType || 'GENERAL',
|
||||
priority: task.value.priority || 'MEDIUM',
|
||||
status: task.value.status || 'PENDING',
|
||||
assigneeId: task.value.assigneeId?.toString() || '',
|
||||
resolutionContent: task.value.resolutionContent || '',
|
||||
devCompletedAt: task.value.devCompletedAt?.split('T')[0] || '',
|
||||
opsCompletedAt: task.value.opsCompletedAt?.split('T')[0] || '',
|
||||
clientConfirmedAt: task.value.clientConfirmedAt?.split('T')[0] || ''
|
||||
}
|
||||
}
|
||||
isEditing.value = !isEditing.value
|
||||
}
|
||||
|
||||
async function saveTask() {
|
||||
isSaving.value = true
|
||||
try {
|
||||
await $fetch(`/api/maintenance/${taskId.value}/update`, {
|
||||
method: 'PUT',
|
||||
body: {
|
||||
projectId: form.value.projectId ? Number(form.value.projectId) : null,
|
||||
requestDate: form.value.requestDate,
|
||||
requestTitle: form.value.requestTitle,
|
||||
requestContent: form.value.requestContent,
|
||||
requesterName: form.value.requesterName,
|
||||
requesterContact: form.value.requesterContact,
|
||||
taskType: form.value.taskType,
|
||||
priority: form.value.priority,
|
||||
status: form.value.status,
|
||||
assigneeId: form.value.assigneeId ? Number(form.value.assigneeId) : null,
|
||||
resolutionContent: form.value.resolutionContent,
|
||||
devCompletedAt: form.value.devCompletedAt || null,
|
||||
opsCompletedAt: form.value.opsCompletedAt || null,
|
||||
clientConfirmedAt: form.value.clientConfirmedAt || null
|
||||
}
|
||||
})
|
||||
isEditing.value = false
|
||||
await loadTask()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '저장에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function changeStatus(status: string) {
|
||||
if (task.value.status === status) return
|
||||
isChangingStatus.value = true
|
||||
try {
|
||||
await $fetch(`/api/maintenance/${taskId.value}/status`, {
|
||||
method: 'PUT',
|
||||
body: { status }
|
||||
})
|
||||
task.value.status = status
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '상태 변경에 실패했습니다.')
|
||||
} finally {
|
||||
isChangingStatus.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function toggleDeploy(type: string, event: Event) {
|
||||
const checked = (event.target as HTMLInputElement).checked
|
||||
const now = new Date().toISOString()
|
||||
|
||||
const fieldMap: Record<string, string> = {
|
||||
'dev': 'devCompletedAt',
|
||||
'ops': 'opsCompletedAt',
|
||||
'client': 'clientConfirmedAt'
|
||||
}
|
||||
|
||||
try {
|
||||
await $fetch(`/api/maintenance/${taskId.value}/update`, {
|
||||
method: 'PUT',
|
||||
body: {
|
||||
...task.value,
|
||||
projectId: task.value.projectId,
|
||||
[fieldMap[type]]: checked ? now : null
|
||||
}
|
||||
})
|
||||
task.value[fieldMap[type]] = checked ? now : null
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '반영 상태 변경에 실패했습니다.')
|
||||
;(event.target as HTMLInputElement).checked = !checked
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteTask() {
|
||||
if (!confirm('정말 삭제하시겠습니까?')) return
|
||||
try {
|
||||
await $fetch(`/api/maintenance/${taskId.value}/delete`, { method: 'DELETE' })
|
||||
router.push('/maintenance')
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '삭제에 실패했습니다.')
|
||||
}
|
||||
}
|
||||
|
||||
function getPriorityBadgeClass(p: string) {
|
||||
return { 'HIGH': 'badge bg-danger', 'MEDIUM': 'badge bg-warning text-dark', 'LOW': 'badge bg-secondary' }[p] || 'badge bg-secondary'
|
||||
}
|
||||
function getPriorityText(p: string) {
|
||||
return { 'HIGH': '높음', 'MEDIUM': '보통', 'LOW': '낮음' }[p] || p
|
||||
}
|
||||
function getStatusBadgeClass(s: string) {
|
||||
return { 'PENDING': 'badge bg-secondary', 'IN_PROGRESS': 'badge bg-primary', 'COMPLETED': 'badge bg-success' }[s] || 'badge bg-secondary'
|
||||
}
|
||||
function getStatusText(s: string) {
|
||||
return { 'PENDING': '미진행', 'IN_PROGRESS': '진행중', 'COMPLETED': '완료' }[s] || s
|
||||
}
|
||||
function getTaskTypeText(t: string) {
|
||||
return { 'GENERAL': '일반', 'BUG': '버그수정', 'ENHANCEMENT': '기능개선', 'DATA': '데이터' }[t] || t
|
||||
}
|
||||
function formatDate(d: string | null) {
|
||||
if (!d) return ''
|
||||
return new Date(d).toISOString().split('T')[0]
|
||||
}
|
||||
function formatDateTime(d: string | null) {
|
||||
if (!d) return '-'
|
||||
const dt = new Date(d)
|
||||
return `${dt.getFullYear()}-${String(dt.getMonth()+1).padStart(2,'0')}-${String(dt.getDate()).padStart(2,'0')} ${String(dt.getHours()).padStart(2,'0')}:${String(dt.getMinutes()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
347
frontend/maintenance/index.vue
Normal file
347
frontend/maintenance/index.vue
Normal file
@@ -0,0 +1,347 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<!-- 헤더 -->
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-tools me-2"></i>유지보수 업무
|
||||
</h4>
|
||||
<div>
|
||||
<NuxtLink to="/maintenance/upload" class="btn btn-outline-primary me-2">
|
||||
<i class="bi bi-upload me-1"></i>일괄 등록
|
||||
</NuxtLink>
|
||||
<NuxtLink to="/maintenance/write" class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg me-1"></i>업무 등록
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 검색 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body py-2">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col-1 text-end"><label class="col-form-label">프로젝트</label></div>
|
||||
<div class="col-2">
|
||||
<select class="form-select form-select-sm" v-model="filter.projectId">
|
||||
<option value="">전체</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">
|
||||
{{ p.projectName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">제목</label></div>
|
||||
<div class="col-2">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control form-control-sm"
|
||||
v-model="filter.keyword"
|
||||
placeholder="제목, 내용, 요청자"
|
||||
@keyup.enter="loadTasks"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">상태</label></div>
|
||||
<div class="col-3">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="status" id="statusAll" value="" v-model="filter.status" @change="loadTasks">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusAll">전체</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusPending" value="PENDING" v-model="filter.status" @change="loadTasks">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusPending">미진행</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusProgress" value="IN_PROGRESS" v-model="filter.status" @change="loadTasks">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusProgress">진행중</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusCompleted" value="COMPLETED" v-model="filter.status" @change="loadTasks">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusCompleted">완료</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-2 align-items-center mt-1">
|
||||
<div class="col-1 text-end"><label class="col-form-label">우선순위</label></div>
|
||||
<div class="col-2">
|
||||
<select class="form-select form-select-sm" v-model="filter.priority">
|
||||
<option value="">전체</option>
|
||||
<option value="HIGH">높음</option>
|
||||
<option value="MEDIUM">보통</option>
|
||||
<option value="LOW">낮음</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">요청일</label></div>
|
||||
<div class="col-2">
|
||||
<input type="date" class="form-control form-control-sm" v-model="filter.startDate" />
|
||||
</div>
|
||||
<div class="col-auto px-1">~</div>
|
||||
<div class="col-2">
|
||||
<input type="date" class="form-control form-control-sm" v-model="filter.endDate" />
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-primary btn-sm me-1" @click="loadTasks">
|
||||
<i class="bi bi-search me-1"></i>조회
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @click="resetSearch">
|
||||
<i class="bi bi-arrow-counterclockwise"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 목록 -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>유지보수 업무 목록 총 <strong>{{ pagination.total }}</strong>건</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 50px" class="text-center">No</th>
|
||||
<th style="width: 100px">요청일</th>
|
||||
<th>제목</th>
|
||||
<th style="width: 120px">프로젝트</th>
|
||||
<th style="width: 80px">요청자</th>
|
||||
<th style="width: 70px" class="text-center">우선순위</th>
|
||||
<th style="width: 80px" class="text-center">상태</th>
|
||||
<th style="width: 80px">담당자</th>
|
||||
<th style="width: 50px" class="text-center" title="개발서버">개발</th>
|
||||
<th style="width: 50px" class="text-center" title="운영서버">운영</th>
|
||||
<th style="width: 50px" class="text-center" title="고객확인">확인</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="isLoading">
|
||||
<td colspan="11" class="text-center py-4">
|
||||
<span class="spinner-border spinner-border-sm me-2"></span>로딩 중...
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else-if="tasks.length === 0">
|
||||
<td colspan="11" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2 mb-0">조회된 업무가 없습니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else v-for="(task, idx) in tasks" :key="task.taskId">
|
||||
<td class="text-center">{{ (pagination.page - 1) * pagination.pageSize + idx + 1 }}</td>
|
||||
<td>{{ formatDate(task.requestDate) }}</td>
|
||||
<td>
|
||||
<NuxtLink :to="`/maintenance/${task.taskId}`" class="text-decoration-none">
|
||||
{{ task.requestTitle }}
|
||||
</NuxtLink>
|
||||
</td>
|
||||
<td>{{ task.projectName || '-' }}</td>
|
||||
<td>{{ task.requesterName || '-' }}</td>
|
||||
<td class="text-center">
|
||||
<span :class="getPriorityBadgeClass(task.priority)">
|
||||
{{ getPriorityText(task.priority) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span :class="getStatusBadgeClass(task.status)">
|
||||
{{ getStatusText(task.status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ task.assigneeName || '-' }}</td>
|
||||
<td class="text-center">
|
||||
<i v-if="task.devCompletedAt" class="bi bi-check-circle-fill text-success"></i>
|
||||
<i v-else class="bi bi-circle text-muted"></i>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<i v-if="task.opsCompletedAt" class="bi bi-check-circle-fill text-success"></i>
|
||||
<i v-else class="bi bi-circle text-muted"></i>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<i v-if="task.clientConfirmedAt" class="bi bi-check-circle-fill text-success"></i>
|
||||
<i v-else class="bi bi-circle text-muted"></i>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 페이지네이션 -->
|
||||
<div class="card-footer d-flex justify-content-between align-items-center" v-if="pagination.totalPages > 1">
|
||||
<small class="text-muted">
|
||||
전체 {{ pagination.total }}건 중 {{ (pagination.page - 1) * pagination.pageSize + 1 }} -
|
||||
{{ Math.min(pagination.page * pagination.pageSize, pagination.total) }}건
|
||||
</small>
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item" :class="{ disabled: pagination.page === 1 }">
|
||||
<a class="page-link" href="#" @click.prevent="goPage(pagination.page - 1)">이전</a>
|
||||
</li>
|
||||
<li
|
||||
class="page-item"
|
||||
v-for="p in visiblePages"
|
||||
:key="p"
|
||||
:class="{ active: p === pagination.page }"
|
||||
>
|
||||
<a class="page-link" href="#" @click.prevent="goPage(p)">{{ p }}</a>
|
||||
</li>
|
||||
<li class="page-item" :class="{ disabled: pagination.page === pagination.totalPages }">
|
||||
<a class="page-link" href="#" @click.prevent="goPage(pagination.page + 1)">다음</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Task {
|
||||
taskId: number
|
||||
projectId: number | null
|
||||
projectName: string | null
|
||||
requestDate: string
|
||||
requestTitle: string
|
||||
requesterName: string | null
|
||||
priority: string
|
||||
status: string
|
||||
assigneeId: number | null
|
||||
assigneeName: string | null
|
||||
devCompletedAt: string | null
|
||||
opsCompletedAt: string | null
|
||||
clientConfirmedAt: string | null
|
||||
}
|
||||
|
||||
interface Project {
|
||||
projectId: number
|
||||
projectName: string
|
||||
}
|
||||
|
||||
const tasks = ref<Task[]>([])
|
||||
const projects = ref<Project[]>([])
|
||||
const isLoading = ref(false)
|
||||
|
||||
const filter = ref({
|
||||
projectId: '',
|
||||
keyword: '',
|
||||
status: '',
|
||||
priority: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
})
|
||||
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
totalPages: 0
|
||||
})
|
||||
|
||||
const visiblePages = computed(() => {
|
||||
const pages: number[] = []
|
||||
const total = pagination.value.totalPages
|
||||
const current = pagination.value.page
|
||||
let start = Math.max(1, current - 2)
|
||||
let end = Math.min(total, current + 2)
|
||||
if (end - start < 4) {
|
||||
if (start === 1) end = Math.min(total, 5)
|
||||
else start = Math.max(1, total - 4)
|
||||
}
|
||||
for (let i = start; i <= end; i++) pages.push(i)
|
||||
return pages
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
await loadProjects()
|
||||
await loadTasks()
|
||||
})
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: Project[] }>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error('Load projects error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadTasks() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<any>('/api/maintenance/list', {
|
||||
query: {
|
||||
projectId: filter.value.projectId || undefined,
|
||||
keyword: filter.value.keyword || undefined,
|
||||
status: filter.value.status || undefined,
|
||||
priority: filter.value.priority || undefined,
|
||||
startDate: filter.value.startDate || undefined,
|
||||
endDate: filter.value.endDate || undefined,
|
||||
page: pagination.value.page,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
})
|
||||
tasks.value = res.tasks || []
|
||||
pagination.value.total = res.pagination?.total || 0
|
||||
pagination.value.totalPages = res.pagination?.totalPages || 0
|
||||
} catch (e) {
|
||||
console.error('Load tasks error:', e)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetSearch() {
|
||||
filter.value = {
|
||||
projectId: '',
|
||||
keyword: '',
|
||||
status: '',
|
||||
priority: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
}
|
||||
pagination.value.page = 1
|
||||
loadTasks()
|
||||
}
|
||||
|
||||
function goPage(page: number) {
|
||||
if (page < 1 || page > pagination.value.totalPages) return
|
||||
pagination.value.page = page
|
||||
loadTasks()
|
||||
}
|
||||
|
||||
function getPriorityBadgeClass(priority: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'HIGH': 'badge bg-danger',
|
||||
'MEDIUM': 'badge bg-warning text-dark',
|
||||
'LOW': 'badge bg-secondary'
|
||||
}
|
||||
return classes[priority] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getPriorityText(priority: string) {
|
||||
const texts: Record<string, string> = { 'HIGH': '높음', 'MEDIUM': '보통', 'LOW': '낮음' }
|
||||
return texts[priority] || priority
|
||||
}
|
||||
|
||||
function getStatusBadgeClass(status: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'PENDING': 'badge bg-secondary',
|
||||
'IN_PROGRESS': 'badge bg-primary',
|
||||
'COMPLETED': 'badge bg-success'
|
||||
}
|
||||
return classes[status] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getStatusText(status: string) {
|
||||
const texts: Record<string, string> = { 'PENDING': '미진행', 'IN_PROGRESS': '진행중', 'COMPLETED': '완료' }
|
||||
return texts[status] || status
|
||||
}
|
||||
|
||||
function formatDate(dateStr: string | null) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
251
frontend/maintenance/upload.vue
Normal file
251
frontend/maintenance/upload.vue
Normal file
@@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<NuxtLink to="/maintenance" class="text-decoration-none text-muted me-2"><i class="bi bi-arrow-left"></i></NuxtLink>
|
||||
<i class="bi bi-upload me-2"></i>유지보수 업무 일괄 등록
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<!-- Step 1: 파일 업로드 -->
|
||||
<div class="card mb-4" v-if="step === 1">
|
||||
<div class="card-header"><strong>Step 1. 파일 업로드</strong></div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">프로젝트 <span class="text-danger">*</span></label>
|
||||
<select class="form-select" v-model="projectId">
|
||||
<option value="">선택하세요</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">{{ p.projectName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">엑셀/CSV 파일 <span class="text-danger">*</span></label>
|
||||
<input type="file" class="form-control" @change="onFileChange" accept=".xlsx,.xls,.csv" ref="fileInput" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info mt-3">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
엑셀 파일의 첫 번째 행은 헤더여야 합니다. AI가 자동으로 컬럼을 매핑합니다.
|
||||
</div>
|
||||
<div class="mt-3">
|
||||
<button class="btn btn-primary" @click="uploadFile" :disabled="!projectId || !selectedFile || isUploading">
|
||||
<span v-if="isUploading"><span class="spinner-border spinner-border-sm me-1"></span>분석 중...</span>
|
||||
<span v-else><i class="bi bi-cloud-upload me-1"></i>업로드 및 분석</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 2: 파싱 결과 검토 -->
|
||||
<div class="card mb-4" v-if="step === 2">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>Step 2. 파싱 결과 검토</strong>
|
||||
<span class="text-muted">{{ uploadResult?.filename }} - {{ uploadResult?.totalRows }}건</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 40px" class="text-center">
|
||||
<input type="checkbox" v-model="selectAll" @change="toggleSelectAll" />
|
||||
</th>
|
||||
<th style="width: 40px" class="text-center">행</th>
|
||||
<th style="width: 100px">요청일</th>
|
||||
<th>요청 제목</th>
|
||||
<th style="width: 80px">유형</th>
|
||||
<th style="width: 80px">우선순위</th>
|
||||
<th style="width: 80px">요청자</th>
|
||||
<th style="width: 80px" class="text-center">상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(task, idx) in parsedTasks" :key="idx" :class="{ 'table-warning': task.isDuplicate }">
|
||||
<td class="text-center">
|
||||
<input type="checkbox" v-model="task.selected" :disabled="task.isDuplicate" />
|
||||
</td>
|
||||
<td class="text-center">{{ task.rowIndex }}</td>
|
||||
<td>
|
||||
<input type="date" class="form-control form-control-sm" v-model="task.requestDate" />
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control form-control-sm" v-model="task.requestTitle" />
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-select form-select-sm" v-model="task.taskType">
|
||||
<option value="bug">버그</option>
|
||||
<option value="feature">기능</option>
|
||||
<option value="inquiry">문의</option>
|
||||
<option value="other">기타</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-select form-select-sm" v-model="task.priority">
|
||||
<option value="high">높음</option>
|
||||
<option value="medium">중간</option>
|
||||
<option value="low">낮음</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>{{ task.requesterName || '-' }}</td>
|
||||
<td class="text-center">
|
||||
<span v-if="task.isDuplicate" class="badge bg-danger">중복</span>
|
||||
<span v-else class="badge bg-success">신규</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-between">
|
||||
<button class="btn btn-secondary" @click="step = 1">
|
||||
<i class="bi bi-arrow-left me-1"></i>이전
|
||||
</button>
|
||||
<div>
|
||||
<span class="me-3">선택: {{ selectedCount }}건 / 중복: {{ duplicateCount }}건</span>
|
||||
<button class="btn btn-primary" @click="bulkCreate" :disabled="selectedCount === 0 || isCreating">
|
||||
<span v-if="isCreating"><span class="spinner-border spinner-border-sm me-1"></span>등록 중...</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>{{ selectedCount }}건 등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Step 3: 완료 -->
|
||||
<div class="card" v-if="step === 3">
|
||||
<div class="card-body text-center py-5">
|
||||
<i class="bi bi-check-circle text-success display-1"></i>
|
||||
<h4 class="mt-3">등록 완료!</h4>
|
||||
<p class="text-muted">{{ createResult?.insertedCount }}건이 등록되었습니다.</p>
|
||||
<div class="mt-4">
|
||||
<NuxtLink to="/maintenance" class="btn btn-primary me-2">
|
||||
<i class="bi bi-list me-1"></i>목록으로
|
||||
</NuxtLink>
|
||||
<button class="btn btn-outline-secondary" @click="resetAll">
|
||||
<i class="bi bi-plus-lg me-1"></i>추가 등록
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Project { projectId: number; projectName: string }
|
||||
interface ParsedTask {
|
||||
rowIndex: number
|
||||
requestDate: string | null
|
||||
requestTitle: string
|
||||
requestContent: string | null
|
||||
requesterName: string | null
|
||||
requesterContact: string | null
|
||||
taskType: string
|
||||
priority: string
|
||||
resolutionContent: string | null
|
||||
isDuplicate: boolean
|
||||
selected: boolean
|
||||
}
|
||||
|
||||
const projects = ref<Project[]>([])
|
||||
const projectId = ref('')
|
||||
const selectedFile = ref<File | null>(null)
|
||||
const fileInput = ref<HTMLInputElement | null>(null)
|
||||
|
||||
const step = ref(1)
|
||||
const isUploading = ref(false)
|
||||
const isCreating = ref(false)
|
||||
|
||||
const uploadResult = ref<any>(null)
|
||||
const parsedTasks = ref<ParsedTask[]>([])
|
||||
const createResult = ref<any>(null)
|
||||
const selectAll = ref(true)
|
||||
|
||||
const selectedCount = computed(() => parsedTasks.value.filter(t => t.selected && !t.isDuplicate).length)
|
||||
const duplicateCount = computed(() => parsedTasks.value.filter(t => t.isDuplicate).length)
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) { router.push('/login'); return }
|
||||
await loadProjects()
|
||||
})
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: Project[] }>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
function onFileChange(e: Event) {
|
||||
const target = e.target as HTMLInputElement
|
||||
selectedFile.value = target.files?.[0] || null
|
||||
}
|
||||
|
||||
async function uploadFile() {
|
||||
if (!projectId.value || !selectedFile.value) return
|
||||
|
||||
isUploading.value = true
|
||||
try {
|
||||
const formData = new FormData()
|
||||
formData.append('file', selectedFile.value)
|
||||
formData.append('projectId', projectId.value)
|
||||
|
||||
const res = await $fetch<any>('/api/maintenance/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
|
||||
uploadResult.value = res
|
||||
parsedTasks.value = res.tasks.map((t: any) => ({ ...t, selected: !t.isDuplicate }))
|
||||
step.value = 2
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '파일 분석에 실패했습니다.')
|
||||
} finally {
|
||||
isUploading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSelectAll() {
|
||||
parsedTasks.value.forEach(t => {
|
||||
if (!t.isDuplicate) t.selected = selectAll.value
|
||||
})
|
||||
}
|
||||
|
||||
async function bulkCreate() {
|
||||
if (selectedCount.value === 0) return
|
||||
|
||||
isCreating.value = true
|
||||
try {
|
||||
const res = await $fetch<any>('/api/maintenance/bulk-create', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
projectId: Number(projectId.value),
|
||||
batchId: uploadResult.value.batchId,
|
||||
tasks: parsedTasks.value.filter(t => t.selected && !t.isDuplicate)
|
||||
}
|
||||
})
|
||||
createResult.value = res
|
||||
step.value = 3
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '등록에 실패했습니다.')
|
||||
} finally {
|
||||
isCreating.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetAll() {
|
||||
step.value = 1
|
||||
selectedFile.value = null
|
||||
uploadResult.value = null
|
||||
parsedTasks.value = []
|
||||
createResult.value = null
|
||||
if (fileInput.value) fileInput.value.value = ''
|
||||
}
|
||||
</script>
|
||||
172
frontend/maintenance/write.vue
Normal file
172
frontend/maintenance/write.vue
Normal file
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-tools me-2"></i>유지보수 업무 등록
|
||||
</h4>
|
||||
<NuxtLink to="/maintenance" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i>목록
|
||||
</NuxtLink>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">프로젝트</label>
|
||||
<select class="form-select" v-model="form.projectId">
|
||||
<option value="">선택 안함</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">
|
||||
{{ p.projectName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">요청일 <span class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" v-model="form.requestDate" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">담당자</label>
|
||||
<select class="form-select" v-model="form.assigneeId">
|
||||
<option value="">미배정</option>
|
||||
<option v-for="e in employees" :key="e.employeeId" :value="e.employeeId">
|
||||
{{ e.employeeName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">제목 <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" v-model="form.requestTitle" placeholder="업무 제목" />
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">우선순위</label>
|
||||
<select class="form-select" v-model="form.priority">
|
||||
<option value="HIGH">높음</option>
|
||||
<option value="MEDIUM">보통</option>
|
||||
<option value="LOW">낮음</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label">업무유형</label>
|
||||
<select class="form-select" v-model="form.taskType">
|
||||
<option value="GENERAL">일반</option>
|
||||
<option value="BUG">버그수정</option>
|
||||
<option value="ENHANCEMENT">기능개선</option>
|
||||
<option value="DATA">데이터</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">요청자명</label>
|
||||
<input type="text" class="form-control" v-model="form.requesterName" placeholder="요청자 이름" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">요청자 연락처</label>
|
||||
<input type="text" class="form-control" v-model="form.requesterContact" placeholder="전화번호 또는 이메일" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">내용</label>
|
||||
<textarea class="form-control" v-model="form.requestContent" rows="6" placeholder="업무 내용을 입력하세요"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer text-end">
|
||||
<button class="btn btn-primary" @click="save" :disabled="isSaving">
|
||||
<span v-if="isSaving">
|
||||
<span class="spinner-border spinner-border-sm me-1"></span>등록 중...
|
||||
</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Project { projectId: number; projectName: string }
|
||||
interface Employee { employeeId: number; employeeName: string }
|
||||
|
||||
const projects = ref<Project[]>([])
|
||||
const employees = ref<Employee[]>([])
|
||||
const isSaving = ref(false)
|
||||
|
||||
const form = ref({
|
||||
projectId: '',
|
||||
requestDate: new Date().toISOString().split('T')[0],
|
||||
requestTitle: '',
|
||||
requestContent: '',
|
||||
requesterName: '',
|
||||
requesterContact: '',
|
||||
taskType: 'GENERAL',
|
||||
priority: 'MEDIUM',
|
||||
assigneeId: ''
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
await loadProjects()
|
||||
await loadEmployees()
|
||||
})
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: Project[] }>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error('Load projects error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadEmployees() {
|
||||
try {
|
||||
const res = await $fetch<{ employees: Employee[] }>('/api/employee/list')
|
||||
employees.value = res.employees || []
|
||||
} catch (e) {
|
||||
console.error('Load employees error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (!form.value.requestTitle) {
|
||||
alert('제목을 입력하세요.')
|
||||
return
|
||||
}
|
||||
if (!form.value.requestDate) {
|
||||
alert('요청일을 선택하세요.')
|
||||
return
|
||||
}
|
||||
|
||||
isSaving.value = true
|
||||
try {
|
||||
const res = await $fetch<{ taskId: number }>('/api/maintenance/create', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
projectId: form.value.projectId ? Number(form.value.projectId) : null,
|
||||
requestDate: form.value.requestDate,
|
||||
requestTitle: form.value.requestTitle,
|
||||
requestContent: form.value.requestContent,
|
||||
requesterName: form.value.requesterName,
|
||||
requesterContact: form.value.requesterContact,
|
||||
taskType: form.value.taskType,
|
||||
priority: form.value.priority,
|
||||
assigneeId: form.value.assigneeId ? Number(form.value.assigneeId) : null
|
||||
}
|
||||
})
|
||||
router.push(`/maintenance/${res.taskId}`)
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '등록에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
437
frontend/meeting/[id].vue
Normal file
437
frontend/meeting/[id].vue
Normal file
@@ -0,0 +1,437 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4>
|
||||
<i class="bi bi-journal-text me-2"></i>
|
||||
{{ isEditing ? '회의록 수정' : '회의록 상세' }}
|
||||
</h4>
|
||||
<p class="text-muted mb-0">
|
||||
{{ meeting?.meetingTitle }}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<NuxtLink to="/meeting" class="btn btn-outline-secondary me-2">
|
||||
<i class="bi bi-arrow-left me-1"></i> 목록
|
||||
</NuxtLink>
|
||||
<button v-if="!isEditing" class="btn btn-primary" @click="isEditing = true">
|
||||
<i class="bi bi-pencil me-1"></i> 수정
|
||||
</button>
|
||||
<button v-if="!isEditing" class="btn btn-outline-danger ms-2" @click="deleteMeeting">
|
||||
<i class="bi bi-trash me-1"></i> 삭제
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isLoading" class="text-center py-5">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
<p class="mt-2 text-muted">로딩 중...</p>
|
||||
</div>
|
||||
|
||||
<div v-else-if="meeting" class="row">
|
||||
<!-- 왼쪽: 기본 정보 -->
|
||||
<div class="col-md-4">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<strong>기본 정보</strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">회의 제목</label>
|
||||
<input
|
||||
v-if="isEditing"
|
||||
type="text"
|
||||
class="form-control"
|
||||
v-model="form.meetingTitle"
|
||||
/>
|
||||
<p v-else class="form-control-plaintext">{{ meeting.meetingTitle }}</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">회의 유형</label>
|
||||
<div v-if="isEditing" class="btn-group w-100" role="group">
|
||||
<input type="radio" class="btn-check" id="type-project" value="PROJECT" v-model="form.meetingType" />
|
||||
<label class="btn btn-outline-primary" for="type-project">프로젝트</label>
|
||||
<input type="radio" class="btn-check" id="type-internal" value="INTERNAL" v-model="form.meetingType" />
|
||||
<label class="btn btn-outline-info" for="type-internal">내부업무</label>
|
||||
</div>
|
||||
<p v-else class="form-control-plaintext">
|
||||
<span :class="meeting.meetingType === 'PROJECT' ? 'badge bg-primary' : 'badge bg-info'">
|
||||
{{ meeting.meetingType === 'PROJECT' ? '프로젝트 회의' : '내부업무 회의' }}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" v-if="form.meetingType === 'PROJECT' || meeting.projectName">
|
||||
<label class="form-label">프로젝트</label>
|
||||
<select v-if="isEditing && form.meetingType === 'PROJECT'" class="form-select" v-model="form.projectId">
|
||||
<option value="">선택</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">{{ p.projectName }}</option>
|
||||
</select>
|
||||
<p v-else class="form-control-plaintext">{{ meeting.projectName || '-' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">회의 일자</label>
|
||||
<input v-if="isEditing" type="date" class="form-control" v-model="form.meetingDate" />
|
||||
<p v-else class="form-control-plaintext">{{ formatDate(meeting.meetingDate) }}</p>
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<label class="form-label">시작</label>
|
||||
<input v-if="isEditing" type="time" class="form-control" v-model="form.startTime" />
|
||||
<p v-else class="form-control-plaintext">{{ meeting.startTime?.slice(0,5) || '-' }}</p>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">종료</label>
|
||||
<input v-if="isEditing" type="time" class="form-control" v-model="form.endTime" />
|
||||
<p v-else class="form-control-plaintext">{{ meeting.endTime?.slice(0,5) || '-' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">장소</label>
|
||||
<input v-if="isEditing" type="text" class="form-control" v-model="form.location" />
|
||||
<p v-else class="form-control-plaintext">{{ meeting.location || '-' }}</p>
|
||||
</div>
|
||||
|
||||
<div class="mb-0">
|
||||
<label class="form-label">작성자</label>
|
||||
<p class="form-control-plaintext">{{ meeting.authorName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 참석자 -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>참석자 ({{ attendees.length }}명)</strong>
|
||||
<div v-if="isEditing">
|
||||
<button class="btn btn-sm btn-outline-primary me-1" @click="showEmployeeModal = true">
|
||||
<i class="bi bi-person-plus"></i>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-secondary" @click="addExternalAttendee">
|
||||
<i class="bi bi-person-plus"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li v-for="(att, idx) in displayAttendees" :key="idx" class="list-group-item d-flex justify-content-between">
|
||||
<div>
|
||||
<i :class="att.isExternal ? 'bi bi-person text-secondary' : 'bi bi-person-fill text-primary'" class="me-1"></i>
|
||||
{{ att.isExternal ? att.externalName : att.employeeName }}
|
||||
<small v-if="att.isExternal && att.externalCompany" class="text-muted">({{ att.externalCompany }})</small>
|
||||
<small v-if="!att.isExternal && att.company" class="text-muted">({{ att.company }})</small>
|
||||
</div>
|
||||
<button v-if="isEditing" class="btn btn-sm btn-link text-danger" @click="removeAttendee(idx)">
|
||||
<i class="bi bi-x-lg"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li v-if="displayAttendees.length === 0" class="list-group-item text-center text-muted">
|
||||
참석자 없음
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 오른쪽: 회의 내용 -->
|
||||
<div class="col-md-8">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">
|
||||
<strong>회의 내용</strong>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<textarea
|
||||
v-if="isEditing"
|
||||
class="form-control border-0 h-100"
|
||||
v-model="form.rawContent"
|
||||
style="min-height: 500px; resize: none;"
|
||||
></textarea>
|
||||
<div v-else class="p-3" style="min-height: 500px; white-space: pre-wrap;">{{ meeting.rawContent || '(내용 없음)' }}</div>
|
||||
</div>
|
||||
<div v-if="isEditing" class="card-footer d-flex justify-content-end">
|
||||
<button class="btn btn-secondary me-2" @click="cancelEdit">취소</button>
|
||||
<button class="btn btn-primary" @click="updateMeeting" :disabled="isSaving">
|
||||
<span v-if="isSaving">
|
||||
<span class="spinner-border spinner-border-sm me-1"></span>저장 중...
|
||||
</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>저장</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 직원 선택 모달 -->
|
||||
<div class="modal fade" :class="{ show: showEmployeeModal }" :style="{ display: showEmployeeModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">내부 참석자 추가</h5>
|
||||
<button type="button" class="btn-close" @click="showEmployeeModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text" class="form-control mb-3" v-model="employeeSearch" placeholder="이름 검색..." />
|
||||
<div style="max-height: 300px; overflow-y: auto;">
|
||||
<div v-for="emp in filteredEmployees" :key="emp.employeeId" class="form-check">
|
||||
<input class="form-check-input" type="checkbox" :id="`emp-${emp.employeeId}`" :value="emp.employeeId" v-model="selectedEmployeeIds" />
|
||||
<label class="form-check-label" :for="`emp-${emp.employeeId}`">
|
||||
{{ emp.employeeName }} <small class="text-muted">({{ emp.company }})</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showEmployeeModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="addSelectedEmployees">추가</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showEmployeeModal"></div>
|
||||
|
||||
<!-- 외부 참석자 모달 -->
|
||||
<div class="modal fade" :class="{ show: showExternalModal }" :style="{ display: showExternalModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">외부 참석자 추가</h5>
|
||||
<button type="button" class="btn-close" @click="showExternalModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">이름 <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" v-model="externalForm.name" />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">소속</label>
|
||||
<input type="text" class="form-control" v-model="externalForm.company" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showExternalModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="confirmExternalAttendee">추가</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showExternalModal"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const meetingId = computed(() => Number(route.params.id))
|
||||
|
||||
const meeting = ref<any>(null)
|
||||
const attendees = ref<any[]>([])
|
||||
const agendas = ref<any[]>([])
|
||||
const projects = ref<any[]>([])
|
||||
const employees = ref<any[]>([])
|
||||
|
||||
const isLoading = ref(true)
|
||||
const isEditing = ref(false)
|
||||
const isSaving = ref(false)
|
||||
|
||||
const form = ref({
|
||||
meetingTitle: '',
|
||||
meetingType: 'PROJECT' as 'PROJECT' | 'INTERNAL',
|
||||
projectId: '' as string | number,
|
||||
meetingDate: '',
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
location: '',
|
||||
rawContent: '',
|
||||
attendees: [] as any[]
|
||||
})
|
||||
|
||||
const displayAttendees = computed(() => isEditing.value ? form.value.attendees : attendees.value)
|
||||
|
||||
// 모달
|
||||
const showEmployeeModal = ref(false)
|
||||
const showExternalModal = ref(false)
|
||||
const employeeSearch = ref('')
|
||||
const selectedEmployeeIds = ref<number[]>([])
|
||||
const externalForm = ref({ name: '', company: '' })
|
||||
|
||||
const filteredEmployees = computed(() => {
|
||||
if (!employeeSearch.value) return employees.value
|
||||
return employees.value.filter(e => e.employeeName.toLowerCase().includes(employeeSearch.value.toLowerCase()))
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
|
||||
await Promise.all([loadMeeting(), loadProjects(), loadEmployees()])
|
||||
})
|
||||
|
||||
async function loadMeeting() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<any>(`/api/meeting/${meetingId.value}/detail`)
|
||||
meeting.value = res.meeting
|
||||
attendees.value = res.attendees || []
|
||||
agendas.value = res.agendas || []
|
||||
|
||||
// 폼 초기화
|
||||
form.value = {
|
||||
meetingTitle: res.meeting.meetingTitle,
|
||||
meetingType: res.meeting.meetingType,
|
||||
projectId: res.meeting.projectId || '',
|
||||
meetingDate: res.meeting.meetingDate?.split('T')[0] || '',
|
||||
startTime: res.meeting.startTime?.slice(0, 5) || '',
|
||||
endTime: res.meeting.endTime?.slice(0, 5) || '',
|
||||
location: res.meeting.location || '',
|
||||
rawContent: res.meeting.rawContent || '',
|
||||
attendees: res.attendees.map((a: any) => ({
|
||||
employeeId: a.employeeId,
|
||||
employeeName: a.employeeName,
|
||||
company: a.company,
|
||||
externalName: a.externalName,
|
||||
externalCompany: a.externalCompany,
|
||||
isExternal: a.isExternal
|
||||
}))
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Load meeting error:', e)
|
||||
alert('회의록을 불러올 수 없습니다.')
|
||||
router.push('/meeting')
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: any[] }>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadEmployees() {
|
||||
try {
|
||||
const res = await $fetch<{ employees: any[] }>('/api/employee/list')
|
||||
employees.value = res.employees || []
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
|
||||
function cancelEdit() {
|
||||
isEditing.value = false
|
||||
// 폼 초기화
|
||||
form.value.attendees = attendees.value.map(a => ({ ...a }))
|
||||
}
|
||||
|
||||
function addSelectedEmployees() {
|
||||
for (const empId of selectedEmployeeIds.value) {
|
||||
if (form.value.attendees.some(a => a.employeeId === empId)) continue
|
||||
const emp = employees.value.find(e => e.employeeId === empId)
|
||||
if (emp) {
|
||||
form.value.attendees.push({
|
||||
employeeId: emp.employeeId,
|
||||
employeeName: emp.employeeName,
|
||||
company: emp.company,
|
||||
isExternal: false
|
||||
})
|
||||
}
|
||||
}
|
||||
selectedEmployeeIds.value = []
|
||||
showEmployeeModal.value = false
|
||||
}
|
||||
|
||||
function addExternalAttendee() {
|
||||
externalForm.value = { name: '', company: '' }
|
||||
showExternalModal.value = true
|
||||
}
|
||||
|
||||
function confirmExternalAttendee() {
|
||||
if (!externalForm.value.name) {
|
||||
alert('이름을 입력하세요.')
|
||||
return
|
||||
}
|
||||
form.value.attendees.push({
|
||||
externalName: externalForm.value.name,
|
||||
externalCompany: externalForm.value.company,
|
||||
isExternal: true
|
||||
})
|
||||
showExternalModal.value = false
|
||||
}
|
||||
|
||||
function removeAttendee(idx: number) {
|
||||
form.value.attendees.splice(idx, 1)
|
||||
}
|
||||
|
||||
async function updateMeeting() {
|
||||
if (!form.value.meetingTitle) {
|
||||
alert('회의 제목을 입력하세요.')
|
||||
return
|
||||
}
|
||||
|
||||
isSaving.value = true
|
||||
try {
|
||||
await $fetch(`/api/meeting/${meetingId.value}/update`, {
|
||||
method: 'PUT',
|
||||
body: {
|
||||
meetingTitle: form.value.meetingTitle,
|
||||
meetingType: form.value.meetingType,
|
||||
projectId: form.value.projectId || undefined,
|
||||
meetingDate: form.value.meetingDate,
|
||||
startTime: form.value.startTime || undefined,
|
||||
endTime: form.value.endTime || undefined,
|
||||
location: form.value.location || undefined,
|
||||
rawContent: form.value.rawContent || undefined,
|
||||
attendees: form.value.attendees.map(a => ({
|
||||
employeeId: a.employeeId,
|
||||
externalName: a.externalName,
|
||||
externalCompany: a.externalCompany
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
isEditing.value = false
|
||||
await loadMeeting()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '수정에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteMeeting() {
|
||||
if (!confirm('정말 삭제하시겠습니까?')) return
|
||||
|
||||
try {
|
||||
await $fetch(`/api/meeting/${meetingId.value}/delete`, { method: 'DELETE' })
|
||||
router.push('/meeting')
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '삭제에 실패했습니다.')
|
||||
}
|
||||
}
|
||||
|
||||
function formatDate(dateStr: string) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
</style>
|
||||
300
frontend/meeting/index.vue
Normal file
300
frontend/meeting/index.vue
Normal file
@@ -0,0 +1,300 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<!-- 헤더 -->
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<i class="bi bi-journal-text me-2"></i>회의록
|
||||
</h4>
|
||||
<NuxtLink to="/meeting/write" class="btn btn-primary">
|
||||
<i class="bi bi-plus-lg me-1"></i>회의록 작성
|
||||
</NuxtLink>
|
||||
</div>
|
||||
|
||||
<!-- 검색 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body py-2">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col-1 text-end"><label class="col-form-label">제목</label></div>
|
||||
<div class="col-2">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control form-control-sm"
|
||||
v-model="filter.keyword"
|
||||
placeholder="제목 또는 내용"
|
||||
@keyup.enter="loadMeetings"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">유형</label></div>
|
||||
<div class="col-2">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="meetingType" id="typeAll" value="" v-model="filter.meetingType" @change="loadMeetings">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="typeAll">전체</label>
|
||||
<input type="radio" class="btn-check" name="meetingType" id="typeProject" value="PROJECT" v-model="filter.meetingType" @change="loadMeetings">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="typeProject">프로젝트</label>
|
||||
<input type="radio" class="btn-check" name="meetingType" id="typeInternal" value="INTERNAL" v-model="filter.meetingType" @change="loadMeetings">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="typeInternal">내부</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">프로젝트</label></div>
|
||||
<div class="col-2">
|
||||
<select class="form-select form-select-sm" v-model="filter.projectId">
|
||||
<option value="">전체</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">
|
||||
{{ p.projectName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-2 align-items-center mt-1">
|
||||
<div class="col-1 text-end"><label class="col-form-label">기간</label></div>
|
||||
<div class="col-2">
|
||||
<input type="date" class="form-control form-control-sm" v-model="filter.startDate" />
|
||||
</div>
|
||||
<div class="col-auto px-1">~</div>
|
||||
<div class="col-2">
|
||||
<input type="date" class="form-control form-control-sm" v-model="filter.endDate" />
|
||||
</div>
|
||||
<div class="col-1"></div>
|
||||
<div class="col-2">
|
||||
<button class="btn btn-primary btn-sm me-1" @click="loadMeetings">
|
||||
<i class="bi bi-search me-1"></i>조회
|
||||
</button>
|
||||
<button class="btn btn-outline-secondary btn-sm" @click="resetSearch">
|
||||
<i class="bi bi-arrow-counterclockwise"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 회의록 목록 -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span>회의록 목록 총 <strong>{{ pagination.total }}</strong>건</span>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 50px" class="text-center">No</th>
|
||||
<th style="width: 110px">회의일</th>
|
||||
<th>제목</th>
|
||||
<th style="width: 80px" class="text-center">유형</th>
|
||||
<th style="width: 150px">프로젝트</th>
|
||||
<th style="width: 80px" class="text-center">참석자</th>
|
||||
<th style="width: 100px">작성자</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="isLoading">
|
||||
<td colspan="7" class="text-center py-4">
|
||||
<span class="spinner-border spinner-border-sm me-2"></span>로딩 중...
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else-if="meetings.length === 0">
|
||||
<td colspan="7" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2 mb-0">조회된 회의록이 없습니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else v-for="(meeting, idx) in meetings" :key="meeting.meetingId">
|
||||
<td class="text-center">{{ (pagination.page - 1) * pagination.pageSize + idx + 1 }}</td>
|
||||
<td>
|
||||
{{ formatDate(meeting.meetingDate) }}
|
||||
<br v-if="meeting.startTime" />
|
||||
<small v-if="meeting.startTime" class="text-muted">
|
||||
{{ meeting.startTime?.slice(0, 5) }}
|
||||
<span v-if="meeting.endTime">~{{ meeting.endTime?.slice(0, 5) }}</span>
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
<NuxtLink :to="`/meeting/${meeting.meetingId}`" class="text-decoration-none">
|
||||
{{ meeting.meetingTitle }}
|
||||
</NuxtLink>
|
||||
<span v-if="meeting.aiStatus === 'CONFIRMED'" class="badge bg-success ms-1">AI</span>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span :class="getTypeBadgeClass(meeting.meetingType)">
|
||||
{{ getTypeText(meeting.meetingType) }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ meeting.projectName || '-' }}</td>
|
||||
<td class="text-center">
|
||||
<span class="badge bg-light text-dark">{{ meeting.attendeeCount }}명</span>
|
||||
</td>
|
||||
<td>{{ meeting.authorName }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 페이지네이션 -->
|
||||
<div class="card-footer d-flex justify-content-between align-items-center" v-if="pagination.totalPages > 1">
|
||||
<small class="text-muted">
|
||||
전체 {{ pagination.total }}건 중 {{ (pagination.page - 1) * pagination.pageSize + 1 }} -
|
||||
{{ Math.min(pagination.page * pagination.pageSize, pagination.total) }}건
|
||||
</small>
|
||||
<nav>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item" :class="{ disabled: pagination.page === 1 }">
|
||||
<a class="page-link" href="#" @click.prevent="goPage(pagination.page - 1)">이전</a>
|
||||
</li>
|
||||
<li
|
||||
class="page-item"
|
||||
v-for="p in visiblePages"
|
||||
:key="p"
|
||||
:class="{ active: p === pagination.page }"
|
||||
>
|
||||
<a class="page-link" href="#" @click.prevent="goPage(p)">{{ p }}</a>
|
||||
</li>
|
||||
<li class="page-item" :class="{ disabled: pagination.page === pagination.totalPages }">
|
||||
<a class="page-link" href="#" @click.prevent="goPage(pagination.page + 1)">다음</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Meeting {
|
||||
meetingId: number
|
||||
meetingTitle: string
|
||||
meetingDate: string
|
||||
startTime: string | null
|
||||
endTime: string | null
|
||||
meetingType: string
|
||||
projectId: number | null
|
||||
projectName: string | null
|
||||
attendeeCount: number
|
||||
authorId: number
|
||||
authorName: string
|
||||
aiStatus: string | null
|
||||
}
|
||||
|
||||
interface Project {
|
||||
projectId: number
|
||||
projectName: string
|
||||
}
|
||||
|
||||
const meetings = ref<Meeting[]>([])
|
||||
const projects = ref<Project[]>([])
|
||||
const isLoading = ref(false)
|
||||
|
||||
const filter = ref({
|
||||
keyword: '',
|
||||
meetingType: '',
|
||||
projectId: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
})
|
||||
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
pageSize: 20,
|
||||
total: 0,
|
||||
totalPages: 0
|
||||
})
|
||||
|
||||
const visiblePages = computed(() => {
|
||||
const pages: number[] = []
|
||||
const total = pagination.value.totalPages
|
||||
const current = pagination.value.page
|
||||
|
||||
let start = Math.max(1, current - 2)
|
||||
let end = Math.min(total, current + 2)
|
||||
|
||||
if (end - start < 4) {
|
||||
if (start === 1) end = Math.min(total, 5)
|
||||
else start = Math.max(1, total - 4)
|
||||
}
|
||||
|
||||
for (let i = start; i <= end; i++) pages.push(i)
|
||||
return pages
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
await loadProjects()
|
||||
await loadMeetings()
|
||||
})
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: Project[] }>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error('Load projects error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMeetings() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<any>('/api/meeting/list', {
|
||||
query: {
|
||||
keyword: filter.value.keyword || undefined,
|
||||
meetingType: filter.value.meetingType || undefined,
|
||||
projectId: filter.value.projectId || undefined,
|
||||
startDate: filter.value.startDate || undefined,
|
||||
endDate: filter.value.endDate || undefined,
|
||||
page: pagination.value.page,
|
||||
pageSize: pagination.value.pageSize
|
||||
}
|
||||
})
|
||||
meetings.value = res.meetings || []
|
||||
pagination.value.total = res.pagination?.total || 0
|
||||
pagination.value.totalPages = res.pagination?.totalPages || 0
|
||||
} catch (e) {
|
||||
console.error('Load meetings error:', e)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetSearch() {
|
||||
filter.value = {
|
||||
keyword: '',
|
||||
meetingType: '',
|
||||
projectId: '',
|
||||
startDate: '',
|
||||
endDate: ''
|
||||
}
|
||||
pagination.value.page = 1
|
||||
loadMeetings()
|
||||
}
|
||||
|
||||
function goPage(page: number) {
|
||||
if (page < 1 || page > pagination.value.totalPages) return
|
||||
pagination.value.page = page
|
||||
loadMeetings()
|
||||
}
|
||||
|
||||
function getTypeBadgeClass(type: string) {
|
||||
return type === 'PROJECT' ? 'badge bg-primary' : 'badge bg-info'
|
||||
}
|
||||
|
||||
function getTypeText(type: string) {
|
||||
return type === 'PROJECT' ? '프로젝트' : '내부'
|
||||
}
|
||||
|
||||
function formatDate(dateStr: string | null) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`
|
||||
}
|
||||
</script>
|
||||
389
frontend/meeting/write.vue
Normal file
389
frontend/meeting/write.vue
Normal file
@@ -0,0 +1,389 @@
|
||||
<template>
|
||||
<div>
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4><i class="bi bi-pencil-square me-2"></i>회의록 작성</h4>
|
||||
<p class="text-muted mb-0">회의 내용을 기록하세요</p>
|
||||
</div>
|
||||
<NuxtLink to="/meeting" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> 목록으로
|
||||
</NuxtLink>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- 왼쪽: 기본 정보 -->
|
||||
<div class="col-md-4">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header">
|
||||
<strong>기본 정보</strong>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">회의 제목 <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" v-model="form.meetingTitle" placeholder="회의 제목 입력" />
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">회의 유형 <span class="text-danger">*</span></label>
|
||||
<div class="btn-group w-100" role="group">
|
||||
<input type="radio" class="btn-check" id="type-project" value="PROJECT" v-model="form.meetingType" />
|
||||
<label class="btn btn-outline-primary" for="type-project">프로젝트 회의</label>
|
||||
<input type="radio" class="btn-check" id="type-internal" value="INTERNAL" v-model="form.meetingType" />
|
||||
<label class="btn btn-outline-info" for="type-internal">내부업무 회의</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3" v-if="form.meetingType === 'PROJECT'">
|
||||
<label class="form-label">프로젝트 <span class="text-danger">*</span></label>
|
||||
<select class="form-select" v-model="form.projectId">
|
||||
<option value="">프로젝트 선택</option>
|
||||
<option v-for="p in projects" :key="p.projectId" :value="p.projectId">
|
||||
{{ p.projectName }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">회의 일자 <span class="text-danger">*</span></label>
|
||||
<input type="date" class="form-control" v-model="form.meetingDate" />
|
||||
</div>
|
||||
|
||||
<div class="row mb-3">
|
||||
<div class="col-6">
|
||||
<label class="form-label">시작 시간</label>
|
||||
<input type="time" class="form-control" v-model="form.startTime" />
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<label class="form-label">종료 시간</label>
|
||||
<input type="time" class="form-control" v-model="form.endTime" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">장소</label>
|
||||
<input type="text" class="form-control" v-model="form.location" placeholder="회의 장소" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 참석자 -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>참석자</strong>
|
||||
<div>
|
||||
<button class="btn btn-sm btn-outline-primary me-1" @click="showEmployeeModal = true">
|
||||
<i class="bi bi-person-plus"></i> 내부
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-secondary" @click="addExternalAttendee">
|
||||
<i class="bi bi-person-plus"></i> 외부
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<ul class="list-group list-group-flush">
|
||||
<li
|
||||
v-for="(att, idx) in form.attendees"
|
||||
:key="idx"
|
||||
class="list-group-item d-flex justify-content-between align-items-center"
|
||||
>
|
||||
<div>
|
||||
<span v-if="att.employeeId">
|
||||
<i class="bi bi-person-fill text-primary me-1"></i>
|
||||
{{ att.employeeName }}
|
||||
<small class="text-muted">({{ att.company }})</small>
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="bi bi-person text-secondary me-1"></i>
|
||||
{{ att.externalName }}
|
||||
<small class="text-muted" v-if="att.externalCompany">({{ att.externalCompany }})</small>
|
||||
</span>
|
||||
</div>
|
||||
<button class="btn btn-sm btn-link text-danger" @click="removeAttendee(idx)">
|
||||
<i class="bi bi-x-lg"></i>
|
||||
</button>
|
||||
</li>
|
||||
<li v-if="form.attendees.length === 0" class="list-group-item text-center text-muted py-4">
|
||||
참석자를 추가하세요
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 오른쪽: 회의 내용 -->
|
||||
<div class="col-md-8">
|
||||
<div class="card h-100">
|
||||
<div class="card-header">
|
||||
<strong>회의 내용</strong>
|
||||
<small class="text-muted ms-2">(자유롭게 작성하면 AI가 정리해줍니다)</small>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<!-- TODO: Tiptap 에디터로 교체 -->
|
||||
<textarea
|
||||
class="form-control border-0 h-100"
|
||||
v-model="form.rawContent"
|
||||
placeholder="회의 내용을 자유롭게 작성하세요...
|
||||
|
||||
예시:
|
||||
- 김철수: 이번 주 진행 상황 공유
|
||||
- 프론트엔드 개발 80% 완료
|
||||
- 백엔드 API 연동 필요
|
||||
- 다음 주 목표: 테스트 환경 구축
|
||||
- 미결정: 배포 일정 (추후 논의)"
|
||||
style="min-height: 500px; resize: none;"
|
||||
></textarea>
|
||||
</div>
|
||||
<div class="card-footer d-flex justify-content-end">
|
||||
<button class="btn btn-secondary me-2" @click="router.push('/meeting')">취소</button>
|
||||
<button class="btn btn-primary" @click="saveMeeting" :disabled="isSaving">
|
||||
<span v-if="isSaving">
|
||||
<span class="spinner-border spinner-border-sm me-1"></span>저장 중...
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="bi bi-check-lg me-1"></i>저장
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 직원 선택 모달 -->
|
||||
<div class="modal fade" :class="{ show: showEmployeeModal }" :style="{ display: showEmployeeModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">내부 참석자 추가</h5>
|
||||
<button type="button" class="btn-close" @click="showEmployeeModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control mb-3"
|
||||
v-model="employeeSearch"
|
||||
placeholder="이름 검색..."
|
||||
/>
|
||||
<div style="max-height: 300px; overflow-y: auto;">
|
||||
<div
|
||||
v-for="emp in filteredEmployees"
|
||||
:key="emp.employeeId"
|
||||
class="form-check"
|
||||
>
|
||||
<input
|
||||
class="form-check-input"
|
||||
type="checkbox"
|
||||
:id="`emp-${emp.employeeId}`"
|
||||
:value="emp.employeeId"
|
||||
v-model="selectedEmployeeIds"
|
||||
/>
|
||||
<label class="form-check-label" :for="`emp-${emp.employeeId}`">
|
||||
{{ emp.employeeName }}
|
||||
<small class="text-muted">({{ emp.company }})</small>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showEmployeeModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="addSelectedEmployees">추가</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showEmployeeModal"></div>
|
||||
|
||||
<!-- 외부 참석자 입력 모달 -->
|
||||
<div class="modal fade" :class="{ show: showExternalModal }" :style="{ display: showExternalModal ? 'block' : 'none' }">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">외부 참석자 추가</h5>
|
||||
<button type="button" class="btn-close" @click="showExternalModal = false"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">이름 <span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" v-model="externalForm.name" />
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">소속</label>
|
||||
<input type="text" class="form-control" v-model="externalForm.company" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showExternalModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="confirmExternalAttendee">추가</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-backdrop fade show" v-if="showExternalModal"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Attendee {
|
||||
employeeId?: number
|
||||
employeeName?: string
|
||||
company?: string
|
||||
externalName?: string
|
||||
externalCompany?: string
|
||||
}
|
||||
|
||||
const projects = ref<any[]>([])
|
||||
const employees = ref<any[]>([])
|
||||
const isSaving = ref(false)
|
||||
|
||||
const form = ref({
|
||||
meetingTitle: '',
|
||||
meetingType: 'PROJECT' as 'PROJECT' | 'INTERNAL',
|
||||
projectId: '' as string | number,
|
||||
meetingDate: new Date().toISOString().split('T')[0],
|
||||
startTime: '',
|
||||
endTime: '',
|
||||
location: '',
|
||||
rawContent: '',
|
||||
attendees: [] as Attendee[]
|
||||
})
|
||||
|
||||
// 직원 선택 모달
|
||||
const showEmployeeModal = ref(false)
|
||||
const employeeSearch = ref('')
|
||||
const selectedEmployeeIds = ref<number[]>([])
|
||||
|
||||
const filteredEmployees = computed(() => {
|
||||
if (!employeeSearch.value) return employees.value
|
||||
const keyword = employeeSearch.value.toLowerCase()
|
||||
return employees.value.filter(e => e.employeeName.toLowerCase().includes(keyword))
|
||||
})
|
||||
|
||||
// 외부 참석자 모달
|
||||
const showExternalModal = ref(false)
|
||||
const externalForm = ref({ name: '', company: '' })
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
|
||||
await Promise.all([loadProjects(), loadEmployees()])
|
||||
})
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: any[] }>('/api/project/list')
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error('Load projects error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadEmployees() {
|
||||
try {
|
||||
const res = await $fetch<{ employees: any[] }>('/api/employee/list')
|
||||
employees.value = res.employees || []
|
||||
} catch (e) {
|
||||
console.error('Load employees error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
function addSelectedEmployees() {
|
||||
for (const empId of selectedEmployeeIds.value) {
|
||||
// 이미 추가된 경우 스킵
|
||||
if (form.value.attendees.some(a => a.employeeId === empId)) continue
|
||||
|
||||
const emp = employees.value.find(e => e.employeeId === empId)
|
||||
if (emp) {
|
||||
form.value.attendees.push({
|
||||
employeeId: emp.employeeId,
|
||||
employeeName: emp.employeeName,
|
||||
company: emp.company
|
||||
})
|
||||
}
|
||||
}
|
||||
selectedEmployeeIds.value = []
|
||||
showEmployeeModal.value = false
|
||||
}
|
||||
|
||||
function addExternalAttendee() {
|
||||
externalForm.value = { name: '', company: '' }
|
||||
showExternalModal.value = true
|
||||
}
|
||||
|
||||
function confirmExternalAttendee() {
|
||||
if (!externalForm.value.name) {
|
||||
alert('이름을 입력하세요.')
|
||||
return
|
||||
}
|
||||
form.value.attendees.push({
|
||||
externalName: externalForm.value.name,
|
||||
externalCompany: externalForm.value.company
|
||||
})
|
||||
showExternalModal.value = false
|
||||
}
|
||||
|
||||
function removeAttendee(idx: number) {
|
||||
form.value.attendees.splice(idx, 1)
|
||||
}
|
||||
|
||||
async function saveMeeting() {
|
||||
// 유효성 검사
|
||||
if (!form.value.meetingTitle) {
|
||||
alert('회의 제목을 입력하세요.')
|
||||
return
|
||||
}
|
||||
if (!form.value.meetingDate) {
|
||||
alert('회의 일자를 선택하세요.')
|
||||
return
|
||||
}
|
||||
if (form.value.meetingType === 'PROJECT' && !form.value.projectId) {
|
||||
alert('프로젝트를 선택하세요.')
|
||||
return
|
||||
}
|
||||
|
||||
isSaving.value = true
|
||||
try {
|
||||
const res = await $fetch<{ success: boolean; meetingId: number }>('/api/meeting/create', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
meetingTitle: form.value.meetingTitle,
|
||||
meetingType: form.value.meetingType,
|
||||
projectId: form.value.projectId || undefined,
|
||||
meetingDate: form.value.meetingDate,
|
||||
startTime: form.value.startTime || undefined,
|
||||
endTime: form.value.endTime || undefined,
|
||||
location: form.value.location || undefined,
|
||||
rawContent: form.value.rawContent || undefined,
|
||||
attendees: form.value.attendees.map(a => ({
|
||||
employeeId: a.employeeId,
|
||||
externalName: a.externalName,
|
||||
externalCompany: a.externalCompany
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
if (res.success) {
|
||||
router.push(`/meeting/${res.meetingId}`)
|
||||
}
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '저장에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
</style>
|
||||
@@ -3,118 +3,197 @@
|
||||
<AppHeader />
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="mb-4">
|
||||
<NuxtLink to="/project" class="text-decoration-none">
|
||||
<i class="bi bi-arrow-left me-1"></i> 목록으로
|
||||
</NuxtLink>
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h4 class="mb-0">
|
||||
<NuxtLink to="/project" class="text-decoration-none text-muted me-2"><i class="bi bi-arrow-left"></i></NuxtLink>
|
||||
<i class="bi bi-folder me-2"></i>{{ project?.projectName || '프로젝트 상세' }}
|
||||
</h4>
|
||||
<div v-if="project">
|
||||
<button class="btn btn-outline-primary me-2" @click="toggleEdit" v-if="!isEditing">
|
||||
<i class="bi bi-pencil me-1"></i>수정
|
||||
</button>
|
||||
<button class="btn btn-secondary me-2" @click="toggleEdit" v-else>취소</button>
|
||||
<button class="btn btn-primary" @click="saveProject" v-if="isEditing" :disabled="isSaving">
|
||||
<span v-if="isSaving"><span class="spinner-border spinner-border-sm me-1"></span></span>
|
||||
<i class="bi bi-check-lg me-1" v-else></i>저장
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="project">
|
||||
<!-- 프로젝트 기본 정보 -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">
|
||||
<i class="bi bi-folder me-2"></i>{{ project.projectName }}
|
||||
</h5>
|
||||
<span :class="getStatusBadgeClass(project.projectStatus)">
|
||||
{{ getStatusText(project.projectStatus) }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-4">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label text-muted">프로젝트 코드</label>
|
||||
<p class="mb-0"><code>{{ project.projectCode || '-' }}</code></p>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label text-muted">발주처</label>
|
||||
<p class="mb-0">{{ project.clientName || '-' }}</p>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label text-muted">계약금액</label>
|
||||
<p class="mb-0">{{ formatMoney(project.contractAmount) }}</p>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label text-muted">기간</label>
|
||||
<p class="mb-0">
|
||||
{{ project.startDate ? formatDate(project.startDate) : '-' }} ~
|
||||
{{ project.endDate ? formatDate(project.endDate) : '진행중' }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-12" v-if="project.projectDescription">
|
||||
<label class="form-label text-muted">설명</label>
|
||||
<p class="mb-0">{{ project.projectDescription }}</p>
|
||||
</div>
|
||||
<div v-if="isLoading" class="text-center py-5">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
</div>
|
||||
|
||||
<div v-else-if="project" class="row">
|
||||
<div class="col-md-8">
|
||||
<!-- 프로젝트 기본 정보 -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<strong>프로젝트 정보</strong>
|
||||
<span :class="getStatusBadgeClass(project.projectStatus)">{{ getStatusText(project.projectStatus) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PM/PL 이력 -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span><i class="bi bi-person-badge me-2"></i>PM/PL 담당 이력</span>
|
||||
<button class="btn btn-sm btn-primary" @click="showAssignModal = true">
|
||||
<i class="bi bi-plus"></i> 담당자 지정
|
||||
</button>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 80px">역할</th>
|
||||
<th>담당자</th>
|
||||
<th style="width: 200px">기간</th>
|
||||
<th>비고</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="m in managers" :key="m.historyId">
|
||||
<td>
|
||||
<span :class="m.roleType === 'PM' ? 'badge bg-primary' : 'badge bg-info'">
|
||||
{{ m.roleType }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ m.employeeName }}</td>
|
||||
<td>
|
||||
{{ formatDate(m.startDate) }} ~
|
||||
{{ m.endDate ? formatDate(m.endDate) : '현재' }}
|
||||
</td>
|
||||
<td>{{ m.changeReason || '-' }}</td>
|
||||
</tr>
|
||||
<tr v-if="managers.length === 0">
|
||||
<td colspan="4" class="text-center text-muted py-3">
|
||||
담당자 이력이 없습니다.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 참여자 통계 (주간보고 작성 기준) -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="bi bi-people me-2"></i>참여자 현황
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3" v-for="member in members" :key="member.employeeId">
|
||||
<div class="p-3 border rounded">
|
||||
<strong>{{ member.employeeName }}</strong>
|
||||
<br />
|
||||
<small class="text-muted">{{ member.reportCount }}건 보고</small>
|
||||
<div class="card-body">
|
||||
<!-- 보기 모드 -->
|
||||
<div v-if="!isEditing">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-4">
|
||||
<label class="text-muted small">프로젝트 코드</label>
|
||||
<p class="mb-0"><code>{{ project.projectCode || '-' }}</code></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="text-muted small">유형</label>
|
||||
<p class="mb-0"><span :class="getTypeBadgeClass(project.projectType)">{{ project.projectType || 'SI' }}</span></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="text-muted small">상태</label>
|
||||
<p class="mb-0"><span :class="getStatusBadgeClass(project.projectStatus)">{{ getStatusText(project.projectStatus) }}</span></p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="text-muted small">소속 사업</label>
|
||||
<p class="mb-0">
|
||||
<NuxtLink v-if="project.businessId" :to="`/business/${project.businessId}`" class="text-decoration-none">
|
||||
{{ project.businessName }}
|
||||
</NuxtLink>
|
||||
<span v-else>-</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="text-muted small">발주처</label>
|
||||
<p class="mb-0">{{ project.clientName || '-' }}</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="text-muted small">기간</label>
|
||||
<p class="mb-0">{{ project.startDate ? formatDate(project.startDate) : '-' }} ~ {{ project.endDate ? formatDate(project.endDate) : '진행중' }}</p>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="text-muted small">계약금액</label>
|
||||
<p class="mb-0">{{ formatMoney(project.contractAmount) }}</p>
|
||||
</div>
|
||||
<div class="col-12" v-if="project.projectDescription">
|
||||
<label class="text-muted small">설명</label>
|
||||
<p class="mb-0" style="white-space: pre-wrap;">{{ project.projectDescription }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 text-center text-muted py-3" v-if="members.length === 0">
|
||||
아직 주간보고를 작성한 참여자가 없습니다.
|
||||
<!-- 수정 모드 -->
|
||||
<div v-else>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-8">
|
||||
<label class="form-label">프로젝트명</label>
|
||||
<input type="text" class="form-control" v-model="form.projectName" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">유형</label>
|
||||
<select class="form-select" v-model="form.projectType">
|
||||
<option value="SI">SI</option>
|
||||
<option value="SM">SM</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">소속 사업</label>
|
||||
<select class="form-select" v-model="form.businessId">
|
||||
<option value="">선택 안함</option>
|
||||
<option v-for="b in businesses" :key="b.businessId" :value="b.businessId">{{ b.businessName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">발주처</label>
|
||||
<input type="text" class="form-control" v-model="form.clientName" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">시작일</label>
|
||||
<input type="date" class="form-control" v-model="form.startDate" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">종료일</label>
|
||||
<input type="date" class="form-control" v-model="form.endDate" />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">상태</label>
|
||||
<select class="form-select" v-model="form.projectStatus">
|
||||
<option value="ACTIVE">진행중</option>
|
||||
<option value="COMPLETED">완료</option>
|
||||
<option value="HOLD">보류</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">계약금액</label>
|
||||
<input type="number" class="form-control" v-model="form.contractAmount" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">설명</label>
|
||||
<textarea class="form-control" v-model="form.projectDescription" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center py-5" v-else-if="isLoading">
|
||||
<div class="spinner-border text-primary"></div>
|
||||
<!-- PM/PL 이력 -->
|
||||
<div class="card">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<span><i class="bi bi-person-badge me-2"></i>PM/PL 담당 이력</span>
|
||||
<button class="btn btn-sm btn-primary" @click="showAssignModal = true">
|
||||
<i class="bi bi-plus"></i> 담당자 지정
|
||||
</button>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 80px">역할</th>
|
||||
<th>담당자</th>
|
||||
<th style="width: 200px">기간</th>
|
||||
<th>비고</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="m in managers" :key="m.historyId">
|
||||
<td><span :class="m.roleType === 'PM' ? 'badge bg-primary' : 'badge bg-info'">{{ m.roleType }}</span></td>
|
||||
<td>{{ m.employeeName }}</td>
|
||||
<td>{{ formatDate(m.startDate) }} ~ {{ m.endDate ? formatDate(m.endDate) : '현재' }}</td>
|
||||
<td>{{ m.changeReason || '-' }}</td>
|
||||
</tr>
|
||||
<tr v-if="managers.length === 0">
|
||||
<td colspan="4" class="text-center text-muted py-3">담당자 이력이 없습니다.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<!-- 현재 담당자 -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-header"><strong>현재 담당자</strong></div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span>PM</span>
|
||||
<strong>{{ project.currentPm?.employeeName || '-' }}</strong>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span>PL</span>
|
||||
<strong>{{ project.currentPl?.employeeName || '-' }}</strong>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 등록 정보 -->
|
||||
<div class="card">
|
||||
<div class="card-header"><strong>등록 정보</strong></div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">등록일</span>
|
||||
<span>{{ formatDateTime(project.createdAt) }}</span>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between">
|
||||
<span class="text-muted">수정일</span>
|
||||
<span>{{ formatDateTime(project.updatedAt) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -138,9 +217,7 @@
|
||||
<label class="form-label">담당자 <span class="text-danger">*</span></label>
|
||||
<select class="form-select" v-model="assignForm.employeeId">
|
||||
<option value="">선택하세요</option>
|
||||
<option v-for="e in employees" :key="e.employeeId" :value="e.employeeId">
|
||||
{{ e.employeeName }} ({{ e.employeeEmail }})
|
||||
</option>
|
||||
<option v-for="e in employees" :key="e.employeeId" :value="e.employeeId">{{ e.employeeName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
@@ -154,9 +231,7 @@
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showAssignModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="assignManager">
|
||||
<i class="bi bi-check-lg me-1"></i> 지정
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" @click="assignManager"><i class="bi bi-check-lg me-1"></i>지정</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -170,13 +245,29 @@ const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
interface Business { businessId: number; businessName: string }
|
||||
|
||||
const project = ref<any>(null)
|
||||
const businesses = ref<Business[]>([])
|
||||
const managers = ref<any[]>([])
|
||||
const members = ref<any[]>([])
|
||||
const employees = ref<any[]>([])
|
||||
const isLoading = ref(true)
|
||||
const isEditing = ref(false)
|
||||
const isSaving = ref(false)
|
||||
const showAssignModal = ref(false)
|
||||
|
||||
const form = ref({
|
||||
projectName: '',
|
||||
projectType: 'SI',
|
||||
businessId: '',
|
||||
clientName: '',
|
||||
startDate: '',
|
||||
endDate: '',
|
||||
contractAmount: null as number | null,
|
||||
projectStatus: 'ACTIVE',
|
||||
projectDescription: ''
|
||||
})
|
||||
|
||||
const assignForm = ref({
|
||||
roleType: 'PM',
|
||||
employeeId: '',
|
||||
@@ -186,12 +277,8 @@ const assignForm = ref({
|
||||
|
||||
onMounted(async () => {
|
||||
const user = await fetchCurrentUser()
|
||||
if (!user) {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
|
||||
await Promise.all([loadProject(), loadEmployees()])
|
||||
if (!user) { router.push('/login'); return }
|
||||
await Promise.all([loadProject(), loadBusinesses(), loadEmployees()])
|
||||
})
|
||||
|
||||
async function loadProject() {
|
||||
@@ -199,14 +286,8 @@ async function loadProject() {
|
||||
try {
|
||||
const res = await $fetch<{ project: any }>(`/api/project/${route.params.id}/detail`)
|
||||
project.value = res.project
|
||||
|
||||
// PM/PL 이력 로드
|
||||
const mgRes = await $fetch<{ managers: any[] }>(`/api/project/${route.params.id}/manager-history`)
|
||||
managers.value = mgRes.managers || []
|
||||
|
||||
// 참여자 현황 (주간보고 기준) - 별도 API 필요하면 추가
|
||||
// 임시로 빈 배열
|
||||
members.value = []
|
||||
} catch (e: any) {
|
||||
alert('프로젝트를 불러오는데 실패했습니다.')
|
||||
router.push('/project')
|
||||
@@ -215,12 +296,53 @@ async function loadProject() {
|
||||
}
|
||||
}
|
||||
|
||||
async function loadBusinesses() {
|
||||
try {
|
||||
const res = await $fetch<{ businesses: Business[] }>('/api/business/list')
|
||||
businesses.value = res.businesses || []
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
async function loadEmployees() {
|
||||
try {
|
||||
const res = await $fetch<{ employees: any[] }>('/api/employee/list')
|
||||
employees.value = res.employees || []
|
||||
} catch (e) {
|
||||
console.error('Load employees error:', e)
|
||||
} catch (e) { console.error(e) }
|
||||
}
|
||||
|
||||
function toggleEdit() {
|
||||
if (!isEditing.value) {
|
||||
form.value = {
|
||||
projectName: project.value.projectName || '',
|
||||
projectType: project.value.projectType || 'SI',
|
||||
businessId: project.value.businessId?.toString() || '',
|
||||
clientName: project.value.clientName || '',
|
||||
startDate: project.value.startDate?.split('T')[0] || '',
|
||||
endDate: project.value.endDate?.split('T')[0] || '',
|
||||
contractAmount: project.value.contractAmount,
|
||||
projectStatus: project.value.projectStatus || 'ACTIVE',
|
||||
projectDescription: project.value.projectDescription || ''
|
||||
}
|
||||
}
|
||||
isEditing.value = !isEditing.value
|
||||
}
|
||||
|
||||
async function saveProject() {
|
||||
isSaving.value = true
|
||||
try {
|
||||
await $fetch(`/api/project/${route.params.id}/update`, {
|
||||
method: 'PUT',
|
||||
body: {
|
||||
...form.value,
|
||||
businessId: form.value.businessId ? Number(form.value.businessId) : null
|
||||
}
|
||||
})
|
||||
isEditing.value = false
|
||||
await loadProject()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || '저장에 실패했습니다.')
|
||||
} finally {
|
||||
isSaving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,49 +351,32 @@ async function assignManager() {
|
||||
alert('담당자와 시작일은 필수입니다.')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await $fetch(`/api/project/${route.params.id}/manager-assign`, {
|
||||
method: 'POST',
|
||||
body: assignForm.value
|
||||
})
|
||||
await $fetch(`/api/project/${route.params.id}/manager-assign`, { method: 'POST', body: assignForm.value })
|
||||
showAssignModal.value = false
|
||||
assignForm.value = {
|
||||
roleType: 'PM',
|
||||
employeeId: '',
|
||||
startDate: new Date().toISOString().split('T')[0],
|
||||
changeReason: ''
|
||||
}
|
||||
assignForm.value = { roleType: 'PM', employeeId: '', startDate: new Date().toISOString().split('T')[0], changeReason: '' }
|
||||
await loadProject()
|
||||
} catch (e: any) {
|
||||
alert(e.data?.message || e.message || '지정에 실패했습니다.')
|
||||
alert(e.data?.message || '지정에 실패했습니다.')
|
||||
}
|
||||
}
|
||||
|
||||
function getTypeBadgeClass(type: string) { return type === 'SM' ? 'badge bg-info' : 'badge bg-primary' }
|
||||
function getStatusBadgeClass(status: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'ACTIVE': 'badge bg-success',
|
||||
'COMPLETED': 'badge bg-secondary',
|
||||
'HOLD': 'badge bg-warning'
|
||||
}
|
||||
return classes[status] || 'badge bg-secondary'
|
||||
return { 'ACTIVE': 'badge bg-success', 'COMPLETED': 'badge bg-secondary', 'HOLD': 'badge bg-warning' }[status] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getStatusText(status: string) {
|
||||
const texts: Record<string, string> = {
|
||||
'ACTIVE': '진행중',
|
||||
'COMPLETED': '완료',
|
||||
'HOLD': '보류'
|
||||
}
|
||||
return texts[status] || status
|
||||
return { 'ACTIVE': '진행중', 'COMPLETED': '완료', 'HOLD': '보류' }[status] || status
|
||||
}
|
||||
|
||||
function formatDate(dateStr: string) {
|
||||
if (!dateStr) return ''
|
||||
const d = new Date(dateStr)
|
||||
return `${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,'0')}-${String(d.getDate()).padStart(2,'0')}`
|
||||
function formatDate(d: string) {
|
||||
if (!d) return ''
|
||||
return new Date(d).toISOString().split('T')[0]
|
||||
}
|
||||
function formatDateTime(d: string) {
|
||||
if (!d) return '-'
|
||||
const dt = new Date(d)
|
||||
return `${dt.getFullYear()}-${String(dt.getMonth()+1).padStart(2,'0')}-${String(dt.getDate()).padStart(2,'0')} ${String(dt.getHours()).padStart(2,'0')}:${String(dt.getMinutes()).padStart(2,'0')}`
|
||||
}
|
||||
|
||||
function formatMoney(amount: number | null) {
|
||||
if (!amount) return '-'
|
||||
return new Intl.NumberFormat('ko-KR').format(amount) + '원'
|
||||
@@ -279,7 +384,5 @@ function formatMoney(amount: number | null) {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.modal.show { background: rgba(0, 0, 0, 0.5); }
|
||||
</style>
|
||||
|
||||
@@ -4,45 +4,49 @@
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4><i class="bi bi-folder me-2"></i>프로젝트 관리</h4>
|
||||
<p class="text-muted mb-0">프로젝트(사업) 정보 관리</p>
|
||||
</div>
|
||||
<h4 class="mb-0"><i class="bi bi-folder me-2"></i>프로젝트 관리</h4>
|
||||
<button class="btn btn-primary" @click="showCreateModal = true">
|
||||
<i class="bi bi-plus-lg me-1"></i> 새 프로젝트
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 필터 -->
|
||||
<div class="card mb-4">
|
||||
<div class="card-body">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
v-model="searchKeyword"
|
||||
placeholder="프로젝트명 또는 코드 검색"
|
||||
/>
|
||||
<div class="card mb-3">
|
||||
<div class="card-body py-2">
|
||||
<div class="row g-2 align-items-center">
|
||||
<div class="col-1 text-end"><label class="col-form-label">프로젝트</label></div>
|
||||
<div class="col-2">
|
||||
<input type="text" class="form-control form-control-sm" v-model="searchKeyword" placeholder="프로젝트명/코드" @keyup.enter="loadProjects" />
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-select" v-model="filterType">
|
||||
<option value="">전체 유형</option>
|
||||
<div class="col-1 text-end"><label class="col-form-label">사업</label></div>
|
||||
<div class="col-2">
|
||||
<select class="form-select form-select-sm" v-model="filterBusinessId" @change="loadProjects">
|
||||
<option value="">전체</option>
|
||||
<option v-for="b in businesses" :key="b.businessId" :value="b.businessId">{{ b.businessName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-1 text-end"><label class="col-form-label">유형</label></div>
|
||||
<div class="col-1">
|
||||
<select class="form-select form-select-sm" v-model="filterType" @change="loadProjects">
|
||||
<option value="">전체</option>
|
||||
<option value="SI">SI</option>
|
||||
<option value="SM">SM</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<select class="form-select" v-model="filterStatus">
|
||||
<option value="">전체 상태</option>
|
||||
<option value="ACTIVE">진행중</option>
|
||||
<option value="COMPLETED">완료</option>
|
||||
<option value="HOLD">보류</option>
|
||||
</select>
|
||||
<div class="col-1 text-end"><label class="col-form-label">상태</label></div>
|
||||
<div class="col-2">
|
||||
<div class="btn-group" role="group">
|
||||
<input type="radio" class="btn-check" name="status" id="statusAll" value="" v-model="filterStatus" @change="loadProjects">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusAll">전체</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusActive" value="ACTIVE" v-model="filterStatus" @change="loadProjects">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusActive">진행</label>
|
||||
<input type="radio" class="btn-check" name="status" id="statusCompleted" value="COMPLETED" v-model="filterStatus" @change="loadProjects">
|
||||
<label class="btn btn-outline-secondary btn-sm" for="statusCompleted">완료</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 d-flex align-items-end">
|
||||
<button class="btn btn-outline-secondary" @click="loadProjects">
|
||||
<i class="bi bi-search me-1"></i> 조회
|
||||
<div class="col-1">
|
||||
<button class="btn btn-outline-secondary btn-sm" @click="resetSearch">
|
||||
<i class="bi bi-arrow-counterclockwise"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -51,56 +55,56 @@
|
||||
|
||||
<!-- 프로젝트 목록 -->
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
프로젝트 목록 총 <strong>{{ filteredProjects.length }}</strong>건
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<table class="table table-hover table-bordered mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th style="width: 120px">코드</th>
|
||||
<th style="width: 50px" class="text-center">No</th>
|
||||
<th style="width: 100px">코드</th>
|
||||
<th>프로젝트명</th>
|
||||
<th style="width: 80px">유형</th>
|
||||
<th>발주처</th>
|
||||
<th style="width: 120px">기간</th>
|
||||
<th style="width: 100px">상태</th>
|
||||
<th style="width: 80px">상세</th>
|
||||
<th style="width: 120px">사업</th>
|
||||
<th style="width: 60px" class="text-center">유형</th>
|
||||
<th style="width: 120px">발주처</th>
|
||||
<th style="width: 180px">기간</th>
|
||||
<th style="width: 80px" class="text-center">상태</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="project in filteredProjects" :key="project.projectId">
|
||||
<tr v-if="isLoading">
|
||||
<td colspan="8" class="text-center py-4">
|
||||
<span class="spinner-border spinner-border-sm me-2"></span>로딩 중...
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else-if="filteredProjects.length === 0">
|
||||
<td colspan="8" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2 mb-0">프로젝트가 없습니다.</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else v-for="(project, idx) in filteredProjects" :key="project.projectId">
|
||||
<td class="text-center">{{ idx + 1 }}</td>
|
||||
<td><code>{{ project.projectCode || '-' }}</code></td>
|
||||
<td>
|
||||
<strong>{{ project.projectName }}</strong>
|
||||
<NuxtLink :to="`/project/${project.projectId}`" class="text-decoration-none">
|
||||
{{ project.projectName }}
|
||||
</NuxtLink>
|
||||
</td>
|
||||
<td>
|
||||
<span :class="getTypeBadgeClass(project.projectType)">
|
||||
{{ project.projectType || 'SI' }}
|
||||
</span>
|
||||
<td>{{ project.businessName || '-' }}</td>
|
||||
<td class="text-center">
|
||||
<span :class="getTypeBadgeClass(project.projectType)">{{ project.projectType || 'SI' }}</span>
|
||||
</td>
|
||||
<td>{{ project.clientName || '-' }}</td>
|
||||
<td>
|
||||
<small v-if="project.startDate">
|
||||
{{ formatDate(project.startDate) }} ~
|
||||
<br />{{ formatDate(project.endDate) || '진행중' }}
|
||||
{{ formatDate(project.startDate) }} ~ {{ formatDate(project.endDate) || '진행중' }}
|
||||
</small>
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
<td>
|
||||
<span :class="getStatusBadgeClass(project.projectStatus)">
|
||||
{{ getStatusText(project.projectStatus) }}
|
||||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<NuxtLink
|
||||
:to="`/project/${project.projectId}`"
|
||||
class="btn btn-sm btn-outline-primary"
|
||||
>
|
||||
<i class="bi bi-eye"></i>
|
||||
</NuxtLink>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="filteredProjects.length === 0">
|
||||
<td colspan="7" class="text-center py-5 text-muted">
|
||||
<i class="bi bi-inbox display-4"></i>
|
||||
<p class="mt-2 mb-0">프로젝트가 없습니다.</p>
|
||||
<td class="text-center">
|
||||
<span :class="getStatusBadgeClass(project.projectStatus)">{{ getStatusText(project.projectStatus) }}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -130,19 +134,26 @@
|
||||
<option value="SM">SM (시스템 유지보수)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">소속 사업</label>
|
||||
<select class="form-select" v-model="newProject.businessId">
|
||||
<option value="">선택 안함</option>
|
||||
<option v-for="b in businesses" :key="b.businessId" :value="b.businessId">{{ b.businessName }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">발주처</label>
|
||||
<input type="text" class="form-control" v-model="newProject.clientName" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">계약금액 (원)</label>
|
||||
<input type="number" class="form-control" v-model="newProject.contractAmount" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">시작일</label>
|
||||
<input type="date" class="form-control" v-model="newProject.startDate" />
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">종료일</label>
|
||||
<input type="date" class="form-control" v-model="newProject.endDate" />
|
||||
</div>
|
||||
@@ -151,20 +162,12 @@
|
||||
<textarea class="form-control" v-model="newProject.projectDescription" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert alert-info mt-3 mb-0">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
프로젝트 코드는 자동 생성됩니다. (예: 2026-001)
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" @click="showCreateModal = false">취소</button>
|
||||
<button type="button" class="btn btn-primary" @click="createProject" :disabled="isCreating">
|
||||
<span v-if="isCreating">
|
||||
<span class="spinner-border spinner-border-sm me-1"></span>등록 중...
|
||||
</span>
|
||||
<span v-else>
|
||||
<i class="bi bi-check-lg me-1"></i>등록
|
||||
</span>
|
||||
<span v-if="isCreating"><span class="spinner-border spinner-border-sm me-1"></span>등록 중...</span>
|
||||
<span v-else><i class="bi bi-check-lg me-1"></i>등록</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -178,16 +181,22 @@
|
||||
const { fetchCurrentUser } = useAuth()
|
||||
const router = useRouter()
|
||||
|
||||
interface Business { businessId: number; businessName: string }
|
||||
|
||||
const projects = ref<any[]>([])
|
||||
const businesses = ref<Business[]>([])
|
||||
const searchKeyword = ref('')
|
||||
const filterBusinessId = ref('')
|
||||
const filterType = ref('')
|
||||
const filterStatus = ref('')
|
||||
const showCreateModal = ref(false)
|
||||
const isCreating = ref(false)
|
||||
const isLoading = ref(false)
|
||||
|
||||
const newProject = ref({
|
||||
projectName: '',
|
||||
projectType: 'SI',
|
||||
businessId: '',
|
||||
clientName: '',
|
||||
contractAmount: null as number | null,
|
||||
startDate: '',
|
||||
@@ -197,7 +206,6 @@ const newProject = ref({
|
||||
|
||||
const filteredProjects = computed(() => {
|
||||
let list = projects.value
|
||||
|
||||
if (searchKeyword.value) {
|
||||
const keyword = searchKeyword.value.toLowerCase()
|
||||
list = list.filter(p =>
|
||||
@@ -205,15 +213,12 @@ const filteredProjects = computed(() => {
|
||||
p.projectCode?.toLowerCase().includes(keyword)
|
||||
)
|
||||
}
|
||||
|
||||
if (filterType.value) {
|
||||
list = list.filter(p => p.projectType === filterType.value)
|
||||
}
|
||||
|
||||
if (filterStatus.value) {
|
||||
list = list.filter(p => p.projectStatus === filterStatus.value)
|
||||
}
|
||||
|
||||
return list
|
||||
})
|
||||
|
||||
@@ -223,30 +228,57 @@ onMounted(async () => {
|
||||
router.push('/login')
|
||||
return
|
||||
}
|
||||
|
||||
await loadBusinesses()
|
||||
await loadProjects()
|
||||
})
|
||||
|
||||
async function loadProjects() {
|
||||
async function loadBusinesses() {
|
||||
try {
|
||||
const res = await $fetch<{ projects: any[] }>('/api/project/list')
|
||||
const res = await $fetch<{ businesses: Business[] }>('/api/business/list')
|
||||
businesses.value = res.businesses || []
|
||||
} catch (e) {
|
||||
console.error('Load businesses error:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadProjects() {
|
||||
isLoading.value = true
|
||||
try {
|
||||
const res = await $fetch<{ projects: any[] }>('/api/project/list', {
|
||||
query: {
|
||||
businessId: filterBusinessId.value || undefined,
|
||||
status: filterStatus.value || undefined
|
||||
}
|
||||
})
|
||||
projects.value = res.projects || []
|
||||
} catch (e) {
|
||||
console.error('Load projects error:', e)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function resetSearch() {
|
||||
searchKeyword.value = ''
|
||||
filterBusinessId.value = ''
|
||||
filterType.value = ''
|
||||
filterStatus.value = ''
|
||||
loadProjects()
|
||||
}
|
||||
|
||||
async function createProject() {
|
||||
if (!newProject.value.projectName) {
|
||||
alert('프로젝트명은 필수입니다.')
|
||||
return
|
||||
}
|
||||
|
||||
isCreating.value = true
|
||||
try {
|
||||
await $fetch('/api/project/create', {
|
||||
method: 'POST',
|
||||
body: newProject.value
|
||||
body: {
|
||||
...newProject.value,
|
||||
businessId: newProject.value.businessId ? Number(newProject.value.businessId) : null
|
||||
}
|
||||
})
|
||||
showCreateModal.value = false
|
||||
resetNewProject()
|
||||
@@ -262,6 +294,7 @@ function resetNewProject() {
|
||||
newProject.value = {
|
||||
projectName: '',
|
||||
projectType: 'SI',
|
||||
businessId: '',
|
||||
clientName: '',
|
||||
contractAmount: null,
|
||||
startDate: '',
|
||||
@@ -278,19 +311,13 @@ function getStatusBadgeClass(status: string) {
|
||||
const classes: Record<string, string> = {
|
||||
'ACTIVE': 'badge bg-success',
|
||||
'COMPLETED': 'badge bg-secondary',
|
||||
'HOLD': 'badge bg-warning',
|
||||
'CANCELLED': 'badge bg-danger'
|
||||
'HOLD': 'badge bg-warning'
|
||||
}
|
||||
return classes[status] || 'badge bg-secondary'
|
||||
}
|
||||
|
||||
function getStatusText(status: string) {
|
||||
const texts: Record<string, string> = {
|
||||
'ACTIVE': '진행중',
|
||||
'COMPLETED': '완료',
|
||||
'HOLD': '보류',
|
||||
'CANCELLED': '취소'
|
||||
}
|
||||
const texts: Record<string, string> = { 'ACTIVE': '진행중', 'COMPLETED': '완료', 'HOLD': '보류' }
|
||||
return texts[status] || status
|
||||
}
|
||||
|
||||
@@ -302,7 +329,5 @@ function formatDate(dateStr: string) {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal.show {
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
.modal.show { background: rgba(0, 0, 0, 0.5); }
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user