feat(schedule): 공정표 제품유형 + 표준공정 자동생성
Backend: - product_types 참조 테이블 + projects.product_type_id FK (tkuser 마이그레이션) - schedule_entries에 work_type_id, risk_assessment_id, source 컬럼 추가 - schedule_phases에 product_type_id 추가 (phase 오염 방지) - generateFromTemplate: tksafety 템플릿 기반 공정 자동 생성 (트랜잭션) - phase 매칭 3단계 우선순위 (전용→범용→신규) - 간트 데이터 NULL 날짜 guard 추가 - system1 startup 마이그레이션 러너 추가 Frontend: - tkuser 프로젝트 추가/수정 폼에 제품유형 드롭다운 추가 - 프로젝트 목록에 제품유형 뱃지 표시 - 공정표 툴바에 "표준공정 생성" 버튼 + 모달 추가 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -470,6 +470,12 @@
|
||||
<input type="date" id="newDueDate" class="input-field w-full px-3 py-1.5 rounded-lg text-sm">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">제품유형</label>
|
||||
<select id="newProductType" class="input-field w-full px-3 py-1.5 rounded-lg text-sm">
|
||||
<option value="">선택</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">현장</label>
|
||||
<input type="text" id="newSite" class="input-field w-full px-3 py-1.5 rounded-lg text-sm" placeholder="설치 현장">
|
||||
@@ -1147,6 +1153,12 @@
|
||||
<input type="date" id="editDueDate" class="input-field w-full px-3 py-1.5 rounded-lg text-sm">
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">제품유형</label>
|
||||
<select id="editProductType" class="input-field w-full px-3 py-1.5 rounded-lg text-sm">
|
||||
<option value="">선택</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-xs font-medium text-gray-600 mb-1">현장</label>
|
||||
<input type="text" id="editSite" class="input-field w-full px-3 py-1.5 rounded-lg text-sm">
|
||||
@@ -2393,7 +2405,7 @@
|
||||
<script src="/static/js/tkuser-tabs.js?v=2026032301"></script>
|
||||
<!-- JS: Individual modules -->
|
||||
<script src="/static/js/tkuser-users.js?v=2026032502"></script>
|
||||
<script src="/static/js/tkuser-projects.js?v=2026031401"></script>
|
||||
<script src="/static/js/tkuser-projects.js?v=2026032601"></script>
|
||||
<script src="/static/js/tkuser-departments.js?v=2026032302"></script>
|
||||
<script src="/static/js/tkuser-issue-types.js?v=2026031401"></script>
|
||||
<script src="/static/js/tkuser-workplaces.js?v=2026031401"></script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* ===== Projects CRUD ===== */
|
||||
let projects = [], projectsLoaded = false;
|
||||
let projects = [], projectsLoaded = false, productTypesCache = [];
|
||||
|
||||
function statusBadge(status, isActive) {
|
||||
if (!isActive || isActive === 0 || isActive === false) return '<span class="px-1.5 py-0.5 rounded text-xs bg-gray-100 text-gray-400">비활성</span>';
|
||||
@@ -7,8 +7,23 @@ function statusBadge(status, isActive) {
|
||||
return '<span class="px-1.5 py-0.5 rounded text-xs bg-emerald-50 text-emerald-600">진행중</span>';
|
||||
}
|
||||
|
||||
async function loadProductTypes() {
|
||||
try {
|
||||
const r = await api('/projects/product-types');
|
||||
productTypesCache = r.data || [];
|
||||
['newProductType', 'editProductType'].forEach(id => {
|
||||
const sel = document.getElementById(id); if (!sel) return;
|
||||
const val = sel.value;
|
||||
sel.innerHTML = '<option value="">선택</option>';
|
||||
productTypesCache.forEach(pt => { const o = document.createElement('option'); o.value = pt.id; o.textContent = `${pt.code} - ${pt.name}`; sel.appendChild(o); });
|
||||
sel.value = val;
|
||||
});
|
||||
} catch(e) { console.warn('제품유형 로드 실패:', e); }
|
||||
}
|
||||
|
||||
async function loadProjects() {
|
||||
try {
|
||||
await loadProductTypes();
|
||||
const r = await api('/projects'); projects = r.data || r;
|
||||
projectsLoaded = true;
|
||||
displayProjects();
|
||||
@@ -26,6 +41,7 @@ function displayProjects() {
|
||||
<div class="text-sm font-medium text-gray-800 truncate"><i class="fas fa-folder mr-1.5 text-gray-400 text-xs"></i>${escapeHtml(p.project_name)}</div>
|
||||
<div class="text-xs text-gray-500 flex items-center gap-1.5 mt-0.5 flex-wrap">
|
||||
<span class="font-mono">${escapeHtml(p.job_no)}</span>
|
||||
${p.product_type_code?`<span class="px-1.5 py-0.5 rounded bg-indigo-50 text-indigo-600 font-medium">${escapeHtml(p.product_type_code)}</span>`:''}
|
||||
${p.site?`<span class="px-1.5 py-0.5 rounded bg-amber-50 text-amber-600">${escapeHtml(p.site)}</span>`:''}
|
||||
${p.pm?`<span class="px-1.5 py-0.5 rounded bg-slate-50 text-slate-500">${escapeHtml(p.pm)}</span>`:''}
|
||||
${statusBadge(p.project_status, p.is_active)}
|
||||
@@ -48,7 +64,8 @@ document.getElementById('addProjectForm').addEventListener('submit', async e =>
|
||||
contract_date: document.getElementById('newContractDate').value || null,
|
||||
due_date: document.getElementById('newDueDate').value || null,
|
||||
site: document.getElementById('newSite').value.trim() || null,
|
||||
pm: document.getElementById('newPm').value.trim() || null
|
||||
pm: document.getElementById('newPm').value.trim() || null,
|
||||
product_type_id: document.getElementById('newProductType').value ? parseInt(document.getElementById('newProductType').value) : null
|
||||
})});
|
||||
showToast('프로젝트가 추가되었습니다.'); document.getElementById('addProjectForm').reset(); await loadProjects();
|
||||
} catch(e) { showToast(e.message, 'error'); }
|
||||
@@ -63,6 +80,7 @@ function editProject(id) {
|
||||
document.getElementById('editDueDate').value = formatDate(p.due_date);
|
||||
document.getElementById('editSite').value = p.site || '';
|
||||
document.getElementById('editPm').value = p.pm || '';
|
||||
document.getElementById('editProductType').value = p.product_type_id || '';
|
||||
document.getElementById('editProjectStatus').value = p.project_status || 'active';
|
||||
document.getElementById('editIsActive').value = p.is_active ? '1' : '0';
|
||||
document.getElementById('editProjectModal').classList.remove('hidden');
|
||||
@@ -79,6 +97,7 @@ document.getElementById('editProjectForm').addEventListener('submit', async e =>
|
||||
due_date: document.getElementById('editDueDate').value || null,
|
||||
site: document.getElementById('editSite').value.trim() || null,
|
||||
pm: document.getElementById('editPm').value.trim() || null,
|
||||
product_type_id: document.getElementById('editProductType').value ? parseInt(document.getElementById('editProductType').value) : null,
|
||||
project_status: document.getElementById('editProjectStatus').value,
|
||||
is_active: document.getElementById('editIsActive').value === '1'
|
||||
})});
|
||||
|
||||
Reference in New Issue
Block a user