diff --git a/src/main/webapp/WEB-INF/views/drilling/statistics/drilling_notice.jsp b/src/main/webapp/WEB-INF/views/drilling/statistics/drilling_notice.jsp index deae4c02..8f947a4c 100644 --- a/src/main/webapp/WEB-INF/views/drilling/statistics/drilling_notice.jsp +++ b/src/main/webapp/WEB-INF/views/drilling/statistics/drilling_notice.jsp @@ -112,6 +112,7 @@ function getStatusInfo(statusCode) { /** * API 호출 결과를 받아 화면에 이력 목록을 표시하는 콜백 함수 */ + var historyData; function displayHistoryList(response) { // ▼▼▼ [수정] 대상 ID를 'notification-list-full'로 변경 var notificationList = document.getElementById('notification-list-full'); @@ -120,7 +121,7 @@ function displayHistoryList(response) { if (response && response.resultCode === 200 && response.datas) { var datas = response.datas; var contentHtml = ''; - + historyData = response.datas; // 전역 변수에 셋팅(엑셀다운로드시 필요) for (var i = 0; i < datas.length; i++) { var item = datas[i]; @@ -169,10 +170,74 @@ function displayHistoryList(response) { console.error("Error fetching history list:", response.resultMessage); } } +/** + * 알림내역 CSV 다운로드 + */ + function clickExcelListDown() { + console.log(historyData); + + if (!historyData || historyData.length === 0) { + alert("다운로드할 데이터가 없습니다."); + return; + } + + const headers = [ + "프로젝트명", + "이전상태", + "변경상태", + "변경일시" + ]; + + const STATE_MAP = { + "0": "미입력", + "1": "입력 중", + "2": "검수 준비 대기중", + "3": "검수중", + "4": "수정 요청", + "6": "검수 완료", + "6": "등록 완료" + }; + + const rows = historyData.map(function (item) { + return [ + item.constName, + STATE_MAP[item.preProjectStateCode] || item.preProjectStateCode, + STATE_MAP[item.projectStateCode] || item.projectStateCode, + item.modDt + ]; + }); + + let csvContent = ""; + csvContent += headers.join(",") + "\n"; + + rows.forEach(function (row) { + csvContent += row + .map(function (value) { + return '"' + String(value).replace(/"/g, '""') + '"'; + }) + .join(",") + "\n"; + }); + + const blob = new Blob( + ["\uFEFF" + csvContent], + { type: "text/csv;charset=utf-8;" } + ); + + const link = document.createElement("a"); + const url = URL.createObjectURL(blob); + + link.href = url; + link.download = "상태변경이력.csv"; + document.body.appendChild(link); + link.click(); + + document.body.removeChild(link); + URL.revokeObjectURL(url); +}
-
+

알림

@@ -181,31 +246,32 @@ function displayHistoryList(response) {
-
-
-
+
+
+
  • 알림 내역
도움말
-

알림 내역

-
-
-
-
-

건설현장 프로젝트 상태 변경 이력

-
-
-
알림 목록을 불러오는 중입니다...
-
-
-
+

알림 내역

+
+
+
+
+

건설현장 프로젝트 상태 변경 이력

+ +
+
+
알림 목록을 불러오는 중입니다...
+
+
+
-
+
-
+