fix: 작업자 배정 조회 쿼리 수정 및 작업보고서 시간 자동입력
- tbmTransferModel: leader_id → leader_user_id 컬럼명 수정, department 필터 제거 - daily-work-report: TBM 출근유형(정상/연장/조퇴)에 따른 시간 자동 계산 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -218,20 +218,20 @@ const TbmTransferModel = {
|
||||
ta.work_hours,
|
||||
w.worker_name,
|
||||
w.job_type,
|
||||
s.leader_id,
|
||||
s.leader_user_id,
|
||||
lw.worker_name as leader_name,
|
||||
s.status as session_status
|
||||
FROM tbm_team_assignments ta
|
||||
INNER JOIN tbm_sessions s ON ta.session_id = s.session_id
|
||||
INNER JOIN workers w ON ta.user_id = w.user_id
|
||||
LEFT JOIN workers lw ON s.leader_id = lw.user_id
|
||||
LEFT JOIN workers lw ON s.leader_user_id = lw.user_id
|
||||
WHERE s.session_date = ?
|
||||
ORDER BY w.worker_name
|
||||
`, [date]);
|
||||
|
||||
// 2. 모든 작업자 가져오기 (배정 안 된 사람도 포함)
|
||||
const [allWorkers] = await db.query(
|
||||
"SELECT user_id, worker_name, job_type FROM workers WHERE status = 'active' AND department = '생산' ORDER BY worker_name"
|
||||
"SELECT user_id, worker_name, job_type FROM workers WHERE status = 'active' ORDER BY worker_name"
|
||||
);
|
||||
|
||||
// 3. 작업자별 배정 현황 구성
|
||||
|
||||
@@ -414,12 +414,29 @@ function renderTbmWorkList() {
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" id="totalHours_${index}" value="" required>
|
||||
<div class="time-input-trigger placeholder"
|
||||
id="totalHoursDisplay_${index}"
|
||||
onclick="openTimePicker(${index}, 'total')">
|
||||
시간 선택
|
||||
</div>
|
||||
${(() => {
|
||||
// TBM 마감 시 확정된 근무시간 자동 계산
|
||||
let autoHours = '';
|
||||
if (tbm.attendance_type === 'overtime') {
|
||||
autoHours = ((tbm.work_hours || 8) + (tbm.attendance_hours || 0)).toString();
|
||||
} else if (tbm.attendance_type === 'early') {
|
||||
autoHours = (tbm.attendance_hours || tbm.work_hours || 8).toString();
|
||||
} else if (tbm.attendance_type === 'regular') {
|
||||
autoHours = (tbm.work_hours || 8).toString();
|
||||
} else if (tbm.work_hours) {
|
||||
autoHours = tbm.work_hours.toString();
|
||||
}
|
||||
const hasAuto = autoHours !== '';
|
||||
return `
|
||||
<input type="hidden" id="totalHours_${index}" value="${autoHours}" required>
|
||||
<div class="time-input-trigger ${hasAuto ? '' : 'placeholder'}"
|
||||
id="totalHoursDisplay_${index}"
|
||||
onclick="openTimePicker(${index}, 'total')"
|
||||
style="${hasAuto ? 'color:#059669;font-weight:600;' : ''}">
|
||||
${hasAuto ? autoHours + 'h' : '시간 선택'}
|
||||
</div>
|
||||
`;
|
||||
})()}
|
||||
</td>
|
||||
<td>
|
||||
<input type="hidden" id="errorHours_${index}" value="0">
|
||||
|
||||
Reference in New Issue
Block a user