From 6d02a20ac12a0358b7e6a85d8987069a1d630a0c Mon Sep 17 00:00:00 2001 From: thkim Date: Wed, 24 Jan 2024 18:02:47 +0900 Subject: [PATCH] =?UTF-8?q?build:=20=EC=A4=91=EA=B0=84=EC=A0=80=EC=9E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/admin/committee/Schedules.jsx | 2 +- .../admin/committee/Schedules/Detail.jsx | 39 +++++--------- .../src/pages/admin/contents/PopUp.jsx | 2 +- .../PopUp/{Writer.jsx => PopupWriter.jsx} | 51 ++++++++++++++++--- .../src/routes/index.jsx | 4 +- 5 files changed, 60 insertions(+), 38 deletions(-) rename egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/{Writer.jsx => PopupWriter.jsx} (89%) diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules.jsx index 45ad396..ea7dc60 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules.jsx @@ -154,7 +154,7 @@ function Schedules(props) { if (scheduleList.length > 0) {//일정 있는 경우 return ( - {day}
{ scheduleList.map((schedule, scheduleIdx) => { diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules/Detail.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules/Detail.jsx index 96006b0..2fab034 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules/Detail.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/committee/Schedules/Detail.jsx @@ -17,8 +17,6 @@ function SchedulesDetail(props) { console.log("EgovAdminScheduleDetail [location] : ", location); const [scheduleDetail, setScheduleDetail] = useState({}); - const [boardAttachFiles, setBoardAttachFiles] = useState(); - const [user, setUser] = useState({}); const retrieveDetail = () => { @@ -32,17 +30,6 @@ function SchedulesDetail(props) { EgovNet.requestFetch(retrieveDetailURL, requestOptions, function (resp) { - /** - * dto.put("evtSeq", tnCmtEvent.getEvtSeq()); // sequence - dto.put("divMeet", tnCmtEvent.getEvtType()); // 구분 - dto.put("upCommittee", tnCmtEvent.getUpCmtSeq()); // 심의위원회 상위 코드 번호 - dto.put("committee", tnCmtEvent.getCmtSeq()); // 심의위원회 하위 코드 번호 - dto.put("title", tnCmtEvent.getEvtTitle()); // 제목 - dto.put("location", tnCmtEvent.getEvtLocation()); // 장소 - dto.put("contents", tnCmtEvent.getEvtContents()); // 내용 - dto.put("startDate", tnCmtEvent.getEvtStartDt()); // 날짜/시간의 시작 일시 - dto.put("endDate", tnCmtEvent.getEvtEndDt()); // 날짜/시간의 종료 일시 - */ setScheduleDetail(resp.result); } ); @@ -137,20 +124,18 @@ function SchedulesDetail(props) { {/* */} -
- {user.id || true && -
- 수정 - -
- } +
+
+ 수정 + +
목록
diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp.jsx index 259ffbd..f9fa52a 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp.jsx @@ -108,7 +108,7 @@ function PopUp(props) { {listPopup.map((it)=>(
{it.seq}
-
{it.popupTitle}
+
{it.popupTitle}
{it.startDate} ~ {it.endDate}
{it.useYn === 'Y' ? : }
diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/Writer.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/PopupWriter.jsx similarity index 89% rename from egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/Writer.jsx rename to egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/PopupWriter.jsx index 5fc2f5d..75a734b 100644 --- a/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/Writer.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/admin/contents/PopUp/PopupWriter.jsx @@ -87,10 +87,39 @@ function PopupWriter(props) { default: navigate({pathname: URL.ERROR}, {state: {msg : ""}}); } - //retrieveDetail(); + retrieveDetail(); } - + const retrieveDetail = () => { + + if (modeInfo.mode === CODE.MODE_CREATE) {// 조회/등록이면 조회 안함 + return; + } + + const retrieveDetailURL = `/contents/api/popup-manage/${location.state?.popupId}`; + const requestOptions = { + method: "GET", + headers: { + 'Content-type': 'application/json' + } + } + EgovNet.requestFetch(retrieveDetailURL, + requestOptions, + function (resp) { + let rawDetail = resp.result; + //기본값 설정 + setScheduleDetail({ + ...popupDetail, + ...rawDetail, + startDate: convertDate(rawDetail.schdulBgnde), + endDate: convertDate(rawDetail.schdulEndde), + }); + setText(rawDetail.contents); + } + ); + } + + const createPopup = () => { const formData = new FormData(); @@ -115,13 +144,13 @@ function PopupWriter(props) { } if (modeInfo.mode === CODE.MODE_MODIFY) { - modeInfo.editURL = `${modeInfo.editURL}/${location.state?.schdulId}`; + modeInfo.editURL = `${modeInfo.editURL}/${location.state?.popupId}`; } EgovNet.requestFetch(modeInfo.editURL, requestOptions, (resp) => { if (Number(resp.resultCode) === Number(CODE.RCV_SUCCESS)) { - navigate({ pathname: URL.ADMIN_SCHEDULE }); + navigate({ pathname: URL.ADMIN__CONTENTS__POP_UP }); } else { navigate({pathname: URL.ERROR}, {state: {msg : resp.resultMessage}}); } @@ -131,8 +160,8 @@ function PopupWriter(props) { } - const onClickDeleteSchedule = (schdulId) => { - const deleteBoardURL = `/schedule/${schdulId}`; + const onClickDelete = (popupId) => { + const deleteBoardURL = `/schedule/${popupId}`; const requestOptions = { method: "DELETE", @@ -157,6 +186,14 @@ function PopupWriter(props) { ); } + const convertDate = (str) => { + let year = str.substring(0, 4); + let month = str.substring(4, 6); + let date = str.substring(6, 8); + let hour = str.substring(8, 10); + let minute = str.substring(10, 12); + return new Date(year, month - 1, date, hour, minute) + } const getDateFourteenDigit = (date) => { return `${getYYYYMMDD(date).toString()}${makeTwoDigit(date.getHours())}${makeTwoDigit(date.getMinutes())}${makeTwoDigit(date.getSeconds())}`; } @@ -281,7 +318,7 @@ function PopupWriter(props) { {modeInfo.mode === CODE.MODE_MODIFY && }
diff --git a/egovframe-template-simple-react-contribution/src/routes/index.jsx b/egovframe-template-simple-react-contribution/src/routes/index.jsx index 9b10d27..5e102ef 100644 --- a/egovframe-template-simple-react-contribution/src/routes/index.jsx +++ b/egovframe-template-simple-react-contribution/src/routes/index.jsx @@ -91,8 +91,8 @@ import AdminStandardsInfoDisclosure from 'pages/admin/standards/InfoDisclosure'; // 관리자 - 컨텐츠 관리 import AdminContentsSurvey from 'pages/admin/contents/Survey'; // 관리자 - 컨텐츠 관리/설문 관리 import AdminContentsPopUp from 'pages/admin/contents/PopUp'; // 관리자 - 컨텐츠 관리/팝업 관리 -import AdminContentsPopUpWriter from 'pages/admin/contents/PopUp/Writer'; // 관리자 - 컨텐츠 관리/팝업 관리/팝업 추가 또는 수정 -import AdminContentsStandardResearch from 'pages/admin/contents/StandardResearch'; // 관리자 - 컨텐츠 관리/건설기준연구 관리 +import AdminContentsPopUpWriter from 'pages/admin/contents/PopUp/PopupWriter'; // 관리자 - 컨텐츠 관리/팝업 관리/팝업 추가 또는 수정 +import AdminContentsStandardResearch from 'pages/admin/contents/StandardResearch'; // 관리자 - 컨텐츠 관리/건설기준연구 관리 import AdminContentsTextMessages from 'pages/admin/contents/TextMessages'; // 관리자 - 컨텐츠 관리/문자 발송 // 관리자 - 위원회 관리