Merge commit '185de5b48caed4f74270335ab48bd893818846cd' into iipbs/wr/form_fuction

This commit is contained in:
leedj312
2025-05-19 17:15:36 +09:00
15 changed files with 966 additions and 214 deletions
+107
View File
@@ -0,0 +1,107 @@
"use client";
import { useWrStore } from "@/app/store";
import { Button } from "@common/components/ui";
import { btnClass } from "@/app/store/common/code";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import {
ContentsDiv,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
export default function coSttn() {
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [pageNation, setPageNation] = useState(1);
const { code, coSttn } = useWrStore(
(state) => state
);
const ref = useRef<ReturnType>({} as ReturnType);
const excelClick = useCallback(() => {
}, []);
return(
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"수요처 관리"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<div>
<Button
className={btnClass}
onClick={() => {
/* 등록 로직 */
}}
>
등록
</Button>
<Button
className={btnClass}
onClick={() => {
/* 저장 로직 */
}}
>
저장
</Button>
</div>
}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
if (returnType.sigunValue != "0") {
con = returnType.sigunValue;
} else {
con = returnType.sidoValue;
}
// coSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={coSttn.coSttNodeList} />
}
headlist={coSttn.coSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
@@ -0,0 +1,147 @@
"use client";
import { useWrStore } from "@/app/store";
import { Button } from "@common/components/ui";
import { btnClass } from "@/app/store/common/code";
import ListDiv from "@common/business_components/ui/list_div";
import {
tableData,
} from "@/components/lib/func/commom";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import {
ContentsDiv,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcel";
import { useCallback, useEffect, useRef, useState } from "react";
export default function ldrmntCoSttn() {
const { code, ldrmntCoSttn } = useWrStore(
(state) => state
);
const { ldrmntCoSttnRes } = ldrmntCoSttn;
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customCoBdst|undefined}>({data:undefined,isOpen:false })
const [pageNation, setPageNation] = useState(1);
const [isRegExcel, setIsRegExcel] = useState(false);
const ref = useRef<ReturnType>({} as ReturnType);
const excelClick = useCallback(() => {
}, []);
const cellClick=(index:number|undefined, headId: string)=>{
if(index!==undefined && bdstTable!==undefined){
setDetailModal({isOpen:true ,data:bdstTable[index] })
}
}
useEffect(() => {
if (ldrmntCoSttnRes.length > 0 && code.cityCd.length > 0) {
const data = tableData(ldrmntCoSttnRes, { code });
console.log("data", data);
const chData = data
.map((item: any) => ({
...item
}))
.filter((item: any) => item !== undefined);
setBdstTable(chData);
}
}, [code, ldrmntCoSttnRes, ldrmntCoSttn.ldrmntCoSttHeadList]);
return(
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"잠재수요처 관리"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<div>
<Button
className={btnClass}
onClick={() => setIsRegExcel(!isRegExcel)}
>
엑셀등록
</Button>
<Button
className={btnClass}
onClick={() => {
// 저장 로직
}}
>
양식받기
</Button>
</div>
}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
if (returnType.sigunValue != "0") {
con = returnType.sigunValue;
} else {
con = returnType.sidoValue;
}
// ldrmntCoSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={ldrmntCoSttn.ldrmntCoSttNodeList} />
}
headlist={ldrmntCoSttn.ldrmntCoSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
<UiModal
open={detailModal.isOpen}
onOpenChange={()=>{
setDetailModal({...detailModal, isOpen:!detailModal.isOpen})
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<CoDetailModal formObj={detailModal.data}/>}/>
<UiModal
bodyClass={"w-[40vw] max-w-none"}
open={isRegExcel}
body={<CoRegExcel></CoRegExcel>}
onOpenChange={setIsRegExcel}
/>
</div>
</ContentsDiv>
</>
)
}
+10
View File
@@ -100,6 +100,16 @@ export default function Home() {
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/coSttn">수요처 관리</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/ldrmntCoSttn">잠재수요처 관리</Link>
</Button>
</div>
</div>
</div>
</div>
@@ -65,20 +65,6 @@ export default function HtdflSttn() {
bdstTable !== undefined
) {
setDetailModal({ isOpen: true, data: bdstTable[index] });
} else if (
headId === "chBuildingYn" &&
index !== undefined &&
bdstTable !== undefined
) {
if (
bdstTable[index] &&
bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null
) {
setBdstChgProps({
isOpen: true,
chBuilding: bdstTable[index].chgBuilding,
});
}
}
};
useEffect(() => {
@@ -106,6 +92,7 @@ export default function HtdflSttn() {
useEffect(() => {
if (htdflSttnRes.length > 0 && code.cityCd.length > 0) {
console.log("htdflSttnRes", htdflSttnRes);
const data = tableData(htdflSttnRes, { code });
const chData = data
.map((item: any) => ({
@@ -205,16 +192,6 @@ export default function HtdflSttn() {
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<SttnDetailModal type={"HTB"} formObj={detailModal.data} />}
/>
<UiModal
bodyClass={""}
open={bdstChgProps.isOpen}
body={
<BdstChgModal chgBuilding={bdstChgProps.chBuilding}></BdstChgModal>
}
onOpenChange={(open) => {
setBdstChgProps({ ...bdstChgProps, isOpen: open });
}}
/>
</ContentsDiv>
</>
);
@@ -1,26 +1,36 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SelectBox,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import { useState } from "react";
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead";
import { useCallback, useEffect, useRef, useState } from "react";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
export default function PbnstSttn() {
const { code, rainSttn } = useWrStore((state) => state);
const { code, pbnstSttn } = useWrStore(
(state) => state
);
const ref = useRef<ReturnType>({} as ReturnType);
const [pageNation, setPageNation] = useState(1);
const [isChHead, setIsChHead] = useState(false);
const nodeList = headMakeprfmnc(rainSttn.pbnSttHeadList, rainSttn.pbnSttHeadNm);
const [bdstTable, setBdstTable] = useState<customPbnst[]>();
// const nodeList = headMakeprfmnc(pbnstSttn.pbnSttHeadList, pbnstSttn.pbnSttHeadNm);
const excelClick = useCallback(() => {
// if (codeData) pbnstSttnSearch(1, "10000", codeData);
}, []);
return (
<>
@@ -28,101 +38,56 @@ export default function PbnstSttn() {
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"하수재이용 시설 현황"} />
<SearchDiv>
<SearchFormLeft>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"권역"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"단위유역"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"중권역"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"환경청"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"시도"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"시군구"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
</SearchFormLeft>
<SearchFormRight>
<div className="space-y">
{/* 첫 줄: 버튼 3개 */}
<div className="flex flex-row space-x-2">
<Button size={"sm"} onClick={(e) => {}}>
조회
</Button>
<Button size={"sm"} onClick={() => {}}>
다운로드
</Button>
</div>
<div className="flex flex-row space-x-2 pt-3">
<Button
size={"sm"}
color="green"
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<Button
className={btnClass}
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>
}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
if (returnType.sigunValue != "0") {
con = returnType.sigunValue;
} else {
con = returnType.sidoValue;
}
// pbnstSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={undefined}
tableData={[]}
headlist={rainSttn.pbnSttHeadList}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}
>
{nodeList}
</UiTable>
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
}
headlist={pbnstSttn.pbnstSttHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
</div>
@@ -132,7 +97,15 @@ export default function PbnstSttn() {
setIsChHead(!isChHead);
}}
bodyClass={""}
body={<HeadChModal headList={[]} type={""} />}
body={
<HeadChModal
type={"PBN"}
headList={pbnstSttn.pbnstSttHeadList.map((item) => ({
...item,
visible: item.visible ?? false,
}))}
/>
}
/>
</ContentsDiv>
</>
+13
View File
@@ -0,0 +1,13 @@
import { z } from "zod";
export const coZod = z.object({
ctpv: z.string(),
sgg: z.string(),
coNm: z.string().min(1).max(20),
bznmNo: z.string().min(1).min(9).max(12),
addr: z.string().min(1).min(6).max(20),
telNo: z.string().min(8).max(12)
});
export type customCoBdst = z.infer<typeof coZod>;
@@ -0,0 +1,99 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { z } from "zod";
export const sttnHeadListType = z.array(
z.object({
id: z.string(),
title: z.string(),
visible: z.boolean(),
})
);
export const coRegExcel = z.object({
file: z.instanceof(File)
});
export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{
id: "ctpv",
title: "시도",
visible: true,
},
{
id: "sgg",
title: "시군구",
visible: true,
},
{
id: "coNm",
title: "회사명",
visible: true,
},
{
id: "addr",
title: "공장주소",
visible: true,
},
{
id: "bznmNo",
title: "공장관리번호",
visible: true,
},
{
id: "telNo",
title: "전화번호",
visible: true,
},
];
// id는 다확인해야함
export const coSttNodeListExport: CommonTableProps[] = [
{
id: "ctpv",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sgg",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "coNm",
title: "회사명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "addr",
title: "공장주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "bznmNo",
title: "공장관리번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "telNo",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
+43
View File
@@ -0,0 +1,43 @@
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { coSttNodeListExport, coSttHeadListExport } from "./headList";
import type { customCoBdst } from "../../matDmd/coReg";
import type { sttnHeadListType } from "../coSttn/headList";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
const coSttHeadList = coSttHeadListExport;
export type coSttnState = {
coSttn: {
coSttnRes: customCoBdst[];
coSttHeadList: CommonTableProps[];
coSttNodeList: CommonTableProps[];
excelList: [];
isInit: boolean;
};
};
type coSttnActions = {
};
export type coSttnType = coSttnState & coSttnActions;
export const coSttnStateExport: coSttnState = {
coSttn: {
coSttHeadList: coSttHeadList,
coSttNodeList: coSttNodeList,
coSttnRes: [],
excelList: [],
isInit: false,
},
};
export const coSttnActionsExport: (set: any) => coSttnActions = (
set: any
) => {
return {
}
}
@@ -0,0 +1,66 @@
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { coSttNodeListExport, coSttHeadListExport } from "../coSttn/headList";
import type { customCoBdst } from "../../matDmd/coReg";
import type { sttnHeadListType } from "../coSttn/headList";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
const coSttHeadList = coSttHeadListExport;
const ldrmntCoSttnRes: customCoBdst[] = [];
const ldrmntCoList = {ctpv: "이거머임",
sgg: "01",
coNm: "회사요",
bznmNo: "abc123",
addr: "서울 강남구",
telNo: "010-1234-5678"}
export type ldrmntCoSttnState = {
ldrmntCoSttn: {
ldrmntCoSttnRes: customCoBdst[];
ldrmntCoSttHeadList: CommonTableProps[];
ldrmntCoSttNodeList: CommonTableProps[];
excelList: [];
isInit: boolean;
};
};
type ldrmntCoSttnActions = {
};
export type ldrmntCoSttnType = ldrmntCoSttnState & ldrmntCoSttnActions;
export const ldrmntCoSttnStateExport: ldrmntCoSttnState = {
ldrmntCoSttn: {
ldrmntCoSttHeadList: coSttHeadList,
ldrmntCoSttNodeList: coSttNodeList,
ldrmntCoSttnRes: [ldrmntCoList],
excelList: [],
isInit: false,
},
};
export const ldrmntCoSttnActionsExport: (set: any) => ldrmntCoSttnActions = (
set: any
) => {
return {
ldrmntCoSttnInit: async (code: string | number) => {
try{
set((state: ldrmntCoSttnState) => {
return {
...state,
ldrmntCoSttn: {
...state.ldrmntCoSttn,
ldrmntCoSttnRes: ldrmntCoSttnRes,
isInit: false,
},
};
});
}catch(e){
console.log(e)
}
},
}
}
@@ -1,44 +1,28 @@
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { TableUpperProps } from "../../fcltReg/rainReg";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { z } from "zod";
export const pbnSttHeadNmExport: chHeadType[] = [
{ headNm: "catchment", text: "유역", length: 3 },
{ headNm: "adminDiv", text: "행정구역", length: 2 },
{ headNm: "rusSup", text: "재이용수공급가능량", length: 3 },
{ headNm: "yearResult", text: "연간실적정보(m³)", length: 3 },
{ headNm: "mngInfo", text: "운영정보", length: 4 },
];
// id는 다확인해야함
export const pbnSttHeadListExport: TableUpperProps[] = [
{ id: "a", title: "권역", upName: "catchment", upSequnce: 1, visible: true },
export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{ id: "a", title: "권역", visible: true },
{
id: "aaa",
title: "단위유역",
upName: "catchment",
upSequnce: 2,
visible: true,
},
{
id: "aaaa",
title: "중권역",
upName: "catchment",
upSequnce: 3,
visible: false,
visible: true,
},
{ id: "operMngCd", title: "환경청", visible: true },
{
id: "cityText",
title: "시도",
upName: "adminDiv",
upSequnce: 1,
visible: false,
visible: true,
},
{
id: "sggText",
title: "시군구",
upName: "adminDiv",
upSequnce: 2,
visible: true,
},
{ id: "bdnstNm", title: "시설명", visible: true },
@@ -51,119 +35,280 @@ export const pbnSttHeadListExport: TableUpperProps[] = [
{
id: "fcltCpct",
title: "시설용량(m³/일)",
upName: "rusSup",
upSequnce: 1,
visible: true,
},
{
id: "trbt",
title: "하수처리량(m³/일)",
upName: "rusSup",
upSequnce: 2,
visible: true,
},
{
id: "ruseCpct",
title: "재이용량(m³/일)",
upName: "rusSup",
upSequnce: 3,
visible: true,
},
{
id: "total",
title: "합계",
upName: "yearResult",
upSequnce: 1,
visible: true,
},
{
id: "ithlWtr",
title: "장내용수",
upName: "yearResult",
upSequnce: 2,
visible: true,
},
{
id: "othlWtr",
title: "장외용수",
upName: "yearResult",
upSequnce: 3,
visible: true,
},
{
id: "mngMeth",
title: "운영방식",
upName: "mngInfo",
upSequnce: 1,
visible: true,
},
{
id: "rprtvBzenty",
title: "대행업체",
upName: "mngInfo",
upSequnce: 2,
visible: true,
},
{
id: "firstDay",
title: "시작일",
upName: "mngInfo",
upSequnce: 3,
visible: true,
},
{
id: "LastDay",
title: "종료일",
upName: "mngInfo",
upSequnce: 4,
visible: true,
},
];
// 참고용 지워야함.
// rainChSttnHead: async (checkList: string[], type: string) => {
// const headList =
// type === "pbn"
// ? pbnSttHeadList
// : type === "rain"
// ? rainSttHeadList
// : null;
// let chNm = type === "pbn" ? pbnSttHeadNm : rainSttNodeList;
// headList?.forEach((item) => {
// if (checkList.find((ch) => ch === item.id)) {
// item.visible = false;
// if (item.upName) {
// const upNames = Array.isArray(item.upName)
// ? item.upName
// : [item.upName];
// upNames?.forEach((up) => {
// chNm.find((ch) => {
// if (ch.headNm === up) {
// ch.length = ch.length - 1;
// }
// });
// });
// }
// }
// });
// set((state: rainSttnState) => ({
// sttnCommon: {
// ...state.sttnCommon,
// pbnSttHeadList:
// type === "pbn" ? headList : state.sttnCommon.pbnSttHeadList,
// rainSttHeadList:
// type === "rain" ? headList : state.sttnCommon.rainSttHeadList,
// rainSttNodeList:
// type === "rain" ? chNm : state.sttnCommon.rainSttNodeList,
// pbnSttHeadNm: type === "rain" ? chNm : state.sttnCommon.pbnSttHeadNm,
// },
// }));
// },
// };
// };
// id는 다확인해야함
export const pbnstSttNodeListExport: CommonTableProps[] = [
{
id: "catchment",
title: "유역",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 3,
},
{
id: "operMngCd",
title: "환경청",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "adminDiv",
title: "행정구역",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 2,
},
{
id: "bdnstNm",
title: "시설명",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "locDiv",
title: "지역구분",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "phone",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "fcltQuantity",
title: "시설용량(톤/일)",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "rusNm",
title: "재이용시설명",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "rusSup",
title: "재이용수공급가능량",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 3,
},
{
id: "yearResult",
title: "연간실적정보(m³)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 3,
},
{
id: "mngInfo",
title: "운영정보",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 4,
},
{
id: "a",
title: "권역",
upName: "catchment",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "aaa",
title: "단위유역",
upName: "catchment",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "aaaa",
title: "중권역",
upName: "catchment",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "cityText",
title: "시도",
upName: "adminDiv",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "sggText",
title: "시군구",
upName: "adminDiv",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "fcltCpct",
title: "시설용량(m³/일)",
upName: "rusSup",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "trbt",
title: "하수처리량(m³/일)",
upName: "rusSup",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "ruseCpct",
title: "재이용량(m³/일)",
upName: "rusSup",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "total",
title: "합계",
upName: "yearResult",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "ithlWtr",
title: "장내용수",
upName: "yearResult",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "othlWtr",
title: "장외용수",
upName: "yearResult",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "mngMeth",
title: "운영방식",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "rprtvBzenty",
title: "대행업체",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "firstDay",
title: "시작일",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "LastDay",
title: "종료일",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
}
];
@@ -0,0 +1,63 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { customPbnst } from "../../fcltReg/pbnstReg";
import type { z } from "zod";
import {
pbnSttHeadListExport,
pbnstSttNodeListExport
} from "./headList";
import { fetchType, getFetch } from "@/components/lib/api";
import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
const pbnstSttHeadList = pbnSttHeadListExport;
const pbnstSttNodeList = pbnstSttNodeListExport;
export type pbnstSttnState = {
pbnstSttn: {
pbnstSttnRes: customPbnst[];
pbnstSttHeadList: CommonTableProps[];
pbnstSttNodeList: CommonTableProps[];
excelList: [];
isInit: boolean;
};
};
type pbnstSttnActions = {
pbnstChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
};
export type pbnstSttnType = pbnstSttnState & pbnstSttnActions;
export const pbnstSttnStateExport: pbnstSttnState = {
pbnstSttn: {
pbnstSttHeadList: pbnstSttHeadList,
pbnstSttNodeList: pbnstSttNodeList,
pbnstSttnRes:[],
excelList:[],
isInit: false,
},
};
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
set: any
) => {
return {
pbnstChSttnHead: async (
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
console.log('head ', headList)
const changeNodeList= controlHeadView(headList,pbnstSttNodeList)
return set((state: pbnstSttnState) => ({
pbnstSttn: {
...state.pbnstSttn,
pbnstSttHeadList: headList,
pbnstSttNodeList: changeNodeList,
},
}));
},
}
}
+17 -2
View File
@@ -84,6 +84,9 @@ import {
type rainChkSttnType,
} from "./prfmncSttn/chkgdnSttn/rainChkgdnSttn";
import { rswtChkStateExport, rswtChkSttnActionsExport, type rswtChkSttnState, type rswtChkSttnType } from "./prfmncSttn/chkgdnSttn/rswtChkgdnSttn";
import { pbnstSttnActionsExport, pbnstSttnStateExport, type pbnstSttnState, type pbnstSttnType } from "./ruseFcltMng/fcltSttn/pbnstSttn";
import { coSttnActionsExport, coSttnStateExport, type coSttnState, type coSttnType } from "./matDmd/coSttn"; // 옮겨야함
import { ldrmntCoSttnActionsExport, ldrmntCoSttnStateExport, type ldrmntCoSttnState, type ldrmntCoSttnType } from "./matDmd/ldrmntCoSttn"; // 옮겨야함
export type WrStore = comCodeType &
pubFacType &
@@ -98,7 +101,10 @@ export type WrStore = comCodeType &
rswtSttnType &
htdflSttnType &
rainChkSttnType&
rswtChkSttnType;
rswtChkSttnType&
coSttnType& // 옮겨야함
ldrmntCoSttnType // 옮겨야함
;
export const StoreZus = (
initState: comCodeState &
@@ -114,7 +120,10 @@ export const StoreZus = (
rswtSttnState &
htdflSttnState &
rainChkSttnState&
rswtChkSttnState
rswtChkSttnState &
coSttnState& // 옮겨야함
ldrmntCoSttnState // 옮겨야함
= {
...comCodeStateExport,
...pubFacStateExport,
@@ -130,6 +139,9 @@ export const StoreZus = (
...htdflSttnStateExport,
...rainChkSttnStateExport,
...rswtChkStateExport,
...pbnstSttnStateExport,
...coSttnStateExport, // 옮겨야함
...ldrmntCoSttnStateExport, // 옮겨야함
}
) => {
return createStore<WrStore>()((set) => {
@@ -155,6 +167,9 @@ export const StoreZus = (
...htdflSttnActionsExport(set),
...rainChkSttnActionsExport(set),
...rswtChkSttnActionsExport(set)
...pbnstSttnActionsExport(set),
...coSttnActionsExport(set), // 옮겨야함
...ldrmntCoSttnActionsExport(set), // 옮겨야함
};
});
};
@@ -0,0 +1,63 @@
import { useState, useEffect } from "react";
import { useForm, FormProvider } from "react-hook-form";
import { useWrStore } from "@/app/store";
import { type customCoBdst } from "@/app/store/matDmd/coReg";
import { ToastFormUi } from "@/components/ui/toast/toastFromUi";
import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import type { z } from "zod";
import { zodResolver } from "@hookform/resolvers/zod";
import { coRegExcel } from "@/app/store/matDmd/coSttn/headList";
export default function CoRegExcel() {
const [excelData, setExcelData] = useState<customCoBdst[]>();
const [files, setFiles] = useState<File[] | null>(null);
const form = useForm<z.infer<typeof coRegExcel>>({
resolver: zodResolver(coRegExcel),
defaultValues: { file: [] },
});
useEffect(() => {
if (!files || files.length === 0) return;
const file = files[0];
if (!file) return;
filePicked(file, 0).then((res) => {
if (res) {
}
});
}, [files]);
const onSubmit = (values: z.infer<typeof coRegExcel>) => {
if (!excelData || excelData.length === 0) {
ToastFormUi({
title: "잠재수요처 등록",
body: "빈 파일 및 파일 오류 입니다.",
});
return;
}
// rainChkExcelDataUPload(excelData);
};
return (
<FormProvider {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<Title title="잠재수요처 등록" />
<div className="flex justify-between items-center mb-4">
<h3 className="text-2xl font-bold text-gray-900">○ 잠재수요처</h3>
<Button type="submit">등록</Button>
</div>
<FormUi label="잠재수요처 파일">
<FileUpload
files={files || []}
setFiles={(files: File[] | null) => {if (files) setFiles(files);}}
fileTypes="xlsx"
></FileUpload>
</FormUi>
</form>
</FormProvider>
);
}
@@ -8,7 +8,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
export default function HeadChModal({headList, type }:{headList : z.infer<typeof sttnHeadListType> ,type:string }) {
const { rainChSttnHead , rswtChSttnHead, htdflChSttnHead} = useWrStore((state) => state);
const { rainChSttnHead , rswtChSttnHead, htdflChSttnHead, pbnstChSttnHead} = useWrStore((state) => state);
let items = headList.map(item => ({id:item.id, title:item.title, val:item.visible }));
@@ -28,12 +28,13 @@ export default function HeadChModal({headList, type }:{headList : z.infer<typeo
const onSubmit = (valueList : z.infer<typeof sttnHeadListType> ) =>{
if(type==='RNB'){
rainChSttnHead(valueList)
}else if(type=== 'RST'){
rswtChSttnHead(valueList)
}else if(type === 'HTB'){
htdflChSttnHead(valueList)
}else if(type === 'PBN'){
pbnstChSttnHead(valueList)
}
}
@@ -0,0 +1,30 @@
"use client";
import { useWrStore } from "@/app/store";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { Title } from "@common/business_components/ui";
import { useEffect, useState } from "react";
export default function SttnDetailModal(
{formObj,}: {formObj: any;}) {
const { code, rainSttn, rswtSttn, rainSttnChkSearch } = useWrStore(
(state) => state
);
const [detailData, setDetailData] = useState({
head: [] as CommonTableProps[],
node:[] as CommonTableProps[],
data: {} as any,
});
useEffect(() =>{
setDetailData({data:[] , head:[], node:[]})
},[])
return (
<div>
<Title title="잠재수요처 상세정보"></Title>
</div>
);
}