실적현황 테이블 데이터 넣기 작업중
This commit is contained in:
@@ -2,19 +2,40 @@
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { btnClass } from "@/app/store/common/code";
|
||||
import type { FcPrfType, PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
|
||||
import { yearOptions } from "@/components/lib/func/commom";
|
||||
import { ContentsDiv, SearchBaseForm, SearchDiv, SearchFormLeft, SearchInput, SelectBox, Title, UiTable } from "@common/business_components/ui";
|
||||
import { ContentsDiv, Title, SearchBaseForm, SelectBox, SearchInput, UiTable } from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, DatePicker, Label } from "@common/components/ui";
|
||||
import { Button, Label } from "@common/components/ui";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
|
||||
|
||||
export default function PbnstPrfmncSttn() {
|
||||
const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncSearch } = useWrStore((state) => state);
|
||||
const { pbnstPrfHeadList } = pbnstPrfmncSttn;
|
||||
const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncInit } = useWrStore((state) => state);
|
||||
const { pbnstPrfHeadList, pbnstPrfmncRes, prfmncRes } = pbnstPrfmncSttn;
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear()));
|
||||
const [toDate, setToDate] = useState<string>(String(new Date().getFullYear()));
|
||||
|
||||
const [pbnstTable, setPbnstTable] = useState<PrfType[]>();
|
||||
const [bdstTable, setbdstTable] = useState<FcPrfType[]>();
|
||||
|
||||
useEffect(() => {
|
||||
console.log("pbnstPrfmncRes", pbnstPrfmncRes )
|
||||
setPbnstTable([]);
|
||||
}, [pbnstPrfmncRes]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("prfmncRes",prfmncRes)
|
||||
setbdstTable(prfmncRes);
|
||||
}, [prfmncRes]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
pbnstPrfmncInit();
|
||||
}, [pbnstPrfmncInit]);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -28,72 +49,59 @@ export default function PbnstPrfmncSttn() {
|
||||
selectUnitWaterShedData={code.lgbsnCd}
|
||||
selectMiddleRegionData={code.mdmbsnCd}
|
||||
selectEnvPartData={code.lclgvrnmntCd}
|
||||
rightChildren={
|
||||
<Button
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
setIsChHead(true);
|
||||
}}
|
||||
>
|
||||
조회항목설정
|
||||
</Button>
|
||||
}
|
||||
leftChildren={
|
||||
<div className="col-span-5">
|
||||
<div className="flex flex-row">
|
||||
<div className="flex flex-row items-center">
|
||||
<Label className="text-xl text-gray-600">하수 재이용년도</Label>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={fromDate}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setFromDate(String(val))
|
||||
}
|
||||
/>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={toDate}
|
||||
onSelectValue={(val: string | number) =>
|
||||
setToDate(String(val))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<SearchInput
|
||||
className={"text-2xl"}
|
||||
label="시설명"
|
||||
textValue={""}
|
||||
setText={(e) => {
|
||||
|
||||
}}
|
||||
/>
|
||||
rightChildren={<Button
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
setIsChHead(true);
|
||||
}}
|
||||
>
|
||||
조회항목설정
|
||||
</Button>}
|
||||
leftChildren={<div className="col-span-5">
|
||||
<div className="flex flex-row">
|
||||
<div className="flex flex-row items-center">
|
||||
<Label className="text-xl text-gray-600">하수 재이용년도</Label>
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label="재이용시설명"
|
||||
label=""
|
||||
selectClass={""}
|
||||
selectArray={[]}
|
||||
value={""}
|
||||
onSelectValue={() => { }}
|
||||
/>
|
||||
selectArray={yearOptions}
|
||||
value={fromDate}
|
||||
onSelectValue={(val: string | number) => setFromDate(String(val))} />
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label=""
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={toDate}
|
||||
onSelectValue={(val: string | number) => setToDate(String(val))} />
|
||||
</div>
|
||||
<SearchInput
|
||||
className={"text-2xl"}
|
||||
label="시설명"
|
||||
textValue={""}
|
||||
setText={(e) => {
|
||||
}} />
|
||||
<SelectBox
|
||||
className="h-full text-2xl"
|
||||
label="재이용시설명"
|
||||
selectClass={""}
|
||||
selectArray={[]}
|
||||
value={""}
|
||||
onSelectValue={() => { }} />
|
||||
</div>
|
||||
}
|
||||
</div>}
|
||||
queryClick={function (): void {
|
||||
if (fromDate && toDate) {
|
||||
const fromNum = Number(fromDate)
|
||||
const toNum = Number(toDate)
|
||||
const fromNum = Number(fromDate);
|
||||
const toNum = Number(toDate);
|
||||
if (fromNum > toNum) {
|
||||
alert("시작년도가 종료년도 이후로 설정할 수 없습니다.")
|
||||
alert("시작년도가 종료년도 이후로 설정할 수 없습니다.");
|
||||
} else {
|
||||
if (toNum - fromNum > 5) {
|
||||
alert("최대 5년까지 선택 가능합니다.")
|
||||
alert("최대 5년까지 선택 가능합니다.");
|
||||
} else {
|
||||
tableHeadMaker(fromNum, toNum)
|
||||
tableHeadMaker(fromNum, toNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +117,7 @@ export default function PbnstPrfmncSttn() {
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
headName={[]}
|
||||
tableData={[]}
|
||||
tableData={pbnstTable || []}
|
||||
headlist={pbnstPrfHeadList}
|
||||
pageSize={20}
|
||||
total={10000}
|
||||
|
||||
@@ -36,7 +36,7 @@ export const pbnstPrfmncSttnHeadListExport: TableUpperProps[] = [
|
||||
|
||||
export const pbnstYearHeadListExport: TableUpperProps[] = [
|
||||
{
|
||||
id: "year",
|
||||
id: "ym",
|
||||
title: "년도",
|
||||
colSpan: 3,
|
||||
row:0
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import type { TableUpperProps } from "../../common/type/headder";
|
||||
import { pbnstPrfmncSttnHeadListExport, pbnstYearHeadListExport } from "./headList";
|
||||
import type { FcPrfType, PrfType } from "../../prfmncReg/pbnstPrfmncReg/type";
|
||||
|
||||
type pbnstPrfmncSttnActions = {
|
||||
tableHeadMaker: (startYear: number, endYear: number) => void;
|
||||
pbnstPrfmncSearch: () => void;
|
||||
pbnstPrfmncInit: () => void;
|
||||
}
|
||||
|
||||
const pbnstPrfmncRes: PrfType[] = [];
|
||||
const prfmncRes: FcPrfType[] = [];
|
||||
|
||||
export type pbnstPrfmncSttnState = {
|
||||
pbnstPrfmncSttn: {
|
||||
pbnstPrfHeadList: TableUpperProps[];
|
||||
pbnstPrfmncRes: PrfType[];
|
||||
prfmncRes: FcPrfType[];
|
||||
isInit: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +24,10 @@ export type pbnstPrfmncSttnType = pbnstPrfmncSttnState & pbnstPrfmncSttnActions;
|
||||
|
||||
export const pbnstPrfmncSttnExport: pbnstPrfmncSttnState = {
|
||||
pbnstPrfmncSttn: {
|
||||
pbnstPrfHeadList: [...pbnstPrfmncSttnHeadListExport]
|
||||
pbnstPrfHeadList: [...pbnstPrfmncSttnHeadListExport],
|
||||
pbnstPrfmncRes: pbnstPrfmncRes,
|
||||
prfmncRes: prfmncRes,
|
||||
isInit: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +39,10 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport];
|
||||
for (let i = startYear; i <= endYear; i++) {
|
||||
const yearHead = JSON.parse(JSON.stringify(pbnstYearHeadListExport));
|
||||
if (yearHead){
|
||||
if (yearHead) {
|
||||
yearHead.forEach((item: { id: number; }) => (item.id = i + item.id))
|
||||
if(yearHead[0])
|
||||
yearHead[0].title = i + "년도"
|
||||
if (yearHead[0])
|
||||
yearHead[0].title = i + "년도"
|
||||
}
|
||||
yearHeader = [...yearHeader, ...yearHead]
|
||||
}
|
||||
@@ -40,30 +50,34 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
|
||||
return {
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
pbnstPrfHeadList: [ ...yearHeader]
|
||||
pbnstPrfHeadList: [...yearHeader]
|
||||
},
|
||||
};
|
||||
});
|
||||
},
|
||||
pbnstPrfmncSearch: async () => {
|
||||
pbnstPrfmncInit: async () => {
|
||||
try {
|
||||
const pbnstPrfmncRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/pubDetailList/`
|
||||
);
|
||||
const pbnstPrfmncSttnRes = await getFetch('wr', `/reuseFc/pubDetailList`);
|
||||
console.log("이안에", pbnstPrfmncSttnRes)
|
||||
const ruseFcltPk = pbnstPrfmncSttnRes.fcltCds;
|
||||
console.log("이거다", ruseFcltPk)
|
||||
const ruseFcltRes = await getFetch('wr', `/reuseFc/pubFc/${ruseFcltPk}`);
|
||||
console.log("이제나올듯", ruseFcltRes)
|
||||
|
||||
|
||||
set((state: pbnstPrfmncSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
pbnstPrfmncSttn: {
|
||||
...state.pbnstPrfmncSttn,
|
||||
pbnstPrfmncRes: pbnstPrfmncRes,
|
||||
pbnstPrfmncSttnRes: pbnstPrfmncSttnRes,
|
||||
ruseFcltRes: ruseFcltRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (erTxt) {
|
||||
console.log("error", erTxt);
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user