diff --git a/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodeList.jsx b/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodeList.jsx index d0d012e..b870248 100644 --- a/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodeList.jsx +++ b/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodeList.jsx @@ -1,195 +1,85 @@ -import React, {useState, useEffect, useCallback, useRef} from 'react'; -import {Link, useLocation, useParams} from 'react-router-dom'; +import React from 'react'; -import * as EgovNet from 'api/egovFetch'; -import URL from 'constants/url'; -import {StandardCodeListModal, StandardCodeListModalTable} from './StandardCodeListModal' -import {AiFillFileMarkdown, AiFillStar} from "react-icons/ai"; -import StandardCodeSearchForm from "./StandardCodeSearchForm"; +import {AiFillStar} from "react-icons/ai"; import Col from "react-bootstrap/Col"; import Row from "react-bootstrap/Row"; -import Loading from "../../../components/Loading"; - -function StandardCodeList({}) { - const {listCode} = useParams(); - const [listData, setListData] = useState([]) - const [listLoading, setListLoading] = useState(true); - const [filterData, setFilterData] = useState(''); - const [resultCnt, setResultCnt] = useState(0); - const [remarkCnt, setRemarkCnt] = useState(0); - const [groupSeq, setGroupSeq] = useState(); - - const [show, setShow] = useState(false); - function close() { - setShow(false); - } - - function showHandling(e) { - const param = e.currentTarget.dataset; - const groupSeq = param.groupSeq; - console.log(groupSeq); - EgovNet.requestFetch( - '/standardCode/codeListModal.do', - { - method: "POST", - headers: { - 'Content-type': 'application/json' - }, - body: JSON.stringify( - groupSeq - ) - }, (resp) => { - console.log(resp + "------------------------resp") - const body = []; - const head = []; - if (resp.length > 0) { - resp.forEach(function (item, index) { - const formattedDate = item.aplcnBgngYmd.match(/\d{4}-\d{2}-\d{2}/)[0]; - const url = "https://www.kcsc.re.kr/file/DownloadGrp/" + item.docFileGrpId; - body.push( - - {formattedDate} - - - ) - }) - head.push( - - 년도 - 기준코드 - 신구건설기준비교 - - ) - } - - setGroupSeq(); - } - ) - setShow(true); - } - - const retrieveList = useCallback((searchCondition) => { - setListLoading(true) - EgovNet.requestFetch('/standardCode/standard-code-list'+EgovNet.convParams(searchCondition), - { - method: "GET", - headers: { - 'Content-type': 'application/json', - } - }, - (resp) => { - setListData(resp.result.resultList); - setResultCnt(resp.result.resultCnt.allCnt); - setRemarkCnt(resp.result.resultCnt.remarkCnt); - setListLoading(false) - }, - function (resp) { - console.log("err response : ", resp); - } - ); - - }, []); +function StandardCodeList({listData, filterData}) { return ( -
-
-
-
- -
-
- 대분류 - 중분류 - 코드번호 - 코드명 - 개정이력 - 보기 - 즐겨찾기 -
- { - listLoading?():( -
- {listData.filter(item => { - if (item.groupNm.includes(filterData)) { - return item - } - return null - }).map(item => { - return ( -
-
{item.mainCategory}
-
{item.middleCategory}
-
{item.kcscCd}
-
{item.groupNm}
{item.rvsnRemark}
-
- - {item.historyList.filter(history => { - return history; - }).map(history => { - let buttonClass = "btn btn-sm docInfoBtn docInfoActive " - let pClass = "yearInfo yearInfoActive"; - if(history.docEr === 'E'){ - buttonClass += "btn-success " - }else{ - buttonClass += "btn-primary " - } - return ( - - { - /*window.open("/standardCode/viewer/"+history.kcscCd+":"+history.rvsnYmd.split('T')[0]);*/ - }} - /> -
-

{history.docYr}

- - ) - })} -
-
-
- - {item.historyList.filter(history => { - return history; - }).map(history => { - let buttonClass = "btn btn-sm docInfoBtn docInfoActive " - let pClass = "yearInfo yearInfoActive"; - if(history.docEr === 'E'){ - buttonClass += "btn-success " - }else{ - buttonClass += "btn-primary " - } - return ( - - { - window.open("/standardCode/viewer/"+history.kcscCd+":"+history.rvsnYmd.split('T')[0]); - }} - /> -
-

{history.docYr}

- - ) - })} -
-
-
-
- ) - })} -
- ) - } +
+ {listData.filter(item => { + if (item.groupNm.includes(filterData)) { + return item + } + return null + }).map(item => { + return ( +
+
{item.mainCategory}
+
{item.middleCategory}
+
{item.kcscCd}
+
{item.groupNm}
{item.rvsnRemark}
+
+ + {item.historyList.filter(history => { + return history; + }).map(history => { + let buttonClass = "btn btn-sm docInfoBtn docInfoActive " + let pClass = "yearInfo yearInfoActive"; + if(history.docEr === 'E'){ + buttonClass += "btn-success " + }else{ + buttonClass += "btn-primary " + } + return ( + + { + /*window.open("/standardCode/viewer/"+history.kcscCd+":"+history.rvsnYmd.split('T')[0]);*/ + }} + /> +
+

{history.docYr}

+ + ) + })} +
- +
+ + {item.historyList.filter(history => { + return history; + }).map(history => { + let buttonClass = "btn btn-sm docInfoBtn docInfoActive " + let pClass = "yearInfo yearInfoActive"; + if(history.docEr === 'E'){ + buttonClass += "btn-success " + }else{ + buttonClass += "btn-primary " + } + return ( + + { + window.open("/standardCode/viewer/"+history.kcscCd+":"+history.rvsnYmd.split('T')[0]); + }} + /> +
+

{history.docYr}

+ + ) + })} +
+
+
-
-
+ ) + })}
); } diff --git a/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodePage.jsx b/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodePage.jsx new file mode 100644 index 0000000..800baef --- /dev/null +++ b/egovframe-template-simple-react-contribution/src/pages/standardCode/list/StandardCodePage.jsx @@ -0,0 +1,124 @@ +import React, {useState, useCallback} from 'react'; +import {useParams} from 'react-router-dom'; + +import * as EgovNet from 'api/egovFetch'; +import {StandardCodeListModal, StandardCodeListModalTable} from './StandardCodeListModal' +import {AiFillFileMarkdown} from "react-icons/ai"; +import StandardCodeSearchForm from "./StandardCodeSearchForm"; +import Loading from "../../../components/Loading"; +import StandardCodeList from "./StandardCodeList"; + +function StandardCodePage({}) { + const {listCode} = useParams(); + const [listData, setListData] = useState([]) + const [listLoading, setListLoading] = useState(true); + const [filterData, setFilterData] = useState(''); + const [resultCnt, setResultCnt] = useState(0); + const [remarkCnt, setRemarkCnt] = useState(0); + const [groupSeq, setGroupSeq] = useState(); + + const [show, setShow] = useState(false); + function close() { + setShow(false); + } + + function showHandling(e) { + const param = e.currentTarget.dataset; + const groupSeq = param.groupSeq; + console.log(groupSeq); + EgovNet.requestFetch( + '/standardCode/codeListModal.do', + { + method: "POST", + headers: { + 'Content-type': 'application/json' + }, + body: JSON.stringify( + groupSeq + ) + }, (resp) => { + console.log(resp + "------------------------resp") + const body = []; + const head = []; + if (resp.length > 0) { + resp.forEach(function (item, index) { + const formattedDate = item.aplcnBgngYmd.match(/\d{4}-\d{2}-\d{2}/)[0]; + const url = "https://www.kcsc.re.kr/file/DownloadGrp/" + item.docFileGrpId; + body.push( + + {formattedDate} + + + ) + }) + head.push( + + 년도 + 기준코드 + 신구건설기준비교 + + ) + } + + setGroupSeq(); + } + ) + setShow(true); + } + + const retrieveList = useCallback((searchCondition) => { + setListLoading(true) + EgovNet.requestFetch('/standardCode/standard-code-list'+EgovNet.convParams(searchCondition), + { + method: "GET", + headers: { + 'Content-type': 'application/json', + } + }, + (resp) => { + setListData(resp.result.resultList); + setResultCnt(resp.result.resultCnt.allCnt); + setRemarkCnt(resp.result.resultCnt.remarkCnt); + setListLoading(false) + }, + function (resp) { + console.log("err response : ", resp); + } + ); + + }, []); + + + return ( +
+
+
+
+ +
+
+ 대분류 + 중분류 + 코드번호 + 코드명 + 개정이력 + 보기 + 즐겨찾기 +
+ { + listLoading?():( + + ) + } +
+ +
+
+
+
+ ); +} + + +export default StandardCodePage; + diff --git a/egovframe-template-simple-react-contribution/src/routes/index.jsx b/egovframe-template-simple-react-contribution/src/routes/index.jsx index b7b1d37..623543b 100644 --- a/egovframe-template-simple-react-contribution/src/routes/index.jsx +++ b/egovframe-template-simple-react-contribution/src/routes/index.jsx @@ -111,10 +111,11 @@ import AdminLogsFileDownloadStatus from 'pages/admin/logs/FileDownloadStatus'; //건설기준코드 import CodeViewer from 'pages/standardCode/viewer/viewer'; +import StandardCodePage from "../pages/standardCode/list/StandardCodePage"; + import * as EgovNet from 'api/egovFetch'; // jwt토큰 위조 검사 때문에 추가 import initPage from 'js/ui'; -import StandardCodeList from "../pages/standardCode/list/StandardCodeList"; const RootRoutes = () => { //useLocation객체를 이용하여 정규표현식을 사용한 /admin/~ 으로 시작하는 경로와 비교에 사용(아래 1줄) */} @@ -330,8 +331,8 @@ const SecondRoutes = () => { } /> {/*기준코드리스트*/} - } /> - } /> + } /> + } />