지도점검 퍼블리싱 완료
This commit is contained in:
@@ -107,7 +107,7 @@ export default function Home() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<ContentsDiv >
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"빗물이용시설 등록"} />
|
||||
@@ -145,7 +145,8 @@ export default function Home() {
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-4 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
<ScrollArea className="h-full">
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rain.upHeadList}
|
||||
pageSize={100}
|
||||
@@ -156,14 +157,15 @@ export default function Home() {
|
||||
}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</UiTable>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<RainRegForm
|
||||
rainForm={rainForm || undefined}
|
||||
rainForm={rainForm ?? {} as customRainBdst}
|
||||
isModal={false}
|
||||
></RainRegForm>
|
||||
</ScrollArea>
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { chHeadNm, fcltDiv, type chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import {
|
||||
fcltDiv,
|
||||
type chHeadType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchDiv,
|
||||
@@ -10,20 +13,24 @@ import {
|
||||
SearchInput,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { useState } from "react";
|
||||
import { headMakeColSpan } from "../../fcltReg/rainReg/page";
|
||||
import { TableRow, TableHead } from "@common/components";
|
||||
import React from "react";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import RainChkgdTable from "@/components/ui/table/rainChkgd/rainChkgdTable";
|
||||
import RswtChkgdTable from "@/components/ui/table/rswtChkgd/rswtChkgdTable";
|
||||
import ChkgdModal from "@/components/ui/modal/chkgdModal/chkgdModal";
|
||||
import ChkgdExcel from "@/components/ui/modal/chkgdExcel/chkgdExcel";
|
||||
|
||||
|
||||
export const headMakeprfmnc = (upHeadList: TableUpperProps[] ,makeHeadNm:chHeadType[] ) => {
|
||||
export const headMakeprfmnc = (
|
||||
upHeadList: TableUpperProps[],
|
||||
makeHeadNm: chHeadType[]
|
||||
) => {
|
||||
return (
|
||||
<>
|
||||
<TableRow>
|
||||
@@ -32,16 +39,22 @@ export const headMakeprfmnc = (upHeadList: TableUpperProps[] ,makeHeadNm:chHeadT
|
||||
<TableHead rowSpan={2} key={head.id}>
|
||||
{head.title}
|
||||
</TableHead>
|
||||
) : head.upSequnce === 1 ? (
|
||||
<TableHead key={head.id} rowSpan={1} colSpan={makeHeadNm.find((ch)=> ch.headNm ===head.upName)?.length}>
|
||||
{makeHeadNm.find((ch)=> ch.headNm ===head.upName)?.text}
|
||||
) : head.upSequnce === 1 ? (
|
||||
<TableHead
|
||||
key={head.id}
|
||||
rowSpan={1}
|
||||
colSpan={
|
||||
makeHeadNm.find((ch) => ch.headNm === head.upName)?.length
|
||||
}
|
||||
>
|
||||
{makeHeadNm.find((ch) => ch.headNm === head.upName)?.text}
|
||||
</TableHead>
|
||||
) : null
|
||||
)}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
makeHeadNm.find((ch)=> ch.headNm ===head.upName) ? (
|
||||
makeHeadNm.find((ch) => ch.headNm === head.upName) ? (
|
||||
<TableHead key={head.id}>{head.title}</TableHead>
|
||||
) : null
|
||||
)}
|
||||
@@ -51,11 +64,20 @@ export const headMakeprfmnc = (upHeadList: TableUpperProps[] ,makeHeadNm:chHeadT
|
||||
};
|
||||
//-----------------------
|
||||
export default function Page() {
|
||||
|
||||
|
||||
|
||||
const [isDetail, setIsDetail] = useState(false);
|
||||
const [isExcel, setIsExcel] = useState(false);
|
||||
|
||||
|
||||
|
||||
const [testObj, setTestObj] = useState({});
|
||||
|
||||
const [selFcltDiv, setSelFcltDiv] = useState("RST");
|
||||
|
||||
|
||||
const cellClick = () => {
|
||||
const ch = { bdstNm: "test", chckYmd: "2022-10-10" };
|
||||
setTestObj(ch);
|
||||
};
|
||||
|
||||
return (
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
@@ -70,28 +92,37 @@ export default function Page() {
|
||||
setText={(e) => {}}
|
||||
/>
|
||||
<SelectBox
|
||||
className={ "col-span-3 w-full h-full text-2xl"}
|
||||
className={"col-span-3 w-full h-full text-2xl"}
|
||||
label={"시설구분"}
|
||||
selectClass={""}
|
||||
selectArray={fcltDiv}
|
||||
onSelectValue={setSelFcltDiv}
|
||||
value={selFcltDiv??fcltDiv[0]?.val}
|
||||
value={selFcltDiv ?? fcltDiv[0]?.val}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg" onClick={(e) => {}}>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={(e) => {
|
||||
cellClick()
|
||||
setIsDetail(!isDetail);
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
삭제
|
||||
</Button>
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
저장
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
결과등록
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
<Button className="mr-4 rounded-lg"
|
||||
onClick={() => {
|
||||
setIsExcel(!isDetail);
|
||||
}}>
|
||||
양식받기
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
@@ -101,14 +132,23 @@ export default function Page() {
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-6">
|
||||
<ListDiv>
|
||||
{selFcltDiv === "RNB" ? (
|
||||
<RainChkgdTable />
|
||||
) : (
|
||||
<RswtChkgdTable />
|
||||
)}
|
||||
{selFcltDiv === "RNB" ? <RainChkgdTable /> : <RswtChkgdTable />}
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<UiModal
|
||||
open={isDetail}
|
||||
onOpenChange={setIsDetail}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<ChkgdModal type={selFcltDiv} obj={testObj}></ChkgdModal>}
|
||||
/>
|
||||
|
||||
<UiModal open={isExcel}
|
||||
onOpenChange={setIsExcel}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,20 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { text } from "stream/consumers";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const rainRegExcel =z.object({
|
||||
bdstInfoPk:z.number().default(111111111),
|
||||
chckYmd:z.date().default(new Date()),
|
||||
file: z.instanceof(File).optional()
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
export const fcltDiv=[
|
||||
{val:'RST', text:'중수도시설'},
|
||||
{val:'RNB', text:'빗물이용시설'},
|
||||
@@ -18,6 +30,8 @@ export type chHeadType={
|
||||
export const rainHeadNm:chHeadType[] = [
|
||||
{headNm:"useQuilty", text:"이용수질(필요시)" , length: 4},
|
||||
{headNm:"feeHist", text:"과태료 부과내역" , length: 3},
|
||||
{headNm:"subWater", text:"연간보급수 이용량(m³)" , length: 13},
|
||||
{headNm:"detailQulity", text:"분기" , length: 11}
|
||||
]
|
||||
|
||||
export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
@@ -42,6 +56,93 @@ export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
{ id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
];
|
||||
|
||||
export const supWaterHeadList:TableUpperProps[] = [
|
||||
{ id: "utztnUsgTest", title: "이용용도" },
|
||||
{ id: "total", title: "계" ,upName: "subWater", upSequnce: 1 , edit:true},
|
||||
{ id: "sub1", title: "1월" , upName: "subWater", upSequnce: 2 , edit:true},
|
||||
{ id: "sub2", title: "2월", upName: "subWater", upSequnce: 3 , edit:true},
|
||||
{ id: "sub3", title: "3월", upName: "subWater", upSequnce: 4 , edit:true},
|
||||
{ id: "sub4", title: "4월", upName: "subWater", upSequnce: 5 , edit:true},
|
||||
{ id: "sub5", title: "5월", upName: "subWater", upSequnce: 6 , edit:true},
|
||||
{ id: "sub6", title: "6월", upName: "subWater", upSequnce: 7 , edit:true},
|
||||
{ id: "sub7", title: "7월", upName: "subWater", upSequnce: 8 , edit:true},
|
||||
{ id: "sub8", title: "8월", upName: "subWater", upSequnce: 9 , edit:true},
|
||||
{ id: "sub9", title: "9월", upName: "subWater", upSequnce: 10, edit:true },
|
||||
{ id: "sub10", title: "10월", upName: "subWater", upSequnce: 11 , edit:true},
|
||||
{ id: "sub11", title: "11월", upName: "subWater", upSequnce: 12 , edit:true},
|
||||
{ id: "sub12", title: "12월", upName: "subWater", upSequnce: 13 , edit:true},
|
||||
]
|
||||
|
||||
|
||||
export const rswtDetailHeadList:TableUpperProps[] = [
|
||||
{ id: "utztnUsgTest", title: "이용용도" },
|
||||
{ id: "avre", title: "평균" ,upName: "detailQulity", upSequnce: 1 , edit:true},
|
||||
{ id: "grssClfg", title: "총대장균군수" , upName: "detailQulity", upSequnce: 2 , edit:true},
|
||||
{ id: "combResdch", title: "결합잔류염소", upName: "detailQulity", upSequnce: 3 , edit:true},
|
||||
{ id: "trbt", title: "탁도", upName: "detailQulity", upSequnce: 4 , edit:true},
|
||||
{ id: "bod", title: "BOD", upName: "detailQulity", upSequnce: 5 , edit:true},
|
||||
{ id: "smll", title: "냄새", upName: "detailQulity", upSequnce: 6 , edit:true},
|
||||
{ id: "crmty", title: "색도", upName: "detailQulity", upSequnce: 7 , edit:true},
|
||||
{ id: "tn", title: "T-N", upName: "detailQulity", upSequnce: 8 , edit:true},
|
||||
{ id: "tph", title: "T-P", upName: "detailQulity", upSequnce: 9 , edit:true},
|
||||
{ id: "ph", title: "PH", upName: "detailQulity", upSequnce: 10, edit:true },
|
||||
{ id: "clIonQnt", title: "염화물", upName: "detailQulity", upSequnce: 11 , edit:true},
|
||||
]
|
||||
|
||||
|
||||
export const supWaterData =[{
|
||||
utztnUsgTest:'test',
|
||||
total:100,
|
||||
sub1:10,
|
||||
sub2:10,
|
||||
sub3:10,
|
||||
sub4:10,
|
||||
sub5:10,
|
||||
sub6:10,
|
||||
sub7:10,
|
||||
sub8:10,
|
||||
sub9:10,
|
||||
sub10:10,
|
||||
sub11:10,
|
||||
sub12:10,
|
||||
},
|
||||
{
|
||||
utztnUsgTest:'test22',
|
||||
total:10011,
|
||||
sub1:101,
|
||||
sub2:101,
|
||||
sub3:101,
|
||||
sub4:101,
|
||||
sub5:101,
|
||||
sub6:101,
|
||||
sub7:101,
|
||||
sub8:101,
|
||||
sub9:101,
|
||||
sub10:101,
|
||||
sub11:101,
|
||||
sub12:101,
|
||||
}
|
||||
]
|
||||
|
||||
type supWaterDataType ={
|
||||
utztnUsgTest:string,
|
||||
total:number,
|
||||
sub1:number,
|
||||
sub2:number,
|
||||
sub3:number,
|
||||
sub4:number,
|
||||
sub5:number,
|
||||
sub6:number,
|
||||
sub7:number,
|
||||
sub8:number,
|
||||
sub9:number,
|
||||
sub10:number,
|
||||
sub11:number,
|
||||
sub12:number,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
// { id: "cityText", title: "시도" },
|
||||
@@ -53,18 +154,18 @@ export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
// { id: "rainDtnbaOpct", title: "빗물저류조용량(m³)" },
|
||||
// { id: "checkDay", title: "점검일" },
|
||||
// { id: "utztnUsg", title: "이용용도" },
|
||||
// { id: "sub1", title: "1월" , upName: "yearSubWater", upSequnce: 1 },
|
||||
// { id: "sub2", title: "2월", upName: "yearSubWater", upSequnce: 2 },
|
||||
// { id: "sub3", title: "3월", upName: "yearSubWater", upSequnce: 3 },
|
||||
// { id: "sub4", title: "4월", upName: "yearSubWater", upSequnce: 4 },
|
||||
// { id: "sub5", title: "5월", upName: "yearSubWater", upSequnce: 5 },
|
||||
// { id: "sub6", title: "6월", upName: "yearSubWater", upSequnce: 6 },
|
||||
// { id: "sub7", title: "7월", upName: "yearSubWater", upSequnce: 7 },
|
||||
// { id: "sub8", title: "8월", upName: "yearSubWater", upSequnce: 8 },
|
||||
// { id: "sub9", title: "9월", upName: "yearSubWater", upSequnce: 9 },
|
||||
// { id: "sub10", title: "10월", upName: "yearSubWater", upSequnce: 10 },
|
||||
// { id: "sub11", title: "11월", upName: "yearSubWater", upSequnce: 11 },
|
||||
// { id: "sub12", title: "12월", upName: "yearSubWater", upSequnce: 12 },
|
||||
// { id: "sub1", title: "1월" , upName: "subWater", upSequnce: 1 },
|
||||
// { id: "sub2", title: "2월", upName: "subWater", upSequnce: 2 },
|
||||
// { id: "sub3", title: "3월", upName: "subWater", upSequnce: 3 },
|
||||
// { id: "sub4", title: "4월", upName: "subWater", upSequnce: 4 },
|
||||
// { id: "sub5", title: "5월", upName: "subWater", upSequnce: 5 },
|
||||
// { id: "sub6", title: "6월", upName: "subWater", upSequnce: 6 },
|
||||
// { id: "sub7", title: "7월", upName: "subWater", upSequnce: 7 },
|
||||
// { id: "sub8", title: "8월", upName: "subWater", upSequnce: 8 },
|
||||
// { id: "sub9", title: "9월", upName: "subWater", upSequnce: 9 },
|
||||
// { id: "sub10", title: "10월", upName: "subWater", upSequnce: 10 },
|
||||
// { id: "sub11", title: "11월", upName: "subWater", upSequnce: 11 },
|
||||
// { id: "sub12", title: "12월", upName: "subWater", upSequnce: 12 },
|
||||
|
||||
// { id: "rain1", title: "1월", upName: "yearRainWater", upSequnce: 1 },
|
||||
// { id: "rain2", title: "2월", upName: "yearRainWater", upSequnce: 2 },
|
||||
@@ -94,6 +195,9 @@ export type rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList:TableUpperProps[]
|
||||
rainHeadNm:chHeadType[]
|
||||
supWaterHeadList:TableUpperProps[]
|
||||
supWaterData:supWaterDataType[]
|
||||
rswtDetailHeadList:TableUpperProps[]
|
||||
};
|
||||
};
|
||||
|
||||
@@ -108,7 +212,10 @@ export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
|
||||
export const rainChkgdnStateExport: rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList:rainChkgdnHeadList,
|
||||
rainHeadNm:rainHeadNm
|
||||
rainHeadNm:rainHeadNm,
|
||||
supWaterHeadList:supWaterHeadList,
|
||||
supWaterData:supWaterData,
|
||||
rswtDetailHeadList:rswtDetailHeadList,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { upHeadList, type bdstAll, type TableUpperProps } from "../rainReg";
|
||||
import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -7,8 +7,8 @@ export const hdtflZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
daddr: z.string().default(" "),
|
||||
bdstNm: z.string().default(" "),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
archChgPrmsnDt: z.date().default(() => new Date()).nullish() ,
|
||||
archArea: z.number().default(0),
|
||||
@@ -48,7 +48,8 @@ export const hdtflZod = z.object({
|
||||
plwtYn: z.string().default(""),
|
||||
orgwtWtritSpt: z.number().default(0),
|
||||
orgwtOcrnProcs: z.string().default(""),
|
||||
wtritEntrcTp: z.number().default(0),
|
||||
wtritEntrcTp: z.number().max(4, "온도는 100이상이 될 수 없습니다.")
|
||||
.default(0),
|
||||
amtgnr: z.number().default(0),
|
||||
prcsProcsYn: z.string().default(""),
|
||||
prcsFcltCpct: z.number().default(0),
|
||||
@@ -77,7 +78,7 @@ export const hdtflZod = z.object({
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date() ,
|
||||
archChgArea: z.number().default(0),
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
)
|
||||
@@ -228,7 +229,30 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
try {
|
||||
const res = await postFectch("/drain/facility", data);
|
||||
if (res.ok) {
|
||||
alert(" 등록이 완료되었습니다.");
|
||||
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res
|
||||
.json()
|
||||
.then((resData: any) => {
|
||||
const chPK = resData?.data?.bdstInfoPk;
|
||||
const makeCh = resData.data.chgBuilding.map(
|
||||
(item: chgBuilding) => ({
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch = postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
})
|
||||
.then((chch: any) => {
|
||||
if (chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
const htdflRes = await initFetch(undefined);
|
||||
set((state: htdflFacState) => ({
|
||||
|
||||
@@ -58,7 +58,7 @@ export const rainZod = z.object({
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date(),
|
||||
archChgArea: z.number().default(0),
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
).default([])
|
||||
@@ -69,7 +69,7 @@ export const rainZod = z.object({
|
||||
export type chgBuilding={
|
||||
bdstInfoFk: number|null,
|
||||
archChgPrmsnDt: Date,
|
||||
archChgArea: number,
|
||||
archChgArea: string,
|
||||
bdstChgNm: string
|
||||
}
|
||||
|
||||
@@ -127,8 +127,10 @@ export type TableUpperProps = {
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
edit?:boolean;
|
||||
};
|
||||
|
||||
|
||||
export const upHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
@@ -188,7 +190,7 @@ const rainRes: customRainBdst[] = [];
|
||||
chgBuilding:[{
|
||||
bdstInfoFk: 0,
|
||||
archChgPrmsnDt: new Date(),
|
||||
archChgArea: 0,
|
||||
archChgArea: "-",
|
||||
bdstChgNm: ""
|
||||
|
||||
}]
|
||||
@@ -291,9 +293,28 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/rainyInfo", data);
|
||||
if(res.ok){
|
||||
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res.json().then((resData: any) => {
|
||||
|
||||
|
||||
// alert(" 등록이 완료되었습니다.")
|
||||
const chPK = resData?.data?.bdstInfoPk
|
||||
const makeCh= resData.data.chgBuilding.map((item: chgBuilding) =>
|
||||
( {
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch= postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
}).then((chch: any) => {
|
||||
if(chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
})
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rainFacState) => ({
|
||||
|
||||
@@ -56,9 +56,18 @@ export const rswtZod = z.object({
|
||||
altUswtrIdntyMthdCd: z.string().default("")
|
||||
}).default({})
|
||||
})
|
||||
).default([])
|
||||
|
||||
).default([]),
|
||||
|
||||
chgBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date() ,
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
|
||||
});
|
||||
|
||||
@@ -161,10 +170,9 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
rswtUpdate: async (data: customRswtBdst) => {
|
||||
try {
|
||||
const res = await putFectch("/reuseFc/waterreuseFc", data);
|
||||
if(res.ok){
|
||||
alert(" 수정이 완료되었습니다.")
|
||||
if (res.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
|
||||
const rswtRes = await initFetch(undefined);
|
||||
set((state: rswtFacState) => ({
|
||||
...state,
|
||||
@@ -183,7 +191,29 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/waterreuseFc", data);
|
||||
if(res.ok){
|
||||
alert(" 등록이 완료되었습니다.")
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res
|
||||
.json()
|
||||
.then((resData: any) => {
|
||||
const chPK = resData?.data?.bdstInfoPk;
|
||||
const makeCh = resData.data.chgBuilding.map(
|
||||
(item: chgBuilding) => ({
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch = postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
})
|
||||
.then((chch: any) => {
|
||||
if (chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rswtFacState) => ({
|
||||
|
||||
@@ -59,7 +59,6 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
}, [selectSgg])
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form", form.getValues());
|
||||
const subscription = form.form?.watch((value: any) => {
|
||||
console.log('vale', value)
|
||||
});
|
||||
@@ -308,10 +307,10 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
<FormUi label="면적">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
placeholder="-"
|
||||
type="text"
|
||||
value={ field.value??0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
value={ field.value??"-"}
|
||||
onChange={(e) => field.onChange((e.target.value))}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
|
||||
@@ -147,7 +147,7 @@ export function RainRegForm({
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? 0}
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(e.target.value === "" ? "" : Number(e.target.value));
|
||||
}}
|
||||
@@ -299,11 +299,11 @@ export function RainRegForm({
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
field.onChange(value === "" ? "" : Number(value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
import { rainRegExcel } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
DatePicker,
|
||||
FileUpload,
|
||||
Form,
|
||||
FormField,
|
||||
FormUi,
|
||||
Title,
|
||||
} from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdExcel({ type }: { type: string }) {
|
||||
const [files, setFiles] = useState(null);
|
||||
|
||||
const [dmdDate, setDmdDate] = useState(new Date());
|
||||
|
||||
const defaultValues: z.infer<typeof rainRegExcel> = rainRegExcel.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof rainRegExcel>>({
|
||||
resolver: zodResolver(rainRegExcel),
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
const onChangeDate = (val: Date | undefined) => {
|
||||
if (val) setDmdDate(val);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<Form {...form}>
|
||||
<div>
|
||||
<Title
|
||||
title={
|
||||
type === "RNB"
|
||||
? "빗물 이용시설"
|
||||
: "중수도 이용시설" + "점검 결과등록"
|
||||
}
|
||||
></Title>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<h3 className="text-2xl font-bold text-gray-900">
|
||||
{"○점검정보 입력"}
|
||||
</h3>
|
||||
|
||||
<Button className="">저장</Button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="chckYmd"
|
||||
render={({ field }) => (
|
||||
<FormUi label="점검일자">
|
||||
<DatePicker
|
||||
mode="single"
|
||||
field={{
|
||||
value:
|
||||
field.value && !isNaN(new Date(field.value).getTime())
|
||||
? new Date(field.value)
|
||||
: new Date(), // Provide a default Date value
|
||||
onChange: (date) => field.onChange(date),
|
||||
}}
|
||||
selectClass={selectClass}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="file"
|
||||
render={({ field }) => (
|
||||
<FormUi label="점검결과 파일">
|
||||
<FileUpload
|
||||
files={field.value}
|
||||
setFiles={setFiles}
|
||||
fileTypes="excel"
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,11 +1,149 @@
|
||||
export default function ChkgdModal(){
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { ScrollArea, Title, UiTable } from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function ChkgdModal({type, obj}:{type:string , obj:any} ){
|
||||
|
||||
|
||||
const { rainChkgdn} = useWrStore((state) => state);
|
||||
|
||||
|
||||
|
||||
const nodeList = headMakeprfmnc(rainChkgdn?.supWaterHeadList,rainChkgdn?.rainHeadNm ) ;
|
||||
const rswtnodeList = headMakeprfmnc(rainChkgdn?.rswtDetailHeadList,rainChkgdn?.rainHeadNm ) ;
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
|
||||
},[rainChkgdn])
|
||||
|
||||
|
||||
const cellClick =(val:number|undefined, headId:string)=>{
|
||||
if(val!=undefined)
|
||||
console.log(rainChkgdn.supWaterData[val])
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(
|
||||
<>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<Title title= {type==='RNB'?'빗물이용시설':'중수도 이용시설' + '지도점검 결과등록' }></Title>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<h3 className="text-2xl font-bold text-gray-900">{"○"+ obj.bdstNm + `(${obj.chckYmd})`}</h3>
|
||||
|
||||
<Button className="">저장</Button>
|
||||
</div>
|
||||
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<UiTable
|
||||
headName={"연간 보급수이용량"}
|
||||
tableData={rainChkgdn.supWaterData||[]}
|
||||
headlist={rainChkgdn?.supWaterHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
|
||||
|
||||
<UiTable
|
||||
headName={"연간 빗물이용량"}
|
||||
tableData={rainChkgdn.supWaterData}
|
||||
headlist={rainChkgdn?.supWaterHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{nodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
{type !=='RNB'?
|
||||
<div>
|
||||
<UiTable
|
||||
headName={"연간이용수질(1분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
<UiTable
|
||||
headName={"연간이용수질(2분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
<UiTable
|
||||
headName={"연간이용수질(3분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
<UiTable
|
||||
headName={"연간이용수질(4분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
</div>
|
||||
:<></>}
|
||||
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</>
|
||||
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { rainHeadNm } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import { rswtHeadNm } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||
import { UiTable } from "@common/business_components/ui";
|
||||
|
||||
export default function RainChkgdTable() {
|
||||
|
||||
Reference in New Issue
Block a user