중수도 지도점검 수정 및 공공 하수처리장 등록 작업중

This commit is contained in:
leedj312
2025-05-22 17:38:02 +09:00
parent 9ee5f43d38
commit 5dfb52457b
17 changed files with 807 additions and 296 deletions
@@ -10,20 +10,20 @@ import {
} from "@common/business_components";
import { Button, Input } from "@common/components";
import { useWrStore } from "../../../store";
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
import { useEffect, useState } from "react";
import type { customPbnst, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import ListDiv from "@common/business_components/ui/list_div";
import { tableData } from "@/components/lib/func/commom";
import type { customPbnst, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm";
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/bugRegForm";
export default function PublicReuseFaciltyInsert() {
const { code, pubFac, pubHasuInit } = useWrStore((state) => state);
const { pubFacHeadList } = pubFac;
const { code, pbnst, pubHasuInit } = useWrStore((state) => state);
const { pubFacHeadList,pbnstHasuRes } = pbnst;
const {pbnstReg} = pubFac
const {pbnstRes} = pbnst
const [currentTab, setCurrentTab] = useState<string>("mng");
const [fcltMng, setFcltMng] = useState<ruseFcltType[]>();
const [searchTxt, setSearchTxt] = useState<string>();
@@ -31,17 +31,17 @@ export default function PublicReuseFaciltyInsert() {
useEffect(() => {
if (!pubFac.isInit) {
if (!pbnst.isInit) {
pubHasuInit(undefined);
}
}, [pubFac.isInit, pubHasuInit]);
}, [pbnst.isInit, pubHasuInit]);
useEffect(() => {
if (code.sggCd.length > 0) {
setbdstTable(tableData(pbnstReg, { code }));
setbdstTable(tableData(pbnstHasuRes, { code }));
}
}, [code, pbnstReg]);
}, [code, pbnstHasuRes]);
const onSelectValue = (val: string) => {
@@ -109,7 +109,7 @@ useEffect(() => {
total={10}
headName={"공공 하수처리시설 등록"}
cellClick={cellClick}
onPageChange={(page: number) => { } } children={undefined} />
onPageChange={(page: number) => { } } children={undefined} />
</ScrollArea>
</ListDiv>
</div>
@@ -88,7 +88,7 @@ export default function Page() {
if (rswtChkgdn.excelList[0]?.data.length > 1)
excelArrayDownload(
"중수도_점검결과_이용량현황",
"중수도시설 지도점검",
"sample_rs_chk.xlsx",
rswtChkgdn.excelList
);
@@ -70,8 +70,6 @@ export default function Page() {
},[rswtChkSttn.isInit, rswtChkSttnInit])
const handleClick = useCallback(
(data: any) => {
if (data) setIsModal({ open: !isModal.open, data: data });
@@ -79,9 +77,6 @@ export default function Page() {
[isModal]
);
const excelDown=() =>{
console.log("excelDown" , rainChkSttn.sttnExcelList)
if(rainChkSttn.sttnExcelList && selFcltDiv === "RNB"){
excelDownload(
rainChkSttn.sttnExcelList,
@@ -90,10 +85,7 @@ const excelDown=() =>{
"A1:Q2",
3
);
}else if(rswtChkSttn.sttnExcelList && selFcltDiv === "RST"){
console.log("rswtChkSttn " , rswtChkSttn.sttnExcelList)
excelDownload(
rswtChkSttn.sttnExcelList,
"중수도시설 지도점검 현황",
@@ -28,6 +28,7 @@ export const rswtMakeExcelSample = (
"",
"",
"",
"",
useType,
"",
"",
@@ -72,6 +73,7 @@ export const rswtMakeExcelSample = (
"",
"",
"",
"",
useType,
"",
"",
@@ -145,15 +147,15 @@ export const excelToRswtGuideData = (excelData: any, year: string) => {
return {
bdstRuseFcltFk: Number(item["NO"]),
operMngCd: item["운영관리형태"],
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
prcsCpct: item["처리용량(m³)"],
spwtPositn: item["채수지점"],
chckYmd:checkYmd,
utztnUsgCd: item["이용용도"],
spwtPositn: item["유량측정방법"],
guideDetails: makeGuidDetail,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
oilqMeasMthd: item["운영관리형태"],
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
operMngCd: item["유량측정방법"],
guideDetails: makeGuidDetail,
};
}
@@ -210,13 +212,13 @@ export const excelToRswtPolution = (excelData: any, year: string) => {
bdstRuseFcltFk: Number(item["NO"]),
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
spwtPositn: item["유량측정방법"],
operMngCd: item["운영관리형태"],
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
prcsCpct: item["처리용량(m³)"],
spwtPositn: item["채수지점"],
rswtrPollutions: makePoluttion,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
oilqMeasMthd: item["운영관리형태"],
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
operMngCd: item["유량측정방법"],
rswtrPolutions: makePoluttion,
rswtrDetails: [
{
utztnUsgCd: item["이용용도"],
@@ -1,6 +1,5 @@
import { getFetch } from "@/components/lib/api";
import { TEST_UUID, type customRainBdst } from "../rainReg";
import type { TableProps } from "../pbnstReg";
import type { customHtdflBdst } from "../htdflReg";
import type { customRswtBdst } from "../rswtReg";
@@ -23,7 +22,7 @@ type TableUpperProps = {
];
const bdstChgHeadList: TableProps[] = [
const bdstChgHeadList: TableUpperProps[] = [
{ id: "bdstChgNm", title: "구분" },
{ id: "archChgPrmsnDt", title: "허가일" },
{ id: "archChgArea", title: "변경면적" },
@@ -144,10 +143,6 @@ const isRswtBdst = (data: any): data is customRswtBdst =>{
}
export type bdstFulType = bdstState & bdstActions;
@@ -155,7 +150,7 @@ export type bdstState = {
bdst: {
bdstBase: any[];
moUpHeadList:TableUpperProps[]
bdstChgHeadList:TableProps[]
bdstChgHeadList:TableUpperProps[]
};
};
@@ -2,6 +2,9 @@ import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/head
import type { TableUpperProps } from "../rainReg";
export const pubFacHeadListExport: TableUpperProps[] = [
{ id: "sido", title: "시도" },
{ id: "gugun", title: "시군구" },
@@ -33,41 +36,41 @@ export type formDetailType ={
export const wasteWaterFcltINfo:formDetailType[]=[
{id:'username' , lable:'폐수배출물신고 허가여부'},
{id:'username' , lable:'Tms설치여부'},
{id:'username' , lable:'공공하수도유입제외 허가여부'},
{id:'wwtEmsnFcltPrmsnYn' , lable:'폐수배출물신고 허가여부'},
{id:'tmsInstlYn' , lable:'Tms설치여부'},
{id:'pbnstDrngInflwExclYn' , lable:'공공하수도유입제외 허가여부'},
]
export const concentratedWaterInfo:formDetailType[]=[
{id:'username' , lable:'눙축수 발생량(m³/일)'},
{id:'username' , lable:'눙축수연계지점'},
{id:'username' , lable:'시설용량(m³/일)'},
{id:'username' , lable:'눙축수처리방식'},
{id:'username' , lable:'눙축수처리공법'},
{id:'erctWtrOcrnCpct' , lable:'눙축수 발생량(m³/일)'},
{id:'erctUswtrLinkSpt' , lable:'눙축수연계지점'},
{id:'erctUswtrFcltCpct' , lable:'시설용량(m³/일)'},
{id:'erctUswtrPrcsMeth' , lable:'눙축수처리방식'},
{id:'erctUswtrPrcsMsrcCd' , lable:'눙축수처리공법'},
]
export const ruseFcltinfo:formDetailType[]=[
{id:'username' , lable:'시설용량(m³/일)'},
{id:'username' , lable:'주처리공법'},
{id:'username' , lable:'위치(주소)'},
{id:'username' , lable:'재처리방식'},
{id:'username' , lable:'위치(처리장 내외)'},
{id:'username' , lable:'메인공급펌프 용량'},
{id:'rprcsFcltCpct' , lable:'시설용량(m³/일)'},
{id:'majorPrcsMsrcCd' , lable:'주처리공법'},
{id:'addr' , lable:'위치(주소)'},
{id:'rprcsMthdCd' , lable:'재처리방식'},
{id:'inoutYn' , lable:'위치(처리장 내외)'},// 머가 내? 외?,
{id:'mainSplyPumpCpct' , lable:'메인공급펌프 용량'},
]
export const businessMoneyInfo:formDetailType[]=[
{id:'username' , lable:'국고'},
{id:'username' , lable:'지방비'},
{id:'gvsbs' , lable:'국고'},
{id:'lcep' , lable:'지방비'},
{id:'username' , lable:'민간투자비'},
{id:'username' , lable:'원인자부담금'},
{id:'username' , lable:'기타'},
{id:'username' , lable:'합계'},
{id:'cusr_alotm' , lable:'원인자부담금'},
{id:'etc' , lable:'기타'},
{id:'totalMoney' , lable:'합계'},
]
export const businessSttnInfo:formDetailType[]=[
{id:'username' , lable:'구분'},
{id:'username' , lable:'사업방식'},
{id:'username' , lable:'사업준공일' ,type:'date'},
{id:'username' , lable:'설치승인인가일' ,type:'date'} ,
{id:'seCd' , lable:'구분'},
{id:'bizMthdCd' , lable:'사업방식'},
{id:'bizCmcnDay' , lable:'사업준공일' ,type:'date'},
{id:'instlAprvSncnDt' , lable:'설치승인인가일' ,type:'date'} ,
]
@@ -3,128 +3,142 @@ import type { TableUpperProps } from "../rainReg";
import { getFetch } from "@/components/lib/api";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import { pubFacHeadListExport, pubMngNmExport, pubMngUpHeadListExport } from "./headList";
import { exampleData, fcBizSchema, type customPbnst, type pubHasuType } from "./type";
import type { SelectDataType } from "@common/business_components/ui";
export const pbnstZod = z.object({
bscFctCd:z.string(),
sido:z.string().default(""),
gugun: z.string().default(""),
bscFctNm:z.string().default(""),
efflWqltStndrdNm:z.string().default(""),
fctCpc:z.number().default(0)
})
export type customPbnst = z.infer<typeof pbnstZod>
export const pbnstReg =[] as customPbnst[];
export type TableProps = {
id: string;
title: string;
};
export type selectLabel = {
text: string;
val: string;
};
export type publicReuseFacilityType = {
sido: string;
sigungo: string;
facilityName: string;
location: string;
locationgubun: string;
facilityCapacity: string;
yn?: string;
authoDay?: string;
area?: string;
reuse?: string;
register?: string;
swtrmtFcltFk: string;
};
export type fcltOperInfoType = {
mng: string;
subCo: string;
startDay: string;
endDay: string;
pbnstRuseFcltPk: string;
};
export type ruseFcltType = {
swtrmtFcltFk: string;
pbnstRuseFcltPk:string;
fcltNm:string;
fcltCpct: number;
swtrmtCpct: number;
ruseCpct:number;
splyExtraCpct:number;
};
const selectLabel: selectLabel[] = [{ text: "test", val: "1" }];
const selectLabel: SelectDataType[] = [{ text: "test", val: "1" }];
const pubFacHeadList= pubFacHeadListExport;
const pubMngUpHeadList = pubMngUpHeadListExport
const pubMngNm= pubMngNmExport;
export type pubFacState = {
pubFac: {
pbnst: {
isInit: boolean;
pubFacHeadList: TableProps[];
pubFacHeadList: TableUpperProps[];
pubMngUpHeadList: TableUpperProps[];
pubMngNm: chHeadType[];
selectLabel: selectLabel[];
pbnstReg:customPbnst[];
}
pbnstHasuRes: pubHasuType[]
selectLabel: SelectDataType[];
pbnstRes: customPbnst[];
pbnstBizCycle: SelectDataType[];
};
};
type pubFacActions = {
pubHasuInit: (txt:string|undefined) => void;
pbnstRegInit: (sgg: string) => void;
pbnstRegSearch: (txt: string | undefined, sgg: string) => void;
pbnstReg: (txt: string | undefined) => void;
pubHasuInit: (txt: string | undefined) => void;
};
export type pubFacType = pubFacState & pubFacActions;
export const pubFacStateExport: pubFacState = {
pubFac: {
pbnst: {
isInit: false,
pubFacHeadList: pubFacHeadList,
pubMngUpHeadList: pubMngUpHeadList,
selectLabel: selectLabel,
pubMngNm:pubMngNm,
pbnstReg:pbnstReg,
pubMngNm: pubMngNm,
pbnstHasuRes: [],
pbnstRes: [],
pbnstBizCycle:[]
},
};
const initFetch = async (txt:string|undefined) => {
const rainRes =await getFetch("common", `/prcsFclt/info/1/10/'A'/41220` +(txt? `/${txt}`:'')+'/0'+'/1' );
return rainRes
const initFetch = async (txt: string | undefined) => {
const rainRes = await getFetch(
"common",
`/prcsFclt/info/1/10/A/41220` + (txt ? `/${txt}` : "") + "/500" + "/1"
);
return rainRes;
};
const getBizCycle = async (fcBizs: z.infer<typeof fcBizSchema>[] ) => {
const pbnstBizCycle =fcBizs.map((item: z.infer<typeof fcBizSchema>) => {
return {
text: `${item.cycl}차수`,
val: item.cycl,
};
});
return pbnstBizCycle;
}
export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
return {
pubHasuInit: async(txt:string |undefined)=>{
try{
const pbnstReg = await initFetch(txt)
return set((state:pubFacState)=>({
pubHasuInit: async (txt: string | undefined) => {
try {
const pbnstHasuRes = await initFetch(txt);
return set((state: pubFacState) => ({
...state,
pubFac:{
...state.pubFac,
pbnstReg:pbnstReg,
pbnst: {
...state.pbnst,
pbnstHasuRes:pbnstHasuRes,
isInit: false,
}
}))
}catch(errorHasu){
console.log(errorHasu)
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
pbnstRegInit: async (txt: string | undefined) => {
try {
//const pbnstRes = await initFetch(txt);
const pbnstRes = exampleData;
}
const pbnstBizCycle = getBizCycle(pbnstRes?.fcBizs);
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstRes: pbnstRes,
pbnstBizCycle:pbnstBizCycle,
isInit: false,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
pbnstRegSearch: async (txt: string | undefined, sgg: string) => {
try {
const pbnstRes = await getFetch(
"wr",
`/api/v1/reuseFc/pubFc` + (txt ? `/${txt}` : "") + `/${sgg}`
);
const pbnstBizCycle = getBizCycle(pbnstRes.fcBizs);
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstReg: pbnstRes,
pbnstBizCycle:pbnstBizCycle,
isInit: false,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
pbnstReg: async (txt: string | undefined) => {
try {
const pbnstRes = await initFetch(txt);
return set((state: pubFacState) => ({
...state,
pbnst: {
...state.pbnst,
pbnstRes: pbnstRes,
isInit: false,
},
}));
} catch (errorHasu) {
console.log(errorHasu);
}
},
};
};
@@ -0,0 +1,442 @@
import { z } from "zod";
export type customPbnst = z.infer<typeof pbnstRegZod>;
export const pbnstReg = [] as customPbnst[];
export type TableProps = {
id: string;
title: string;
};
export type selectLabel = {
text: string;
val: string;
};
export type publicReuseFacilityType = {
sido: string;
sigungo: string;
facilityName: string;
location: string;
locationgubun: string;
facilityCapacity: string;
yn?: string;
authoDay?: string;
area?: string;
reuse?: string;
register?: string;
swtrmtFcltFk: string;
};
export type fcltOperInfoType = {
mng: string;
subCo: string;
startDay: string;
endDay: string;
pbnstRuseFcltPk: string;
};
export type ruseFcltType = {
swtrmtFcltFk: string;
pbnstRuseFcltPk: string;
fcltNm: string;
fcltCpct: number;
swtrmtCpct: number;
ruseCpct: number;
splyExtraCpct: number;
};
const pplInstlSchema = z.object({
ruseFcltBizFk: z.string(),
pdmt: z.string(),
ppMqlt: z.string(),
cpct: z.string(),
});
const fcFileSchema = z.object({
ruseFcltFk: z.number().default(0),
fileTkn: z.string().default("test"),
filePath: z.string().default("test"),
fileKnd: z.string().default("test"),
regDt: z.date().default(new Date()),
rgtr: z.string().default("test"),
mdfcnDt: z.date().default(new Date()),
mdfr: z.string().default("test"),
});
const fcOperSchema = z.object({
pbnstRuseFcltOperInfoPk: z.number().default(0),
pbnstRuseFcltFk: z.number().default(0),
operMthd: z.string(),
rprtvBzenty: z.string(),
bgngDt: z.date().default(new Date()),
endDt: z.date().default(new Date()),
regDt: z.date().default(new Date()),
rgtr: z.string().default("test"),
mdfcnDt: z.date().default(new Date()),
mdfr: z.string().default("test"),
});
const fcOrgwtSchema = z.object({
pbnstRuseFcltBizFk: z.number().default(0),
swtrmtFcltFk: z.number().default(0),
orgwtWtritQnt: z.string(),
tmsYn: z.string(),
dschgFmYn: z.string(),
dtlPstnExpln: z.string(),
regDt: z.date().default(new Date()),
rgtr: z.string().default("test"),
mdfcnDt: z.date().default(new Date()),
mdfr: z.string().default("test"),
});
const fcPrfmncSchema = z.object({
pbnstRuseFcltFk: z.number().default(0),
ym: z.string(),
wshwtr: z.string(),
coolUswtr: z.string(),
cleanUswtr: z.string(),
drwtUswtr: z.string(),
dltnUswtr: z.string(),
ithlRswtr: z.string(),
ithlEtcUswtr: z.string(),
cleanToilUswtr: z.string(),
resn: z.string(),
lndwtr: z.string(),
hydUswtr: z.string(),
rvrKeepUswtr: z.string(),
farmUswtr: z.string(),
ugwtChr: z.string(),
indstUswtr: z.string(),
regDt: z.date().default(new Date()),
rgtr: z.string().default("test"),
mdfcnDt: z.date().default(new Date()),
mdfr: z.string().default("test"),
});
export const fcBizSchema = z.object({
pbnstRuseFcltBizPk: z.number().default(0),
pbnstRuseFcltFk: z.number().default(0),
cycl: z.string(),
seCd: z.string(),
bizMthdCd: z.string(),
instlAprvSncnDt: z.string(),
bizCmcnDay: z.string(),
gvsbs: z.string(),
lcep: z.string(),
cusrAlotm: z.string(),
etc: z.string(),
totalMoney: z.string(),
rprcsFcltCpct: z.string(),
majorPrcsMsrcCd: z.string(),
addr: z.string(),
rprcsMthdCd: z.string(),
inoutYn: z.string(),
mainSplyPumpCpct: z.string(),
erctWtrOcrnCpct: z.string(),
erctUswtrLinkSpt: z.string(),
erctUswtrFcltCpct: z.string(),
erctUswtrPrcsMeth: z.string(),
erctUswtrPrcsMsrcCd: z.string(),
wwtEmsnFcltPrmsnYn: z.string(),
tmsInstlYn: z.string(),
pbnstDrngInflwExclYn: z.string(),
bod: z.string(),
grssClfg: z.string(),
combResdch: z.string(),
trbt: z.string(),
clIonQnt: z.string(),
smll: z.string(),
crmty: z.string(),
tph: z.string(),
tn: z.string(),
ph: z.string(),
cdtnv: z.string(),
designCst: z.string(),
cstrnSpvsCst: z.string(),
fcltSbsdCst: z.string(),
wstCst: z.string(),
cnstCmcnCst: z.string(),
mntrgEqpmntInstlCst: z.string(),
gisDbCst: z.string(),
elpwrMtrngCst: z.string(),
mchnCst: z.string(),
archCst: z.string(),
pplCst: z.string(),
ruseFcltCst: z.string(),
designCstClcln: z.string(),
cstrnSpvsCstClcln: z.string(),
fcltSbsdCstClcln: z.string(),
wstCstClcln: z.string(),
cnstCmcnCstClcln: z.string(),
mntrgEqpmntInstlCstClcln: z.string(),
gisDbCstClcln: z.string(),
elpwrMtrngCstClcln: z.string(),
mchnCstClcln: z.string(),
archCstClcln: z.string(),
pplCstClcln: z.string(),
ruseFcltCstClcln: z.string(),
fcOrgwts: z.array(fcOrgwtSchema),
pplInstls: z.array(pplInstlSchema),
flg: z.string(),
regDt: z.string(),
rgtr: z.string(),
mdfcnDt: z.string(),
mdfr: z.string(),
});
export const pbnstRegZod = z.object({
pbnstRuseFcltPk: z.number().default(0),
swtrmtFcltFk: z.string(),
ruseUtztnFcltNm: z.string(),
fcltCpct: z.string(),
ruseCpct: z.string(),
splyExtraCpct: z.string(),
regDt: z.date().default(new Date()),
rgtr: z.string().default("test"),
mdfcnDt: z.date().default(new Date()),
mdfr: z.string().default("test"),
fcFiles: z.array(fcFileSchema),
fcBizs: z.array(fcBizSchema),
fcOpers: z.array(fcOperSchema),
});
const pubHasuZod = z.object({
bscFctCd: z.string(),
sido: z.string().default(""),
gugun: z.string().default(""),
bscFctNm: z.string().default(""),
efflWqltStndrdNm: z.string().default(""),
fctCpc: z.number().default(0),
});
export type pubHasuType = z.infer<typeof pubHasuZod>;
//관경 제외
export const exampleData = {
pbnstRuseFcltPk: 1,
swtrmtFcltFk: "SWTRMT-001",
ruseUtztnFcltNm: "재이용시설 A",
fcltCpct: "100",
ruseCpct: "90",
splyExtraCpct: "10",
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
fcFiles: [],
fcBizs: [
{
pbnstRuseFcltBizPk: 10,
pbnstRuseFcltFk: 1,
cycl: "1",
seCd: "A010",
bizMthdCd: "M02",
instlAprvSncnDt: "2022-01-01",
bizCmcnDay: "2022-02-01",
gvsbs: "정부지원",
lcep: "지자체",
cusrAlotm: "고객",
etc: "비고 없음",
totalMoney: "100000000",
rprcsFcltCpct: "50",
majorPrcsMsrcCd: "MP01",
addr: "서울시 종로구",
rprcsMthdCd: "RP01",
inoutYn: "Y",
mainSplyPumpCpct: "30",
erctWtrOcrnCpct: "5",
erctUswtrLinkSpt: "있음",
erctUswtrFcltCpct: "20",
erctUswtrPrcsMeth: "생물학적",
erctUswtrPrcsMsrcCd: "EM01",
wwtEmsnFcltPrmsnYn: "Y",
tmsInstlYn: "N",
pbnstDrngInflwExclYn: "Y",
bod: "30",
grssClfg: "양호",
combResdch: "적정",
trbt: "10",
clIonQnt: "5",
smll: "없음",
crmty: "정상",
tph: "0.2",
tn: "2",
ph: "7.2",
cdtnv: "100",
designCst: "1000",
cstrnSpvsCst: "500",
fcltSbsdCst: "200",
wstCst: "300",
cnstCmcnCst: "1000",
mntrgEqpmntInstlCst: "150",
gisDbCst: "200",
elpwrMtrngCst: "180",
mchnCst: "700",
archCst: "400",
pplCst: "300",
ruseFcltCst: "5000",
designCstClcln: "990",
cstrnSpvsCstClcln: "480",
fcltSbsdCstClcln: "190",
wstCstClcln: "280",
cnstCmcnCstClcln: "980",
mntrgEqpmntInstlCstClcln: "140",
gisDbCstClcln: "190",
elpwrMtrngCstClcln: "170",
mchnCstClcln: "680",
archCstClcln: "380",
pplCstClcln: "290",
ruseFcltCstClcln: "4800",
fcOrgwts: [
{
pbnstRuseFcltBizFk: 10,
swtrmtFcltFk: 1,
orgwtWtritQnt: "100",
tmsYn: "Y",
dschgFmYn: "N",
dtlPstnExpln: "배출 위치",
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
mdfr: "admin",
},
{
pbnstRuseFcltBizFk: 10,
swtrmtFcltFk: 2,
orgwtWtritQnt: "153",
tmsYn: "Y",
dschgFmYn: "N",
dtlPstnExpln: "배출 위치22",
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
mdfr: "admin",
},
],
flg: "N",
regDt: "2022-01-01",
rgtr: "admin",
mdfcnDt: "2022-02-01",
mdfr: "admin",
},
{
pbnstRuseFcltBizPk: 11,
pbnstRuseFcltFk: 1,
cycl: "2",
seCd: "A011",
bizMthdCd: "M02",
instlAprvSncnDt: "2022-01-01",
bizCmcnDay: "2022-02-01",
gvsbs: "민간",
lcep: "지자체",
cusrAlotm: "고객",
etc: "비고 없음",
totalMoney: "100000000",
rprcsFcltCpct: "50",
majorPrcsMsrcCd: "MP01",
addr: "부산시 해운대구",
rprcsMthdCd: "RP01",
inoutYn: "Y",
mainSplyPumpCpct: "30",
erctWtrOcrnCpct: "5",
erctUswtrLinkSpt: "있음",
erctUswtrFcltCpct: "20",
erctUswtrPrcsMeth: "생물학적",
erctUswtrPrcsMsrcCd: "EM01",
wwtEmsnFcltPrmsnYn: "Y",
tmsInstlYn: "N",
pbnstDrngInflwExclYn: "Y",
bod: "30",
grssClfg: "양호",
combResdch: "적정",
trbt: "10",
clIonQnt: "5",
smll: "없음",
crmty: "정상",
tph: "0.2",
tn: "2",
ph: "7.2",
cdtnv: "100",
designCst: "1000",
cstrnSpvsCst: "500",
fcltSbsdCst: "200",
wstCst: "300",
cnstCmcnCst: "1000",
mntrgEqpmntInstlCst: "150",
gisDbCst: "200",
elpwrMtrngCst: "180",
mchnCst: "700",
archCst: "400",
pplCst: "300",
ruseFcltCst: "5000",
designCstClcln: "990",
cstrnSpvsCstClcln: "480",
fcltSbsdCstClcln: "190",
wstCstClcln: "280",
cnstCmcnCstClcln: "980",
mntrgEqpmntInstlCstClcln: "140",
gisDbCstClcln: "190",
elpwrMtrngCstClcln: "170",
mchnCstClcln: "680",
archCstClcln: "380",
pplCstClcln: "290",
ruseFcltCstClcln: "4800",
fcOrgwts: [
{
pbnstRuseFcltBizFk: 11,
swtrmtFcltFk: 1,
orgwtWtritQnt: "152",
tmsYn: "Y",
dschgFmYn: "N",
dtlPstnExpln: "배출 위치1",
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
mdfr: "admin",
},
{
pbnstRuseFcltBizFk: 11,
swtrmtFcltFk: 1,
orgwtWtritQnt: "150",
tmsYn: "Y",
dschgFmYn: "N",
dtlPstnExpln: "배출 위치",
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
mdfr: "admin",
},
],
flg: "N",
regDt: "2022-01-01",
rgtr: "manager",
mdfcnDt: "2022-02-01",
mdfr: "manager",
},
],
fcOpers: [
{
pbnstRuseFcltOperInfoPk: 100,
pbnstRuseFcltFk: 1,
operMthd: "위탁",
rprtvBzenty: "기관명",
bgngDt: new Date("2025-05-21T11:03:26.434810"),
endDt: new Date("2025-05-21T11:03:26.434810"),
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
mdfr: "admin",
},
{
pbnstRuseFcltOperInfoPk: 101,
pbnstRuseFcltFk: 1,
operMthd: "직영",
rprtvBzenty: "기관명",
bgngDt: new Date("2025-05-21T11:03:26.434810"),
endDt: new Date("2025-05-21T11:03:26.434810"),
regDt: new Date("2025-05-21T11:03:26.434810"),
rgtr: "admin",
mdfcnDt: new Date("2025-05-21T11:03:26.434810"),
mdfr: "admin",
},
],
};
+2
View File
@@ -12,3 +12,5 @@ export const DEV_URL_FO = `http://con.mind-one.co.kr:${DEV_PORT_NEW}/api/v1`;
export const CS_URL= 'http://dev.onasys.co.kr:8000'
export const CS_TUS_UPLOAD= "/attach-service/api/v1/tus/upload";
@@ -0,0 +1,53 @@
import { Upload, type HttpRequest, type HttpResponse, type OnSuccessPayload } from "tus-js-client";
import { CS_TUS_UPLOAD, CS_URL } from "../config";
type UploadOptions = {
handleUploadStart?: (upload: Upload) => void;
handleProgress?: (percentage: string) => void;
handleSuccess?: (payload :OnSuccessPayload) => void;
handleResponse?: (req:HttpRequest, res: HttpResponse) => void;
};
export function TusClientUpload(oFile: File, setUpload: (upload: Upload) => void, options?: UploadOptions) {
const Authorization = "Authorization";
const AUTH_USER_ID = "token-id";
//CS_URL
const uploader = new Upload(oFile, {
endpoint: 'http://localhost:3001' + CS_TUS_UPLOAD,
chunkSize: 10* 1024 * 1024,
headers: {
Authorization: "",
AUTH_USER_ID: "",
},
metadata: {
filename: oFile.name,
filetype: oFile.type,
},
onError(error) {
console.error(`Failed because: ${error}`);
},
onProgress(bytesUploaded, bytesTotal) {
const percentage = ((bytesUploaded / bytesTotal) * 100).toFixed(2);
options?.handleProgress?.(percentage);
},
onAfterResponse(req, res) {
const fileInfo = res.getHeader("X-File-Info");
if (fileInfo === undefined || fileInfo === null) return;
options?.handleResponse?.(res);
},
onSuccess(payload :OnSuccessPayload) {
options?.handleSuccess?.(payload);
},
});
uploader.start();
options?.handleUploadStart?.(uploader);
console.log("upload start >>>>>", uploader);
// setUpload(uploader);
}
//
@@ -303,8 +303,7 @@ export default function BdstReg({ form }: { form: any }) {
selectClass={selectClass}
selectArray={code.chBuCd}
onSelectValue={val => f.onChange(val)}
value={f.value ?? code.chBuCd[0]?.val}
/>
value={f.value ?? code.chBuCd[0]?.val} className={""} label={""} />
</FormUi>
)}
/>
@@ -2,15 +2,12 @@
import { SelectBox } from "@common/business_components";
import {
DatePicker,
FileUpload,
FormUi,
UiTable,
} from "@common/business_components/ui";
import { Form, FormField } from "@common/business_components/ui/form";
import { Button, Input, TableHead, TableRow } from "@common/components";
import { zodResolver } from "@hookform/resolvers/zod";
import { useState } from "react";
import { use, useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { useWrStore } from "@/app/store";
@@ -21,7 +18,6 @@ import {
import {
commonButonSize,
formH1Class,
formH2Class,
formTableName,
} from "@/components/lib/class/comClass";
import MngRegFormDetail from "../mngReg/mngRegFormDetail/mngRegFormDetail";
@@ -32,25 +28,22 @@ import {
ruseFcltinfo,
wasteWaterFcltINfo,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList";
import { pbnstRegZod } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
const formSchema = z.object({
username: z.string().min(2).max(50),
facilityName: z.string().min(2).max(50),
});
export function PbnstBuseForm() {
const { code, pubFac } = useWrStore((state) => state);
const { pubMngUpHeadList } = pubFac;
const { code, pbnst } = useWrStore((state) => state);
const { pubMngUpHeadList,pbnstBizCycle } = pbnst;
const [getBizCycle, setBizCycle] = useState('');
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
username: "",
},
const form = useForm<z.infer<typeof pbnstRegZod>>({
resolver: zodResolver(pbnstRegZod),
});
// 2. Define a submit handler.
function onSubmit(values: z.infer<typeof formSchema>) {
function onSubmit(values: z.infer<typeof pbnstRegZod>) {
// Do something with the form values.
// ✅ This will be type-safe and validated.
console.log(values);
@@ -62,6 +55,11 @@ export function PbnstBuseForm() {
const [instlAprvDate, setInstlAprvDate] = useState(new Date());
const [bizCmcnDate, setBizCmcnDate] = useState(new Date());
const [files, setFiles] = useState(null);
useEffect(() => {
if (getBizCycle ) {
console.log("getBizCycle", getBizCycle);
}
}, [getBizCycle]);
return (
<div className=" !mx-[1.6rem] !p-0r">
@@ -76,108 +74,21 @@ export function PbnstBuseForm() {
<h1 className=" text-xl"></h1>
<div className="flex items-center gap-2 mx-3">
<h1 className={formTableName}>등록차수</h1>
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormUi label="">
<SelectBox
label=""
selectArray={code.yn}
selectArray={pbnstBizCycle}
value={pbnstBizCycle.length > 0 && pbnstBizCycle[0]? pbnstBizCycle[0].val : ""}
className={""}
selectClass={selectClass}
onSelectValue={() => {}}
{...field}
></SelectBox>
</FormUi>
)}
/>
onSelectValue={(val) => {setBizCycle}}
>
</SelectBox>
<Button size={commonButonSize}>저장</Button>
</div>
</div>
{/* <div>
<h1 className={formH1Class}>사업현황 </h1>
</div>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-3">
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormUi label="구분">
<SelectBox
selectArray={code.yn}
className={""}
label={""}
selectClass={selectClass}
onSelectValue={() => {}}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormUi label="사업방식">
<SelectBox
selectArray={code.yn}
className={""}
label={""}
selectClass={selectClass}
onSelectValue={() => {}}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormUi label="사업준공일">
<DatePicker
selectClass={"rounded-lg w-full"}
field={{
value: bizCmcnDate,
onChange: function (date: Date | undefined): void {
if (date) setBizCmcnDate(date);
},
}}
mode="single"
{...field}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="username"
render={({ field }) => (
<FormUi label="설치승인인가일">
<DatePicker
selectClass={"rounded-lg w-full bg-white"}
field={{
value: instlAprvDate,
onChange: (date: Date | undefined): void => {
if (date) setInstlAprvDate(date);
},
}}
mode="single"
{...field}
/>
</FormUi>
)}
/>
</div>
</div> */}
<MngRegFormDetail
formList={businessSttnInfo}
h1Title={"사업현황"}
@@ -6,19 +6,24 @@ import { Form, FormField } from "@common/business_components/ui/form";
import { Button, Input, TableHead, TableRow } from "@common/components";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { set, useForm } from "react-hook-form";
import { nullable, z } from "zod";
import { useWrStore } from "@/app/store";
import {
selectClass,
type TableUpperProps,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type {
fcltOperInfoType,
ruseFcltType,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import { commonButonSize, formH1Class, formH2Class, formTableName } from "@/components/lib/class/comClass";
import {
commonButonSize,
formH1Class,
formH2Class,
formTableName,
} from "@/components/lib/class/comClass";
import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable";
import { TusClientUpload } from "@/components/lib/useTus_wr/useTusWr";
import type { Upload } from "tus-js-client";
import type { fcltOperInfoType, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
const formSchema = z.object({
fcltNm: z.string().min(2).max(50),
@@ -31,12 +36,23 @@ const formSchema = z.object({
});
export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
const { pubFac } = useWrStore((state) => state);
const { pubMngUpHeadList, isInit } = pubFac;
const { pbnst } = useWrStore((state) => state);
const { pubMngUpHeadList, isInit } = pbnst;
const [ruseOperData, setRuseOperData] = useState<fcltOperInfoType[]>();
const [files, setFiles] = useState<File[] | null>(null);
const [planFiles, setPlanFiles] = useState<File[] | null>(null);
const [relationfiles, setRelationFiles] = useState<File[] | null>(null);
const [isModalOpen, setIsModalOpen] = useState(false);
const [upload, setUpload] = useState<Upload | null>(null);
const [progress, setProgress] = useState(0);
const handleProgress = (percentage: string) => {
console.log("handleProgress", percentage);
setProgress(Number(percentage));
};
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
@@ -69,6 +85,35 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
console.log(values);
}
const testFile = () => {
if (relationfiles && relationfiles[0])
TusClientUpload(relationfiles[0], setUpload, {
handleUploadStart: () => {
console.log("handleUploadStart");
},
handleProgress,
handleResponse: (req, res) => {
console.log(" handleResponse req", req);
console.log("handleResponse res", res);
},
handleSuccess: (a) => {
console.log("req", a);
},
});
};
useEffect(() => {
if (relationfiles && relationfiles[0])
console.log("relationfiles ", relationfiles[0]);
// TusClientUpload(
// relationfiles[0],{
// handleUploadStart: setUpload,
// handleProgress,
// handleSuccess: setUpload,
// })
}, [relationfiles]);
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
return (
<>
@@ -127,26 +172,24 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
</div>
<div>
<div className="h-[200px] overflow-y-auto">
<div className="flex justify-between items-center mx-3 mb-3">
<span className={formTableName}>재이용시설 운영정보</span>
<Button
type="button"
size={commonButonSize}
className="!text-xl"
onClick={() => setIsModalOpen(true)}
>
추가등록
</Button>
</div>
<RuseMngTable
tableData={ []}
headList={pubFac.pubMngUpHeadList}
upHeadList={pubFac.pubMngNm}>
</RuseMngTable>
<div className="h-[200px] overflow-y-auto">
<div className="flex justify-between items-center mx-3 mb-3">
<span className={formTableName}>재이용시설 운영정보</span>
<Button
type="button"
size={commonButonSize}
className="!text-xl"
onClick={() => testFile()}
>
추가등록
</Button>
</div>
<RuseMngTable
tableData={[]}
headList={pbnst.pubMngUpHeadList}
upHeadList={pbnst.pubMngNm}
></RuseMngTable>
</div>
</div>
<div>
<h1 className={formH1Class}>재이용수 공급 가능량</h1>
@@ -207,8 +250,8 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
render={({}) => (
<FormUi label="계통도">
<FileUpload
files={files || []}
setFiles={setFiles}
files={relationfiles || []}
setFiles={setRelationFiles}
fileTypes="PDF"
></FileUpload>
</FormUi>
@@ -222,8 +265,8 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
render={({}) => (
<FormUi label="평면도">
<FileUpload
files={files || []}
setFiles={setFiles}
files={planFiles || []}
setFiles={setPlanFiles}
fileTypes="PDF"
></FileUpload>
</FormUi>
@@ -85,10 +85,11 @@ export default function ChkgdExcel({ type }: { type: string }) {
guide.utztnUsgCd === polution.utztnUsgCd
);
if (fusion) {
return {
...guide,
rswtrPolutions: fusion?.rswtrPollutions,
rswtrPollutions: fusion?.rswtrPollutions,
rswtrDetails:fusion?.rswtrDetails
};
} else {
@@ -104,10 +105,13 @@ export default function ChkgdExcel({ type }: { type: string }) {
(item) => !guideKey.has(keyGenerator(item))
);
const listTotalData:rswtChkZodType[] =[
...totalData,
...onlypolution
]
setExcelRswtData(listTotalData);
}
});
+50
View File
@@ -0,0 +1,50 @@
import { NextRequest, NextResponse } from "next/server";
import { CS_URL } from "./components/lib/config";
//import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config";
const CLAIM_NAME = "Authorization"
const AUTH_USER_ID = "token-id"
const serverApiUrl =
CS_URL;
export function middleware(req: NextRequest) {
const pathname = req.nextUrl.pathname;
console.log(`[Middleware] Request URL: ${req.url}`);
const searchParams = req.nextUrl.searchParams;
if (pathname.startsWith("/server")) {
const queryParams = searchParams.toString();
const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${queryParams ? `?${queryParams}` : ""
}`;
console.log(`[Middleware] Rewriting from '/server' path to: ${newUrl}`);
return NextResponse.rewrite(new URL(newUrl));
}
if (pathname.startsWith("/attach-service")) {
const requestHeaders = new Headers(req.headers);
const token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhMGVjN2EwNy03NTJhLTRmN2YtODlhNi04NTRlNjNkMmUzYTAiLCJpYXQiOjE3NDc4MTM2MDksImV4cCI6MTc0NzgxMzkwOX0.XGiDHC-ljuEdN6M638q0nDet6XRQcO8o66LKvZZ07r4rGykn2ba8yagC_-8LVpVjrkPzIVZnW10I2fQWgAGT5Q"
const userId = 'a0ec7a07-752a-4f7f-89a6-854e63d2e3a0';
//const token = req.cookies.get(CLAIM_NAME)?.value;
//const userId = req.cookies.get(AUTH_USER_ID)?.value;
const newUrl = `${serverApiUrl}${pathname}`;
console.log("serverApiUrl ", serverApiUrl);
console.log("pathname ", pathname);
if (token) requestHeaders.set(CLAIM_NAME, token);
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
console.log(
`[Middleware] Rewriting from '/attach-service' path to: ${newUrl}`,
);
return NextResponse.rewrite(new URL(newUrl), {
headers: requestHeaders,
});
}
return NextResponse.next();
}
export const config = {
matcher: ["/server/:path*", "/attach-service/:path*"],
};
+2 -1
View File
@@ -9,9 +9,9 @@
"lint": "next lint"
},
"dependencies": {
"@common/assets": "workspace:*",
"@common/business_components": "workspace:*",
"@common/components": "workspace:*",
"@common/assets": "workspace:*",
"@hookform/resolvers": "^4.1.3",
"@tanstack/react-table": "^8.21.2",
"class-variance-authority": "^0.7.1",
@@ -22,6 +22,7 @@
"react-hot-toast": "^2.5.2",
"tailwind-merge": "^3.0.1",
"tailwindcss-animate": "^1.0.7",
"tus-js-client": "^4.3.1",
"zod": "^3.24.2"
},
"devDependencies": {
Binary file not shown.