diff --git a/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx b/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx new file mode 100644 index 0000000..cb7bf47 --- /dev/null +++ b/egovframe-template-simple-react-contribution/src/pages/admin/board/AdminPostMgtList.jsx @@ -0,0 +1,199 @@ +import React, { useState, useEffect, useCallback, useRef } from 'react'; +import { Link, useLocation } from 'react-router-dom'; + +import * as EgovNet from 'api/egovFetch'; +import URL from 'constants/url'; + +import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin'; +import EgovPaging from 'components/EgovPaging'; + +import { itemIdxByPage } from 'utils/calc'; + +function EgovAdminBoardList(props) { + console.group("EgovAdminBoardList"); + console.log("[Start] EgovAdminBoardList ------------------------------"); + console.log("EgovAdminBoardList [props] : ", props); + + const location = useLocation(); + console.log("EgovAdminBoardList [location] : ", location); + + // eslint-disable-next-line no-unused-vars + const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시 + const [paginationInfo, setPaginationInfo] = useState({}); + + const cndRef = useRef(); + const wrdRef = useRef(); + + const [listTag, setListTag] = useState([]); + + const retrieveList = useCallback((srchCnd) => { + console.groupCollapsed("EgovAdminBoardList.retrieveList()"); + + const retrieveListURL = '/cop/bbs/selectBBSMasterInfsAPI.do'; + + const requestOptions = { + method: "POST", + headers: { + 'Content-type': 'application/json', + + }, + body: JSON.stringify(srchCnd) + } + + EgovNet.requestFetch(retrieveListURL, + requestOptions, + (resp) => { + setPaginationInfo(resp.result.paginationInfo); + + let mutListTag = []; + listTag.push(
검색된 결과가 없습니다.
); // 게시판 목록 초기값 + + const resultCnt = parseInt(resp.result.resultCnt); + const currentPageNo = resp.result.paginationInfo.currentPageNo; + const pageSize = resp.result.paginationInfo.pageSize; + + // 리스트 항목 구성 + resp.result.resultList.forEach(function (item, index) { + if (index === 0) mutListTag = []; // 목록 초기화 + const listIdx = itemIdxByPage(resultCnt , currentPageNo, pageSize, index); + + mutListTag.push( + +