건설기준코드리스트모달창구현

cks
dbnt-design 2023-11-07 13:11:22 +09:00
parent 3aaa157dde
commit 6423d6e908
2 changed files with 64 additions and 20 deletions

View File

@ -5,11 +5,11 @@ import * as EgovNet from 'api/egovFetch';
import URL from 'constants/url'; import URL from 'constants/url';
import { NOTICE_BBS_ID } from 'config'; import { NOTICE_BBS_ID } from 'config';
import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavInform';
import EgovPaging from 'components/EgovPaging'; import EgovPaging from 'components/EgovPaging';
import { itemIdxByPage } from 'utils/calc'; import { itemIdxByPage } from 'utils/calc';
import StandardCodeListModal from './StandardCodeListModal' import {StandardCodeListModal,TestTable} from './StandardCodeListModal'
function StandardCodeList(props) { function StandardCodeList(props) {
const {listCode} = useParams(); const {listCode} = useParams();
@ -17,8 +17,40 @@ function StandardCodeList(props) {
const [groupseq,setgroupseq] = useState(); const [groupseq,setgroupseq] = useState();
function showhandling(e){ function showhandling(e){
const param = e.currentTarget.dataset; const param = e.currentTarget.dataset;
const groupseq = param.groupseq;
console.log(groupseq);
EgovNet.requestFetch(
'/standardCode/testCodeList.do',
{
method: "POST",
headers: {
'Content-type': 'application/json'
},
body: JSON.stringify(
groupseq
)
},(resp) =>{
console.log(resp+"------------------------resp")
const body =[];
if(resp.length>0){
resp.forEach(function (item,index){
const formattedDate = item.aplcnBgngYmd.match(/\d{4}-\d{2}-\d{2}/)[0];
body.push(
<tr>
<td>{formattedDate}</td>
<td>{item.docFileGrpId}</td>
<td></td>
</tr>)
})
}
setgroupseq(<TestTable content={body}/>);
}
)
setshow(true); setshow(true);
setgroupseq(param.groupseq);
} }
function close () { function close () {
setshow(false); setshow(false);
@ -75,15 +107,8 @@ function StandardCodeList(props) {
mutListTag.push( mutListTag.push(
<Link <Link
to={"#"}
state={{
docInfoSeq: item.docInfoSeq,
docNm: item.docNm,
kcscCd: item.kcscCd,
searchCondition: searchCondition
}}
key={listIdx} key={listIdx}
className="list_item" > className="list_item List_Codes" >
<div></div> <div></div>
<div></div> <div></div>
<div>{item.kcscCd}</div> <div>{item.kcscCd}</div>
@ -134,14 +159,14 @@ function StandardCodeList(props) {
<div className="layout"> <div className="layout">
{/* <!-- Navigation --> */} {/* <!-- Navigation --> */}
<EgovLeftNav/>
{/* <!--// Navigation --> */} {/* <!--// Navigation --> */}
<div className="contents NOTICE_LIST" id="contents"> <div className="contents NOTICE_LIST" id="contents">
{/* <!-- 본문 --> */} {/* <!-- 본문 --> */}
<div className="top_tit"> <div className="top_tit">
<h1 className="tit_1">건설기준코드</h1> <h2 className="tit_1">건설기준코드</h2>
</div> </div>
<h2 className="tit_2">설계기준, 표준시방서 내용을 열람할 있습니다.</h2> <h2 className="tit_2">설계기준, 표준시방서 내용을 열람할 있습니다.</h2>
@ -206,7 +231,8 @@ function StandardCodeList(props) {
retrieveList({ ...searchCondition, pageIndex: passedPage, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value }) retrieveList({ ...searchCondition, pageIndex: passedPage, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value })
}} /> }} />
{/* <!--/ Paging --> */} {/* <!--/ Paging --> */}
<StandardCodeListModal show ={show} groupseq ={groupseq} onClose = {close}/> <StandardCodeListModal size={"lg"} show ={show} content ={groupseq} onClose = {close} title={"개정이력"}/>
</div> </div>
{/* <!--// 본문 --> */} {/* <!--// 본문 --> */}

View File

@ -1,17 +1,35 @@
import {Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalTitle} from "react-bootstrap"; import {Button, Modal, ModalBody, ModalFooter, ModalHeader, ModalTitle} from "react-bootstrap";
function StandardCodeListModal({show,groupseq,onClose}){ function StandardCodeListModal({show,content,onClose,title,size}){
//todo 로직추가구현필요
return( return(
<Modal show={show}> <Modal size={size} show={show} aria-labelledby="example-modal-sizes-title-lg">
<ModalHeader> <ModalHeader>
<ModalTitle>개정이력</ModalTitle> <ModalTitle id="example-modal-sizes-title-lg">{title}</ModalTitle>
</ModalHeader> </ModalHeader>
<ModalBody> <ModalBody>
{groupseq} {content}
</ModalBody> </ModalBody>
<ModalFooter><Button onClick={onClose}>닫기</Button></ModalFooter> <ModalFooter><Button onClick={onClose}>닫기</Button></ModalFooter>
</Modal>) </Modal>)
} }
export default StandardCodeListModal;
function TestTable({content}){
return(
<table>
<thead>
<tr>
<td>년도</td>
<td>기준코드</td>
<td>신구건설기준비교</td>
</tr>
</thead>
<tbody>
{content}
</tbody>
</table>
)
}
export {StandardCodeListModal,TestTable};