feat: tkuser 통합 관리 서비스 + 전체 시스템 SSO 쿠키 인증 통합

- tkuser 서비스 신규 추가 (API + Web)
  - 사용자/권한/프로젝트/부서/작업자/작업장/설비/작업/휴가 통합 관리
  - 작업장 탭: 공장→작업장 드릴다운 네비게이션 + 구역지도 클릭 연동
  - 작업 탭: 공정(work_types)→작업(tasks) 계층 관리
  - 휴가 탭: 유형 관리 + 연차 배정(근로기준법 자동계산)
- 전 시스템 SSO 쿠키 인증으로 통합 (.technicalkorea.net 공유)
- System 2: 작업 이슈 리포트 기능 강화
- System 3: tkuser API 연동, 페이지 권한 체계 적용
- docker-compose에 tkuser-api, tkuser-web 서비스 추가
- ARCHITECTURE.md, DEPLOYMENT.md 문서 작성

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-02-12 13:45:52 +09:00
parent 6495b8af32
commit 733bb0cb35
96 changed files with 9721 additions and 825 deletions

View File

@@ -3,7 +3,7 @@ FROM node:18-alpine
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
RUN npm install --omit=dev
COPY . .

View File

@@ -4,6 +4,7 @@
const workIssueModel = require('../models/workIssueModel');
const imageUploadService = require('../services/imageUploadService');
const mProjectService = require('../services/mProjectService');
// ==================== 신고 카테고리 관리 ====================
@@ -26,7 +27,7 @@ exports.getAllCategories = (req, res) => {
exports.getCategoriesByType = (req, res) => {
const { type } = req.params;
if (!['nonconformity', 'safety'].includes(type)) {
if (!['nonconformity', 'safety', 'facility'].includes(type)) {
return res.status(400).json({ success: false, error: '유효하지 않은 카테고리 타입입니다.' });
}
@@ -283,16 +284,53 @@ exports.createReport = async (req, res) => {
...photoPaths
};
workIssueModel.createReport(reportData, (err, reportId) => {
workIssueModel.createReport(reportData, async (err, reportId) => {
if (err) {
console.error('신고 생성 실패:', err);
return res.status(500).json({ success: false, error: '신고 생성 실패' });
}
// 응답 먼저 반환 (사용자 대기 X)
res.status(201).json({
success: true,
message: '문제 신고가 등록되었습니다.',
data: { report_id: reportId }
});
// 부적합 유형이면 System 3(tkqc)으로 비동기 전달
try {
const categoryInfo = await new Promise((resolve, reject) => {
workIssueModel.getCategoryById(issue_category_id, (catErr, data) => {
if (catErr) reject(catErr); else resolve(data);
});
});
if (categoryInfo && categoryInfo.category_type === 'nonconformity') {
// 사진은 System 2에만 저장, URL 참조만 전달
const baseUrl = process.env.SYSTEM2_PUBLIC_URL || 'https://tkreport.technicalkorea.net';
const photoUrls = Object.values(photoPaths).filter(Boolean)
.map(p => `${baseUrl}/api/uploads/${p}`);
const descParts = [additional_description || categoryInfo.category_name];
if (photoUrls.length > 0) {
descParts.push('', '[첨부 사진]');
photoUrls.forEach((url, i) => descParts.push(`${i + 1}. ${url}`));
}
const result = await mProjectService.sendToMProject({
category: categoryInfo.category_name,
description: descParts.join('\n'),
reporter_name: req.user.name || req.user.username,
tk_issue_id: reportId,
photos: [] // 사진 복사 안 함 (URL 참조만)
});
if (result.success && result.mProjectId) {
workIssueModel.updateMProjectId(reportId, result.mProjectId, () => {});
}
}
} catch (e) {
console.error('System3 연동 실패 (신고는 정상 저장됨):', e.message);
}
});
} catch (error) {
console.error('신고 생성 에러:', error);

View File

@@ -198,6 +198,24 @@ const deleteItem = async (itemId, callback) => {
}
};
/**
* 카테고리 ID로 단건 조회
*/
const getCategoryById = async (categoryId, callback) => {
try {
const db = await getDb();
const [rows] = await db.query(
`SELECT category_id, category_type, category_name, description
FROM issue_report_categories
WHERE category_id = ?`,
[categoryId]
);
callback(null, rows[0] || null);
} catch (err) {
callback(err);
}
};
// ==================== 문제 신고 관리 ====================
// 한국 시간 유틸리티 import
@@ -736,6 +754,22 @@ const getStatusLogs = async (reportId, callback) => {
}
};
/**
* m_project_id 업데이트 (System 3 연동 후)
*/
const updateMProjectId = async (reportId, mProjectId, callback) => {
try {
const db = await getDb();
await db.query(
`UPDATE work_issue_reports SET m_project_id = ? WHERE report_id = ?`,
[mProjectId, reportId]
);
callback(null);
} catch (err) {
callback(err);
}
};
// ==================== 통계 ====================
/**
@@ -854,6 +888,7 @@ module.exports = {
// 카테고리
getAllCategories,
getCategoriesByType,
getCategoryById,
createCategory,
updateCategory,
deleteCategory,
@@ -872,6 +907,9 @@ module.exports = {
updateReport,
deleteReport,
// System 3 연동
updateMProjectId,
// 상태 관리
receiveReport,
assignReport,

View File

@@ -8,6 +8,7 @@
"dev": "node --watch index.js"
},
"dependencies": {
"async-retry": "^1.3.3",
"bcrypt": "^6.0.0",
"cors": "^2.8.5",
"dotenv": "^16.4.5",

View File

@@ -0,0 +1,300 @@
/* Common CSS - 공통 스타일 */
/* ========== 통일된 헤더 스타일 ========== */
.work-report-container {
min-height: 100vh;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.work-report-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
text-align: center;
padding: 2rem 1.5rem;
margin-bottom: 0;
}
.work-report-header h1 {
font-size: clamp(1.5rem, 4vw, 2.5rem);
font-weight: 700;
margin: 0 0 0.75rem 0;
text-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.3);
word-wrap: break-word;
overflow-wrap: break-word;
}
.work-report-header .subtitle {
font-size: clamp(0.875rem, 2vw, 1.1rem);
opacity: 0.9;
margin: 0;
font-weight: 300;
word-wrap: break-word;
overflow-wrap: break-word;
max-width: 90%;
margin-left: auto;
margin-right: auto;
}
.work-report-main {
background: #f8f9fa;
min-height: calc(100vh - 12rem);
padding-top: 2rem;
}
.back-button {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1.5rem;
background: rgba(255, 255, 255, 0.9);
color: #495057;
text-decoration: none;
border-radius: 0.5rem;
font-weight: 500;
margin: 0 1.5rem 1.5rem 1.5rem;
transition: all 0.3s ease;
box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.1);
white-space: nowrap;
}
.back-button:hover {
background: white;
color: #007bff;
transform: translateY(-0.0625rem);
box-shadow: 0 0.25rem 0.5rem rgba(0,0,0,0.15);
}
/* 반응형 헤더 */
@media (max-width: 768px) {
.work-report-header {
padding: 1.5rem 1rem;
}
.work-report-header h1 {
margin-bottom: 0.5rem;
}
.back-button {
margin: 0 1rem 1rem 1rem;
padding: 0.625rem 1.25rem;
font-size: 0.875rem;
}
}
@media (max-width: 480px) {
.work-report-header {
padding: 1.25rem 0.75rem;
}
.work-report-header .subtitle {
font-size: 0.8125rem;
}
.back-button {
margin: 0 0.75rem 0.75rem 0.75rem;
padding: 0.5rem 1rem;
font-size: 0.8125rem;
}
}
/* Reset and Base Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
line-height: 1.6;
color: #333;
background-color: #f8fafc;
}
/* Typography */
h1, h2, h3, h4, h5, h6 {
font-weight: 600;
line-height: 1.25;
margin-bottom: 0.5rem;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }
/* ========== 헤더 액션 버튼 ========== */
.header-actions {
display: flex;
align-items: center;
gap: 1rem;
margin-right: 1rem;
}
.dashboard-btn {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.6rem 1.2rem;
background: rgba(255, 255, 255, 0.15);
color: white;
border: 1px solid rgba(255, 255, 255, 0.3);
border-radius: 8px;
font-size: 0.9rem;
font-weight: 500;
text-decoration: none;
cursor: pointer;
transition: all 0.3s ease;
backdrop-filter: blur(10px);
}
.dashboard-btn:hover {
background: rgba(255, 255, 255, 0.25);
border-color: rgba(255, 255, 255, 0.5);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.dashboard-btn .btn-icon {
font-size: 1rem;
}
/* Buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.5rem 1rem;
border: none;
border-radius: 0.375rem;
font-size: 0.875rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
text-decoration: none;
}
.btn-primary {
background-color: #3b82f6;
color: white;
}
.btn-primary:hover {
background-color: #2563eb;
}
.btn-secondary {
background-color: #6b7280;
color: white;
}
.btn-secondary:hover {
background-color: #4b5563;
}
/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
/* Container */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 1rem;
}
/* Cards */
.card {
background: white;
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
border: 1px solid #e5e7eb;
}
.card-header {
padding: 1rem;
border-bottom: 1px solid #e5e7eb;
}
.card-body {
padding: 1rem;
}
/* Forms */
.form-group {
margin-bottom: 1rem;
}
.form-label {
display: block;
font-weight: 500;
margin-bottom: 0.25rem;
color: #374151;
}
.form-control {
width: 100%;
padding: 0.5rem 0.75rem;
border: 1px solid #d1d5db;
border-radius: 0.375rem;
font-size: 0.875rem;
transition: border-color 0.2s ease;
}
.form-control:focus {
outline: none;
border-color: #3b82f6;
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* Loading */
.loading {
display: inline-block;
width: 20px;
height: 20px;
border: 3px solid #f3f3f3;
border-top: 3px solid #3b82f6;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Responsive */
@media (max-width: 768px) {
.container {
padding: 0 0.5rem;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
}

View File

@@ -0,0 +1,477 @@
/* ✅ design-system.css - 한글 기반 모던 디자인 시스템 */
/* ========== 색상 시스템 ========== */
:root {
/* 주요 브랜드 색상 (하늘색 계열) */
--primary-50: #f0f9ff;
--primary-100: #e0f2fe;
--primary-200: #bae6fd;
--primary-300: #7dd3fc;
--primary-400: #38bdf8;
--primary-500: #0ea5e9;
--primary-600: #0284c7;
--primary-700: #0369a1;
--primary-800: #075985;
--primary-900: #0c4a6e;
/* 헤더 그라디언트 */
--header-gradient: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 50%, #7dd3fc 100%);
/* 보조 색상 */
--secondary-50: #f3e5f5;
--secondary-100: #e1bee7;
--secondary-200: #ce93d8;
--secondary-300: #ba68c8;
--secondary-400: #ab47bc;
--secondary-500: #9c27b0;
--secondary-600: #8e24aa;
--secondary-700: #7b1fa2;
--secondary-800: #6a1b9a;
--secondary-900: #4a148c;
/* 그레이 스케일 */
--gray-50: #fafafa;
--gray-100: #f5f5f5;
--gray-200: #eeeeee;
--gray-300: #e0e0e0;
--gray-400: #bdbdbd;
--gray-500: #9e9e9e;
--gray-600: #757575;
--gray-700: #616161;
--gray-800: #424242;
--gray-900: #212121;
/* 상태 색상 */
--success-50: #e8f5e8;
--success-500: #4caf50;
--success-700: #388e3c;
--warning-50: #fff8e1;
--warning-500: #ff9800;
--warning-700: #f57c00;
--error-50: #ffebee;
--error-500: #f44336;
--error-700: #d32f2f;
--info-50: #e1f5fe;
--info-500: #03a9f4;
--info-700: #0288d1;
/* 따뜻한 중성 색상 (베이지/크림) */
--warm-50: #fafaf9; /* 매우 밝은 크림 */
--warm-100: #f5f5f4; /* 밝은 크림 */
--warm-200: #e7e5e4; /* 베이지 */
--warm-300: #d6d3d1; /* 중간 베이지 */
--warm-400: #a8a29e; /* 진한 베이지 */
--warm-500: #78716c; /* 그레이 베이지 */
/* 부드러운 작업 상태 색상 (눈이 편한 톤) */
--status-success-bg: #dcfce7; /* 부드러운 초록 배경 */
--status-success-text: #16a34a; /* 부드러운 초록 텍스트 */
--status-info-bg: #e0f2fe; /* 부드러운 하늘색 배경 */
--status-info-text: #0284c7; /* 부드러운 하늘색 텍스트 */
--status-warning-bg: #fef3c7; /* 부드러운 노랑 배경 */
--status-warning-text: #ca8a04; /* 부드러운 노랑 텍스트 */
--status-error-bg: #fee2e2; /* 부드러운 빨강 배경 */
--status-error-text: #dc2626; /* 부드러운 빨강 텍스트 */
--status-critical-bg: #fecaca; /* 진한 빨강 배경 */
--status-critical-text: #b91c1c; /* 진한 빨강 텍스트 */
--status-vacation-bg: #fed7aa; /* 부드러운 주황 배경 */
--status-vacation-text: #ea580c; /* 부드러운 주황 텍스트 */
/* 배경 색상 */
--bg-primary: #ffffff;
--bg-secondary: #f8fafc;
--bg-tertiary: #f1f5f9;
--bg-overlay: rgba(0, 0, 0, 0.5);
/* 텍스트 색상 */
--text-primary: #1a202c;
--text-secondary: #4a5568;
--text-tertiary: #718096;
--text-inverse: #ffffff;
/* 경계선 */
--border-light: #e2e8f0;
--border-medium: #cbd5e0;
--border-dark: #a0aec0;
/* 그림자 */
--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
/* 반경 */
--radius-sm: 4px;
--radius-md: 8px;
--radius-lg: 12px;
--radius-xl: 16px;
--radius-full: 9999px;
/* 간격 */
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
--space-8: 32px;
--space-10: 40px;
--space-12: 48px;
--space-16: 64px;
--space-20: 80px;
--space-24: 96px;
/* 폰트 크기 */
--text-xs: 12px;
--text-sm: 14px;
--text-base: 16px;
--text-lg: 18px;
--text-xl: 20px;
--text-2xl: 24px;
--text-3xl: 30px;
--text-4xl: 36px;
--text-5xl: 48px;
/* 폰트 두께 */
--font-light: 300;
--font-normal: 400;
--font-medium: 500;
--font-semibold: 600;
--font-bold: 700;
--font-extrabold: 800;
/* 애니메이션 */
--transition-fast: 150ms ease-in-out;
--transition-normal: 250ms ease-in-out;
--transition-slow: 350ms ease-in-out;
}
/* ========== 기본 리셋 ========== */
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', system-ui, sans-serif;
font-size: var(--text-base);
line-height: 1.6;
color: var(--text-primary);
background-color: var(--bg-secondary);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* ========== 타이포그래피 ========== */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }
.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-inverse { color: var(--text-inverse); }
/* ========== 카드 컴포넌트 ========== */
.card {
background: var(--bg-primary);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
border: 1px solid var(--border-light);
transition: var(--transition-normal);
}
.card:hover {
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.card-header {
padding: var(--space-6);
border-bottom: 1px solid var(--border-light);
}
.card-body {
padding: var(--space-6);
}
.card-footer {
padding: var(--space-6);
border-top: 1px solid var(--border-light);
background: var(--bg-tertiary);
border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
/* ========== 버튼 컴포넌트 ========== */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: var(--space-2);
padding: var(--space-3) var(--space-4);
font-size: var(--text-sm);
font-weight: var(--font-medium);
border-radius: var(--radius-md);
border: none;
cursor: pointer;
transition: var(--transition-fast);
text-decoration: none;
white-space: nowrap;
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.btn-primary {
background: var(--primary-500);
color: var(--text-inverse);
}
.btn-primary:hover:not(:disabled) {
background: var(--primary-600);
transform: translateY(-1px);
box-shadow: var(--shadow-md);
}
.btn-secondary {
background: var(--gray-100);
color: var(--text-primary);
border: 1px solid var(--border-medium);
}
.btn-secondary:hover:not(:disabled) {
background: var(--gray-200);
}
.btn-success {
background: var(--success-500);
color: var(--text-inverse);
}
.btn-success:hover:not(:disabled) {
background: var(--success-700);
}
.btn-warning {
background: var(--warning-500);
color: var(--text-inverse);
}
.btn-warning:hover:not(:disabled) {
background: var(--warning-700);
}
.btn-error {
background: var(--error-500);
color: var(--text-inverse);
}
.btn-error:hover:not(:disabled) {
background: var(--error-700);
}
.btn-sm {
padding: var(--space-2) var(--space-3);
font-size: var(--text-xs);
}
.btn-lg {
padding: var(--space-4) var(--space-6);
font-size: var(--text-lg);
}
/* ========== 배지 컴포넌트 ========== */
.badge {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: var(--space-1) var(--space-2);
font-size: var(--text-xs);
font-weight: var(--font-medium);
border-radius: var(--radius-full);
white-space: nowrap;
}
.badge-primary {
background: var(--primary-100);
color: var(--primary-800);
}
.badge-success {
background: var(--success-50);
color: var(--success-700);
}
.badge-warning {
background: var(--warning-50);
color: var(--warning-700);
}
.badge-error {
background: var(--error-50);
color: var(--error-700);
}
.badge-gray {
background: var(--gray-100);
color: var(--gray-700);
}
/* ========== 상태 표시기 ========== */
.status-dot {
display: inline-block;
width: 8px;
height: 8px;
border-radius: var(--radius-full);
margin-right: var(--space-2);
}
.status-dot.active {
background: var(--success-500);
box-shadow: 0 0 0 2px var(--success-100);
}
.status-dot.inactive {
background: var(--gray-400);
}
.status-dot.warning {
background: var(--warning-500);
box-shadow: 0 0 0 2px var(--warning-100);
}
.status-dot.error {
background: var(--error-500);
box-shadow: 0 0 0 2px var(--error-100);
}
/* ========== 그리드 시스템 ========== */
.grid {
display: grid;
gap: var(--space-6);
}
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) {
.grid-cols-2,
.grid-cols-3,
.grid-cols-4 {
grid-template-columns: 1fr;
}
}
/* ========== 플렉스 유틸리티 ========== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
/* ========== 간격 유틸리티 ========== */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.m-1 { margin: var(--space-1); }
.m-2 { margin: var(--space-2); }
.m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); }
.m-6 { margin: var(--space-6); }
.m-8 { margin: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
/* ========== 반응형 유틸리티 ========== */
@media (max-width: 640px) {
.sm\:hidden { display: none; }
.sm\:text-sm { font-size: var(--text-sm); }
.sm\:p-4 { padding: var(--space-4); }
}
@media (max-width: 768px) {
.md\:hidden { display: none; }
.md\:flex-col { flex-direction: column; }
}
@media (max-width: 1024px) {
.lg\:hidden { display: none; }
}
/* ========== 애니메이션 ========== */
.fade-in {
animation: fadeIn var(--transition-normal) ease-in-out;
}
.slide-up {
animation: slideUp var(--transition-normal) ease-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes slideUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ========== 로딩 스피너 ========== */
.spinner {
width: 20px;
height: 20px;
border: 2px solid var(--gray-200);
border-top: 2px solid var(--primary-500);
border-radius: var(--radius-full);
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -2,7 +2,7 @@
* 신고 상세 페이지 JavaScript
*/
const API_BASE = window.API_BASE_URL || 'http://localhost:20005/api';
const API_BASE = window.API_BASE_URL || 'http://localhost:30005/api';
let reportId = null;
let reportData = null;

View File

@@ -4,7 +4,7 @@
*/
// API 설정
const API_BASE = window.API_BASE_URL || 'http://localhost:20005/api';
const API_BASE = window.API_BASE_URL || 'http://localhost:30005/api';
// 상태 변수
let selectedFactoryId = null;
@@ -175,7 +175,7 @@ async function loadMapImage() {
if (data.success && data.data) {
const selectedCategory = data.data.find(c => c.category_id == selectedFactoryId);
if (selectedCategory && selectedCategory.layout_image) {
const baseUrl = (window.API_BASE_URL || 'http://localhost:20005').replace('/api', '');
const baseUrl = (window.API_BASE_URL || 'http://localhost:30005').replace('/api', '');
const fullImageUrl = selectedCategory.layout_image.startsWith('http')
? selectedCategory.layout_image
: `${baseUrl}${selectedCategory.layout_image}`;

View File

@@ -3,7 +3,7 @@
* category_type=safety 고정 필터
*/
const API_BASE = window.API_BASE_URL || 'http://localhost:20005/api';
const API_BASE = window.API_BASE_URL || 'http://localhost:30005/api';
const CATEGORY_TYPE = 'safety';
// 상태 한글 변환
@@ -110,7 +110,7 @@ function renderIssues(issues) {
return;
}
const baseUrl = (window.API_BASE_URL || 'http://localhost:20005').replace('/api', '');
const baseUrl = (window.API_BASE_URL || 'http://localhost:30005').replace('/api', '');
issueList.innerHTML = issues.map(issue => {
const reportDate = new Date(issue.report_date).toLocaleString('ko-KR', {

View File

@@ -3,16 +3,17 @@
*/
// API 설정
const API_BASE = window.API_BASE_URL || 'http://localhost:20005/api';
const API_BASE = window.API_BASE_URL || 'http://localhost:30005/api';
// 상태 변수
let selectedFactoryId = null;
let selectedWorkplaceId = null;
let selectedWorkplaceName = null;
let selectedType = null; // 'nonconformity' | 'safety'
let selectedType = null; // 'nonconformity' | 'safety' | 'facility'
let selectedCategoryId = null;
let selectedCategoryName = null;
let selectedItemId = null;
let customItemName = null;
let selectedTbmSessionId = null;
let selectedVisitRequestId = null;
let photos = [null, null, null, null, null];
@@ -166,10 +167,9 @@ async function loadMapImage() {
if (data.success && data.data) {
const selectedCategory = data.data.find(c => c.category_id == selectedFactoryId);
if (selectedCategory && selectedCategory.layout_image) {
const baseUrl = (window.API_BASE_URL || 'http://localhost:20005').replace('/api', '');
const fullImageUrl = selectedCategory.layout_image.startsWith('http')
? selectedCategory.layout_image
: `${baseUrl}${selectedCategory.layout_image}`;
: selectedCategory.layout_image;
canvasImage = new Image();
canvasImage.onload = () => renderMap();
@@ -251,7 +251,7 @@ function renderMap() {
ctx.fillRect(0, 0, canvas.width, canvas.height);
// 배치도 이미지
if (canvasImage && canvasImage.complete) {
if (canvasImage && canvasImage.complete && canvasImage.naturalWidth > 0) {
const scale = Math.min(canvas.width / canvasImage.width, canvas.height / canvasImage.height);
const x = (canvas.width - canvasImage.width * scale) / 2;
const y = (canvas.height - canvasImage.height * scale) / 2;
@@ -587,6 +587,14 @@ function renderItems(items) {
btn.onclick = () => onItemSelect(item, btn);
grid.appendChild(btn);
});
// 직접 입력 버튼 추가
const customBtn = document.createElement('button');
customBtn.type = 'button';
customBtn.className = 'item-btn custom-input-btn';
customBtn.textContent = '+ 직접 입력';
customBtn.onclick = () => showCustomItemInput(customBtn);
grid.appendChild(customBtn);
}
/**
@@ -598,6 +606,21 @@ function onItemSelect(item, btn) {
btn.classList.add('selected');
selectedItemId = item.item_id;
customItemName = null;
// 직접 입력 영역 숨기기
const customInput = document.getElementById('customItemInput');
if (customInput) {
customInput.style.display = 'none';
document.getElementById('customItemName').value = '';
}
// 직접 입력 버튼 텍스트 초기화
const customBtn = document.querySelector('.item-btn.custom-input-btn');
if (customBtn) {
customBtn.textContent = '+ 직접 입력';
}
updateStepStatus();
}
@@ -667,9 +690,9 @@ function updateStepStatus() {
steps[2].classList.toggle('active', step2Complete);
// Step 3: 항목
const step3Complete = selectedItemId;
steps[2].classList.toggle('completed', step3Complete);
steps[3].classList.toggle('active', step3Complete);
const step3Complete = selectedItemId || (selectedItemId === 'custom' && customItemName);
steps[2].classList.toggle('completed', !!step3Complete);
steps[3].classList.toggle('active', !!step3Complete);
// 제출 버튼 활성화
const submitBtn = document.getElementById('submitBtn');
@@ -697,7 +720,8 @@ async function submitReport() {
tbm_session_id: selectedTbmSessionId,
visit_request_id: selectedVisitRequestId,
issue_category_id: selectedCategoryId,
issue_item_id: selectedItemId,
issue_item_id: selectedItemId === 'custom' ? null : selectedItemId,
custom_item_name: customItemName || null,
additional_description: additionalDescription || null,
photos: photos.filter(p => p !== null)
};
@@ -728,6 +752,77 @@ async function submitReport() {
}
}
/**
* 직접 입력 버튼 클릭
*/
function showCustomItemInput(btn) {
// 기존 항목 선택 해제
document.querySelectorAll('.item-btn').forEach(b => b.classList.remove('selected'));
btn.classList.add('selected');
selectedItemId = null;
customItemName = null;
const customInput = document.getElementById('customItemInput');
if (customInput) {
customInput.style.display = 'flex';
document.getElementById('customItemName').focus();
}
updateStepStatus();
}
/**
* 직접 입력 확인
*/
function confirmCustomItem() {
const input = document.getElementById('customItemName');
const name = input.value.trim();
if (!name) {
input.focus();
return;
}
customItemName = name;
selectedItemId = 'custom';
updateStepStatus();
// 직접 입력 UI 숨기되 값은 유지
const customInput = document.getElementById('customItemInput');
if (customInput) {
customInput.style.display = 'none';
}
// 직접 입력 버튼 텍스트 업데이트
const customBtn = document.querySelector('.item-btn.custom-input-btn');
if (customBtn) {
customBtn.textContent = `${name}`;
customBtn.classList.add('selected');
}
}
/**
* 직접 입력 취소
*/
function cancelCustomItem() {
const customInput = document.getElementById('customItemInput');
if (customInput) {
customInput.style.display = 'none';
document.getElementById('customItemName').value = '';
}
customItemName = null;
if (selectedItemId === 'custom') {
selectedItemId = null;
}
// 직접 입력 버튼 상태 초기화
const customBtn = document.querySelector('.item-btn.custom-input-btn');
if (customBtn) {
customBtn.textContent = '+ 직접 입력';
customBtn.classList.remove('selected');
}
updateStepStatus();
}
// 기타 위치 입력 시 위치 정보 업데이트
document.addEventListener('DOMContentLoaded', () => {
const customLocationInput = document.getElementById('customLocation');

View File

@@ -17,7 +17,32 @@ server {
add_header Cache-Control "no-store, no-cache, must-revalidate";
}
# API 프록시 (시스템 2 API)
# System 1 API 프록시 (공장/작업장, TBM, 출입관리)
location /api/workplaces/ {
proxy_pass http://system1-api:3005;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api/tbm/ {
proxy_pass http://system1-api:3005;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /api/workplace-visits/ {
proxy_pass http://system1-api:3005;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# System 2 API 프록시 (신고 관련)
location /api/ {
proxy_pass http://system2-api:3005;
proxy_set_header Host $host;
@@ -26,9 +51,24 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
# 업로드 파일
location /uploads/ {
# System 2 API uploads (신고 사진 등)
# ^~ + 더 긴 prefix → /api/ 보다 우선 매칭
location ^~ /api/uploads/ {
proxy_pass http://system2-api:3005/uploads/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# System 1 uploads 프록시 (작업장 레이아웃 이미지 등)
# ^~ : 정적파일 캐시 regex보다 우선 매칭
location ^~ /uploads/ {
proxy_pass http://system1-api:3005/uploads/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {

File diff suppressed because it is too large Load Diff