2024-01-03 08:59:14 +00:00
|
|
|
import React, {useState, useImperativeHandle, forwardRef} from "react";
|
|
|
|
|
import * as EgovNet from "api/egovFetch";
|
2023-12-29 02:56:04 +00:00
|
|
|
import {Container} from "react-bootstrap";
|
|
|
|
|
import Row from "react-bootstrap/Row";
|
|
|
|
|
import Col from "react-bootstrap/Col";
|
|
|
|
|
import Form from 'react-bootstrap/Form'
|
|
|
|
|
import Button from "react-bootstrap/Button";
|
|
|
|
|
|
2024-01-03 08:59:14 +00:00
|
|
|
function ChildCodeDiv({}, ref){
|
|
|
|
|
|
|
|
|
|
const [codeItemRow, setCodeItemRow] = useState();
|
|
|
|
|
const [grpCd, setGrpCd] = useState();
|
|
|
|
|
|
|
|
|
|
useImperativeHandle(ref, ()=>({
|
|
|
|
|
getCodeItemList
|
|
|
|
|
}))
|
|
|
|
|
async function getCodeItemList(parentCd){
|
|
|
|
|
setCodeItemRow([]);
|
|
|
|
|
setGrpCd(parentCd)
|
|
|
|
|
EgovNet.requestFetch(
|
|
|
|
|
'/admin/config/code-item?grpCd='+parentCd,
|
|
|
|
|
{
|
|
|
|
|
method: "GET"
|
|
|
|
|
},
|
|
|
|
|
(resp) => {
|
|
|
|
|
const codeItemList = resp.result.codeItemList;
|
|
|
|
|
const itemTag = [];
|
|
|
|
|
codeItemList.forEach(function (item, index){
|
|
|
|
|
itemTag.push(
|
|
|
|
|
<Row className={"py-2 border-bottom"}>
|
|
|
|
|
<Col xs={3}><Form.Control type={"text"} size={"sm"} defaultValue={item.itemCd}/></Col>
|
|
|
|
|
<Col xs={5}><Form.Control type={"text"} size={"sm"} defaultValue={item.itemNm}/></Col>
|
|
|
|
|
<Col xs={2}><Button variant={"danger"} size={"sm"}>삭제</Button></Col>
|
|
|
|
|
<Col xs={2}><Button variant={"primary"} size={"sm"}>수정</Button></Col>
|
|
|
|
|
</Row>
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
setCodeItemRow(itemTag);
|
|
|
|
|
},
|
|
|
|
|
function (resp) {
|
|
|
|
|
console.log("err response : ", resp);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-29 02:56:04 +00:00
|
|
|
return (
|
|
|
|
|
<Container className={"pt-3"}>
|
|
|
|
|
<Row className={"py-2 bg-light border-bottom"}>
|
2024-01-03 08:59:14 +00:00
|
|
|
<Col xs={3}>코드</Col>
|
|
|
|
|
<Col xs={5}>코드명</Col>
|
2023-12-29 02:56:04 +00:00
|
|
|
<Col xs={2}>삭제</Col>
|
|
|
|
|
<Col xs={2}>수정</Col>
|
|
|
|
|
</Row>
|
2024-01-03 08:59:14 +00:00
|
|
|
{codeItemRow}
|
|
|
|
|
{grpCd!=null?(
|
|
|
|
|
<Row className={"py-1"}>
|
|
|
|
|
<Col xs={3}>
|
|
|
|
|
<Form.Control type={"text"} placeholder={"코드"} size={"sm"}/>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col xs={5}>
|
|
|
|
|
<Form.Control type={"text"} placeholder={"코드명"} size={"sm"}/>
|
|
|
|
|
</Col>
|
|
|
|
|
<Col xs={{span:2, offset:2}}><Button type={"button"} variant={"primary"} size={"sm"}>등록</Button></Col>
|
|
|
|
|
</Row>
|
|
|
|
|
):(
|
|
|
|
|
<Row className={"py-1"}>
|
|
|
|
|
<Col>코드 그룹을 선택해주세요.</Col>
|
|
|
|
|
</Row>
|
|
|
|
|
)}
|
2023-12-29 02:56:04 +00:00
|
|
|
</Container>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-03 08:59:14 +00:00
|
|
|
export default forwardRef(ChildCodeDiv);
|