Merge commit '46565c1820d541389be69046b626d7b7c23615c7' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run
iipbs_wr / build (push) Waiting to run
This commit is contained in:
@@ -38,7 +38,7 @@ export default function RswtSttn() {
|
||||
);
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
|
||||
const { rswtSttnRes } = rswtSttn;
|
||||
const { rswtSttnRes, rswtSttnResCount } = rswtSttn;
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [bdstTable, setBdstTable] = useState<customRswtBdst[]>();
|
||||
@@ -96,7 +96,7 @@ export default function RswtSttn() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswtSttn.isInit) {
|
||||
rswtSttnInit(1, "20", "0", fcltNm, code.cityCd, code.sggCd);
|
||||
rswtSttnInit(false, 1, "20", "0", fcltNm, code.cityCd, code.sggCd);
|
||||
}
|
||||
}, [rswtSttn.isInit, rswtSttnInit]);
|
||||
|
||||
@@ -111,7 +111,7 @@ export default function RswtSttn() {
|
||||
chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N',
|
||||
instlCst: item.reuseBuilding[0]?.instlCst === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCst,
|
||||
instlCstSprtAmt: item.reuseBuilding[0]?.instlCstSprtAmt === -1 ? "확인불가" : item.reuseBuilding[0]?.instlCstSprtAmt,
|
||||
archArea : item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가'
|
||||
archArea: item?.archArea.split('.')[0] !== '-1' ? item?.archArea.split('.')[0] : '확인불가'
|
||||
}
|
||||
})
|
||||
.filter(
|
||||
@@ -137,8 +137,8 @@ export default function RswtSttn() {
|
||||
const excelClick = useCallback(() => {
|
||||
// 최신 검색 조건 반영
|
||||
const con = getConValue();
|
||||
rswtSttnSearch(true, pageNation, "20", String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, pageNation, fcltNm]);
|
||||
rswtSttnSearch(true, pageNation, String(rswtSttnResCount), String(con), fcltNm, code.cityCd, code.sggCd);
|
||||
}, [rswtSttnSearch, objSearch, code.cityCd, code.sggCd, pageNation, fcltNm, rswtSttnResCount]);
|
||||
|
||||
useEffect(() => {
|
||||
rswtSttnSearch(false, pageNation, "20", String(getConValue()), fcltNm, code.cityCd, code.sggCd);
|
||||
@@ -158,7 +158,10 @@ export default function RswtSttn() {
|
||||
label="시도"
|
||||
selectClass={""}
|
||||
selectArray={code.cityCd}
|
||||
onSelectValue={getSelCity}
|
||||
onSelectValue={(val) => {
|
||||
getSelCity(val)
|
||||
setPageNation(1)
|
||||
}}
|
||||
/>
|
||||
<SelectBox
|
||||
className="col-span-2 w-1/6 h-full text-2xl ml-4"
|
||||
@@ -166,7 +169,10 @@ export default function RswtSttn() {
|
||||
selectClass={""}
|
||||
selectArray={selectSgg || []}
|
||||
value={objSearch.sgg} // value props 추가
|
||||
onSelectValue={getSgg}
|
||||
onSelectValue={(val) => {
|
||||
getSgg(val)
|
||||
setPageNation(1)
|
||||
}}
|
||||
/>
|
||||
<div className="col-span-2 flex flex-row space-x-2">
|
||||
<Label className="w-28 mt-2 text-xl text-gray-600">
|
||||
@@ -225,7 +231,7 @@ export default function RswtSttn() {
|
||||
}
|
||||
headlist={rswtSttn.rswtSttHeadList}
|
||||
pageSize={20}
|
||||
total={10000}
|
||||
total={rswtSttnResCount || 0}
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
onPageChange={setPageNation}
|
||||
></UiTable>
|
||||
|
||||
@@ -3,13 +3,12 @@ import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import { useWrStore } from "@/app/store";
|
||||
|
||||
export const excelRSwtSttnParsing = (
|
||||
data: customRswtBdst[],
|
||||
excel: customRswtBdst[],
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]
|
||||
): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excel.data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
sidoCode.find((sido) => sido.val === item.ctpvCd.toString())?.text ?? "",
|
||||
sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { fetchType, getFetch, getFetchWithCount } from "@/components/lib/api";
|
||||
import type { z } from "zod";
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
@@ -24,11 +24,12 @@ export type rswtSttnState = {
|
||||
rswtSttNodeList: CommonTableProps[];
|
||||
excelList: [];
|
||||
isInit: boolean;
|
||||
rswtSttnResCount: number;
|
||||
};
|
||||
};
|
||||
|
||||
type rswtSttnActions = {
|
||||
rswtSttnInit: (page: number, total: string, con: string, txt: string,
|
||||
rswtSttnInit: (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => void;
|
||||
rswtSttnSearch: (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
@@ -48,6 +49,7 @@ export const rswtSttnStateExport: rswtSttnState = {
|
||||
rswtSttnRes: rswtSttnRes,
|
||||
excelList: [],
|
||||
isInit: false,
|
||||
rswtSttnResCount: 1,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -57,12 +59,11 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rswtSttnInit: async (page: number, total: string, con: string, txt: string,
|
||||
rswtSttnInit: async (isExcel: boolean, page: number, total: string, con: string, txt: string,
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
|
||||
const rswtSttnRes = await getFetch(
|
||||
const rswtSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
@@ -70,16 +71,46 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
(con ? `/${con}` : "/0") +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
set((state: rswtSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
rswtSttnRes: rswtSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
console.log("rswtSttnResㅇㅇ", rswtSttnRes)
|
||||
if (isExcel) {
|
||||
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode);
|
||||
set((state: rswtSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
excelList: rswtExcel,
|
||||
rswtSttnResCount: rswtSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else
|
||||
set((state: rswtSttnState) => {
|
||||
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
rswtSttnRes: rswtSttnRes.data,
|
||||
rswtSttnResCount: rswtSttnRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
// }
|
||||
|
||||
// set((state: rswtSttnState) => {
|
||||
// return {
|
||||
// ...state,
|
||||
// rswtSttn: {
|
||||
// ...state.rswtSttn,
|
||||
// rswtSttnRes: rswtSttnRes.data,
|
||||
// rswtSttnResCount: rswtSttnRes.count,
|
||||
// excelList: rswtExcel,
|
||||
// isInit: false,
|
||||
// },
|
||||
// };
|
||||
// });
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
@@ -88,7 +119,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
sidoCode: SelectDataType[],
|
||||
sggCode: SelectDataType[]) => {
|
||||
try {
|
||||
const rswtSttnRes = await getFetch(
|
||||
const rswtSttnRes = await getFetchWithCount(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc` +
|
||||
(page ? `/${page}` : "/1") +
|
||||
@@ -104,6 +135,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
excelList: rswtExcel,
|
||||
rswtSttnResCount: rswtSttnRes.count,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -114,7 +146,8 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
rswtSttnRes: rswtSttnRes,
|
||||
rswtSttnRes: rswtSttnRes.data,
|
||||
rswtSttnResCount: rswtSttnRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user