import React, {useCallback, useEffect, useState} from 'react'; import {Link, useLocation, useNavigate, useParams} from 'react-router-dom'; import * as EgovNet from 'api/egovFetch'; import URL from 'constants/url'; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; import Button from 'react-bootstrap/Button'; import {format} from "date-fns"; import EgovPaging from "../../components/EgovPaging"; function List(){ const navigate = useNavigate(); const goToCreate = () => { navigate('/support/create/KCSC-QA'); }; const location = useLocation(); const {BbsCode} = useParams(); const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchKeyword: '', bbsId:BbsCode });// 기존 조회에서 접근 했을 시 || 신규로 접근 했을 시 const [paginationInfo, setPaginationInfo] = useState({}); const [listTag, setListTag] = useState([]); const [categoryList, setCategoryList] = useState([]); const [show, setShow] = useState(false); const [modalBody, setModalBody] = useState(); const handleClose = () => setShow(false); const handleShow = () => setShow(true); console.log("@@@ BbsCode : " + BbsCode); const retrieveList = useCallback((searchCondition) => { handleClose(); const params = EgovNet.convParams(searchCondition); console.groupCollapsed("EgovAdminPostList.retrieveList()"); const retrieveListURL = '/admin/boards/posts/post-list' + params; const requestOptions = { method: "GET", headers: { 'Content-type': 'application/json', } } EgovNet.requestFetch(retrieveListURL, requestOptions, (resp) => { setPaginationInfo(resp.result.paginationInfo); setCategoryList(resp.result.categoryList); console.log("@@@ resultCnt : " + resp.result.resultCnt); let mutListTag = []; setListTag([]); resp.result.fixedList.forEach(function (item) { const finalModifiedDate = item?.lastChgDt ? item?.lastChgDt : item?.frstCrtDt; const formattedDate = finalModifiedDate ? format(finalModifiedDate, "yyyy-MM-dd") : ""; mutListTag.push(
공지
{item?.bbsContTitle}
{item?.frstCrtId}
{item?.bbsReadCnt}
{formattedDate}
{item?.fileGrpId && }
); }); resp.result.postList.forEach(function (item, index) { const finalModifiedDate = item?.lastChgDt ? item?.lastChgDt : item?.frstCrtDt; const formattedDate = finalModifiedDate ? format(finalModifiedDate, "yyyy-MM-dd") : ""; mutListTag.push(
{resp.result.resultCnt - (resp.result.paginationInfo.pageIndex -1) * resp.result.paginationInfo.rowCnt - index}
{item?.bbsContTitle}
{item?.frstCrtId}
{item?.bbsReadCnt}
{formattedDate}
{item?.fileGrpId && }
); }); if(!mutListTag.length) mutListTag.push(

검색된 결과가 없습니다.

); // 게시판 목록 초기값 setListTag(mutListTag); }, function (resp) { console.log("err response : ", resp); } ); console.groupEnd("EgovAdminPostList.retrieveList()"); },[listTag]); useEffect(() => { retrieveList(searchCondition); // eslint-disable-next-line react-hooks/exhaustive-deps }, [searchCondition]); return (
{/* */}
  • Home
  • 정보제공
  • 게시판명
{/* */}
{/* */}

게시판명

{/* */}
{/* */} {/* */}
번호 제목 작성자 조회수 등록일 파일
{/* */} {/*

검색된 결과가 없습니다.

*/} {/* */} {listTag} {/*
3
[공지] 공통컴포넌트 중 모니터링 관련 서비스 실행시 오류가 발생합니다 [15]
관리자
3
2021-7-24
2
validation 처리 시.패스워드에 대한 메소드를 찾지 못합니다.
홍길동
3
2021-7-24
1
미답변시 아이콘   답변완료시 아이콘   공통컴포넌트 중 모니터링 관련 서비스 실행시 오류가 발생합니다.
홍길동
3
2021-7-24
*/}
{/* */} {/* */} { retrieveList({ ...searchCondition, pageIndex: passedPage}) //, searchCnd: cndRef.current.value, searchKeyword: wrdRef.current.value }} />
{/* */} {/* 수요조사는 버튼명 "의견 접수" 수요조사와 QNA만 작성가능하게 관리자 세팅되어야 함/관리자 쓰기권한만 작성가능 */}
{/* */}
); } export default List;