feat(tkqc): 관리함 이슈 프로젝트 변경 + cause_person 필드명 버그 수정

- 모바일/데스크톱 관리함에서 이슈 소속 프로젝트 변경 가능
- 프로젝트 변경 시 sequence_no 자동 재계산 (DB 함수 사용)
- in_progress 상태에서만 변경 허용 (프론트+백엔드 이중 제한)
- cause_person → responsible_person_detail 필드명 불일치 수정

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-27 07:56:20 +09:00
parent ea6f7c3013
commit ac2a2e7eed
4 changed files with 71 additions and 3 deletions

View File

@@ -253,6 +253,14 @@ function openEditMgmtSheet(issueId) {
var issue = issues.find(function (i) { return i.id === issueId; });
if (!issue) return;
// 프로젝트 셀렉트 채우기
var projSel = document.getElementById('editProject');
projSel.innerHTML = '<option value="">선택하세요</option>';
projects.forEach(function (p) {
projSel.innerHTML += '<option value="' + p.id + '"' + (p.id == issue.project_id ? ' selected' : '') + '>' + escapeHtml(p.project_name || p.job_no) + '</option>';
});
projSel.disabled = (issue.review_status === 'completed');
document.getElementById('editManagementComment').value = cleanManagementComment(issue.management_comment) || '';
document.getElementById('editResponsibleDept').value = issue.responsible_department || '';
document.getElementById('editResponsiblePerson').value = issue.responsible_person || '';
@@ -270,6 +278,22 @@ async function saveManagementEdit() {
expected_completion_date: document.getElementById('editExpectedDate').value ? document.getElementById('editExpectedDate').value + 'T00:00:00' : null
};
// 프로젝트 변경 확인
var newProjectId = parseInt(document.getElementById('editProject').value);
var issue = issues.find(function (i) { return i.id === currentIssueId; });
if (newProjectId && issue && newProjectId !== issue.project_id) {
// 프로젝트 변경은 /issues/{id} PUT으로 별도 호출
var projResp = await fetch(API_BASE_URL + '/issues/' + currentIssueId, {
method: 'PUT',
headers: { 'Authorization': 'Bearer ' + TokenManager.getToken(), 'Content-Type': 'application/json' },
body: JSON.stringify({ project_id: newProjectId })
});
if (!projResp.ok) {
var projErr = await projResp.json();
throw new Error(projErr.detail || '프로젝트 변경 실패');
}
}
var resp = await fetch(API_BASE_URL + '/issues/' + currentIssueId + '/management', {
method: 'PUT',
headers: { 'Authorization': 'Bearer ' + TokenManager.getToken(), 'Content-Type': 'application/json' },
@@ -358,7 +382,7 @@ function loadAdditionalInfo() {
var issue = issues.find(function (i) { return i.id === id; });
if (!issue) return;
document.getElementById('additionalCauseDept').value = issue.cause_department || '';
document.getElementById('additionalCausePerson').value = issue.cause_person || '';
document.getElementById('additionalCausePerson').value = issue.responsible_person_detail || '';
document.getElementById('additionalCauseDetail').value = issue.cause_detail || '';
}
@@ -372,7 +396,7 @@ async function saveAdditionalInfo() {
headers: { 'Authorization': 'Bearer ' + TokenManager.getToken(), 'Content-Type': 'application/json' },
body: JSON.stringify({
cause_department: document.getElementById('additionalCauseDept').value || null,
cause_person: document.getElementById('additionalCausePerson').value.trim() || null,
responsible_person_detail: document.getElementById('additionalCausePerson').value.trim() || null,
cause_detail: document.getElementById('additionalCauseDetail').value.trim() || null
})
});