From 023afd63b7d88e81d712ef6cf5c8ca9247efb47f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EC=A7=80=EC=9D=B8?= Date: Mon, 9 Feb 2026 11:29:25 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=9C=EC=A3=BC=EA=B8=B0=EA=B4=80=20>=20?= =?UTF-8?q?=ED=86=B5=EA=B3=84=20:=20=EC=95=8C=EB=A6=BC=EB=82=B4=EC=97=AD?= =?UTF-8?q?=20CSV=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drilling/statistics/drilling_notice.jsp | 104 ++++++++++++++---- 1 file changed, 85 insertions(+), 19 deletions(-) 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) {
-
-
-
+
+
+
  • 알림 내역
도움말
-

알림 내역

-
-
-
-
-

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

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

알림 내역

+
+
+
+
+

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

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