하수재이용/빗물/중수도/온배수 등록 페이지 전체적인 레이아웃 수정
This commit is contained in:
@@ -29,7 +29,7 @@ import {
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { Toaster } from "react-hot-toast";
|
||||
import toast, { Toaster } from "react-hot-toast";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
export default function LdrmntCoSttn() {
|
||||
@@ -46,7 +46,6 @@ export default function LdrmntCoSttn() {
|
||||
const [excelData, setExcelData] = useState<any[]>();
|
||||
const [resetPage, isResetPage] = useState(false);
|
||||
const { t } = useTranslation('base');
|
||||
// const [isExcelDownload, setIsExcelDownload] = useState(false);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
excelDownload(
|
||||
@@ -81,20 +80,20 @@ export default function LdrmntCoSttn() {
|
||||
const excelDownloadClick = useCallback(() => {
|
||||
const cityNm = computeCityNm();
|
||||
ldrmntSearch(true, 1, String(ldrmntResCount), cityNm, searchTxt || "");
|
||||
// setIsExcelDownload(true);
|
||||
}, [objSearch, searchTxt, code, ldrmntSearch, computeCityNm, ldrmntResCount]);
|
||||
|
||||
useEffect(() => {
|
||||
if (/*isExcelDownload &&*/ excelData && excelData.length > 0) {
|
||||
if (excelData && excelData.length > 0) {
|
||||
downloadExcel({
|
||||
data: excelData,
|
||||
fileName: "잠재수요처 관리",
|
||||
sheetNameArray: ["Sheet1"],
|
||||
headerRange: "A1:F1"
|
||||
});
|
||||
// setIsExcelDownload(false);
|
||||
} else {
|
||||
toast.error(t('excelDownErrMsg'));
|
||||
}
|
||||
}, [excelData, /*isExcelDownload*/]);
|
||||
}, [excelData]);
|
||||
|
||||
const [isExcelOpen, setIsExcelOpen] = useState<{
|
||||
isModal: boolean;
|
||||
|
||||
@@ -10,11 +10,10 @@ import {
|
||||
ScrollArea,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
UiTable
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components";
|
||||
@@ -97,15 +96,13 @@ export default function Home() {
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7 !text-3xl"
|
||||
className="col-span-3 !text-3xl"
|
||||
label="시설명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<div className="flex flex-row space-x-2 items-center">
|
||||
<Button
|
||||
size={"sm"}
|
||||
@@ -123,7 +120,9 @@ export default function Home() {
|
||||
신규등록
|
||||
</Button>
|
||||
</div>
|
||||
</SearchFormRight>
|
||||
</SearchFormLeft>
|
||||
{/* <SearchFormRight>
|
||||
</SearchFormRight> */}
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
@@ -146,7 +145,7 @@ export default function Home() {
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full">
|
||||
<ListDiv>
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<ScrollArea className="h-[65vh]">
|
||||
<HtdflRegForm
|
||||
htdflForm={htdflForm ?? ({} as customHtdflBdst)}
|
||||
isModal={false}
|
||||
|
||||
@@ -271,7 +271,7 @@ export default function PublicReuseFaciltyInsert() {
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className={"col-span-3 my-7 !text-3xl"}
|
||||
className={"col-span-3 !text-3xl"}
|
||||
label="시설명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
@@ -316,10 +316,10 @@ export default function PublicReuseFaciltyInsert() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-8 gap-4 h-full">
|
||||
<div className="grid grid-cols-8 gap-4">
|
||||
<div className="col-span-5 h-full min-h-0">
|
||||
<ListDiv className="min-h-0">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
{/* <ScrollArea className="h-[60vh]"> */}
|
||||
{" "}
|
||||
{/* 높이 조정 */}
|
||||
<UiTable
|
||||
@@ -332,10 +332,10 @@ export default function PublicReuseFaciltyInsert() {
|
||||
onPageChange={setPageNation}
|
||||
resetPageNo={resetPage}
|
||||
/>
|
||||
</ScrollArea>
|
||||
{/* </ScrollArea> */}
|
||||
</ListDiv>
|
||||
</div>
|
||||
<ListDiv className="col-span-3 pr-6 ">
|
||||
<ListDiv className="col-span-3 pr-6">
|
||||
{formWatch && formWatch[0]?.pbnstRuseFcltId ? (
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<div className="flex justify-between items-center">
|
||||
|
||||
@@ -86,7 +86,7 @@ export default function Home() {
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className={"col-span-3 my-7 !text-3xl"}
|
||||
className={"col-span-3 !text-3xl"}
|
||||
label="건물명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
@@ -139,7 +139,7 @@ export default function Home() {
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full">
|
||||
<ListDiv className="">
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<ScrollArea className="h-[65vh]">
|
||||
<RainRegForm
|
||||
rainForm={rainForm ?? ({} as customRainBdst)}
|
||||
isModal={false}
|
||||
|
||||
@@ -9,11 +9,10 @@ import {
|
||||
ScrollArea,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
UiTable
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components";
|
||||
@@ -94,19 +93,17 @@ export default function Home() {
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
className="col-span-3"
|
||||
label="건물명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<div className="flex flex-row space-x-2">
|
||||
<div className="flex flex-row space-x-2 items-center">
|
||||
<Button
|
||||
size={"sm"}
|
||||
className="mr-4 "
|
||||
className=""
|
||||
onClick={() => {
|
||||
rswtBdstSearch(searchTxt || "", pageNation, "41");
|
||||
}}
|
||||
@@ -121,7 +118,9 @@ export default function Home() {
|
||||
신규등록
|
||||
</Button>
|
||||
</div>
|
||||
</SearchFormRight>
|
||||
</SearchFormLeft>
|
||||
{/* <SearchFormRight>
|
||||
</SearchFormRight> */}
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
@@ -137,12 +136,13 @@ export default function Home() {
|
||||
headName={"건축물 목록"}
|
||||
cellClick={cellClick}
|
||||
onPageChange={setPageNation}
|
||||
index={0}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full">
|
||||
<ListDiv>
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<ListDiv className="">
|
||||
<ScrollArea className="h-[65vh]">
|
||||
<RswtrRegForm
|
||||
rswtForm={rswtForm ?? ({} as customRswtBdst)}
|
||||
isModal={false}
|
||||
|
||||
@@ -118,7 +118,7 @@ export const htdflFacStateExport: htdflFacState = {
|
||||
|
||||
const initFetch = async (code: string) => {
|
||||
|
||||
let url = `/drain/facilityList/1/10`
|
||||
let url = `/drain/facilityList/1/11`
|
||||
|
||||
url+=`/${code}`
|
||||
|
||||
@@ -134,7 +134,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
try {
|
||||
const htdflRes = await getFetchWithCount(
|
||||
"wr",
|
||||
`/drain/facilityList/${pageNation}/10/${code}`
|
||||
`/drain/facilityList/${pageNation}/11/${code}`
|
||||
);
|
||||
return set((state: htdflFacState) => ({
|
||||
...state,
|
||||
@@ -176,7 +176,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
}
|
||||
const htdflRes = await getFetchWithCount(
|
||||
"wr",
|
||||
`/drain/facilityList/1/10/${code}`
|
||||
`/drain/facilityList/1/11/${code}`
|
||||
);
|
||||
set((state: htdflFacState) => ({
|
||||
...state,
|
||||
@@ -219,7 +219,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
}
|
||||
},htdflNmSearch :async(code:string | number, fcltNm:string) =>{
|
||||
try {
|
||||
const htdflRes = await getFetchWithCount("wr", `/drain/facilityList/1/10/${code}/${fcltNm}`);
|
||||
const htdflRes = await getFetchWithCount("wr", `/drain/facilityList/1/11/${code}/${fcltNm}`);
|
||||
set((state: htdflFacState) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -105,7 +105,7 @@ const checkWrRegList = async () => {
|
||||
const hasuListFetch = async (page: string, sggOrCity: string, searchTxt?:string) => {
|
||||
const checkWrRegListRes = await checkWrRegList();
|
||||
|
||||
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/10/A/${sggOrCity? sggOrCity : "11"}/0/1/SW`;
|
||||
let url = `/prcsFclt/ruseInfo/${page ? page : 1}/11/A/${sggOrCity? sggOrCity : "11"}/0/1/SW`;
|
||||
|
||||
|
||||
const data = checkWrRegListRes.filter((item:string) => item !== "")
|
||||
|
||||
@@ -5,24 +5,24 @@ import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "./type";
|
||||
|
||||
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
|
||||
export const TEST_UUID = '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
|
||||
|
||||
const rainyObjSchema = z.object({
|
||||
bdstReuseFcltFk: z.number().nullish(),
|
||||
pntfColKnd: z.string().min(1, { message: validationMessages.requiredSelect("종류") }),
|
||||
pntfColArea: z.number().nullish() ,
|
||||
pntfColArea: z.number().nullish(),
|
||||
dtfcltCpct: z.number().default(0),
|
||||
filtrTrtmfctYn: z.string().default("Y"),
|
||||
filtrTrtmfctCpct: z.number().nullish().default(0),
|
||||
filtrTrtmfctPrs: z.string().default(""),
|
||||
annRnwtQty: z.number().default(0),
|
||||
oilqMeasMthd: z.string().default("").nullish(),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
rgtr: z.string().nullish(),
|
||||
mdfr: z.string().nullish(),
|
||||
});
|
||||
|
||||
|
||||
const rainBuildingSchema = baseReuseBuildingSchema.extend({
|
||||
const rainBuildingSchema = baseReuseBuildingSchema.extend({
|
||||
rainyObj: rainyObjSchema,
|
||||
})
|
||||
|
||||
@@ -36,19 +36,19 @@ export const rainZod = z.object({
|
||||
archChgPrmsnDt: z.coerce.date().nullish().default(null),
|
||||
archArea: z.string().default(''),
|
||||
archChgArea: z.number().default(0),
|
||||
rgtr:z.string().nullish(),
|
||||
mdfr:z.string().nullish(),
|
||||
rgtr: z.string().nullish(),
|
||||
mdfr: z.string().nullish(),
|
||||
reuseBuilding: z.array(rainBuildingSchema).default([]),
|
||||
chgBuilding: z.array(chgBuildingSchema).default([])
|
||||
})
|
||||
|
||||
export type chgBuilding={
|
||||
bdstInfoSn?: number|null,
|
||||
export type chgBuilding = {
|
||||
bdstInfoSn?: number | null,
|
||||
archChgPrmsnDt?: Date,
|
||||
archChgArea?: string,
|
||||
bdstChgNm?: string
|
||||
rgtr?:string|null;
|
||||
mdfr?:string|null;
|
||||
rgtr?: string | null;
|
||||
mdfr?: string | null;
|
||||
}
|
||||
export type customRainBdst = z.infer<typeof rainZod>
|
||||
|
||||
@@ -74,15 +74,15 @@ export type rainFacState = {
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
rainRes: customRainBdst[];
|
||||
rainResCount:number;
|
||||
rainResCount: number;
|
||||
};
|
||||
};
|
||||
type rainFacSActions = {
|
||||
initRain: (code:string|number) => void;
|
||||
getRainData:(pageNation:number, code:string|number) =>void;
|
||||
rainSearch: (txt:string,pageNation:number,code:string|number) => void;
|
||||
rainBdstReg: (data: customRainBdst, code:string|number) => void;
|
||||
rainBdstUpdate: (data: customRainBdst, code:string|number) => void;
|
||||
initRain: (code: string | number) => void;
|
||||
getRainData: (pageNation: number, code: string | number) => void;
|
||||
rainSearch: (txt: string, pageNation: number, code: string | number) => void;
|
||||
rainBdstReg: (data: customRainBdst, code: string | number) => void;
|
||||
rainBdstUpdate: (data: customRainBdst, code: string | number) => void;
|
||||
|
||||
};
|
||||
|
||||
@@ -92,23 +92,23 @@ export const rainFacStateExport: rainFacState = {
|
||||
rain: {
|
||||
isInit: false,
|
||||
rainRes: rainRes,
|
||||
rainResCount:1,
|
||||
rainResCount: 1,
|
||||
upHeadList: upHeadList,
|
||||
},
|
||||
};
|
||||
|
||||
const initFetch = async (code:string|number) => {
|
||||
const initFetch = async (code: string | number) => {
|
||||
// const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/10/${code}`);
|
||||
const rainRes =await getFetchWithCount("wr", `/reuseFc/rainyInfoList/1/10/${code}`);
|
||||
const rainRes = await getFetchWithCount("wr", `/reuseFc/rainyInfoList/1/11/${code}`);
|
||||
return rainRes;
|
||||
};
|
||||
export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
getRainData: async(pageNation:number, code:string|number) =>{
|
||||
try{
|
||||
const rainRes =await getFetchWithCount("wr", `/reuseFc/rainyInfoList/${pageNation}/10/${code}`);
|
||||
getRainData: async (pageNation: number, code: string | number) => {
|
||||
try {
|
||||
const rainRes = await getFetchWithCount("wr", `/reuseFc/rainyInfoList/${pageNation}/11/${code}`);
|
||||
|
||||
// 여기서 상태 업데이트
|
||||
return set((state: rainFacState) => ({
|
||||
@@ -116,18 +116,18 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes.data,
|
||||
rainResCount:rainRes.count,
|
||||
rainResCount: rainRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
|
||||
}catch(e){
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
initRain: async (code:string|number) => {
|
||||
initRain: async (code: string | number) => {
|
||||
try {
|
||||
// 파라이터 수정 통합관리자 =0, 시관리자=시코드, 시군구 관리자= 시군구 코드 를 세번째 파라미터로 지정 / 건축물 서치가 있을경우 4번째 파라미터로 던지기 즉 1/20/42(서울시)/영현빌딩 이런식으로)
|
||||
const rainRes = await initFetch(code);
|
||||
@@ -137,7 +137,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes.data,
|
||||
rainResCount:rainRes.count,
|
||||
rainResCount: rainRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -145,52 +145,53 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
console.log("error", error);
|
||||
}
|
||||
},
|
||||
rainSearch: async(txt:string,pageNation:number) =>{
|
||||
try{
|
||||
rainSearch: async (txt: string, pageNation: number) => {
|
||||
try {
|
||||
|
||||
// const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:''))
|
||||
const rainRes = await getFetchWithCount('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:''))
|
||||
const rainRes = await getFetchWithCount('wr', `/reuseFc/rainyInfoList/${pageNation}/11/41` + (txt ? `/${txt}` : ''))
|
||||
console.log("rainRes", rainRes)
|
||||
set((state: rainFacState) => {
|
||||
return {
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes.data,
|
||||
rainResCount:rainRes.count,
|
||||
rainResCount: rainRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
})}
|
||||
catch(erTxt){
|
||||
})
|
||||
}
|
||||
catch (erTxt) {
|
||||
console.log("error", erTxt)
|
||||
}
|
||||
},
|
||||
rainBdstReg: async (data: customRainBdst,code:string|number) => {
|
||||
rainBdstReg: async (data: customRainBdst, code: string | number) => {
|
||||
try {
|
||||
|
||||
const test =await makeRstr(data);
|
||||
const test = await makeRstr(data);
|
||||
const res = await postFectch("/reuseFc/rainyInfo", test);
|
||||
if(res.status===200){
|
||||
if(data.chgBuilding.length > 0){
|
||||
if (res.status === 200) {
|
||||
if (data.chgBuilding.length > 0) {
|
||||
|
||||
const chPK = res?.data?.bdstInfoSn
|
||||
const makeCh= res.data.chgBuilding.map((item: chgBuilding) =>
|
||||
( {
|
||||
const makeCh = res.data.chgBuilding.map((item: chgBuilding) =>
|
||||
({
|
||||
...item,
|
||||
bdstInfoSn: chPK,
|
||||
})
|
||||
);
|
||||
const chch= await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
const chch = await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
|
||||
if(chch.status ===200) {
|
||||
if (chch.status === 200) {
|
||||
toast.success("건축물 등록이 완료되었습니다.");
|
||||
}else{
|
||||
} else {
|
||||
toast.error("건축물 증축/개축/중축 오류입니다.");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
toast.success("건축물 등록이 완료되었습니다.");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
toast.error("건축물 등록이 완료되었습니다.");
|
||||
}
|
||||
const rainRes = await initFetch(code);
|
||||
@@ -199,7 +200,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes.data,
|
||||
rainResCount:rainRes.count,
|
||||
rainResCount: rainRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -209,21 +210,49 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
} finally {
|
||||
}
|
||||
},
|
||||
rainBdstUpdate: async (data: customRainBdst,code:string|number) => {
|
||||
rainBdstUpdate: async (data: customRainBdst, code: string | number) => {
|
||||
try {
|
||||
const chData =await makeMdfr(data);
|
||||
const chData = await makeMdfr(data);
|
||||
const res = await putFectch("/reuseFc/rainyInfo", chData);
|
||||
if(res.status === 200){
|
||||
toast.success("수정이 완료되었습니다.");
|
||||
console.log("res", res)
|
||||
console.log("data", data)
|
||||
if (res.status === 200) {
|
||||
if (data.chgBuilding.length > 0) {
|
||||
const chPK = data?.bdstInfoSn;
|
||||
console.log("chPK", chPK)
|
||||
const makeCh = data.chgBuilding.map((item: chgBuilding) =>
|
||||
({
|
||||
...item,
|
||||
bdstInfoSn: chPK,
|
||||
})
|
||||
);
|
||||
console.log("makeCh", makeCh)
|
||||
const chch = await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
console.log("chch", chch)
|
||||
|
||||
if (chch.status === 200) {
|
||||
toast.success("건축물 수정이 완료되었습니다.");
|
||||
} else {
|
||||
toast.error("건축물 증축/개축/중축 오류입니다.");
|
||||
}
|
||||
} else {
|
||||
toast.success("건축물 수정이 완료되었습니다.");
|
||||
}
|
||||
} else {
|
||||
toast.error("건축물 수정이 완료되었습니다.");
|
||||
}
|
||||
|
||||
// }
|
||||
// toast.success("수정이 완료되었습니다.");
|
||||
|
||||
// }
|
||||
const rainRes = await initFetch(code);
|
||||
set((state: rainFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes.data,
|
||||
rainResCount:rainRes.count,
|
||||
rainResCount: rainRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -233,5 +262,6 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { z } from "zod";
|
||||
import { makeMdfr, makeRstr } from "../bdstReg";
|
||||
import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "../rainReg/type";
|
||||
|
||||
const rswtrObjSchema = z.object({
|
||||
const rswtrObjSchema = z.object({
|
||||
bdstRuseFcltSn: z.number().nullish(),
|
||||
//wtrUsqty: z.number({ required_error: validationMessages.required("물사용량(m³)") }).positive({ message: validationMessages.required("물사용량(m³)") }),
|
||||
//oblgTrgtWtrUsqty: z.number().nullish().default(0),
|
||||
@@ -24,7 +24,7 @@ import { baseReuseBuildingSchema, chgBuildingSchema, validationMessages } from "
|
||||
mdfr: z.string().nullish().default(null),
|
||||
});
|
||||
|
||||
const rswtBuildingSchema = baseReuseBuildingSchema.extend({
|
||||
const rswtBuildingSchema = baseReuseBuildingSchema.extend({
|
||||
rswtrObj: rswtrObjSchema,
|
||||
})
|
||||
|
||||
@@ -57,7 +57,7 @@ export type rswtFacState = {
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
rswtRes: customRswtBdst[];
|
||||
rswtResCount:number;
|
||||
rswtResCount: number;
|
||||
};
|
||||
};
|
||||
type rswtFacSActions = {
|
||||
@@ -79,12 +79,12 @@ export const rswtFacStateExport: rswtFacState = {
|
||||
isInit: false,
|
||||
upHeadList: upHeadList,
|
||||
rswtRes: rswtRes,
|
||||
rswtResCount:1,
|
||||
rswtResCount: 1,
|
||||
},
|
||||
};
|
||||
|
||||
const initFetch = async (code: string | number) => {
|
||||
const rswtRes = await getFetchWithCount("wr", `/reuseFc/waterreuseFc/1/10/${code}`);
|
||||
const rswtRes = await getFetchWithCount("wr", `/reuseFc/waterreuseFc/1/11/${code}`);
|
||||
return rswtRes;
|
||||
};
|
||||
export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
@@ -99,7 +99,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
try {
|
||||
const rswtRes = await getFetchWithCount(
|
||||
"wr",
|
||||
`/reuseFc/waterreuseFc/${pageNation}/10/${code}` +
|
||||
`/reuseFc/waterreuseFc/${pageNation}/11/${code}` +
|
||||
(txt ? `/${txt}` : "")
|
||||
);
|
||||
set((state: rswtFacState) => {
|
||||
@@ -108,7 +108,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
rswt: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes.data,
|
||||
rswtResCount:rswtRes.count,
|
||||
rswtResCount: rswtRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
@@ -121,7 +121,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
try {
|
||||
const rswtRes = await getFetchWithCount(
|
||||
"wr",
|
||||
`/reuseFc/waterreuseFc/${pageNation}/10/${code}`
|
||||
`/reuseFc/waterreuseFc/${pageNation}/11/${code}`
|
||||
);
|
||||
console.log(pageNation);
|
||||
// 여기서 상태 업데이트
|
||||
@@ -130,7 +130,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
rswt: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes.data,
|
||||
rswtResCount:rswtRes.count,
|
||||
rswtResCount: rswtRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -146,7 +146,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
rswt: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes.data,
|
||||
rswtResCount:rswtRes.count,
|
||||
rswtResCount: rswtRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
@@ -158,21 +158,41 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
try {
|
||||
const chData = await makeMdfr(data);
|
||||
const res = await putFectch("/reuseFc/waterreuseFc", chData);
|
||||
if (res.status ===200) {
|
||||
if (res.status === 200) {
|
||||
if (data.chgBuilding.length > 0) {
|
||||
const chPK = data?.bdstInfoSn;
|
||||
const makeCh = data.chgBuilding.map((item: chgBuilding) =>
|
||||
({
|
||||
...item,
|
||||
bdstInfoSn: chPK,
|
||||
})
|
||||
);
|
||||
const chch = await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
|
||||
if (chch.status === 200) {
|
||||
toast.success("중수도 건축물 수정이 완료되었습니다.");
|
||||
} else {
|
||||
toast.error("중수도 건축물 증축/개축/중축 오류입니다.");
|
||||
}
|
||||
} else {
|
||||
toast.success("중수도 건축물 수정이 완료되었습니다.");
|
||||
}
|
||||
} else {
|
||||
toast.error("중수도 건축물 수정이 완료되었습니다.");
|
||||
}
|
||||
const rswtRes = await initFetch(code);
|
||||
set((state: rswtFacState) => ({
|
||||
...state,
|
||||
rswt: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes.data,
|
||||
rswtResCount:rswtRes.count,
|
||||
rswtResCount: rswtRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
} catch (errorUpdate) {
|
||||
toast.error("중수도 건축물 수정 오류입니다. ");
|
||||
toast.error("중수도 건축물 수정 오류입니다.");
|
||||
console.error(errorUpdate);
|
||||
} finally {
|
||||
}
|
||||
@@ -181,29 +201,29 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
try {
|
||||
const chData = await makeRstr(data);
|
||||
const res = await postFectch("/reuseFc/waterreuseFc", chData);
|
||||
if (res.status===200) {
|
||||
if(data.chgBuilding.length>0 ){
|
||||
if (res.status === 200) {
|
||||
if (data.chgBuilding.length > 0) {
|
||||
|
||||
const chPK = res?.data?.bdstInfoSn
|
||||
const makeCh= res.data.chgBuilding.map((item: chgBuilding) =>
|
||||
( {
|
||||
const makeCh = res.data.chgBuilding.map((item: chgBuilding) =>
|
||||
({
|
||||
...item,
|
||||
bdstInfoSn: chPK,
|
||||
})
|
||||
);
|
||||
const chch= await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
const chch = await postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
|
||||
if(chch.status ===200) {
|
||||
if (chch.status === 200) {
|
||||
|
||||
console.log('chch.status' , chch.status)
|
||||
console.log('chch.status', chch.status)
|
||||
toast.success("건축물(중수도) 및 증축/개축/중축 등록이 완료되었습니다.");
|
||||
}else{
|
||||
} else {
|
||||
toast.error("건축물(중수도 증축/개축/중축 오류입니다.");
|
||||
}
|
||||
} else {
|
||||
toast.success("건축물(중수도 등록이 완료되었습니다.");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
toast.error("건축물(중수도) 등록이 완료하였습니다.");
|
||||
}
|
||||
const rswtRes = await initFetch(code);
|
||||
@@ -212,7 +232,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
rain: {
|
||||
...state.rswt,
|
||||
rswtRes: rswtRes.data,
|
||||
rswtResCount:rswtRes.count,
|
||||
rswtResCount: rswtRes.count,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -104,7 +104,7 @@ export default function HtdflRegForm({
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]")
|
||||
} else {
|
||||
setDivStyle("h-[53vh]")
|
||||
setDivStyle("h-[57vh]")
|
||||
}
|
||||
}, [isModal, readonly]);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export default function RainRegForm({
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]")
|
||||
} else {
|
||||
setDivStyle("h-[53vh]")
|
||||
setDivStyle("h-[57vh]")
|
||||
}
|
||||
}, [isModal, readonly]);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ export default function RswtrRegForm({
|
||||
} else if (readonly === true) {
|
||||
setDivStyle("h-[62vh]")
|
||||
} else {
|
||||
setDivStyle("h-[53vh]")
|
||||
setDivStyle("h-[57vh]")
|
||||
}
|
||||
}, [isModal, readonly]);
|
||||
// const defaultValues: z.infer<typeof rswtZod> = rswtZod.parse({});
|
||||
|
||||
Reference in New Issue
Block a user