wr: 시군구 초기화

This commit is contained in:
dongsilove
2026-02-13 20:21:06 +09:00
parent 62fef6bcdc
commit a91bcd9cf7
4 changed files with 25 additions and 6 deletions
@@ -149,9 +149,12 @@ export default function CoMatRvw() {
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
const data =
cityValue === "0"
? [{ val: "0", text: "전체" }]
: getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "" });
setObjSearch({ city: cityValue, sgg: "0" });
};
const getSgg = (val: string | number) => {
@@ -192,6 +195,7 @@ export default function CoMatRvw() {
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
value={objSearch.city}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl ml-4"
@@ -199,6 +203,7 @@ export default function CoMatRvw() {
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
value={objSearch.sgg}
/>
<div className="col-span-7 w-full">
<div className="flex flex-row items-center">
@@ -61,9 +61,13 @@ export default function RuseCaseMng() {
(item: { val: string; text: string }) => item.val === cityValue
)?.text;
setSidoCd(cityText || "");
const data = getCity(cityValue, code.sggCd);
const data =
cityValue === "0"
? [{ val: "0", text: "전체" }]
: getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "" });
setSigunguCd("");
setObjSearch({ city: cityValue, sgg: "0" });
};
// 시군구 선택
@@ -199,6 +203,7 @@ export default function RuseCaseMng() {
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
value={objSearch.city}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl ml-4"
@@ -206,6 +211,7 @@ export default function RuseCaseMng() {
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
value={objSearch.sgg}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl ml-4"
@@ -62,7 +62,10 @@ export default function RuseRvwHstry() {
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
const data =
cityValue === "0"
? [{ val: "0", text: "전체" }]
: getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: "0" });
};
@@ -240,6 +243,7 @@ export default function RuseRvwHstry() {
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
value={objSearch.city}
>
{""}
</SelectBox>
@@ -249,6 +253,7 @@ export default function RuseRvwHstry() {
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
value={objSearch.sgg}
>
{""}
</SelectBox>
@@ -69,7 +69,10 @@ export default function CoSttn() {
const getSelCity = useCallback(
(val: string | number) => {
const cityValue = String(val);
const data = getCity(cityValue, code.sggCd);
const data =
cityValue === "0"
? [{ val: "0", text: "전체" }]
: getCity(cityValue, code.sggCd);
setSelectSgg(data);
// 시/도를 변경하면 시/군/구는 '전체'("0")로 초기화합니다.
setObjSearch({ city: cityValue, sgg: "0" });