하수재이용시설현황 조회조건 변경, 엑셀 다운로드 수정
This commit is contained in:
@@ -38,16 +38,18 @@ export default function PbnstSttn() {
|
||||
);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<WaterReuseFacility[]>();
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [pbnDetaileData, setPbnDetaileData] = useState<{
|
||||
isModal: boolean;
|
||||
data: customPbnst;
|
||||
}>({ isModal: false, data: {} as customPbnst });
|
||||
const [returnType, setReturnType] = useState<ReturnType>({} as ReturnType);
|
||||
|
||||
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
pbnstSttnSearch("1", "10000", ref.current, "", searchYear);
|
||||
}, [pbnstSttnSearch, searchYear, ref.current]);
|
||||
pbnstSttnSearch(true, "1", "20", ref.current, "", searchYear);
|
||||
}, [pbnstSttnSearch]);
|
||||
|
||||
const cellCLick = useCallback(
|
||||
(index: number | undefined) => {
|
||||
@@ -75,7 +77,7 @@ export default function PbnstSttn() {
|
||||
}, [pbnstSttn.excelList]);
|
||||
useEffect(() => {
|
||||
if (!pbnstSttn.isInit) {
|
||||
pbnSttnInit("1", "13", ref.current, searchYear);
|
||||
pbnSttnInit("1", "20", ref.current, searchYear);
|
||||
}
|
||||
}, [pbnstSttn.isInit, pbnSttnInit, ref.current]);
|
||||
useEffect(() => {
|
||||
@@ -91,6 +93,10 @@ export default function PbnstSttn() {
|
||||
// pbnNmSearch(String(pageNation), "23", ref.current, pbnRuseNm, searchYear);
|
||||
// }, [pbnRuseNm,pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
pbnstSttnSearch(false, String(pageNation), "20", returnType, pbnRuseNm, searchYear);
|
||||
}, [pageNation]);
|
||||
|
||||
useEffect(() => {
|
||||
if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk)
|
||||
setPbnDetaileData({
|
||||
@@ -127,34 +133,36 @@ export default function PbnstSttn() {
|
||||
}
|
||||
leftChildren={
|
||||
<div className="col-span-3 flex items-center">
|
||||
<SelectBox
|
||||
className="w-48 h-full text-2xl"
|
||||
label="연도"
|
||||
selectClass={"w-full "}
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
/>
|
||||
<Label className="w-64 mt-2 mx-4 text-xl text-gray-600">
|
||||
{"하수처리시설명 "}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={"text-2xl w-full ㅍ"}
|
||||
label=""
|
||||
textValue={pbnRuseNm || ""}
|
||||
setText={(e) => {
|
||||
setPbnRuseNm(e || "");
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<SelectBox
|
||||
className="w-48 h-full text-2xl"
|
||||
label="연도"
|
||||
selectClass={"w-full "}
|
||||
selectArray={yearOptions}
|
||||
value={searchYear}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setSearchYear(String(val))
|
||||
}
|
||||
/>
|
||||
<Label className="w-64 mt-2 mx-4 text-xl text-gray-600">
|
||||
{"하수처리시설명 "}
|
||||
</Label>
|
||||
<SearchInput
|
||||
className={"text-2xl w-full ㅍ"}
|
||||
label=""
|
||||
textValue={pbnRuseNm || ""}
|
||||
setText={(e) => {
|
||||
setPbnRuseNm(e || "");
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
pbnstSttnSearch("1", "20", returnType, pbnRuseNm, searchYear);
|
||||
console.log("시군구코드", returnType)
|
||||
setReturnType(returnType);
|
||||
pbnstSttnSearch(false, "1", "20", returnType, pbnRuseNm, searchYear);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {}}
|
||||
initClick={function (): void { }}
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
isAdmin={false}
|
||||
@@ -178,8 +186,9 @@ export default function PbnstSttn() {
|
||||
}}
|
||||
onPageChange={(page: number) => {
|
||||
pbnstSttnSearch(
|
||||
false,
|
||||
String(page),
|
||||
String(13),
|
||||
String(20),
|
||||
ref.current,
|
||||
pbnRuseNm,
|
||||
searchYear
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TableUpperProps } from "@/app/store/common/type/header";
|
||||
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { getFetch, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
import toast from "react-hot-toast";
|
||||
@@ -95,7 +95,9 @@ export const rainFacStateExport: rainFacState = {
|
||||
};
|
||||
|
||||
const initFetch = async (code:string|number) => {
|
||||
const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/10/${code}`);
|
||||
// const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/10/${code}`);
|
||||
const rainRes =await getFetchWithCount("wr", `/reuseFc/rainyInfoList/1/10/${code}`);
|
||||
console.log("데이터", rainRes)
|
||||
return rainRes;
|
||||
};
|
||||
export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
@@ -143,7 +145,9 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
rainSearch: async(txt:string,pageNation:number) =>{
|
||||
try{
|
||||
|
||||
const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:''))
|
||||
// const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:''))
|
||||
const rainRes = await getFetchWithCount('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:''))
|
||||
console.log("rainRes", rainRes)
|
||||
set((state: rainFacState) => {
|
||||
return {
|
||||
rain: {
|
||||
|
||||
@@ -105,7 +105,7 @@ export const htdflSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
export const htdflSttNodeListExport: CommonTableProps[] = [
|
||||
{
|
||||
id: "bdnstInfo",
|
||||
title: "1.건축물정보",
|
||||
title: "건축물정보",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
@@ -113,7 +113,7 @@ export const htdflSttNodeListExport: CommonTableProps[] = [
|
||||
},
|
||||
{
|
||||
id: "htdflFcltInfo",
|
||||
title: "2.온배수 시설현황",
|
||||
title: "온배수 시설현황",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
@@ -121,7 +121,7 @@ export const htdflSttNodeListExport: CommonTableProps[] = [
|
||||
},
|
||||
{
|
||||
id: "htdflMngInfo",
|
||||
title: "3.온배수운영현황",
|
||||
title: "온배수운영현황",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
|
||||
@@ -100,7 +100,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 3,
|
||||
},
|
||||
{
|
||||
id: "operMngCd",
|
||||
id: "rgnNm",
|
||||
title: "환경청",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -116,7 +116,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 2,
|
||||
},
|
||||
{
|
||||
id: "bdnstNm",
|
||||
id: "bscFctNm",
|
||||
title: "시설명",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -124,7 +124,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "locDiv",
|
||||
id: "efflWqltStndrdNm",
|
||||
title: "지역구분",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -148,7 +148,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "rusNm",
|
||||
id: "ruseUtztnFcltNm",
|
||||
title: "재이용시설명",
|
||||
visible: true,
|
||||
row: 1,
|
||||
@@ -180,7 +180,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 4,
|
||||
},
|
||||
{
|
||||
id: "a",
|
||||
id: "rvbsn",
|
||||
title: "권역",
|
||||
upName: "catchment",
|
||||
visible: true,
|
||||
@@ -189,7 +189,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "aaa",
|
||||
id: "lgbsn",
|
||||
title: "단위유역",
|
||||
upName: "catchment",
|
||||
visible: true,
|
||||
@@ -198,7 +198,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "aaaa",
|
||||
id: "mdmbsn",
|
||||
title: "중권역",
|
||||
upName: "catchment",
|
||||
visible: true,
|
||||
@@ -207,7 +207,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "cityText",
|
||||
id: "sido",
|
||||
title: "시도",
|
||||
upName: "adminDiv",
|
||||
visible: true,
|
||||
@@ -216,7 +216,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "sggText",
|
||||
id: "gugun",
|
||||
title: "시군구",
|
||||
upName: "adminDiv",
|
||||
visible: true,
|
||||
@@ -234,7 +234,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "trbt",
|
||||
id: "splyExtraCpct",
|
||||
title: "하수처리량(m³/일)",
|
||||
upName: "rusSup",
|
||||
visible: true,
|
||||
@@ -252,7 +252,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "total",
|
||||
id: "usageTotal",
|
||||
title: "합계",
|
||||
upName: "yearResult",
|
||||
visible: true,
|
||||
@@ -261,7 +261,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "ithlWtr",
|
||||
id: "inUsage",
|
||||
title: "장내용수",
|
||||
upName: "yearResult",
|
||||
visible: true,
|
||||
@@ -270,7 +270,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "othlWtr",
|
||||
id: "outUsage",
|
||||
title: "장외용수",
|
||||
upName: "yearResult",
|
||||
visible: true,
|
||||
@@ -279,7 +279,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "mngMeth",
|
||||
id: "operMthd",
|
||||
title: "운영방식",
|
||||
upName: "mngInfo",
|
||||
visible: true,
|
||||
@@ -297,7 +297,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "firstDay",
|
||||
id: "bgngDt",
|
||||
title: "시작일",
|
||||
upName: "mngInfo",
|
||||
visible: true,
|
||||
@@ -306,7 +306,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "LastDay",
|
||||
id: "endDt",
|
||||
title: "종료일",
|
||||
upName: "mngInfo",
|
||||
visible: true,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { CommonTableProps, TableUpperProps } from "@/app/store/common/type/header";
|
||||
import type { z } from "zod";
|
||||
import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList";
|
||||
import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList";
|
||||
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
@@ -21,12 +21,12 @@ export type pbnstSttnState = {
|
||||
pbnstSttHeadList: CommonTableProps[];
|
||||
pbnstSttNodeList: CommonTableProps[];
|
||||
pbnstDetail: customPbnst;
|
||||
ruseFcltNodeList:TableUpperProps[]
|
||||
ruseSplyHeadList:TableUpperProps[]
|
||||
rusePplHeadList:TableUpperProps[]
|
||||
ruseGuranteeHeadList:TableUpperProps[]
|
||||
ruseDmdHeadList:TableUpperProps[]
|
||||
ruseFcltHeadList:TableUpperProps[]
|
||||
ruseFcltNodeList: TableUpperProps[]
|
||||
ruseSplyHeadList: TableUpperProps[]
|
||||
rusePplHeadList: TableUpperProps[]
|
||||
ruseGuranteeHeadList: TableUpperProps[]
|
||||
ruseDmdHeadList: TableUpperProps[]
|
||||
ruseFcltHeadList: TableUpperProps[]
|
||||
excelList: [];
|
||||
isInit: boolean;
|
||||
};
|
||||
@@ -35,11 +35,12 @@ export type pbnstSttnState = {
|
||||
type pbnstSttnActions = {
|
||||
pbnstChSttnHead: (headList: z.infer<typeof sttnHeadListType>) => void;
|
||||
pbnstSttnSearch: (
|
||||
isExcel: boolean,
|
||||
page: string,
|
||||
total: string,
|
||||
reurnValue: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string
|
||||
year: string,
|
||||
) => void;
|
||||
pbnSttnInit: (
|
||||
page: string,
|
||||
@@ -63,12 +64,12 @@ export const pbnstSttnStateExport: pbnstSttnState = {
|
||||
pbnstSttn: {
|
||||
pbnstSttHeadList: pbnstSttHeadList,
|
||||
pbnstSttNodeList: pbnstSttNodeList,
|
||||
ruseFcltNodeList:ruseFcltNodeListExport,
|
||||
ruseSplyHeadList:ruseSplyHeadListExport,
|
||||
rusePplHeadList:rusePplHeadListExport,
|
||||
ruseGuranteeHeadList:ruseGuranteeHeadListExport,
|
||||
ruseDmdHeadList:ruseDmdHeadListExport,
|
||||
ruseFcltHeadList:ruseFcltHeadListExport,
|
||||
ruseFcltNodeList: ruseFcltNodeListExport,
|
||||
ruseSplyHeadList: ruseSplyHeadListExport,
|
||||
rusePplHeadList: rusePplHeadListExport,
|
||||
ruseGuranteeHeadList: ruseGuranteeHeadListExport,
|
||||
ruseDmdHeadList: ruseDmdHeadListExport,
|
||||
ruseFcltHeadList: ruseFcltHeadListExport,
|
||||
pbnstSttnRes: [],
|
||||
pbnstDetail: {} as customPbnst,
|
||||
pbnstSearchData: [],
|
||||
@@ -84,33 +85,39 @@ const hasuListFetch = async (
|
||||
searchNm: string | undefined,
|
||||
year: string
|
||||
) => {
|
||||
|
||||
let url = "";
|
||||
if (reurnValue.partValue === "A") {
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${
|
||||
reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
|
||||
// reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue
|
||||
reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue
|
||||
}/0/1/SW`
|
||||
} else if (reurnValue.partValue === "R") {
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${
|
||||
reurnValue.regionValue
|
||||
? reurnValue.regionValue
|
||||
: reurnValue.unitWaterShedValue
|
||||
? reurnValue.unitWaterShedValue
|
||||
: reurnValue.middleRegionValue
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue
|
||||
? reurnValue.regionValue
|
||||
: reurnValue.unitWaterShedValue
|
||||
? reurnValue.unitWaterShedValue
|
||||
: reurnValue.middleRegionValue
|
||||
}/0/1/SW`
|
||||
} else {
|
||||
url = `/prcsFclt/info/${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue}/0/1/SW`
|
||||
|
||||
|
||||
}
|
||||
if( searchNm&& searchNm?.length>0){
|
||||
url+="/"+searchNm
|
||||
if (searchNm && searchNm?.length > 0) {
|
||||
url += "/" + searchNm
|
||||
}
|
||||
|
||||
console.log("주소", url)
|
||||
const pbnList = await getFetch(fetchType.COMMON, url);
|
||||
console.log("pbnList", pbnList)
|
||||
const arrayList = pbnList.map((item: pubHasuType) => item.bscFctCd);
|
||||
console.log("어레이리스트", arrayList)
|
||||
const getRuseList = await postFectch(
|
||||
`/reuseFc/pubDetailList/${year}`,
|
||||
arrayList,
|
||||
fetchType.WR
|
||||
);
|
||||
console.log("getRuseList", getRuseList)
|
||||
const checkWrRegListRes = getRuseList.data;
|
||||
|
||||
const data: WaterReuseFacility[] = checkWrRegListRes.map(
|
||||
@@ -167,11 +174,11 @@ const hasuListFetch = async (
|
||||
outUsage: usage.outUsage,
|
||||
operMthd: item.operList[0]?.operMthd,
|
||||
rprtvBzenty: item.operList[0]?.rprtvBzenty,
|
||||
bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "",
|
||||
bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "",
|
||||
endDt: moment(item.operList[0]?.endDt).format("YYYY-MM-DD") ?? "",
|
||||
searchNm: findData.bscFctNm,
|
||||
searchPk: findData.bscFctCd,
|
||||
prfList:item?.prfList??[]
|
||||
prfList: item?.prfList ?? []
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -196,13 +203,15 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
}));
|
||||
},
|
||||
pbnstSttnSearch: async (
|
||||
isExcel: boolean,
|
||||
page: string,
|
||||
total: string,
|
||||
reurnValue: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string
|
||||
year: string,
|
||||
) => {
|
||||
try {
|
||||
console.log("여기")
|
||||
const pbnstSttnRes = await hasuListFetch(
|
||||
page,
|
||||
total,
|
||||
@@ -210,9 +219,12 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
searchNm,
|
||||
year
|
||||
);
|
||||
|
||||
console.log("pbnstSttnRes", pbnstSttnRes);
|
||||
if (Number(total) > 9000) {
|
||||
// if (Number(total) > 9000) {
|
||||
if (isExcel) {
|
||||
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -253,7 +265,6 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
year
|
||||
);
|
||||
|
||||
console.log('pbnstSttnRes ', pbnstSttnRes)
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -271,10 +282,9 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
getPbnStnDetail: async (pbnstRuseFcltPk: string) => {
|
||||
try {
|
||||
let pbnstDetail = await getFetch("wr", `/reuseFc/pubFc/${pbnstRuseFcltPk}`);
|
||||
if(pbnstDetail.length>=0){
|
||||
pbnstDetail= pbnstDetail.find((item: customPbnst) =>item.pbnstRuseFcltPk === pbnstRuseFcltPk)
|
||||
if (pbnstDetail.length >= 0) {
|
||||
pbnstDetail = pbnstDetail.find((item: customPbnst) => item.pbnstRuseFcltPk === pbnstRuseFcltPk)
|
||||
}
|
||||
console.log( 'pbnstDetail ', pbnstDetail)
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -294,16 +304,16 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
|
||||
reurnValue: ReturnType,
|
||||
searchNm: string | undefined,
|
||||
year: string
|
||||
) => {
|
||||
) => {
|
||||
try {
|
||||
|
||||
const pbnstSttnRes = await hasuListFetch(
|
||||
page,
|
||||
total,
|
||||
reurnValue,
|
||||
searchNm,
|
||||
year
|
||||
);
|
||||
|
||||
const pbnstSttnRes = await hasuListFetch(
|
||||
page,
|
||||
total,
|
||||
reurnValue,
|
||||
searchNm,
|
||||
year
|
||||
);
|
||||
|
||||
set((state: pbnstSttnState) => {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user