게시판 작업중
parent
1406047290
commit
a8e435876b
|
|
@ -1,5 +1,5 @@
|
|||
import React, { useState } from 'react';
|
||||
import {Link, useNavigate} from 'react-router-dom';
|
||||
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';
|
||||
|
|
@ -7,6 +7,8 @@ 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();
|
||||
|
|
@ -14,6 +16,89 @@ function List(){
|
|||
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(
|
||||
<div className="list_item">
|
||||
<div>공지</div>
|
||||
<div className="al">{item?.bbsContTitle}</div>
|
||||
<div>{item?.frstCrtId}</div>
|
||||
<div>{item?.bbsReadCnt}</div>
|
||||
<div>{formattedDate}</div>
|
||||
<div>{item?.fileGrpId && <img src="/assets/images/file.png" />}</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
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(
|
||||
<div className="list_item">
|
||||
<div>{resp.result.resultCnt - (resp.result.paginationInfo.pageIndex -1) * resp.result.paginationInfo.rowCnt - index}</div>
|
||||
<div className="al">{item?.bbsContTitle}</div>
|
||||
<div>{item?.frstCrtId}</div>
|
||||
<div>{item?.bbsReadCnt}</div>
|
||||
<div>{formattedDate}</div>
|
||||
<div>{item?.fileGrpId && <img src="/assets/images/file.png" />}</div>
|
||||
</div>
|
||||
);
|
||||
});
|
||||
if(!mutListTag.length) mutListTag.push(<p className="no_data" key="0">검색된 결과가 없습니다.</p>); // 게시판 목록 초기값
|
||||
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 (
|
||||
|
|
@ -72,7 +157,8 @@ function List(){
|
|||
{/* <p className="no_data" key="0">검색된 결과가 없습니다.</p> */}
|
||||
|
||||
{/* <!-- case : 데이터 있을때 --> */}
|
||||
<Link to={URL.SUPPORT_DETAIL_NOCODE+'/KCSC-NTC'} className="list_item">
|
||||
{listTag}
|
||||
{/*<Link to={URL.SUPPORT_DETAIL_NOCODE+'/KCSC-NTC'} className="list_item">
|
||||
<div>3</div>
|
||||
<div className="al">[공지] 공통컴포넌트 중 모니터링 관련 서비스 실행시 오류가 발생합니다 [15] <img src="/assets/images/lock.png" className="pt-1" /> <img src="/assets/images/new.png" className="pt-1" /></div>
|
||||
<div>관리자</div>
|
||||
|
|
@ -91,16 +177,16 @@ function List(){
|
|||
<Link to={URL.SUPPORT_DETAIL_NOCODE+'/KCSC-NTC'} className="list_item">
|
||||
<div>1</div>
|
||||
<div className="al d-flex align-items-center">
|
||||
{/*미답변시 아이콘*/}
|
||||
미답변시 아이콘
|
||||
<img src="/assets/images/icon_answer0.png" className="pt-1 h_30 pb-1" />
|
||||
{/*답변완료시 아이콘*/}
|
||||
{/*<img src="/assets/images/icon_answer.png" className="pt-1 h_30 pb-1" /> */}
|
||||
답변완료시 아이콘
|
||||
<img src="/assets/images/icon_answer.png" className="pt-1 h_30 pb-1" />
|
||||
공통컴포넌트 중 모니터링 관련 서비스 실행시 오류가 발생합니다.</div>
|
||||
<div>홍길동</div>
|
||||
<div>3</div>
|
||||
<div>2021-7-24</div>
|
||||
<div></div>
|
||||
</Link>
|
||||
</Link>*/}
|
||||
</div>
|
||||
</div>
|
||||
{/* <!--// 게시판목록 --> */}
|
||||
|
|
@ -108,6 +194,9 @@ function List(){
|
|||
<Row className="board_bot justify-content-between">
|
||||
<Col xs={3} className=""></Col>
|
||||
{/* <!-- Paging --> */}
|
||||
<EgovPaging pagination={paginationInfo} moveToPage={passedPage => {
|
||||
retrieveList({ ...searchCondition, pageIndex: passedPage}) //, searchCnd: cndRef.current.value, searchKeyword: wrdRef.current.value
|
||||
}} />
|
||||
<Col xs={6} className="paging">
|
||||
<ul>
|
||||
<li className="btn"><button to="" className="first">처음</button></li>
|
||||
|
|
|
|||
|
|
@ -171,15 +171,15 @@ public class AdminBoardsController extends BaseController {
|
|||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/posts/post-list", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO getPostList(TnBbsContents params) throws Exception {
|
||||
public ResultVO getPostList(TnBbsContents tnBbsContents) throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
params.setQueryInfo();
|
||||
Map<String, Object> resultMap = adminBoardsService.selectPostList(params);
|
||||
tnBbsContents.setQueryInfo();
|
||||
Map<String, Object> resultMap = adminBoardsService.selectPostList(tnBbsContents);
|
||||
resultMap.put("categoryList", adminBoardsService.selectBoardList());
|
||||
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
|
||||
params.setContentCnt(totCnt);
|
||||
params.setPaginationInfo();
|
||||
resultMap.put("paginationInfo", params);
|
||||
tnBbsContents.setContentCnt(totCnt);
|
||||
tnBbsContents.setPaginationInfo();
|
||||
resultMap.put("paginationInfo", tnBbsContents);
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@
|
|||
<if test='searchKeyword != null and searchKeyword != ""'>
|
||||
and bbs_cont_title like '%'||#{searchKeyword}||'%'
|
||||
</if>
|
||||
<if test='bbsId != null and bbsId != ""'>
|
||||
and bbs_id = #{bbsId}
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue