물 하수재이용 등록 사업 작업중

This commit is contained in:
leedj312
2025-05-26 16:10:34 +09:00
parent 06f5400569
commit 2b18aa2c4b
9 changed files with 139 additions and 48 deletions
@@ -39,7 +39,10 @@ useEffect(() => {
}, [pbnst.isInit, pubHasuInit,pbnstRegInit]);
useEffect(() => {
if (code.sggCd.length > 0) {
console.log("pbnstHasuRes", pbnstHasuRes);
if (code.sggCd.length > 0 && pbnstHasuRes.length > 0) {
setbdstTable(tableData(pbnstHasuRes, { code }));
}
}, [code, pbnstHasuRes]);
+29
View File
@@ -89,6 +89,31 @@ const chBuCd = [
{ val: "개축", text: "개축" },
{ val: "재축", text: "재축" },
]
const pplQulity = [
{ val: "도복장강관", text: "도복장강관" },
{ val: "PE관", text: "PE관" },
{ val: "스테인레스관", text: "스테인레스관" },
{ val: "덕타일주철관", text: "덕타일주철관" },
{ val: "유리섬유복합관", text: "유리섬유복합관" },
{ val: "기타", text: "기타" },
]
const pplLenght = [
{ val: "D100", text: "D100" },
{ val: "D200", text: "D200" },
{ val: "D250", text: "D250" },
{ val: "D300", text: "D300" },
{ val: "D350", text: "D350" },
{ val: "D400", text: "D400" },
{ val: "D450", text: "D450" },
{ val: "D500", text: "D500" },
{ val: "D700", text: "D700" },
{ val: "D900", text: "D900" },
{ val: "D1000​", text: "D1000​" },
]
export const buildingType = {
RST:"RST",
RNB:"RNB",
@@ -109,6 +134,8 @@ export type comCodeState = {
lclgvrnmntCd: EnvPartSelectDataType[];
orgwtKndCd: SelectDataType[];
yn: SelectDataType[];
pplQulity: SelectDataType[];
pplLenght: SelectDataType[];
buildingType: {
RST:string,
RNB:string,
@@ -247,6 +274,8 @@ export const comCodeStateExport: comCodeState = {
mdmbsnCd: [],
lgbsnCd: [],
lclgvrnmntCd: [],
pplQulity:pplQulity,
pplLenght:pplLenght,
yn: yn,
buildingType:buildingType,
},
@@ -12,8 +12,8 @@ export const pubFacHeadListExport: TableUpperProps[] = [
{ id: "addr", title: "위치" },
{ id: "efflWqltStndrdNm", title: "지역구분" },
{ id: "fctCpc", title: "시설용량" },
{ id: "yn", title: "재이용여부" },
{ id: "authoDay", title: "등록여부" },
{ id: "ruse", title: "재이용여부" },
{ id: "rswtrYn", title: "등록여부" },
];
export const pbnstMngUpHeadListExport: TableUpperProps[] = [
@@ -25,8 +25,8 @@ export const pbnstMngUpHeadListExport: TableUpperProps[] = [
export const pplInstlsHeadListExport: TableUpperProps[] = [
{ id: "ppMqlt", title: "관재질", },
{ id: "pdmt", title: "관경" },
{ id: "ppMqlt", title: "관재질", type: "select", selectData:'pplQulity' },
{ id: "pdmt", title: "관경", type: "select", selectData:'pplLenght'},
{ id: "cpct", title: "연장", },
];
@@ -1,6 +1,6 @@
import { z } from "zod";
import type { TableUpperProps } from "../rainReg";
import { getFetch } from "@/components/lib/api";
import { fetchType, getFetch, postFectch } from "@/components/lib/api";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import { exampleData, fcBizSchema, type customPbnst, type pubHasuType } from "./type";
import type { SelectDataType } from "@common/business_components/ui";
@@ -56,12 +56,35 @@ export const pubFacStateExport: pubFacState = {
},
};
const initFetch = async (txt: string | undefined) => {
const rainRes = await getFetch(
"common",
`/prcsFclt/info/1/10/A/41220` + (txt ? `/${txt}` : "") + "/500" + "/1"
const checkWrRegList = async () => {
const wrRegList = await getFetch(
"wr",
`/reuseFc/pubFc`
);
return rainRes;
return wrRegList;
}
const hasuListFetch = async (txt: string | undefined ) => {
const checkWrRegListRes = await checkWrRegList()
// prcsFclt/ruseInfo/1/20/A/11/0/1/SW
const rainRes = await postFectch(
`/prcsFclt/ruseInfo/1/10/A/11` + "/0" + "/1" +"/SW"
,checkWrRegListRes,
fetchType.COMMON );
const hasuList = rainRes.data.map((item: any) => {
return {
...item,
ruse: item.ruse===false ? 'N' : 'Y', };
})
return hasuList;
};
const getBizCycle = (fcBizs: z.infer<typeof fcBizSchema>[] ) => {
@@ -79,8 +102,10 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
pubHasuInit: async (txt: string | undefined) => {
try {
const pbnstHasuRes = await initFetch(txt);
const pbnstHasuRes = await hasuListFetch(txt);
console.log('qwe ',pbnstHasuRes)
return set((state: pubFacState) => ({
...state,
@@ -141,7 +166,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
},
pbnstReg: async (txt: string | undefined) => {
try {
const pbnstRes = await initFetch(txt);
const pbnstRes = await hasuListFetch(txt);
return set((state: pubFacState) => ({
...state,
pbnst: {
@@ -1,6 +1,7 @@
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
import type { SelectDataType } from "@common/business_components/ui";
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
export const rainZod = z.object({
@@ -90,6 +91,7 @@ export type TableUpperProps = {
visible?:boolean;
rowSpan?: true;
type?: string;
selectData ?:string;
};
export const upHeadList: TableUpperProps[] = [
+5 -3
View File
@@ -20,11 +20,13 @@ export const getFetch = async( type:string , url: string) => {
return res.data;
}
export const postFectch = async (url: string, params: any) => {
export const postFectch = async (url: string, params: any , type?:string) => {
const div = type === fetchType.COMMON ? DEV_URL_FO : DEV_URL_WR
const response = await fetch(DEV_URL_WR+url, {
const response = await fetch(div+url, {
method: "POST",
headers: {
'accept': 'application/json',
"Content-Type": "application/json",
},
body: JSON.stringify(params),
@@ -32,7 +34,7 @@ export const postFectch = async (url: string, params: any) => {
if(!response.ok) {
throw new Error(`오류 발생: ${response.status}`);
}
return response;
return await response.json();
}
+2 -1
View File
@@ -6,8 +6,9 @@ const DEV_PORT_NEW="11082"
export const LOCAL_URL_WR = `http://localhost:${LOCAL_PORT}/api/v1`;
export const DEV_URL_WR = `http://con.mind-one.co.kr:${DEV_PORT}/api/v1`;
// export const DEV_URL_WR = `http://192.168.0.91:8880/api/v1`;
//export const DEV_URL_FO = `http://con.mind-one.co.kr:${DEV_PORT_FO}/api/v1`;
// export const DEV_URL_FO = `http://192.168.0.91:8882/api/v1`;
export const DEV_URL_FO = `http://con.mind-one.co.kr:${DEV_PORT_NEW}/api/v1`;
@@ -1,7 +1,7 @@
"use client";
import { SelectBox } from "@common/business_components";
import { FormUi } from "@common/business_components/ui";
import { FormUi, type SelectDataType } from "@common/business_components/ui";
import { Form, FormField } from "@common/business_components/ui/form";
import { Button, Input, Label, TableHead, TableRow } from "@common/components";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -27,51 +27,64 @@ import {
ruseWaterQulityList,
wasteWaterFcltINfo,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/headList";
import { fcBizSchema, pbnstRegZod, type fcBizType, type fcOrgwtType, type ppInstlType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import {
fcBizSchema,
pbnstRegZod,
type fcBizType,
type fcOrgwtType,
type ppInstlType,
} from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import RuseMngTable from "@/components/ui/table/pbnstReg/ruseMngTable/ruseMngTable";
export function PbnstBuseForm({data} :{data: fcBizType[]} ) {
export function PbnstBuseForm({ data }: { data: fcBizType[] }) {
const { code, pbnst } = useWrStore((state) => state);
const { pbnstBizCycle, pbnstRes
} = pbnst;
const [getBizCycle, setBizCycle] = useState('1');
const [orgwtData ,setOrgwtData] = useState<fcOrgwtType[]>([]);
const [ppistlData ,setPpistlData] = useState<ppInstlType[]>([]);
const { pbnstBizCycle, pbnstRes } = pbnst;
const [getBizCycle, setBizCycle] = useState("1");
const [ppiSelectList, setPpiSelectList] =
useState<[{ name: string; val: SelectDataType[] }]>();
const [ppiYn, setPpiYn] = useState("Y");
const form = useForm<fcBizType>({
resolver: zodResolver(fcBizSchema),
});
// 2. Define a submit handler.
function onSubmit(values: fcBizType) {
console.log(values);
}
const onSelectValue = (val: string) => {
console.log(val);
};
const { fields: fcOrgwtFiled } = useFieldArray({
const { fields: fcOrgwtFiled } = useFieldArray({
control: form.control,
name: "fcOrgwts",
});
const { fields: pplInstls } = useFieldArray({
const { fields: pplInstls } = useFieldArray({
control: form.control,
name: "pplInstls",
});
useEffect(() => {
if(data){
const index = Number(getBizCycle) -1
if (data) {
const index = Number(getBizCycle) - 1;
form.reset(data[index]);
}
}, [ getBizCycle,data]);
}, [getBizCycle, data]);
useEffect(() => {
}, [pbnstBizCycle]);
const ppl = [];
if (code.pplLenght) {
ppl.push({ name: "pplLenght", val: code.pplLenght });
}
if (code.pplLenght) {
ppl.push({ name: "pplQulity", val: code.pplQulity });
}
if (ppl.length > 0) {
setPpiSelectList(ppl);
}
}, [code]);
useEffect(() => {
console.log("ppiSelectList:", ppiSelectList);
}, [ppiSelectList]);
useEffect(() => {
console.log("form errors:", form.formState.errors);
}, [form.formState.errors]);
@@ -93,13 +106,10 @@ export function PbnstBuseForm({data} :{data: fcBizType[]} ) {
<SelectBox
label=""
selectArray={pbnstBizCycle}
value={
getBizCycle?? pbnstBizCycle[0]?.val
}
value={getBizCycle ?? pbnstBizCycle[0]?.val}
className={""}
selectClass={selectClass}
onSelectValue={(val) => {
setBizCycle(String(val));
}}
></SelectBox>
@@ -117,8 +127,6 @@ export function PbnstBuseForm({data} :{data: fcBizType[]} ) {
<MngRegFormDetail
formList={businessMoneyInfo}
h1Title={"사업비"}
form={form}
moClass="grid grid-cols-12 gap-4"
@@ -180,8 +188,9 @@ export function PbnstBuseForm({data} :{data: fcBizType[]} ) {
<div>
<RuseMngTable
tableData={ pplInstls}
tableData={pplInstls}
headList={pbnst.pplInstlsHeadLisat}
code={ppiSelectList ?? []}
/>
</div>
@@ -1,6 +1,7 @@
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/TableHead";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { selectClass, type TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { SelectBox, type SelectDataType } from "@common/business_components/ui";
import {
Input,
Table,
@@ -15,11 +16,16 @@ export default function RuseMngTable({
tableData,
headList,
upHeadList,
code = [],
}: {
tableData: any[];
headList: TableUpperProps[];
upHeadList?: chHeadType[];
code?:{name:string, val:SelectDataType[] }[]
}) {
return (
<>
<Table variant="secondary">
@@ -53,7 +59,21 @@ export default function RuseMngTable({
onChange={(e) => {}}
value={item[head.id] || ""}
/>
) : (
) : head.type === "select" ? (
<SelectBox
label=""
selectArray={code.find(item => item.name === head.selectData)?.val ?? []}
value={
tableData[index][item[head.id]]
}
className={""}
selectClass={selectClass}
onSelectValue={(val) => {
tableData[index][head.id] = val;
}}
></SelectBox>
)
: (
`${item[head.id] || ""}`
)}
</TableCell>