diff --git a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx index 0f3d710c7..90e9bd440 100644 --- a/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/irsetting/page.tsx @@ -42,19 +42,14 @@ interface UploadedFileInfo { // 초기 파일 정보 상태 const initialFileInfo: UploadedFileInfo = { file: null, atflCd: null, atflId: null }; -interface ApiSelectOption { - text: string; - val: string; -} - const IrSetting = () => { const [input1, setInput1] = useState('0.8'); // 오수전환율 초기값 const [input2, setInput2] = useState(''); const [select1, setSelect1] = useState('0'); // 하수처리장코드 const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태 const [isLoadingResult, setIsLoadingResult] = useState(false); // 로딩 상태 - const [ctpvCd, setCtpvCd] = useState(0); // 시도 코드 상태 - const [sggCd, setSggCd] = useState(0); // 시군구 코드 상태 + const [ctpvCd, setCtpvCd] = useState('0'); // 시도 코드 상태 + const [sggCd, setSggCd] = useState('0'); // 시군구 코드 상태 const [sggName, setSggName] = useState(''); // 시군구 이름 상태 const [swtrmtFcltNm, setSwtrmtFcltNm] = useState(''); // 하수처리시설명 상태 @@ -298,8 +293,8 @@ const IrSetting = () => { // 새로운 JSON 데이터 생성 const combinedAnalysisData = { - ctpvCd: (ctpvCd ? String(ctpvCd) : null), - sggCd: (sggCd ? String(sggCd) : null), // 시군구코드 (선택값) + ctpvCd: ctpvCd !== '0' ? String(ctpvCd).trim() : null, + sggCd: sggCd !== '0' ? String(sggCd) : null, // 시군구코드 (선택값) swtrmtFcltNm: swtrmtFcltNm ?? null, aplcnYm: selectedDate, // 적용연월 drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환) diff --git a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx index f0da9ad47..aea5c873a 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdii/page.tsx @@ -95,11 +95,6 @@ interface UploadedFileInfo { // 초기 파일 정보 상태 const initialFileInfo: UploadedFileInfo = { file: null, atflCd: null, atflId: null }; -interface ApiSelectOption { - text: string; - val: string; -} - export default function RTKForm() { const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태 const [isLoadingResult, setIsLoadingResult] = useState(false); // 로딩 상태 @@ -113,8 +108,8 @@ export default function RTKForm() { ]); const [select1, setSelect1] = useState('0'); // 하수처리장 (swtrmtFcltCd) - const [ctpvCd, setCtpvCd] = useState(0); // 시도 코드 상태 - const [sggCd, setSggCd] = useState(0); // 시군구 코드 상태 + const [ctpvCd, setCtpvCd] = useState('0'); // 시도 코드 상태 + const [sggCd, setSggCd] = useState('0'); // 시군구 코드 상태 const [sggName, setSggName] = useState(''); // 시군구 이름 상태 const [swtrmtFcltNm, setSwtrmtFcltNm] = useState(''); // 하수처리시설명 상태 @@ -290,8 +285,8 @@ export default function RTKForm() { // 새로운 JSON 데이터 생성 const combinedAnalysisData = { aplcnYm: formData.date, // 적용연월 (YYYYMM 형식) - ctpvCd: ctpvCd ? String(ctpvCd) : null, // 시도코드 (선택값) - sggCd: sggCd ? String(sggCd) : null, // 시군구코드 (선택값) + ctpvCd: ctpvCd !== '0' ? String(ctpvCd).trim() : null, // 시도코드 (선택값) + sggCd: sggCd !== '0' ? String(sggCd) : null, // 시군구코드 (선택값) swtrmtFcltNm: swtrmtFcltNm ?? null, atflCd: file1?.atflCd, // 첨부파일CD (오수관망도) atflId: file1?.atflId, // 첨부파일ID (오수관망도) @@ -357,10 +352,6 @@ export default function RTKForm() { name: "initialDepths" }) - const onSubmit = (data: z.infer) => { - console.log("✅ 제출 데이터:", data) - } - // 단위도 계수 테이블 설정 (EditableTableHeadItem 타입 사용 및 id 수정) const unitFactorHeadlist: EditableTableHeadItem[] = [ { id: 'response', title: 'Response', editable: false, width: '150px' }, // width 속성 추가 @@ -377,11 +368,6 @@ export default function RTKForm() { { id: 'Do', title: 'Do', editable: true, inputProps: { type: 'text' } } ]; - // 테이블 페이지 변경 핸들러 - const handlePageChange = (page: number) => { - console.log('Page changed:', page) - } - return ( <> diff --git a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx index 784aeb6a5..257916d76 100644 --- a/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/rdiiResult/page.tsx @@ -77,8 +77,8 @@ const Result = () => { const [resetSelection, setResetSelection] = useState(false); const [isResetPage, setIsResetPage] = useState(false); const [curPage, setCurPage] = useState(1); // 현재 페이지 - const [ctpvCd, setCtpvCd] = useState(0); // 시도 코드 상태 - const [sggCd, setSggCd] = useState(0); // 시군구 코드 상태 + const [ctpvCd, setCtpvCd] = useState('0'); // 시도 코드 상태 + const [sggCd, setSggCd] = useState('0'); // 시군구 코드 상태 const [sggName, setSggName] = useState(''); // 시군구 이름 상태 const {ctpv, sgg} = useStore(); @@ -112,8 +112,8 @@ const Result = () => { const inftwtAnlsSearchDto = { aplcnYmFrom: formValues.aplcnYmFrom?.trim() ? formValues.aplcnYmFrom : null, aplcnYmTo: formValues.aplcnYmTo?.trim() ? formValues.aplcnYmTo : null, - ctpvCd: ctpvCd || null, - sggCd: sggCd || null, + ctpvCd: ctpvCd !== '0' ? ctpvCd.trim() : null, + sggCd: sggCd !== '0' ? sggCd : null, swtrmtFcltNm: formValues.swtrmtFcltNm?.trim() ? formValues.swtrmtFcltNm : null, auth: AUTH, }; @@ -140,15 +140,15 @@ const Result = () => { const dataWithRowNumber = (data.content || []).map((item: any, index: number) => { // 🎯 먼저 각 아이템을 포맷팅 const formattedItem = formatDisplayData(item); - const ctpvOne = ctpv.find(code => code.id === item.ctpvCd); - const sggOne = sgg.find(code => code.id === item.sggCd); + const ctpvOne = ctpv.find(code => code.val.trim() === item.ctpvCd.trim()); + const sggOne = sgg.find(code => code.val === item.sggCd); // 추가 처리 및 일련번호 추가 return { ...formattedItem, rowNumber: (curPage - 1) * 10 + index + 1, // 1부터 시작하는 일련번호 추가 scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn, // scsYn이 null이면 'N'으로 변경 - ctpvNm: ctpvOne ? ctpvOne.name : item.ctpvCd, - sggNm: sggOne ? sggOne.name : item.sggCd, + ctpvNm: ctpvOne ? ctpvOne.text.trim() : item?.ctpvCd?.trim(), + sggNm: sggOne ? sggOne.text : item.sggCd, }; }) .filter((item: any) => item.scsYn === 'Y'); diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index 6e929933a..8df0a60a8 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -74,8 +74,8 @@ const Result = () => { const [resetSelection, setResetSelection] = useState(false); const [isResetPage, setIsResetPage] = useState(false); const [curPage, setCurPage] = useState(1); // 현재 페이지 - const [ctpvCd, setCtpvCd] = useState(0); // 시도 코드 상태 - const [sggCd, setSggCd] = useState(0); // 시군구 코드 상태 + const [ctpvCd, setCtpvCd] = useState('0'); // 시도 코드 상태 + const [sggCd, setSggCd] = useState('0'); // 시군구 코드 상태 const [sggName, setSggName] = useState(''); // 시군구 이름 상태 const {ctpv, sgg} = useStore(); @@ -106,8 +106,8 @@ const Result = () => { let inftwtAnlsSearchDto = { "aplcnYmFrom": formValues.aplcnYmFrom && formValues.aplcnYmFrom !== '' ? formValues.aplcnYmFrom : null, "aplcnYmTo": formValues.aplcnYmTo && formValues.aplcnYmTo !== '' ? formValues.aplcnYmTo : null, - "ctpvCd": ctpvCd === 0 ? null : ctpvCd, - "sggCd": sggCd === 0 ? null : sggCd, + "ctpvCd": ctpvCd === '0' ? null : ctpvCd.trim(), + "sggCd": sggCd === '0' ? null : sggCd, "swtrmtFcltNm": formValues.swtrmtFcltNm?.trim() ? formValues.swtrmtFcltNm : null, "auth": AUTH, }; @@ -135,15 +135,15 @@ const Result = () => { const dataWithRowNumber = (data.content || []).map((item: any, index: number) => { // 🎯 먼저 각 아이템을 포맷팅 const formattedItem = formatDisplayData(item); - const ctpvOne = ctpv.find(code => code.id === item.ctpvCd); - const sggOne = sgg.find(code => code.id === item.sggCd); + const ctpvOne = ctpv.find(code => code.val.trim() === item?.ctpvCd?.trim()); + const sggOne = sgg.find(code => code.val === item.sggCd); // 추가 처리 및 일련번호 추가 return { ...formattedItem, rowNumber: (curPage - 1) * 10 + index + 1, // 1부터 시작하는 일련번호 추가 scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn, // scsYn이 null이면 'N'으로 변경 - ctpvNm: ctpvOne ? ctpvOne.name : item.ctpvCd, - sggNm: sggOne ? sggOne.name : item.sggCd, + ctpvNm: ctpvOne ? ctpvOne.text : item.ctpvCd, + sggNm: sggOne ? sggOne.text : item.sggCd, }; }) .filter((item: any) => item.scsYn === 'Y'); diff --git a/apps/sn/app/components/ui/ctpvSggPrcsFcltSelectBox.tsx b/apps/sn/app/components/ui/ctpvSggPrcsFcltSelectBox.tsx index 9b9df0724..66d5722d8 100644 --- a/apps/sn/app/components/ui/ctpvSggPrcsFcltSelectBox.tsx +++ b/apps/sn/app/components/ui/ctpvSggPrcsFcltSelectBox.tsx @@ -43,6 +43,8 @@ export function CtpvSggPrcsFcltSelectBox({ const [prcsFcltOptions, setPrcsFcltOptions] = useState([]); const { ctpv, sgg } = useStore(); + const sidoStr = String(sido ?? ''); + const sidoPrefix = sidoStr.slice(0, 2); useEffect(() => { (async () => { @@ -129,7 +131,7 @@ export function CtpvSggPrcsFcltSelectBox({ className="w-48" selectClass="w-48 rounded-lg bg-white truncate" label="" - selectArray={[defaultOption, ...sgg.filter(opt => opt.val.startsWith(sido.slice(0, 2)))]} + selectArray={[defaultOption, ...sgg.filter(opt => opt.val.startsWith(sidoPrefix))]} value={sigungu} onSelectValue={val => { onSigunguChange(String(val))