This commit is contained in:
2026-01-04 20:58:47 +09:00
parent a87c11597a
commit 0660ed3973
37 changed files with 1723 additions and 885 deletions

View File

@@ -1,4 +1,4 @@
import { queryOne } from '../../../../utils/db'
import { query, queryOne } from '../../../../utils/db'
/**
* 주간보고 상세 조회
@@ -12,10 +12,13 @@ export default defineEventHandler(async (event) => {
const reportId = getRouterParam(event, 'id')
// 마스터 조회
const report = await queryOne<any>(`
SELECT r.*, p.project_name, p.project_code, e.employee_name as author_name
FROM wr_weekly_report_detail r
JOIN wr_project_info p ON r.project_id = p.project_id
SELECT
r.*,
e.employee_name as author_name,
e.employee_email as author_email
FROM wr_weekly_report r
JOIN wr_employee_info e ON r.author_id = e.employee_id
WHERE r.report_id = $1
`, [reportId])
@@ -24,25 +27,46 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 404, message: '보고서를 찾을 수 없습니다.' })
}
// 프로젝트별 실적 조회
const projects = await query<any>(`
SELECT
rp.detail_id,
rp.project_id,
p.project_code,
p.project_name,
rp.work_description,
rp.plan_description
FROM wr_weekly_report_project rp
JOIN wr_project_info p ON rp.project_id = p.project_id
WHERE rp.report_id = $1
ORDER BY rp.detail_id
`, [reportId])
return {
reportId: report.report_id,
projectId: report.project_id,
projectName: report.project_name,
projectCode: report.project_code,
authorId: report.author_id,
authorName: report.author_name,
reportYear: report.report_year,
reportWeek: report.report_week,
weekStartDate: report.week_start_date,
weekEndDate: report.week_end_date,
workDescription: report.work_description,
planDescription: report.plan_description,
issueDescription: report.issue_description,
remarkDescription: report.remark_description,
workHours: report.work_hours,
reportStatus: report.report_status,
submittedAt: report.submitted_at,
createdAt: report.created_at,
updatedAt: report.updated_at
report: {
reportId: report.report_id,
authorId: report.author_id,
authorName: report.author_name,
authorEmail: report.author_email,
reportYear: report.report_year,
reportWeek: report.report_week,
weekStartDate: report.week_start_date,
weekEndDate: report.week_end_date,
issueDescription: report.issue_description,
vacationDescription: report.vacation_description,
remarkDescription: report.remark_description,
reportStatus: report.report_status,
submittedAt: report.submitted_at,
createdAt: report.created_at,
updatedAt: report.updated_at
},
projects: projects.map((p: any) => ({
detailId: p.detail_id,
projectId: p.project_id,
projectCode: p.project_code,
projectName: p.project_name,
workDescription: p.work_description,
planDescription: p.plan_description
}))
}
})