perf: WebView2 HostObject 프록시 캐싱으로 성능 개선
- 각 HTML 파일에서 machine 프록시를 전역 변수로 한 번만 초기화 - 매 함수 호출마다 hostObjects.machine 접근하던 오버헤드 제거 - 네비게이션 클릭 시 콘솔 로그 추가 (디버깅용) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -187,7 +187,7 @@
|
||||
</svg>
|
||||
할일추가
|
||||
</button>
|
||||
<button onclick="window.location.href='/Todo'" class="text-xs bg-white/20 hover:bg-white/30 px-3 py-1 rounded-full transition-colors">
|
||||
<button onclick="window.location.href='/Todo/index.html'" class="text-xs bg-white/20 hover:bg-white/30 px-3 py-1 rounded-full transition-colors">
|
||||
전체보기
|
||||
</button>
|
||||
</div>
|
||||
@@ -510,174 +510,44 @@
|
||||
<script>
|
||||
// 대시보드 전용 스크립트
|
||||
|
||||
// 휴가 인원 Ajax 업데이트
|
||||
function updateLeaveCount() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/TodayCountH')
|
||||
.then(response => response.text())
|
||||
.then(data => {
|
||||
const cleanData = data.replace(/"/g, '');
|
||||
const count = parseInt(cleanData, 10);
|
||||
animateNumberChange('leaveCount', count);
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('휴가 인원 업데이트 중 오류 발생:', error);
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// 휴가자 목록 Ajax 업데이트
|
||||
function updateHolidayList() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetholyUser')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
// 형태에 따른 색상 결정
|
||||
const typeColorClass = (item.type === '휴가') ? 'bg-green-500/20 text-green-300' : 'bg-warning-500/20 text-warning-300';
|
||||
|
||||
// 종류에 따른 색상 결정
|
||||
let cateColorClass = 'bg-warning-500/20 text-warning-300'; // 기본값
|
||||
if (item.cate === '휴가') {
|
||||
cateColorClass = 'bg-warning-500/20 text-warning-300'; // 노란색 계열
|
||||
} else if (item.cate === '파견') {
|
||||
cateColorClass = 'bg-purple-500/20 text-purple-300'; // 보라색 계열
|
||||
} else {
|
||||
cateColorClass = 'bg-warning-500/20 text-warning-300'; // 기타는 주황색 계열
|
||||
}
|
||||
|
||||
// 기간 표시 형식 개선
|
||||
let periodText = '';
|
||||
if (item.sdate && item.edate) {
|
||||
if (item.sdate === item.edate) {
|
||||
periodText = item.sdate;
|
||||
} else {
|
||||
periodText = `${item.sdate}~${item.edate}`;
|
||||
}
|
||||
} else if (item.sdate) {
|
||||
periodText = item.sdate;
|
||||
} else {
|
||||
periodText = '-';
|
||||
}
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-4 py-3 text-white text-sm">${item.name || '-'}(${item.uid})</td>
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${typeColorClass}">
|
||||
${item.type || '-'}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${cateColorClass}">
|
||||
${item.cate || '-'}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-white/80 text-sm">${periodText}</td>
|
||||
<td class="px-4 py-3 text-white/80 text-sm max-w-32 truncate" title="${item.title || '-'}">${item.title || '-'}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-8 text-center text-white/50">
|
||||
현재 휴가자가 없습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
}
|
||||
document.getElementById('holidayTable').innerHTML = tableRows;
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('휴가자 목록 업데이트 중 오류 발생:', error);
|
||||
document.getElementById('holidayTable').innerHTML = `
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
// 비동기 프록시 캐싱 (한 번만 초기화)
|
||||
const machine = window.chrome.webview.hostObjects.machine;
|
||||
|
||||
// 구매요청 데이터 Ajax 업데이트
|
||||
function updatePurchaseCount() {
|
||||
async function updatePurchaseCount() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetPurchaseWaitCount')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data) {
|
||||
// NR 구매요청 카운트 업데이트
|
||||
if (data.NR !== undefined) {
|
||||
animateNumberChange('purchaseCountNR', data.NR);
|
||||
}
|
||||
|
||||
// CR 구매요청 카운트 업데이트
|
||||
if (data.CR !== undefined) {
|
||||
animateNumberChange('purchaseCountCR', data.CR);
|
||||
}
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('구매요청 데이터 업데이트 중 오류 발생:', error);
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
try {
|
||||
const jsonData = await machine.GetPurchaseWaitCount();
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
// 휴가요청 데이터 Ajax 업데이트
|
||||
function updateHolydayRequestCount() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetHolydayRequestCount')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data) {
|
||||
// NR 구매요청 카운트 업데이트
|
||||
if (data.HOLY !== undefined) {
|
||||
animateNumberChange('leaveRequestCount', data.HOLY);
|
||||
}
|
||||
if (data) {
|
||||
// NR 구매요청 카운트 업데이트
|
||||
if (data.NR !== undefined) {
|
||||
animateNumberChange('purchaseCountNR', data.NR);
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('휴가요청 데이터 업데이트 중 오류 발생:', error);
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// 사용자카운트 데이터 Ajax 업데이트
|
||||
function updateCurrentUserCount() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetCurrentUserCount')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data) {
|
||||
// NR 구매요청 카운트 업데이트
|
||||
if (data.Count !== undefined) {
|
||||
animateNumberChange('presentCount', data.Count);
|
||||
}
|
||||
// CR 구매요청 카운트 업데이트
|
||||
if (data.CR !== undefined) {
|
||||
animateNumberChange('purchaseCountCR', data.CR);
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('현재유저 카운트 업데이트 중 오류 발생:', error);
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('구매요청 데이터 업데이트 중 오류 발생:', error);
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// 숫자 애니메이션
|
||||
function animateNumberChange(elementId, newValue) {
|
||||
const element = document.getElementById(elementId);
|
||||
if (!element) {
|
||||
console.warn(`Element not found: ${elementId}`);
|
||||
return;
|
||||
}
|
||||
const currentValue = parseInt(element.textContent) || 0;
|
||||
const increment = (newValue - currentValue) / 20;
|
||||
let current = currentValue;
|
||||
|
||||
|
||||
const timer = setInterval(() => {
|
||||
current += increment;
|
||||
if ((increment > 0 && current >= newValue) || (increment < 0 && current <= newValue)) {
|
||||
@@ -699,23 +569,22 @@
|
||||
}
|
||||
|
||||
// Todo 목록 Ajax 업데이트
|
||||
function updateTodoList() {
|
||||
async function updateTodoList() {
|
||||
showLoading();
|
||||
fetch('/Todo/GetUrgentTodos')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.Success && data.Data) {
|
||||
displayTodoList(data.Data);
|
||||
} else {
|
||||
displayTodoList([]);
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Todo 목록 업데이트 중 오류 발생:', error);
|
||||
try {
|
||||
const jsonData = await machine.GetUrgentTodos();
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
if (data.Success && data.Data) {
|
||||
displayTodoList(data.Data);
|
||||
} else {
|
||||
displayTodoList([]);
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Todo 목록 업데이트 중 오류 발생:', error);
|
||||
displayTodoList([]);
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// Todo 목록 표시
|
||||
@@ -763,7 +632,7 @@
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
|
||||
</svg>
|
||||
<p class="text-sm">할일이 없습니다</p>
|
||||
<button onclick="window.location.href='/Todo'" class="text-primary-400 hover:text-primary-300 text-xs transition-colors mt-1 inline-block">
|
||||
<button onclick="window.location.href='/Todo/index.html'" class="text-primary-400 hover:text-primary-300 text-xs transition-colors mt-1 inline-block">
|
||||
할일 추가하기 →
|
||||
</button>
|
||||
</div>
|
||||
@@ -795,28 +664,27 @@
|
||||
|
||||
// Todo 페이지로 이동
|
||||
function goToTodoPage() {
|
||||
window.location.href = '/Todo/';
|
||||
window.location.href = '/Todo/index.html';
|
||||
}
|
||||
|
||||
// 할일 상세 정보 표시
|
||||
function showTodoDetail(todoId) {
|
||||
async function showTodoDetail(todoId) {
|
||||
showLoading();
|
||||
fetch(`/Todo/GetTodo?id=${todoId}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.Success && data.Data) {
|
||||
displayTodoDetail(data.Data);
|
||||
document.getElementById('todoDetailModal').classList.remove('hidden');
|
||||
} else {
|
||||
showError('할일 정보를 불러올 수 없습니다.');
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('할일 상세 정보 로드 중 오류 발생:', error);
|
||||
showError('할일 정보를 불러오는 중 오류가 발생했습니다.');
|
||||
hideLoading();
|
||||
});
|
||||
try {
|
||||
const jsonData = await machine.GetTodo(todoId);
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
if (data.Success && data.Data) {
|
||||
displayTodoDetail(data.Data);
|
||||
document.getElementById('todoDetailModal').classList.remove('hidden');
|
||||
} else {
|
||||
showError('할일 정보를 불러올 수 없습니다.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('할일 상세 정보 로드 중 오류 발생:', error);
|
||||
showError('할일 정보를 불러오는 중 오류가 발생했습니다.');
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// 할일 상세 정보를 모달에 표시
|
||||
@@ -867,7 +735,7 @@
|
||||
// 할일 상세 정보에서 Todo 페이지로 이동
|
||||
function goToTodoPageFromDetail() {
|
||||
hideTodoDetailModal();
|
||||
window.location.href = '/Todo/';
|
||||
window.location.href = '/Todo/index.html';
|
||||
}
|
||||
|
||||
// 간단한 에러 표시 함수
|
||||
@@ -915,32 +783,25 @@
|
||||
}
|
||||
|
||||
// 대시보드에서 할일 추가
|
||||
function addDashboardTodo() {
|
||||
const formData = {
|
||||
title: document.getElementById('dashboardTodoTitle').value,
|
||||
remark: document.getElementById('dashboardTodoRemark').value,
|
||||
expire: document.getElementById('dashboardTodoExpire').value || null,
|
||||
seqno: parseInt(document.getElementById('dashboardTodoSeqno').value),
|
||||
flag: document.getElementById('dashboardTodoFlag').checked,
|
||||
request: document.getElementById('dashboardTodoRequest').value || null,
|
||||
status: document.getElementById('dashboardTodoStatus').value
|
||||
};
|
||||
async function addDashboardTodo() {
|
||||
const title = document.getElementById('dashboardTodoTitle').value;
|
||||
const remark = document.getElementById('dashboardTodoRemark').value;
|
||||
const expire = document.getElementById('dashboardTodoExpire').value || '';
|
||||
const seqno = parseInt(document.getElementById('dashboardTodoSeqno').value) || 0;
|
||||
const flag = document.getElementById('dashboardTodoFlag').checked;
|
||||
const request = document.getElementById('dashboardTodoRequest').value || '';
|
||||
const status = document.getElementById('dashboardTodoStatus').value || '0';
|
||||
|
||||
if (!formData.remark.trim()) {
|
||||
if (!remark.trim()) {
|
||||
showError('할일 내용을 입력해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
showLoading();
|
||||
fetch('/Todo/CreateTodo', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(formData)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
try {
|
||||
const jsonData = await machine.CreateTodo(title, remark, expire, seqno, flag, request, status);
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
if (data.Success) {
|
||||
hideDashboardAddTodoModal();
|
||||
updateTodoList(); // 대시보드 할일 목록 새로고침
|
||||
@@ -948,33 +809,30 @@
|
||||
} else {
|
||||
showError(data.Message || '할일 추가에 실패했습니다.');
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
} catch (error) {
|
||||
console.error('할일 추가 중 오류:', error);
|
||||
showError('서버 연결에 실패했습니다.');
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// Todo 목록 업데이트
|
||||
function updateTodoList() {
|
||||
// Todo 목록 업데이트 (중복 함수 - 이미 위에서 정의됨, displayUrgentTodos 호출용으로 유지)
|
||||
async function updateTodoListUrgent() {
|
||||
showLoading();
|
||||
fetch('/Todo/GetUrgentTodos')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.Success && data.Data) {
|
||||
displayUrgentTodos(data.Data);
|
||||
} else {
|
||||
displayEmptyTodos();
|
||||
}
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('급한 할일 목록 업데이트 중 오류 발생:', error);
|
||||
try {
|
||||
const jsonData = await machine.GetUrgentTodos();
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
if (data.Success && data.Data) {
|
||||
displayUrgentTodos(data.Data);
|
||||
} else {
|
||||
displayEmptyTodos();
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('급한 할일 목록 업데이트 중 오류 발생:', error);
|
||||
displayEmptyTodos();
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// 급한 할일 목록 표시
|
||||
@@ -1069,21 +927,13 @@
|
||||
}
|
||||
|
||||
// 페이지 로드 시 데이터 업데이트
|
||||
updateLeaveCount();
|
||||
updateHolidayList();
|
||||
updatePurchaseCount();
|
||||
updateHolydayRequestCount();
|
||||
updateCurrentUserCount();
|
||||
updateTodoList();
|
||||
|
||||
|
||||
// 30초마다 데이터 새로고침
|
||||
setInterval(() => {
|
||||
updateLeaveCount();
|
||||
updateHolidayList();
|
||||
updatePurchaseCount();
|
||||
updateHolydayRequestCount();
|
||||
updateCurrentUserCount();
|
||||
updateTodoList();
|
||||
}, 30000);
|
||||
|
||||
@@ -1103,77 +953,9 @@
|
||||
// 공통 네비게이션 초기화
|
||||
initNavigation('dashboard');
|
||||
|
||||
// 출근 대상자 모달 표시
|
||||
function showPresentUserModal() {
|
||||
document.getElementById('presentUserModal').classList.remove('hidden');
|
||||
loadPresentUserList();
|
||||
}
|
||||
|
||||
// 출근 대상자 모달 숨기기
|
||||
function hidePresentUserModal() {
|
||||
document.getElementById('presentUserModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 출근 대상자 목록 로드
|
||||
function loadPresentUserList() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetPresentUserList')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
const statusClass = item.useUserState == 1 ? 'bg-success-500/20 text-success-300' : 'bg-danger-500/20 text-danger-300';
|
||||
const statusText = item.useUserState == 1 ? '활성' : '비활성';
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white">${item.id || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white">${item.name || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.processs || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.grade || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${statusClass}">
|
||||
${statusText}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.email || '-'}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
document.getElementById('presentUserCount').textContent = data.length;
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-8 text-center text-white/50">
|
||||
출근 대상자가 없습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('presentUserCount').textContent = '0';
|
||||
}
|
||||
document.getElementById('presentUserTable').innerHTML = tableRows;
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('출근 대상자 목록 로드 중 오류 발생:', error);
|
||||
document.getElementById('presentUserTable').innerHTML = `
|
||||
<tr>
|
||||
<td colspan="5" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('presentUserCount').textContent = '0';
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// ESC 키로 모달 닫기
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Escape') {
|
||||
hidePresentUserModal();
|
||||
hideHolidayRequestModal();
|
||||
hidePurchaseNRModal();
|
||||
hidePurchaseCRModal();
|
||||
hideTodoDetailModal();
|
||||
@@ -1181,103 +963,6 @@
|
||||
}
|
||||
});
|
||||
|
||||
// 모달 외부 클릭으로 닫기
|
||||
document.getElementById('presentUserModal').addEventListener('click', function(event) {
|
||||
if (event.target === this) {
|
||||
hidePresentUserModal();
|
||||
}
|
||||
});
|
||||
|
||||
// 휴가요청 모달 표시
|
||||
function showHolidayRequestModal() {
|
||||
document.getElementById('holidayRequestModal').classList.remove('hidden');
|
||||
loadHolidayRequestList();
|
||||
}
|
||||
|
||||
// 휴가요청 모달 숨기기
|
||||
function hideHolidayRequestModal() {
|
||||
document.getElementById('holidayRequestModal').classList.add('hidden');
|
||||
}
|
||||
|
||||
// 휴가요청 목록 로드
|
||||
function loadHolidayRequestList() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetholyRequestUser')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
// 일자 포맷팅 (시작일 ~ 종료일)
|
||||
const startDate = item.sdate ? new Date(item.sdate).toLocaleDateString('ko-KR') : '-';
|
||||
const endDate = item.edate ? new Date(item.edate).toLocaleDateString('ko-KR') : '-';
|
||||
const dateRange = startDate !== '-' && endDate !== '-' ? `${startDate} ~ ${endDate}` : '-';
|
||||
|
||||
// 요청일 포맷팅 (holydays 컬럼은 숫자 형태)
|
||||
const requestDate = item.holydays || '-';
|
||||
|
||||
// 휴가 종류별 색상 구분
|
||||
let cateColorClass = 'bg-white/20 text-white'; // 기본값 (흰색)
|
||||
const cateValue = item.cate || '';
|
||||
if (cateValue === '대체') {
|
||||
cateColorClass = 'bg-yellow-500/20 text-yellow-300'; // 노란색
|
||||
} else if (cateValue === '년차') {
|
||||
cateColorClass = 'bg-green-500/20 text-green-300'; // 녹색
|
||||
} else if (cateValue === '하기') {
|
||||
cateColorClass = 'bg-blue-500/20 text-blue-300'; // 파란색
|
||||
}
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white">${item.uid || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white">${item.name || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${cateColorClass}">
|
||||
${item.cate || '-'}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${dateRange}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${requestDate}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.holytimes || '-'}</td>
|
||||
<td class="px-6 py-4 text-white/80">${item.HolyReason || '-'}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
document.getElementById('holidayRequestCount').textContent = data.length;
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="7" class="px-6 py-8 text-center text-white/50">
|
||||
휴가 신청이 없습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('holidayRequestCount').textContent = '0';
|
||||
}
|
||||
document.getElementById('holidayRequestTable').innerHTML = tableRows;
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('휴가요청 목록 로드 중 오류 발생:', error);
|
||||
document.getElementById('holidayRequestTable').innerHTML = `
|
||||
<tr>
|
||||
<td colspan="7" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('holidayRequestCount').textContent = '0';
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
|
||||
// 휴가요청 모달 외부 클릭으로 닫기
|
||||
document.getElementById('holidayRequestModal').addEventListener('click', function(event) {
|
||||
if (event.target === this) {
|
||||
hideHolidayRequestModal();
|
||||
}
|
||||
});
|
||||
|
||||
// 구매NR 모달 표시
|
||||
function showPurchaseNRModal() {
|
||||
document.getElementById('purchaseNRModal').classList.remove('hidden');
|
||||
@@ -1290,60 +975,59 @@
|
||||
}
|
||||
|
||||
// 구매NR 목록 로드
|
||||
function loadPurchaseNRList() {
|
||||
async function loadPurchaseNRList() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetPurchaseNRList')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
// 요청일 포맷팅
|
||||
const requestDate = item.pdate ? new Date(item.pdate).toLocaleDateString('ko-KR') : '-';
|
||||
|
||||
// 금액 포맷팅 (천 단위 콤마)
|
||||
const amount = item.pumamt ? Number(item.pumamt).toLocaleString() : '-';
|
||||
const price = item.pumprice ? Number(item.pumprice).toLocaleString() : '-';
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${requestDate}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.process || '-'}</td>
|
||||
<td class="px-6 py-4 text-white">${item.pumname || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumscale || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumunit || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumqtyreq || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${price}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white font-medium">${amount}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
document.getElementById('purchaseNRCount').textContent = data.length;
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
||||
구매요청이 없습니다
|
||||
</td>
|
||||
try {
|
||||
const jsonData = await machine.GetPurchaseNRList();
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
// 요청일 포맷팅
|
||||
const requestDate = item.pdate ? new Date(item.pdate).toLocaleDateString('ko-KR') : '-';
|
||||
|
||||
// 금액 포맷팅 (천 단위 콤마)
|
||||
const amount = item.pumamt ? Number(item.pumamt).toLocaleString() : '-';
|
||||
const price = item.pumprice ? Number(item.pumprice).toLocaleString() : '-';
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${requestDate}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.process || '-'}</td>
|
||||
<td class="px-6 py-4 text-white">${item.pumname || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumscale || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumunit || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumqtyreq || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${price}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white font-medium">${amount}</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('purchaseNRCount').textContent = '0';
|
||||
}
|
||||
document.getElementById('purchaseNRTable').innerHTML = tableRows;
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('구매NR 목록 로드 중 오류 발생:', error);
|
||||
document.getElementById('purchaseNRTable').innerHTML = `
|
||||
});
|
||||
document.getElementById('purchaseNRCount').textContent = data.length;
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
||||
구매요청이 없습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('purchaseNRCount').textContent = '0';
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
document.getElementById('purchaseNRTable').innerHTML = tableRows;
|
||||
} catch (error) {
|
||||
console.error('구매NR 목록 로드 중 오류 발생:', error);
|
||||
document.getElementById('purchaseNRTable').innerHTML = `
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('purchaseNRCount').textContent = '0';
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// 구매NR 모달 외부 클릭으로 닫기
|
||||
@@ -1365,60 +1049,59 @@
|
||||
}
|
||||
|
||||
// 구매CR 목록 로드
|
||||
function loadPurchaseCRList() {
|
||||
async function loadPurchaseCRList() {
|
||||
showLoading();
|
||||
fetch('/DashBoard/GetPurchaseCRList')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
// 요청일 포맷팅
|
||||
const requestDate = item.pdate ? new Date(item.pdate).toLocaleDateString('ko-KR') : '-';
|
||||
|
||||
// 금액 포맷팅 (천 단위 콤마)
|
||||
const amount = item.pumamt ? Number(item.pumamt).toLocaleString() : '-';
|
||||
const price = item.pumprice ? Number(item.pumprice).toLocaleString() : '-';
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${requestDate}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.process || '-'}</td>
|
||||
<td class="px-6 py-4 text-white">${item.pumname || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumscale || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumunit || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumqtyreq || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${price}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white font-medium">${amount}</td>
|
||||
</tr>
|
||||
`;
|
||||
});
|
||||
document.getElementById('purchaseCRCount').textContent = data.length;
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
||||
구매요청이 없습니다
|
||||
</td>
|
||||
try {
|
||||
const jsonData = await machine.GetPurchaseCRList();
|
||||
const data = JSON.parse(jsonData);
|
||||
|
||||
let tableRows = '';
|
||||
if (data && data.length > 0) {
|
||||
data.forEach(item => {
|
||||
// 요청일 포맷팅
|
||||
const requestDate = item.pdate ? new Date(item.pdate).toLocaleDateString('ko-KR') : '-';
|
||||
|
||||
// 금액 포맷팅 (천 단위 콤마)
|
||||
const amount = item.pumamt ? Number(item.pumamt).toLocaleString() : '-';
|
||||
const price = item.pumprice ? Number(item.pumprice).toLocaleString() : '-';
|
||||
|
||||
tableRows += `
|
||||
<tr class="hover:bg-white/5 transition-colors">
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${requestDate}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.process || '-'}</td>
|
||||
<td class="px-6 py-4 text-white">${item.pumname || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumscale || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumunit || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${item.pumqtyreq || '-'}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white/80">${price}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-white font-medium">${amount}</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('purchaseCRCount').textContent = '0';
|
||||
}
|
||||
document.getElementById('purchaseCRTable').innerHTML = tableRows;
|
||||
hideLoading();
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('구매CR 목록 로드 중 오류 발생:', error);
|
||||
document.getElementById('purchaseCRTable').innerHTML = `
|
||||
});
|
||||
document.getElementById('purchaseCRCount').textContent = data.length;
|
||||
} else {
|
||||
tableRows = `
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
<td colspan="8" class="px-6 py-8 text-center text-white/50">
|
||||
구매요청이 없습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('purchaseCRCount').textContent = '0';
|
||||
hideLoading();
|
||||
});
|
||||
}
|
||||
document.getElementById('purchaseCRTable').innerHTML = tableRows;
|
||||
} catch (error) {
|
||||
console.error('구매CR 목록 로드 중 오류 발생:', error);
|
||||
document.getElementById('purchaseCRTable').innerHTML = `
|
||||
<tr>
|
||||
<td colspan="8" class="px-6 py-8 text-center text-danger-400">
|
||||
데이터를 불러오는 중 오류가 발생했습니다
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
document.getElementById('purchaseCRCount').textContent = '0';
|
||||
}
|
||||
hideLoading();
|
||||
}
|
||||
|
||||
// 구매CR 모달 외부 클릭으로 닫기
|
||||
|
||||
Reference in New Issue
Block a user