건설기준코드 검색 기능 추가
parent
52e6aed96e
commit
720033ece6
|
|
@ -16,6 +16,10 @@ function StandardCodeSearchForm({param, reloadFunction, resultCnt, remarkCnt}){
|
|||
});
|
||||
const [subTabsVisible, setSubTabsVisible] = useState(false);
|
||||
|
||||
const [cat1SelectOption, setCat1SelectOption] = useState([])
|
||||
const [cat2SelectOption, setCat2SelectOption] = useState([])
|
||||
const [cat3SelectOption, setCat3SelectOption] = useState([])
|
||||
|
||||
function getSelectBoxOption(groupCd, handler){
|
||||
EgovNet.requestFetch(
|
||||
'/standardCode/category-option?listCode='+groupCd,
|
||||
|
|
@ -44,19 +48,39 @@ function StandardCodeSearchForm({param, reloadFunction, resultCnt, remarkCnt}){
|
|||
}, [searchCondition]);
|
||||
|
||||
useEffect(() => {
|
||||
if(searchCondition.tab){
|
||||
getSelectBoxOption(searchCondition.tab, (resp)=>{
|
||||
debugger
|
||||
setSearchCondition({...searchCondition, category1: '', category2: '', category3: ''})
|
||||
const groupCd = searchCondition.tab;
|
||||
getSelectBoxOption(groupCd, (resp)=>{
|
||||
const options = [];
|
||||
resp.result.groupList.forEach(function (item, index){
|
||||
options.push(<option value={item.groupCurCd}>{item.groupNm}</option>)
|
||||
})
|
||||
setCat1SelectOption(options)
|
||||
})
|
||||
}
|
||||
}, [searchCondition.tab]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
setSearchCondition({...searchCondition, category2: '', category3: ''})
|
||||
const groupCd = searchCondition.tab+searchCondition.category1;
|
||||
getSelectBoxOption(groupCd, (resp)=>{
|
||||
const options = [];
|
||||
resp.result.groupList.forEach(function (item, index){
|
||||
options.push(<option value={item.groupCurCd}>{item.groupNm}</option>)
|
||||
})
|
||||
setCat2SelectOption(options)
|
||||
})
|
||||
}, [searchCondition.category1]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
setSearchCondition({...searchCondition, category3: ''})
|
||||
const groupCd = searchCondition.tab+searchCondition.category1+searchCondition.category2;
|
||||
getSelectBoxOption(groupCd, (resp)=>{
|
||||
const options = [];
|
||||
resp.result.groupList.forEach(function (item, index){
|
||||
options.push(<option value={item.groupCurCd}>{item.groupNm}</option>)
|
||||
})
|
||||
setCat3SelectOption(options)
|
||||
})
|
||||
}, [searchCondition.category2]);
|
||||
|
||||
|
||||
|
|
@ -78,23 +102,28 @@ function StandardCodeSearchForm({param, reloadFunction, resultCnt, remarkCnt}){
|
|||
</li>
|
||||
<li className="third_1 L">
|
||||
<label className="f_select" htmlFor="sel1">
|
||||
<select id="sel1" title="조건" value={searchCondition.category1}>
|
||||
<select id="sel1" title="조건" value={searchCondition.category1}
|
||||
onChange={(e)=>{setSearchCondition({...searchCondition, category1: e.target.value})}}>
|
||||
<option value="">전체</option>
|
||||
|
||||
{cat1SelectOption}
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
<li className="third_1 L">
|
||||
<label className="f_select w_306" htmlFor="sel1">
|
||||
<select id="sel2" title="조건" value={searchCondition.category2}>
|
||||
<select id="sel2" title="조건" value={searchCondition.category2}
|
||||
onChange={(e)=>{setSearchCondition({...searchCondition, category2: e.target.value})}}>
|
||||
<option value="">전체</option>
|
||||
{cat2SelectOption}
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
<li className="third_1 L">
|
||||
<label className="f_select w_306" htmlFor="sel1">
|
||||
<select id="sel3" title="조건" value={searchCondition.category3} >
|
||||
<select id="sel3" title="조건" value={searchCondition.category3}
|
||||
onChange={(e)=>{setSearchCondition({...searchCondition, category3: e.target.value})}}>
|
||||
<option value="">전체</option>
|
||||
{cat3SelectOption}
|
||||
</select>
|
||||
</label>
|
||||
</li>
|
||||
|
|
|
|||
Loading…
Reference in New Issue