Files
tk-factory-services/tksafety/web/risk-assess.html
Hyungi Ahn 0de9d5bb48 feat(sso): 인앱 브라우저 SSO 토큰 릴레이 — 카톡 WebView 쿠키 미공유 해결
카카오톡 인앱 WebView는 서브도메인 간 쿠키를 공유하지 않아
tkds에서 로그인 후 tkfb로 리다이렉트 시 인증이 풀리는 문제.

- sso-relay.js: URL hash의 _sso= 토큰을 로컬 쿠키+localStorage로 설정
- gateway dashboard: 로그인 후 redirect URL에 #_sso=<token> 추가
- 전 서비스 HTML: core JS 직전에 sso-relay.js 로드 (81개 파일)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 15:44:02 +09:00

219 lines
13 KiB
HTML

<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>위험성평가 수행 - TK 안전관리</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/tksafety.css?v=2026031501">
</head>
<body>
<!-- Header -->
<header class="bg-blue-700 text-white sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between items-center h-14">
<div class="flex items-center gap-3">
<button id="mobileMenuBtn" onclick="toggleMobileMenu()" class="lg:hidden text-blue-200 hover:text-white">
<i class="fas fa-bars text-xl"></i>
</button>
<i class="fas fa-shield-alt text-xl text-blue-200"></i>
<h1 class="text-lg font-semibold">TK 안전관리</h1>
</div>
<div class="flex items-center gap-4">
<div id="headerUserName" class="text-sm font-medium hidden sm:block">-</div>
<div id="headerUserAvatar" class="w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center text-sm font-semibold">-</div>
<button onclick="doLogout()" class="text-blue-200 hover:text-white" title="로그아웃"><i class="fas fa-sign-out-alt"></i></button>
</div>
</div>
</div>
</header>
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 fade-in">
<div class="flex gap-6">
<!-- Sidebar Nav -->
<nav id="sideNav" class="hidden lg:flex flex-col gap-1 w-48 flex-shrink-0 pt-2"></nav>
<!-- Main -->
<div class="flex-1 min-w-0">
<!-- 뒤로가기 -->
<div class="mb-3">
<a href="risk-projects.html" class="text-sm text-blue-600 hover:text-blue-800">
<i class="fas fa-arrow-left mr-1"></i>프로젝트 목록
</a>
</div>
<!-- 프로젝트 헤더 -->
<div id="projectHeader" class="bg-white rounded-xl shadow-sm p-4 mb-5">
<div class="text-center text-gray-400 py-4">로딩 중...</div>
</div>
<!-- 세부 공정 + 평가 항목 -->
<div id="processContainer" class="mb-5">
<div class="bg-white rounded-xl shadow-sm p-8 text-center text-gray-400">로딩 중...</div>
</div>
<!-- 수시 평가: 공정 추가 버튼 -->
<div id="addProcessArea" class="mb-5 hidden">
<button onclick="openAddProcessModal()" class="px-4 py-2 border-2 border-dashed border-gray-300 rounded-xl text-gray-400 hover:border-blue-400 hover:text-blue-500 w-full text-sm">
<i class="fas fa-plus mr-1"></i>세부 공정 추가
</button>
</div>
<!-- 감소대책 섹션 -->
<div id="mitigationContainer" class="bg-white rounded-xl shadow-sm p-4">
<div class="text-center text-gray-400 py-4">로딩 중...</div>
</div>
</div>
</div>
</div>
<!-- 평가 항목 모달 -->
<div id="riskItemModal" class="hidden modal-overlay" onclick="if(event.target===this)closeItemModal()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 id="riskItemModalTitle" class="text-lg font-semibold">항목 추가</h3>
<button onclick="closeItemModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<form id="riskItemForm" onsubmit="submitItem(event)">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">분류</label>
<input type="text" id="riCategory" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="예: 기계적, 물리적">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">원인(작업)</label>
<input type="text" id="riCause" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="예: 선반작업">
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">유해·위험요인</label>
<textarea id="riHazard" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="2" placeholder="유해위험요인 상세 기술"></textarea>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">관련법규</label>
<input type="text" id="riRegulation" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="예: 산업안전보건법 제38조">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">감소대책 No</label>
<input type="text" id="riMitigationNo" class="input-field w-full px-3 py-2 rounded-lg text-sm" placeholder="예: 1">
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">현재 안전조치</label>
<textarea id="riCurrentMeasure" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="2" placeholder="현재 시행중인 안전조치"></textarea>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">가능성 (1~5)</label>
<select id="riLikelihood" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="">-</option>
<option value="1">1 (극히 드묾)</option>
<option value="2">2 (드묾)</option>
<option value="3">3 (보통)</option>
<option value="4">4 (자주)</option>
<option value="5">5 (매우 자주)</option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">중대성 (1~5)</label>
<select id="riSeverity" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="">-</option>
<option value="1">1 (미미)</option>
<option value="2">2 (경미)</option>
<option value="3">3 (보통)</option>
<option value="4">4 (중대)</option>
<option value="5">5 (치명적)</option>
</select>
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">세부내용</label>
<textarea id="riDetail" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="2" placeholder="추가 세부사항"></textarea>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeItemModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700">저장</button>
</div>
</form>
</div>
</div>
<!-- 감소대책 모달 -->
<div id="mitigationModal" class="hidden modal-overlay" onclick="if(event.target===this)closeMitigationModal()">
<div class="modal-content p-6">
<div class="flex justify-between items-center mb-4">
<h3 id="mitigationModalTitle" class="text-lg font-semibold">감소대책 추가</h3>
<button onclick="closeMitigationModal()" class="text-gray-400 hover:text-gray-600"><i class="fas fa-times"></i></button>
</div>
<form id="mitigationForm" onsubmit="submitMitigation(event)">
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">대책 No <span class="text-red-400">*</span></label>
<input type="text" id="rmNo" class="input-field w-full px-3 py-2 rounded-lg text-sm" required>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">현재 위험성</label>
<input type="number" id="rmRiskScore" class="input-field w-full px-3 py-2 rounded-lg text-sm" min="1" max="25">
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">유해·위험요인</label>
<textarea id="rmHazard" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="2"></textarea>
</div>
<div class="sm:col-span-2">
<label class="block text-xs font-medium text-gray-600 mb-1">개선계획</label>
<textarea id="rmPlan" class="input-field w-full px-3 py-2 rounded-lg text-sm" rows="2"></textarea>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">담당자</label>
<input type="text" id="rmManager" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">예산</label>
<input type="text" id="rmBudget" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">일정</label>
<input type="text" id="rmSchedule" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">완료일</label>
<input type="date" id="rmCompDate" class="input-field w-full px-3 py-2 rounded-lg text-sm">
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">가능성(후) (1~5)</label>
<select id="rmPostLikelihood" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="">-</option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option>
<option value="4">4</option><option value="5">5</option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">중대성(후) (1~5)</label>
<select id="rmPostSeverity" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="">-</option>
<option value="1">1</option><option value="2">2</option><option value="3">3</option>
<option value="4">4</option><option value="5">5</option>
</select>
</div>
<div>
<label class="block text-xs font-medium text-gray-600 mb-1">상태</label>
<select id="rmStatus" class="input-field w-full px-3 py-2 rounded-lg text-sm">
<option value="planned">계획</option>
<option value="in_progress">진행중</option>
<option value="completed">완료</option>
</select>
</div>
</div>
<div class="flex justify-end mt-4 gap-2">
<button type="button" onclick="closeMitigationModal()" class="px-4 py-2 border rounded-lg text-sm hover:bg-gray-50">취소</button>
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm hover:bg-blue-700">저장</button>
</div>
</form>
</div>
</div>
<script src="/static/js/sso-relay.js?v=20260401"></script>
<script src="/static/js/tksafety-core.js?v=2026040101"></script>
<script src="/static/js/tksafety-risk.js?v=2026031501"></script>
<script>initRiskAssessPage();</script>
</body>
</html>