Merge branch 'iipbs/sn/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/sn/dev
iipbs_sn / build (push) Has been cancelled

This commit is contained in:
yschoi
2025-05-02 17:55:57 +09:00
31 changed files with 1153 additions and 972 deletions
+32 -26
View File
@@ -1,10 +1,10 @@
"use client"
import { FileUpload, SelectBox } from '@common/business_components/ui';
import { Button } from '@common/components/ui';
import { Button, Input } from '@common/components/ui';
import React, { useState } from 'react'
const FileUploadForm = ({title}:{title:string}) => {
const FileUploadForm = ({ title }: { title: string }) => {
const [files, setFiles] = useState<File[] | null>(null);
const [selectedYear, setSelectedYear] = useState<string>('');
@@ -20,35 +20,41 @@ const FileUploadForm = ({title}:{title:string}) => {
<h3 className="text-2xl font-medium">{title}</h3>
</div>
<div className="card p-6">
<div className="flex items-center space-x-4">
<div className="w-[400px]">
<FileUpload
files={files}
setFiles={setFiles}
fileTypes=".xlsx,.xls"
/>
</div>
<div className="grid grid-col-2 items-center space-x-4">
<div className='flex'>
<SelectBox
className="w-50 mr-3 ml-4"
selectClass="rounded-lg bg-white"
label="년도"
selectArray={yearOptions}
onSelectValue={(value: string | number) => setSelectedYear(String(value))}
/><SelectBox
className="w-50"
selectClass="w-50 rounded-lg bg-white"
label="관리년도"
selectClass="rounded-lg bg-white"
label="분기"
selectArray={yearOptions}
onSelectValue={(value: string | number) => setSelectedYear(String(value))}
/>
<Button
className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700"
size="sm"
onClick={() => {
if (!files?.[0] || !selectedYear) {
alert('파일과 등록년도를 선택해주세요.');
return;
}
// TODO: 파일 업로드 처리
console.log('Upload file:', files[0], 'Year:', selectedYear);
}}
>
등록
</Button>
</div>
<div className='flex mt-5 items-center'>
<div className="w-[200px] mr-4">
<Input id="file" type="file" />
</div>
<Button
className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700"
size="sm"
onClick={() => {
if (!files?.[0] || !selectedYear) {
alert('파일과 등록년도를 선택해주세요.');
return;
}
// TODO: 파일 업로드 처리
console.log('Upload file:', files[0], 'Year:', selectedYear);
}}
>
등록
</Button>
</div>
</div>
</div>
</div>
+1 -1
View File
@@ -10,7 +10,7 @@ interface FormSectionProps {
const FormSection = ({ children, titleNm, form, name }: FormSectionProps) => {
return (
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="grid grid-cols-[130px_1fr] items-center">
<div className="text-xl font-medium">{titleNm}</div>
<FormField
control={form.control}
+128
View File
@@ -0,0 +1,128 @@
import UiPageNations from "@common/business_components/ui/table/uiPageNations";
import { Table, TableBody, TableCell, TableRow } from "@common/components";
import { useEffect, useState } from "react";
type UiTableProps = {
headName: React.ReactNode | undefined;
tableData: { [key: string]: string | number | boolean | object }[];
headlist: UiHeadProps[];
pageSize: number;
total: number;
children: React.ReactNode | undefined;
cellClick: ((index: number | undefined, headId: string) => void) | undefined;
onPageChange: (page: number) => void;
className?: string;
resetPageNo?: boolean;
isEditable?: boolean;
};
type UiHeadProps = {
id: string;
title: string;
align?: string;
type?: string;
options?: string[];
};
export function VerticalTable({
tableData,
headlist,
pageSize,
total,
children,
headName,
cellClick,
onPageChange,
className = "",
resetPageNo = false,
isEditable = false,
}: UiTableProps) {
const [cur, setCur] = useState<number>(1);
const [formData, setFormData] = useState<{ [key: string]: string | number | boolean }>({});
useEffect(() => {
if (resetPageNo) {
setCur(1);
onPageChange(1);
}
}, [onPageChange, resetPageNo]);
useEffect(() => {
console.log('data',tableData)
if (tableData.length > 0 && tableData[0]) {
setFormData(tableData[0] as { [key: string]: string | number | boolean });
}
}, [tableData]);
const handleInputChange = (id: string, value: string | number | boolean) => {
setFormData((prev) => ({
...prev,
[id]: value,
}));
};
const handlePageChange = (page: number) => {
setCur(page);
onPageChange(page);
};
return (
<>
{headName ? (
<div className="card-header">
<h3 className="text-2xl mx-3 font-medium text-label">{headName}</h3>
</div>
) : null}
<div className={`card !m-[1.2rem] !p-0r ${className}`}>
<Table variant="secondary">
<TableBody className="text-center">
{headlist?.map((head) => (
<TableRow key={head.id}>
{/* 컬럼 제목 */}
<TableCell className="font-bold bg-blue-100 text-xs">
{head.title}
</TableCell>
{/* 데이터 값 또는 입력 필드 */}
<TableCell className="text-xs">
{isEditable ? (
head.type === "select" ? (
<select
value={formData[head.id] ?? "-"}
onChange={(e) => handleInputChange(head.id, e.target.value)}
className="w-full border border-gray-300 rounded-sm px-2 py-1 text-xl border-radius-0"
>
{head.options?.map((option) => (
<option key={option} value={option}>
{option}
</option>
))}
</select>
) : head.type === "input" ? (
<input
type="text"
value={formData[head.id] ?? ""}
onChange={(e) => handleInputChange(head.id, e.target.value)}
className="w-full text-xl border-radius-0 border border-gray-300 rounded-sm px-2 py-1"
/>
) : (
<span>{formData[head.id] ?? "-"}</span>
)
) : (
<span>{formData[head.id] ?? "-"}</span>
)}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
{total > 0 && (
<UiPageNations
total={total}
cur={cur}
pageSize={pageSize}
onPageChange={handlePageChange}
/>
)}
</div>
</>
);
}
+29 -39
View File
@@ -7,21 +7,26 @@ import React, { type ReactNode } from 'react'
type TitleName = {
mainTitle: string
firstCardTitle: string
secondCardTitle: string
secondCardTitle?: string
}
type TableInfoData = {
headList: { id: string; title: string; align?: string; }[]
tableData: { [key: string]: string | number | boolean | object }[];
cellClickFunc: Function
onPageChangeFunc: Function
type SelectBox = {
labelNm?:Label
searchChk?:boolean
}
type Label= {
first: string
second: string
third:string
fourth:string
}
type BaseLayout = {
children: ReactNode
children?: ReactNode[]
titleName: TitleName
form: any
onSubmitEvent: Function
graphBtn: boolean
tableInfoData: TableInfoData
graphBtn?: boolean
firstDivBtn?:boolean
searchBox?:SelectBox
}
// TODO: 나중에 이벤트 추가되면 파라미터 추가 필요 ?
/**
@@ -31,59 +36,44 @@ type BaseLayout = {
* @param form : zod 스키마
* @param onSubmitEvent : 폼 이벤트 처리
* @param graphBtn : 하단에 그래프 버튼 유무 처리
* @param tableInfoData : 하단 테이블 관련 props 항목
* @returns
*/
const BaseLayout = ({ children, titleName, form, onSubmitEvent, graphBtn, tableInfoData }: BaseLayout) => {
const BaseLayout = ({ children,titleName, form, onSubmitEvent, graphBtn=false, searchBox }: BaseLayout) => {
return (
<ContentLayout title={titleName.mainTitle}>
<SearchDiv>
<SearchFormLeft>
<SelectBox className="col-span-3" label='시설검색' selectArray={[{ text: '한강 유역청', val: '1' }]} onSelectValue={(val) => { }} selectClass={undefined} />
<SelectBox label='' selectArray={[{ text: '경기도', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
<SelectBox label='' selectArray={[{ text: '양평군', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
<SelectBox label='' selectArray={[{ text: '양평하수처리장', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
<SelectBox className="col-span-2" label={searchBox?.labelNm?.first ?? ''} selectArray={[{ text: '한강 유역청', val: '1' }]} onSelectValue={(val) => { }} selectClass={undefined} />
<SelectBox label={searchBox?.labelNm?.second ?? ''} selectArray={[{ text: '경기도', val: '1' }]} className="col-span-2" onSelectValue={() => { }} selectClass='' />
<SelectBox label={searchBox?.labelNm?.third ?? ''} selectArray={[{ text: '양평군', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
<SelectBox label={searchBox?.labelNm?.fourth ?? ''} selectArray={[{ text: '양평하수처리장', val: '1' }]} className="col-span-3" onSelectValue={() => { }} selectClass='' />
</SearchFormLeft>
<SearchFormRight>
<Button>조회</Button>
</SearchFormRight>
{searchBox?.searchChk ? <SearchFormRight><Button>조회</Button></SearchFormRight> : null}
</SearchDiv>
<ListDiv>
<div className="card-header">
<h3 className="text-2xl font-medium">{titleName.firstCardTitle}</h3>
<div>
{graphBtn ? <Button className="!mr-[1.2rem]">다운로드</Button> : null}
{/* 그래프 있을 시 */}
{graphBtn ? <Button className="!mr-[1.2rem]">삭제</Button> : null}
</div>
</div>
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmitEvent)}>
<div className="card !m-[1.2rem]">
{/* 폼 정보 입력 칸 */}
{children}
<div className="flex justify-end mt-1">
<Button type="submit">자료업로드</Button>
</div>
{children?.[0]}
</div>
</form>
</Form>
</ListDiv>
<ListDiv>
{children?.[1] != null ? <ListDiv>
<div className="card-header flex items-center justify-between">
<h3 className="text-2xl font-medium">{titleName.secondCardTitle}</h3>
<div>
<Button className="!mr-[1.2rem]">삭제</Button>
{/* 그래프 있을 시 */}
{graphBtn ? <Button className="!mr-[1.2rem]">그래프</Button> : null}
</div>
</div>
<UiTable
headName=''
headlist={tableInfoData.headList}
tableData={tableInfoData.tableData}
total={0}
pageSize={10}
children={undefined}
cellClick={(e) => { tableInfoData.cellClickFunc(e) }}
onPageChange={(e) => { tableInfoData.onPageChangeFunc(e) }}
/>
</ListDiv>
<div className="card !m-[1.2rem]">{children?.[1]}</div>
</ListDiv> : null}
</ContentLayout>
)
}
-101
View File
@@ -1,101 +0,0 @@
"use client"
import { z } from "zod"
import { useForm, useFieldArray } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { FormField, SelectBox } from "@common/business_components/ui"
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, DatePicker } from "@common/components/ui"
import React, { useState } from "react"
import BaseLayout from "@/ii/BaseLayout"
// zod 스키마 정의
const formSchema = z.object({
region: z.string(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
})
const region:{text:string,val:number}[] = [{text:'양평', val:1},{text:'강남',val:2},{text:'test',val:3}]
export default function RTKForm() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
inputdate: new Date(),
rtkSource: "",
}
})
const [selectedDate, setSelectedDate] = useState(new Date())
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'no', title: '번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'guyeok', title: '처리구역' },
{ id: 'fileNm', title: '파일명' },
{ id: 'time', title: '입력시간' }
]
const rtxNmDataList = [
{ "no": '1', 'hasu': '하수처리장', 'guyeok': '처리구역', 'fileNm': '파일', 'time': '2025-04-18' }
]
const handlePageChange = (page: number) => {
console.log('Page changed:', page)
}
return (
<BaseLayout titleName={{mainTitle: "관망도 등록",firstCardTitle: "SWMM5 파일 업로드",secondCardTitle: "SWMM 파일 업로드현황"}} form={form} onSubmitEvent={()=>{}} graphBtn={false} tableInfoData={{headList: rtxNmHeadlist, tableData: rtxNmDataList, cellClickFunc: ()=>{}, onPageChangeFunc: ()=>{}}} >
{/* 기본 정보 입력 폼 */}
<div className="space-y-[1.2rem]">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 처리구역</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<SelectBox label='' selectArray={region} onSelectValue={()=>{}} selectClass="" className="w-[150px]"/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 입력일</div>
<FormField
control={form.control}
name="inputdate"
render={({ field }) => (
<DatePicker
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }}
mode={"single"}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 파일위치</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file"/>
</div>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 비고</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<Input
className="h-17 text-center text-xl w-[200px]"
placeholder=""
{...field}
/>
)}
/>
</div>
</div>
</BaseLayout>
)
}
-96
View File
@@ -1,96 +0,0 @@
'use client'
import React, { useState } from 'react'
import { z } from 'zod'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import { FormField, SelectBox } from '@common/business_components/ui'
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DatePicker, Input } from '@common/components/ui'
import BaseLayout from '@/ii/BaseLayout'
// zod 스키마 정의
const formSchema = z.object({
region: z.string(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
})
const region:{text:string,val:number}[] = [{text:'양평', val:1},{text:'강남',val:2},{text:'test',val:3}]
const Page = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
inputdate: new Date(),
rtkSource: "",
}
})
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'no', title: '번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'guyeok', title: '처리구역' },
{ id: 'fileNm', title: '파일명' },
{ id: 'time', title: '입력시간' }
]
const rtxNmDataList = [
{ "no": '1', 'hasu': '하수처리장', 'guyeok': '처리구역', 'fileNm': '파일', 'time': '2025-04-18' }
]
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<BaseLayout titleName={{ mainTitle: '티센 폴리곤 등록', firstCardTitle: '맨홀별 티센 폴리곤(shape파일) 업로드', secondCardTitle: '수용가-맨홀 매칭 파일 업로드 현황' }} form={form} onSubmitEvent={() => { }} graphBtn={false} tableInfoData={{ headList:rtxNmHeadlist, tableData:rtxNmDataList, cellClickFunc: () => { }, onPageChangeFunc: () => { } }}>
<div className="space-y-[1.2rem]">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 처리구역</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<SelectBox label='' selectArray={region} onSelectValue={() => { } } selectClass={undefined} className='w-[150px]'/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 입력일</div>
<FormField
control={form.control}
name="inputdate"
render={({ field }) => (
<DatePicker
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }}
mode={"single"}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 파일위치</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 비고</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<Input
className="h-17 text-center text-xl w-[200px]"
placeholder=""
{...field}
/>
)}
/>
</div>
</div>
</BaseLayout>
)
}
export default Page
-99
View File
@@ -1,99 +0,0 @@
"use client"
import { z } from "zod"
import { FormField} from '@common/business_components/ui'
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, DatePicker, Input } from '@common/components/ui'
import React, { useState } from 'react'
import { zodResolver } from "@hookform/resolvers/zod"
import { useForm } from "react-hook-form"
import BaseLayout from "@/ii/BaseLayout"
// zod 스키마 정의
const formSchema = z.object({
region: z.string(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
})
function RegistForm() {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
inputdate: new Date(),
rtkSource: "",
}
})
const [selectedDate, setSelectedDate] = useState(new Date())
const onSubmit = (data: z.infer<typeof formSchema>) => {
console.log("✅ 제출 데이터:", data)
}
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'no', title: '번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'guyeok', title: '처리구역' },
{ id: 'fileNm', title: '파일명' },
{ id: 'time', title: '입력시간' }
]
const rtxNmDataList = [
{ "no": '1', 'hasu': '하수처리장', 'guyeok': '처리구역', 'fileNm': '파일', 'time': '2025-04-18' }
]
return (
<BaseLayout titleName={{ mainTitle: "수용가-맨홀 등록", firstCardTitle: "수용가-맨홀 매칭 Shape파일 업로드", secondCardTitle: "수용가-맨홀 매칭 Shape파일 업로드 현황" }} form={form} onSubmitEvent={onSubmit} graphBtn={false} tableInfoData={{
headList: rtxNmHeadlist, tableData: rtxNmDataList, cellClickFunc: () => { }, onPageChangeFunc: () => { }
}}>
{/* 기본 정보 입력 폼 */}
<div className="space-y-[1.2rem]">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 처리구역</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<Select onValueChange={field.onChange} value={field.value}>
<SelectTrigger className="w-[150px]">
<SelectValue placeholder="선택하세요" />
</SelectTrigger>
<SelectContent>
<SelectItem value="양평">양평</SelectItem>
<SelectItem value="강남">강남</SelectItem>
<SelectItem value="마포">마포</SelectItem>
</SelectContent>
</Select>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 입력일</div>
<FormField
control={form.control}
name="inputdate"
render={({ field }) => (
<DatePicker
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }}
mode={"single"}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 파일위치</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
</div>
</BaseLayout>
)
}
export default RegistForm
-114
View File
@@ -1,114 +0,0 @@
'use client'
import React, { useState } from 'react'
import BaseLayout from '../../BaseLayout'
import { FormField, SelectBox } from '@common/business_components/ui'
import { DatePicker, Input } from '@common/components/ui'
import { z } from 'zod'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import FormSection from '@/components/ui/formSection'
const formSchema = z.object({
region: z.string(),
suyeonga: z.number(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
})
const region: { text: string, val: number }[] = [{ text: '양평', val: 1 }, { text: '강남', val: 2 }, { text: 'test', val: 3 }]
const IrSetting = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
suyeonga: 0,
inputdate: new Date(),
rtkSource: "",
}
})
console.log('test')
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'nm', title: '분석번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'region', title: '처리구역' },
{ id: 'sangsu', title: '상수사용량' },
{ id: 'wjsghks', title: '오수 전환율' },
{ id: 'tnsdhtn', title: '순오수량' },
{ id: 'rkddn', title: '강우 유출량' },
{ id: 'rdii', title: 'RDII' }
]
const rtxNmDataList = [
{ "nm": '1', 'hasu': '', 'region': '처리', 'sangsu': '파일', 'wjsghks': '', 'tnsdhtn': '', 'rkddn': '', 'rdii': '' }
]
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<BaseLayout titleName={{ mainTitle: '침입수 산정', firstCardTitle: '침입수 산정 기초자료 설정', secondCardTitle: '침입수 산정결과 현황' }} form={form} onSubmitEvent={() => { }} graphBtn={true} tableInfoData={{ headList: rtxNmHeadlist, tableData: rtxNmDataList, cellClickFunc: () => { }, onPageChangeFunc: () => { } }}>
<div className="grid grid-cols-2 gap-4">
<FormSection name='region' form={form} titleNm='○ 처리구역'><SelectBox label='' selectArray={region} onSelectValue={() => { }} selectClass={undefined} className='w-[150px]' /></FormSection>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 오수 전환율</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<Input
className="h-[3.2rem] text-center text-xl w-[150px]"
placeholder=""
{...field}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 수용가 수</div>
<FormField
control={form.control}
name="suyeonga"
render={({ field }) => (
<SelectBox label='' selectArray={[]} onSelectValue={() => { }} selectClass={undefined} className='w-[150px]' />
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 수용가-맨홀 매칭</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 상수사용량 정보</div>
<FormField
control={form.control}
name="inputdate"
render={({ field }) => (
<DatePicker
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }}
mode={"single"} className='w-[150px]'
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 관망도 자료</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
</div>
</BaseLayout>
)
}
export default IrSetting
@@ -1,98 +0,0 @@
'use client'
import React, { useState } from 'react'
import BaseLayout from '../../BaseLayout'
import { FormField, SelectBox } from '@common/business_components/ui'
import { DatePicker, Input } from '@common/components/ui'
import { z } from 'zod'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
const formSchema = z.object({
region: z.string(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
})
const region: { text: string, val: number }[] = [{ text: '양평', val: 1 }, { text: '강남', val: 2 }, { text: 'test', val: 3 }]
const MeasureDataUpload = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
inputdate: new Date(),
rtkSource: "",
}
})
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'fileNm', title: '파일명' },
{ id: 'status', title: '상태' },
{ id: 'code', title: '지정코드' },
{ id: 'cjfl', title: '처리' },
{ id: 'add', title: '추가' },
{ id: 'update', title: '변경' },
{ id: 'error', title: '오류' },
{ id: 'skip', title: 'Skip' }
]
const rtxNmDataList = [
{ "status": '상태', 'code': '123824', 'cjfl': '처리', 'fileNm': '파일', 'add': '', 'update': '', 'error': '', 'skip': '' }
]
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<BaseLayout titleName={{ mainTitle: '측정자료 등록', firstCardTitle: '하수측정자료 업로드', secondCardTitle: '하수측정자료 파일 업로드 현황' }} form={form} onSubmitEvent={() => { }} graphBtn={true} tableInfoData={{ headList: rtxNmHeadlist, tableData: rtxNmDataList, cellClickFunc: () => { }, onPageChangeFunc: () => { } }}>
<div className="space-y-[1.2rem]">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 처리구역</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<SelectBox label='' selectArray={region} onSelectValue={() => { }} selectClass={undefined} className='w-[150px]' />
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 입력일</div>
<FormField
control={form.control}
name="inputdate"
render={({ field }) => (
<DatePicker
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }}
mode={"single"} className='w-[150px]'
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 관로 관리번호</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<Input
className="h-[3.2rem] text-center text-xl w-[150px]"
placeholder=""
{...field}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 파일위치</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
</div>
</BaseLayout>
)
}
export default MeasureDataUpload
+63
View File
@@ -0,0 +1,63 @@
'use client'
import React, { useState } from 'react'
import { FormField, SelectBox } from '@common/business_components/ui'
import { Button, DatePicker, Input } from '@common/components/ui'
import { z } from 'zod'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import FormSection from '@/components/ui/formSection'
import BaseLayout from '../BaseLayout'
const formSchema = z.object({
managenm: z.string(),
region: z.string(),
suyeonga: z.number(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
suyeongaPlace: z.string()
})
const region: { text: string, val: number }[] = [{ text: '양평', val: 1 }, { text: '강남', val: 2 }, { text: 'test', val: 3 }]
const IrSetting = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
managenm: "",
region: "",
suyeonga: 0,
inputdate: new Date(),
rtkSource: "",
suyeongaPlace: ""
}
})
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<BaseLayout titleName={{ mainTitle: '침입수 산정', firstCardTitle: '실측자료 등록', secondCardTitle: '침입수 분석자료 입력' }} form={form} onSubmitEvent={() => { }} graphBtn={false}>
<div className="grid grid-cols-2 gap-4">
<FormSection name='managenm' form={form} titleNm='○ 관로 관리번호'>
<DatePicker selected={selectedDate} onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date);}} mode={"single"} />
</FormSection>
<FormSection name='region' form={form} titleNm='○ 파일위치'>
<div className="w-[150px]">
<Input id="fileNm" type="file" />
</div>
</FormSection>
</div>
<div className="grid gap-4">
<FormSection name='suyeongaPlace' form={form} titleNm='○ 오수관망도'><div className="w-[150px]">
<Input id="fileNm" type="file" />
</div></FormSection>
<FormSection name='suyeonga' form={form} titleNm='○ 수용가-맨홀 매칭결과'><div className="w-[150px]">
<Input id="fileNm" type="file" />
</div></FormSection>
<FormSection name='inputdate' form={form} titleNm='○ 실수사용량 적용기간'>
<DatePicker selected={selectedDate} onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }} mode={"single"} />
</FormSection>
<FormSection name='rtkSource' form={form} titleNm='○ 오수전환율'><Input className="h-[3.2rem] text-center text-xl w-[150px]" /></FormSection>
<div className="flex justify-end mt-1">
<Button type="submit">침입수분석 실행</Button>
</div>
</div>
</BaseLayout>
)
}
export default IrSetting
@@ -1,15 +1,14 @@
"use client"
import { z } from "zod"
import { date, z } from "zod"
import { useForm, useFieldArray } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage, FormUi, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox } from "@common/business_components/ui"
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, Button } from "@common/components/ui"
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, Button, DatePicker } from "@common/components/ui"
import { UiTable } from "@common/business_components/ui"
import React from "react"
import ContentLayout from "@/components/ui/contentLayout"
import ListDiv from "@common/business_components/ui/list_div"
import React, { useState } from "react"
import BaseLayout from "@/ii/BaseLayout"
import FormSection from "@/components/ui/formSection"
// TODO: 컴포넌트 호출 ~ 필요 코드 수정해야댐
// zod 스키마 정의
const formSchema = z.object({
@@ -27,7 +26,11 @@ const formSchema = z.object({
Dmax: z.string(),
Drec: z.string(),
Do: z.string(),
}))
})),
suyeonga: z.string(),
rate: z.string(),
date: z.coerce.date(),
rain: z.string(),
})
export default function RTKForm() {
@@ -79,64 +82,23 @@ export default function RTKForm() {
{ id: 'Drec', title: 'Drec' },
{ id: 'Do', title: 'Do' }
]
const rtxNmHeadlist = [
{ id: 'no', title: '번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'guyeok', title: '처리구역' },
{ id: 'cnfcj', title: '출처' },
{ id: 'time', title: '입력시간' }
]
// 테이블 페이지 변경 핸들러
const handlePageChange = (page: number) => {
console.log('Page changed:', page)
}
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<BaseLayout titleName={{ mainTitle: '모의정보 설정', firstCardTitle: '모의정보 설정', secondCardTitle: 'RTX계수 입력현황' }} form={form} onSubmitEvent={() => { }} graphBtn={false} tableInfoData={{ headList: rtxNmHeadlist, tableData: [{}], cellClickFunc: () => { }, onPageChangeFunc: () => { } }}>
<div className="space-y-[1.2rem]">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 처리구역</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<SelectBox label="" selectArray={[{ text: '양평', val: 1 }]} onSelectValue={() => { }} selectClass="" className="w-[150px]" />
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ RDII 기여면적(ha)</div>
<FormField
control={form.control}
name="rdiiArea"
render={({ field }) => (
<Input
className="h-10 text-center text-xl w-[150px]"
placeholder=""
type=""
{...field}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ RTK계수 출처</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<Input
className="h-10 text-center text-xl w-[250px]"
placeholder=""
{...field}
/>
)}
/>
</div>
</div>
{/* 테이블 컨테이너 */}
<div className="mt-[1.2rem]">
<BaseLayout titleName={{ mainTitle: 'RDII 분석', firstCardTitle: 'RDII 분석자료 입력' }} form={form} onSubmitEvent={() => { }} graphBtn={false}>
{[<div className="space-y-[1.2rem]" key="form-section">
<div className="grid grid-cols-2 gap-4">
<FormSection name="rtkSource" form={form} titleNm="○ RTK계수 출처"><Input
className="h-10 text-center text-xl w-[150px]"
placeholder=""
/></FormSection>
<FormSection name="rdiiArea" form={form} titleNm="○ RDII 기여면적(ha)"><Input
className="h-10 text-center text-xl w-[150px]"
placeholder=""
/></FormSection></div>
<div className="grid grid-cols-2">
<div>
<div className="mb-[1.2rem] text-xl font-medium">○ 단위도 계수</div>
@@ -169,7 +131,26 @@ export default function RTKForm() {
</UiTable>
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<FormSection name="suyeonga" form={form} titleNm="○ 오수관망도"><div className="w-[150px]">
<Input id="fileNm" type="file" />
</div></FormSection>
<FormSection name="regopm" form={form} titleNm="○ 수용가-맨홀 매칭결과"><div className="w-[150px]">
<Input id="fileNm2" type="file" />
</div></FormSection>
<FormSection name='date' form={form} titleNm='○ 실수사용량 적용기간'>
<DatePicker selected={selectedDate} onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }} mode={"single"} />
</FormSection>
<FormSection name='rate' form={form} titleNm='○ 오수전환율'><Input className="h-[3.2rem] text-center text-xl w-[150px]" /></FormSection>
<FormSection name="rain" form={form} titleNm="○ 강우자료"><div className="w-[150px]">
<Input id="fileNm3" type="file" />
</div></FormSection>
</div>
<div className="flex justify-end mt-1">
<Button type="submit">RDII분석 실행</Button>
</div>
</div>
]}
</BaseLayout >
)
}
-54
View File
@@ -1,54 +0,0 @@
'use client'
import React, { useState } from 'react'
import BaseLayout from '../../BaseLayout'
import { FormField, SelectBox } from '@common/business_components/ui'
import { DatePicker, Input } from '@common/components/ui'
import { z } from 'zod'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
const formSchema = z.object({
region: z.string(),
})
const region: { text: string, val: number }[] = [{ text: '양평', val: 1 }, { text: '강남', val: 2 }, { text: 'test', val: 3 }]
const RainDataUpload = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
}
})
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'fileNm', title: '파일명' },
{ id: 'status', title: '상태' },
{ id: 'code', title: '지정코드' },
{ id: 'cjfl', title: '처리' },
{ id: 'add', title: '추가' },
{ id: 'update', title: '변경' },
{ id: 'error', title: '오류' },
{ id: 'skip', title: 'Skip' }
]
const rtxNmDataList = [
{ "status": '상태', 'code': '123824', 'cjfl': '처리', 'fileNm': '파일', 'add': '', 'update': '', 'error': '', 'skip': '' }
]
return (
<BaseLayout titleName={{ mainTitle: '강우자료 등록', firstCardTitle: '강우자료 업로드', secondCardTitle: '강우자료 파일 업로드 현황' }} form={form} onSubmitEvent={() => { }} graphBtn={true} tableInfoData={{ headList: rtxNmHeadlist, tableData: rtxNmDataList, cellClickFunc: () => { }, onPageChangeFunc: () => { } }}>
<div className="space-y-[1.2rem]">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 파일위치</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
</div>
</BaseLayout>
)
}
export default RainDataUpload
-149
View File
@@ -1,149 +0,0 @@
'use client'
import BaseLayout from '@/ii/BaseLayout'
import { FormField, SelectBox } from '@common/business_components/ui'
import { DatePicker, Input } from '@common/components/ui'
import { zodResolver } from '@hookform/resolvers/zod'
import React, { useState } from 'react'
import { useForm } from 'react-hook-form'
import { z } from 'zod'
const formSchema = z.object({
region: z.string(),
suyeonga:z.number(),
meter:z.string(),
inputdate: z.coerce.date(),
inpSource:z.string(),
rtkSource: z.string(),
})
const region: { text: string, val: number }[] = [{ text: '양평', val: 1 }, { text: '강남', val: 2 }, { text: 'test', val: 3 }]
const RdiiSetting = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
region: "",
meter:"",
suyeonga:0,
inputdate: new Date(),
inpSource:"",
rtkSource: "",
}
})
// TODO: 임시 데이터
const rtxNmHeadlist = [
{ id: 'nm', title: '분석번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'region', title: '처리구역' },
{ id: 'sangsu', title: '상수사용량' },
{ id: 'wjsghks', title: '오수 전환율' },
{ id: 'tnsdhtn', title: '순오수량' },
{ id: 'rkddn', title: '강우 유출량' },
{ id: 'rdii', title: 'RDII' }
]
const rtxNmDataList = [
{ "nm": '1', 'hasu': '', 'region': '처리', 'sangsu': '파일', 'wjsghks': '', 'tnsdhtn': '', 'rkddn': '', 'rdii': '' }
]
const [selectedDate, setSelectedDate] = useState(new Date())
return (
<BaseLayout titleName={{ mainTitle: 'RDII 산정', firstCardTitle: 'RDII산정 기초자료 설정', secondCardTitle: 'RDII 산정결과 현황' }} form={form} onSubmitEvent={() => { }} graphBtn={true} tableInfoData={{ headList: rtxNmHeadlist, tableData: rtxNmDataList, cellClickFunc: () => { }, onPageChangeFunc: () => { } }}>
<div className="grid grid-cols-3 gap-4">
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 처리구역</div>
<FormField
control={form.control}
name="region"
render={({ field }) => (
<SelectBox label='' selectArray={region} onSelectValue={() => { }} selectClass={undefined} className='w-[150px]' />
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 상수사용량 정보</div>
<FormField
control={form.control}
name="inputdate"
render={({ field }) => (
<DatePicker
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }}
mode={"single"} className='w-[150px]'
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 관망도자료</div>
<FormField
control={form.control}
name="rtkSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ RDII 기여면적(ha)</div>
<FormField
control={form.control}
name="meter"
render={({ field }) => (
<Input
className="h-[3.2rem] text-center text-xl w-[150px]"
placeholder=""
{...field}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 오수 전환율</div>
<FormField
control={form.control}
name="inpSource"
render={({ field }) => (
<Input
className="h-[3.2rem] text-center text-xl w-[150px]"
placeholder=""
{...field}
/>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 강우자료</div>
<FormField
control={form.control}
name="inpSource"
render={({ field }) => (
<div className="w-[150px]">
<Input id="picture" type="file" />
</div>
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 수용가 수</div>
<FormField
control={form.control}
name="suyeonga"
render={({ field }) => (
<SelectBox label='' selectArray={[]} onSelectValue={() => { }} selectClass={undefined} className='w-[150px] h-[3.2rem]' />
)}
/>
</div>
<div className="grid grid-cols-[120px_1fr] items-center">
<div className="text-xl font-medium">○ 수용가-맨홀 매칭</div>
<FormField
control={form.control}
name="inpSource"
render={({ field }) => (
<SelectBox label='' selectArray={[{'text':'매칭(양평).shp','val':'1'}]} onSelectValue={() => { }} selectClass={undefined} className='h-[3.2rem] w-[150px]' />
)}
/>
</div>
</div>
</BaseLayout>
)
}
export default RdiiSetting
+64
View File
@@ -0,0 +1,64 @@
'use client'
import React, { useState } from 'react'
import { FormField, SelectBox, UiTable } from '@common/business_components/ui'
import { Button, DatePicker, Input } from '@common/components/ui'
import { z } from 'zod'
import { zodResolver } from '@hookform/resolvers/zod'
import { useForm } from 'react-hook-form'
import FormSection from '@/components/ui/formSection'
import BaseLayout from '../BaseLayout'
import { title } from 'process'
const formSchema = z.object({
managenm: z.string(),
region: z.string(),
suyeonga: z.number(),
inputdate: z.coerce.date(),
rtkSource: z.string(),
suyeongaPlace: z.string()
})
// TODO: 분석구분에 따라서 테이블 컬럼 변경필요
const tableColumn = [
{ id: 'no', title: '번호' },
{ id: 'hasu', title: '하수처리장' },
{ id: 'guyeok', title: '처리구역' },
{ id: 'sangsu', title: '상수 사용량' },
{ id: 'rate', title: '오수 전환율' },
{ id: 'water', title: '순오수량' },
{ id: 'measureWater', title: '측정하수량' },
{ id: 'ii', title: '침입수량' },
{ id: 'date', title: '분석일자' },
{ id: 'usr', title: '분석자' }
]
const tableInfoData = [{ 'no': '1', 'hasu': '양평하수처리장', 'guyeok': '양평', 'sangsu': '1000', 'rate': '0.5', 'water': '500', 'measureWater': '1000', 'ii': '500', 'date': '2023-10-01', 'usr': '홍길동' }]
const Result = () => {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
managenm: "",
region: "",
suyeonga: 0,
inputdate: new Date(),
rtkSource: "",
suyeongaPlace: ""
}
})
return (
<BaseLayout searchBox={{labelNm: {first: "분석기간",second: "침입수",third: "처리장",fourth: "처리구역",},searchChk: true,}} titleName={{ mainTitle: '분석결과', firstCardTitle: '분석이력' }} form={form} onSubmitEvent={() => { }} graphBtn={true}>
{[<div key='table1'>
<div className="mb-[1.2rem] text-xl font-medium">○ 침입수 산정결과 현황</div>
<UiTable
headName=''
headlist={tableColumn}
tableData={tableInfoData}
total={0}
pageSize={10}
children={undefined}
cellClick={(e) => { }}
onPageChange={(e) => { }}
/>
</div>]}
</BaseLayout>
)
}
export default Result
+130
View File
@@ -0,0 +1,130 @@
'use client'
import { VerticalTable } from "@/components/verticalTable";
import { Button, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@common/components/ui";
import { useState } from "react";
import { CommonTableColumn } from "./table";
const inputColumn = [
{ id: "title", title: "설치주제", type: "select", options: ["BTL", "재정사업"] },
{ id: "guyeok", title: "처리구역", type: "select", options: ["구역1", "구역2"] },
{ id: "basu", title: "배수구역", type: "input" },
{ id: "bungu", title: "배수분구", type: "input" },
{ id: "wltjs", title: "지선/간선", type: "select", options: ["지선", "간선"] },
{ id: "flow", title: "흐름방식", type: "select", options: ["자연유하", "압송"] },
{ id: "place", title: "매설위치", type: "select", options: ["도로", "하상"] },
];
const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData:any }) => {
// TODO: 런타임 에러 해결 필요
const [repairData, setRepairData] = useState([
{ year: "2025", type: "개대체" },
{ year: "2025", type: "보수" },
]);
const [cleaningData, setCleaningData] = useState([
{ year: "2025", type: "청소" },
{ year: "2025", type: "준설" },
]);
const [inspectionData, setInspectionData] = useState([
{ year: "2025", type: "관로기술진단" },
{ year: "2025", type: "관로기술진단" },
]);
const handleInputChange = (section: string, index: number, field: string, value: string) => {
const updateData = (data: { year: string; type: string }[], setData: React.Dispatch<React.SetStateAction<{ year: string; type: string }[]>>) => {
const updated = [...data];
if (updated[index]) {
updated[index][field as keyof typeof updated[number]] = value;
}
setData(updated);
};
if (section === "repair") {
updateData(repairData, setRepairData);
} else if (section === "cleaning") {
updateData(cleaningData, setCleaningData);
} else if (section === "inspection") {
updateData(inspectionData, setInspectionData);
}
};
function transformFeatureDataToArray(featureData: any, keys: string[]) {
// 필요한 키만 추출하여 새로운 객체 생성
const transformedData = keys.reduce((acc, key) => {
acc[key] = featureData[key] !== undefined ? featureData[key] : "N/A"; // 값이 없으면 "N/A"로 처리
return acc;
}, {} as Record<string, any>);
// 배열로 감싸서 반환
return [transformedData];
}
const keys = CommonTableColumn.map((column) => column.id);
const transformedFeatureData = transformFeatureDataToArray(featureData, keys);
const renderSection = (title: string, data: { year: string; type: string }[], sectionKey: string) => (
<div>
{/* 섹션 제목 */}
<div className="card-header">
<h3 className="text-2xl mx-3 font-medium text-label">{title}</h3>
</div>
{/* 테이블 */}
<div className="card !m-[1.2rem] !p-0r">
<Table variant="secondary" className="w-full">
<TableHeader>
<TableRow>
<TableHead className="border border-gray-300 px-2 py-2 text-sm">년도</TableHead>
<TableHead className="border border-gray-300 px-2 py-2 text-sm">구분</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.map((row, index) => (
<TableRow key={index}>
<TableCell className="border border-gray-300 px-2 py-2 text-sm">
<input
type="text"
value={row.year}
onChange={(e) => handleInputChange(sectionKey, index, "year", e.target.value)}
className="w-full text-xl border-radius-0 px-3 py-2 text-base text-center leading-normal"
/>
</TableCell>
<TableCell className="border border-gray-300 px-2 py-2 text-sm text-center leading-normal">{row.type}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
</div>
);
return (
<div id="popup" className="absolute top-0 right-0 w-[350px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-[1000]">
<div className="card-header bg-primary flex items-center justify-between p-4">
<div className="flex mx-3 flex-col">
<h3 className="text-2xl font-medium text-white text-label">하수관로 정보</h3>
<div className="font-medium text-white text-label">(00구 00리 하수관로)</div>
</div>
<button
onClick={onClose}
className="text-white hover:text-gray-700 focus:outline-none"
aria-label="닫기"
>
✕
</button>
</div>
<div className="overflow-y-auto flex-1">
<VerticalTable headName='LX 연계정보' tableData={transformedFeatureData} headlist={CommonTableColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}></VerticalTable>
<VerticalTable headName='자체 입력정보' tableData={[]} headlist={inputColumn} pageSize={20} total={0} children={undefined} cellClick={undefined} isEditable={true} onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}></VerticalTable>
{/* here */}
{renderSection("보수 및 갱신", repairData, "repair")}
{renderSection("청소 및 준설", cleaningData, "cleaning")}
{renderSection("점검 및 진단", inspectionData, "inspection")}
</div>
<div className="w-full mx-5 flex items-center justify-end space-x-2">
<Button className="px-4 mr-5 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700">
저장
</Button>
</div>
</div>
)
}
export default FeatureClickEventPopup;
+2 -1
View File
@@ -10,6 +10,7 @@ import { mapService } from "@service";
const Map = () => {
const [treeData, setTreeData] = useState([]); // 초기값을 객체 또는 null로 설정
const [selectedFeature,setSelectedFeature] = useState(null); // 선택된 피처 상태
const fetchData = async () => {
try {
@@ -27,7 +28,7 @@ const Map = () => {
return (
<div className="bg-container">
<Gis treeData={treeData}/>
<Gis treeData={treeData} isSearch={true} />
</div>
);
};
+40
View File
@@ -0,0 +1,40 @@
export const CommonTableColumn = [
{ id: 'swtrmt_fclt_cd', title: '하수처리시설코드' },
{ id: 'swtrmt_fclt_nm', title: '하수처리시설명' },
{ id: 'fclt_cpct', title: '시설용량' },
{ id: 'rgn_expln', title: '지역설명' },
{ id: 'cmcn_ymd', title: '준공일자' },
{ id: 'oprtng_strt_ymd', title: '가동개시일자' },
{ id: 'clsg_ymd', title: '폐쇄일자' },
{ id: 'prcs_msrc_cd', title: '처리공법코드' },
{ id: 'lae_cd', title: '지자체코드' },
{ id: 'lae_nm', title: '지자체명' },
{ id: 'ctpv_nm', title: '시도명' },
{ id: 'sgg_nm', title: '시군구명' },
{ id: 'sarea_cd', title: '권역코드' },
{ id: 'sarea_nm', title: '권역명' },
{ id: 'lrge_sarea_nm', title: '대권역명' },
{ id: 'rvr_nm', title: '하천명' },
{ id: 'addr', title: '주소' },
{ id: 'daddr', title: '상세주소' },
{ id: 'rdnm_addr', title: '도로명주소' },
{ id: 'dtl_rdnm_addr', title: '상세도로명주소' },
{ id: 'dschg_wtst_nm', title: '방류수계명' },
{ id: 'plln_area', title: '부지면적' },
{ id: 'mng_rprtv_bzenty_nm', title: '관리대행업제명' },
{ id: 'swtrmt_ppltn_cnt', title: '하수처리인구수' },
{ id: 'prcs_zone_area_sum', title: '처리구역면적합계' },
{ id: 'geom', title: 'geometry' },
{ id: 'xcrd', title: 'X좌표' },
{ id: 'ycrd', title: 'Y좌표' },
{ id: 'oprtng_stts_cd', title: '가동상태코드' },
{ id: 'rprs_msrc_cn', title: '대표공법내용' },
{ id: 'stty_crtr_bod', title: '법정기준생물화학적산소요구량' },
{ id: 'stty_crtr_toc', title: '법정기준TOC' },
{ id: 'stty_crtr_ss', title: '법정기준SS' },
{ id: 'stty_crtr_tn', title: '법정기준총질소' },
{ id: 'stty_crtr_tph', title: '법정기준총인' },
{ id: 'stty_crtr_clbcl_cnt', title: '법정기준대장균수' },
{ id: 'bsn_nm', title: '유역명' },
{ id: 'obsrvn_spt_cd', title: '관측지점코드' },
];
+5 -16
View File
@@ -5,19 +5,8 @@ import React, { useRef, useState } from 'react'
import FileUploadForm from '../../components/ui/fileUploadForm'
import ListDiv from '@common/business_components/ui/list_div'
import ContentLayout from '@/components/ui/contentLayout'
const tableHeadlist = [
{ id: 'no', title: 'NO' },
{ id: 'fileNm', title: '파일명' },
{ id: 'manageYear', title: '기준년도' },
{ id: 'registDt', title: '등록 일자' },
{ id: 'registUsr', title: '등록자' }
import { tableData, tableHeadlist } from '../oldPp/page'
]
const tableData = [
{ 'no': '1', 'fileNm': '파일명', 'manageYear': '2023', 'registDt': '2025-04-16', 'registUsr': 'me' },
{ 'no': '2', 'fileNm': '파일명', 'manageYear': '2024', 'registDt': '2025-04-16', 'registUsr': 'me2' },
{ 'no': '3', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3' }
]
const Page = () => {
const [selectedDate, setSelectedDate] = useState(new Date())
const [company, setCompany] = useState('')
@@ -28,7 +17,7 @@ const Page = () => {
<SearchFormLeft>
<div className='flex items-center gap-4'>
<div className='flex items-center gap-2'>
<Label className="w-20 text-xl text-gray-600">수행기간</Label>
<Label className="w-20 text-xl text-gray-600">등록기간</Label>
<DatePicker mode={'single'}
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }} />
@@ -38,7 +27,7 @@ const Page = () => {
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }} />
</div>
<div className='flex items-center'>
<Label className="w-20 text-xl text-gray-600">수행사</Label>
<Label className="w-20 text-xl text-gray-600">등록자</Label>
<Input
className='w-[100px]'
value={company}
@@ -46,7 +35,7 @@ const Page = () => {
/>
</div>
<div className='flex items-center'>
<Label className="w-20 text-xl text-gray-600">사업명</Label>
<Label className="w-20 text-xl text-gray-600">파일명</Label>
<Input
className='w-[100px]'
value={pjNm}
@@ -67,7 +56,7 @@ const Page = () => {
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" >삭제</Button>
</div>
</div>
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={20} total={20} children={undefined} cellClick={() => { }} onPageChange={function (page: number): void {
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={20} children={undefined} cellClick={() => { }} onPageChange={function (page: number): void {
throw new Error('Function not implemented.')
}}></UiTable>
</ListDiv>
+35 -9
View File
@@ -1,26 +1,36 @@
'use client'
import { ContentsDiv, MainDiv, SearchDiv, SearchFormLeft, SearchFormRight, SelectBox, Title, UiTable } from '@common/business_components/ui'
import { Button, DatePicker, Label } from '@common/components/ui'
import { Button, DatePicker, Input, Label } from '@common/components/ui'
import React, { useState } from 'react'
import FileUploadForm from '../../components/ui/fileUploadForm'
import ListDiv from '@common/business_components/ui/list_div'
import ContentLayout from '@/components/ui/contentLayout'
// TODO: 임시 id
const tableHeadlist = [
export const tableHeadlist = [
{ id: 'no', title: 'NO' },
{ id: 'fileNm', title: '파일명' },
{ id: 'manageYear', title: '관리년도' },
{ id: 'manageYear', title: '년도' },
{ id: 'bungi', title: '분기' },
{ id: 'registDt', title: '등록 일자' },
{ id: 'registUsr', title: '등록자' }
]
const tableData = [
{ 'no': '1', 'fileNm': '파일명', 'manageYear': '2023', 'registDt': '2025-04-16', 'registUsr': 'me' },
{ 'no': '2', 'fileNm': '파일명', 'manageYear': '2024', 'registDt': '2025-04-16', 'registUsr': 'me2' },
{ 'no': '3', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3' }
export const tableData = [
{ 'no': '1', 'fileNm': '파일명', 'manageYear': '2023', 'registDt': '2025-04-16', 'registUsr': 'me', 'bungi': '1분기' },
{ 'no': '2', 'fileNm': '파일명', 'manageYear': '2024', 'registDt': '2025-04-16', 'registUsr': 'me2', 'bungi': '1분기' },
{ 'no': '3', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '4', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '5', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '6', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '7', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '8', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '9', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '10', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' }
]
const Page = () => {
const [selectedDate, setSelectedDate] = useState<Date>(new Date());
const [company, setCompany] = useState('')
const [pjNm, setpjNm] = useState('')
return (
<ContentLayout title='노후 하수관로 정비사업'>
<SearchDiv>
@@ -35,6 +45,22 @@ const Page = () => {
<DatePicker mode={'single'}
selected={selectedDate}
onSelect={(date: Date | undefined) => { if (date) setSelectedDate(date) }} />
<div className='flex items-center'>
<Label className="w-20 text-xl text-gray-600">등록자</Label>
<Input
className='w-[100px]'
value={company}
onChange={(e) => setCompany(e.target.value)}
/>
</div>
<div className='flex items-center'>
<Label className="w-20 text-xl text-gray-600">파일명</Label>
<Input
className='w-[100px]'
value={pjNm}
onChange={(e) => setpjNm(e.target.value)}
/>
</div>
</div>
</div>
</SearchFormLeft>
@@ -43,14 +69,14 @@ const Page = () => {
</SearchFormRight>
</SearchDiv>
<ListDiv className="mt-4">
<div className="card-header flex items-center justify-between">
<div className="card-header flex items-center justify-between">
<h3 className="text-2xl font-medium">사업정보 등록현황</h3>
<div>
<Button className="px-4 py-2 !mr-[1.2rem] bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700" size="sm" >파일 다운로드</Button>
<Button className="px-4 py-2 bg-blue-600 text-white rounded-sm text-sm font-medium hover:bg-blue-700 !mr-[1.2rem]" size="sm" >삭제</Button>
</div>
</div>
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={20} total={20} children={undefined} cellClick={() => { }} onPageChange={function (page: number): void {
<UiTable headName='' tableData={tableData} headlist={tableHeadlist} pageSize={10} total={20} children={undefined} cellClick={() => { }} onPageChange={function (page: number): void {
throw new Error('Function not implemented.')
}}></UiTable>
</ListDiv>
+3 -18
View File
@@ -14,24 +14,9 @@ export default function Home() {
</div>
<div><h3 className="text-2xl text-bold gap-4 mx-4">I/I 분석(기초정보 설정)</h3>
<div className="flex flex-row gap-4 p-4">
<Link href={"/ii/baseinfo/mock"}><Button>모의정보 설정</Button></Link>
<Link href={"/ii/baseinfo/observe"}><Button>관망도 등록</Button></Link>
<Link href={"/ii/baseinfo/polygon"}><Button>티센 폴리곤 등록</Button></Link>
<Link href={"/ii/baseinfo/regist"}><Button>수용가-맨홀 등록</Button></Link>
</div>
</div>
<div>
<h3 className="text-2xl text-bold gap-4 mx-4">I/I 분석(침입수 분석)</h3>
<div className="flex flex-row gap-4 p-4">
<Link href={"/ii/ir/measureDataUpload"}><Button>하수측정자료 업로드</Button></Link>
<Link href={"/ii/ir/irsetting"}><Button>침입수 산정</Button></Link>
</div>
</div>
<div>
<h3 className="text-2xl text-bold gap-4 mx-4">I/I 분석(RDII 분석)</h3>
<div className="flex flex-row gap-4 p-4">
<Link href={"/ii/rdii/rain"}><Button>강우자료 등록</Button></Link>
<Link href={"/ii/rdii/rdiisetting"}><Button>rdii 산정</Button></Link>
<Link href={"/ii/irsetting"}><Button>침입수 분석</Button></Link>
<Link href={"/ii/rdii"}><Button>RDII 분석</Button></Link>
<Link href={"/ii/result"}><Button>분석결과</Button></Link>
</div>
</div>
</div>
@@ -31,6 +31,7 @@
"@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-select": "^2.1.6",
"@radix-ui/react-slot": "^1.1.2",
"axios": "1.8.1",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
@@ -10,23 +10,34 @@ import proj4 from 'proj4';
import { register } from 'ol/proj/proj4';
import GisApp from './lib/gis.core';
import GisContent from './GisContent';
import GisTree from './GisTree';
import GisLonLat from './GisLonLat';
import GisToolBar from './GisToolBar';
import GisSearch from './GisSearch';
import GisTab from './GisTab';
import MapToggleBtn from './MapToggleBtn';
import FeatureClickEventPopup from '@/map/featureClickEventPopup';
export const GisContext = createContext({gisCore: null, gisMap: null, treeData:null, checkedLayerIds:null});
export const useGisContext = () => useContext(GisContext);
function Gis({ treeData = [] }) {
function Gis({ treeData = [], isSearch = false }) {
const mapRef = useRef();
const overviewMapRef = useRef(null);
const [mapObject, setMapObject] = useState({});
const [tabVisible, setTabVisible] = useState(true);
const [isOpen, setIsOpen] = useState(false); // 팝업 열기/닫기 상태
const [featureData,setFeatureData] = useState(null) // 선택된 피쳐 데이터
const gisCore = useMemo(() => new GisApp.core({ targetId: mapRef.current }), []);
//const [treeData, setTreeData] = useState([]);
const checkedLayerIds = useRef([]);
let gisMap = null;
const closePopup = () => {
setIsOpen(false); // 팝업 닫기
setFeatureData(null)
};
const handleFeatureSelect = (data) => {
console.log('check',data)
setFeatureData(data); // 선택된 피처 데이터 저장
setIsOpen(true); // 팝업 열기
};
useEffect(() => {
if (!mapRef.current) return;
@@ -98,7 +109,7 @@ function Gis({ treeData = [] }) {
//setTreeData(data);
const layerItems = getLayerItems(layerCode);
//setEditLayerItems(prev => [...layerItems]);
//setEditLayerItems(prev => [...layerItems])
}, [treeData]);
const getLayerItems= (layerCode) => {
@@ -126,33 +137,26 @@ function Gis({ treeData = [] }) {
}
}
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
return (
<>
<GisContext.Provider value={{gisCore, gisMap, treeData, checkedLayerIds}}>
<>
<div className="h-[calc(100vh-10rem)] flex relative">
<div className="absolute top-0 left-0 z-40 w-[280px] h-[calc(100vh-10rem)] bg-white border rounded-md shadow-md flex flex-col overflow-hidden">
<Tabs defaultValue="layers" className="flex-1 flex flex-col overflow-hidden">
<TabsList className="flex-none border-b text-[70%]">
<TabsTrigger value="layers" className="flex-1">레이어</TabsTrigger>
<TabsTrigger value="search" className="flex-1">시설검색</TabsTrigger>
</TabsList>
<TabsContent value="layers" className="grow overflow-y-auto p-2 min-h-0">
<GisTree />
</TabsContent>
<TabsContent value="search" className="grow overflow-y-auto p-2 min-h-0">
<GisSearch />
</TabsContent>
</Tabs>
</div>
<GisTab visible={tabVisible} setVisible={setTabVisible} isSearch={isSearch} />
<GisContent onFeatureSelect={handleFeatureSelect}/>
{isOpen && featureData && (
<FeatureClickEventPopup
featureData={featureData}
onClose={closePopup} // 닫기 콜백 전달
/>
)}
<div ref={mapRef} className="gis-map flex-1 relative" style={{ height: '100%', padding: 0 }} />
<GisLonLat />
<GisToolBar />
<MapToggleBtn />
<GisLonLat/>
<GisToolBar/>
<MapToggleBtn/>
</div>
</>
</GisContext.Provider>
</>
);
}
@@ -6,23 +6,23 @@ import GisSelect from './GisSelect';
import GisToolBar from './GisToolBar';
import './lib/css/gis.edit.css';
import MapToggleBtn from './MapToggleBtn';
//import GisEdit from './GisEdit';
import GisEdit from './GisEdit';
export default function GisContent({ edit = false }) {
export default function GisContent({ edit = false,onFeatureSelect }) {
const { gisMap, gisCore } = useGisContext();
const [visibleComponents, setVisibleComponents] = useState({});
const addressResultLayer = useRef(null);
const [playShow, setPlayShow] = useState({ show: false });
//셀렉트 버튼 이벤트
const clickFeature = useCallback(feature => {
if (feature) {
const layer = feature.getLayer();
setVisibleComponents(prevState => ({
...prevState,
}));
}
}, []);
// const clickFeature = useCallback(feature => {
// if (feature) {
// const layer = feature.getLayer();
// setVisibleComponents(prevState => ({
// ...prevState,
// }));
// }
// }, []);
const selectRslt = useCallback(feature => {
GisApp.Module.layer.highLightFeature(
@@ -52,9 +52,9 @@ export default function GisContent({ edit = false }) {
<>
{/*<GisTree />*/}
{/* <MapToggleBtn useCesium={useCesium} /> */}
<GisLonLat />
<GisToolBar />
<GisSelect clickFeature={clickFeature} />
{/* { <GisLonLat /> */}
{/* <GisSelect clickFeature={clickFeature} /> */}
<GisSelect onFeatureSelect={onFeatureSelect}/>
{/* {edit && <GisEdit />} */}
</>
);
@@ -1,9 +1,9 @@
import GisApp from './lib/gis.core';
import React, { useContext, useEffect, useRef, useState } from 'react';
import { GisContext, setTree } from './Gis';
import Button from '../button/Button';
import { Button } from "@common/components";
import { gAlert, gConfirm } from './lib/util';
import { fclApi } from '../../js/apis/fcl/fclApi';
// import { fclApi } from '../../js/apis/fcl/fclApi';
export default React.memo(function GisEdit() {
const { editLayerItems = [], siteSn, locgovCd, checkedLayerIds } = useContext(GisContext);
@@ -96,10 +96,10 @@ export default React.memo(function GisEdit() {
return;
}
if (!gConfirm('CONFIRM', 'SAVE_QUEST')) return false;
const result = await fclApi.saveEditFeatures(editFeatures);
if (result.code === 200) {
editModule.clearUndoRedo();
}
// const result = await fclApi.saveEditFeatures(editFeatures);
// if (result.code === 200) {
// editModule.clearUndoRedo();
// }
};
useEffect(() => {
@@ -3,7 +3,7 @@ import GisApp from './lib/gis.core';
import GisOlSelect from './lib/gis.select';
import { useContext } from 'react';
import { GisContext } from './Gis';
export default React.memo(function GisSelect({ clickFeature }) {
export default React.memo(function GisSelect({ onFeatureSelect }) {
const { gisMap } = useContext(GisContext);
const select = new GisOlSelect(gisMap);
GisApp.Module.select = select;
@@ -12,11 +12,15 @@ export default React.memo(function GisSelect({ clickFeature }) {
};
select.getSelectedInfo(function (features) {
clickFeature(features[0]);
//clickFeature(features[0]);
if(features.length > 0) {
const layer = features[0];
onFeatureSelect(layer.getProperties()); //피쳐 속성데이터 상위컴포넌트로 전달
}
});
return (
<>
<div className="select_control map_control_div ol-unselectable ol-control" style={{ pointerEvents: 'auto', zIndex: '1' }}>
{/* <div className="select_control map_control_div ol-unselectable ol-control" style={{ pointerEvents: 'auto', zIndex: '1' }}>
<h3>선,면,다각형을 이용한 시설물 선택 영역</h3>
<ul>
<li>
@@ -30,7 +34,7 @@ export default React.memo(function GisSelect({ clickFeature }) {
</div>
</li>
</ul>
</div>
</div> */}
</>
);
});
@@ -0,0 +1,82 @@
import React, { useState } from 'react';
import { Tabs, TabsList, TabsTrigger } from '@common/components/ui/tabs';
import GisTree from './GisTree';
import GisSearch from './GisSearch';
import { ChevronLeft, ChevronRight, Search } from 'lucide-react';
import SearchModal from './SearchModal';
function GisTab({ visible, setVisible, isSearch }) {
const [activeTab, setActiveTab] = useState('layers');
const [isSearchModalOpen, setIsSearchModalOpen] = useState(false);
return (
<>
<div
className={`absolute top-0 left-0 w-[250px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-40
${visible ? 'translate-x-0 opacity-100' : '-translate-x-full opacity-0 pointer-events-none'}`}
>
<Tabs value={activeTab} onValueChange={setActiveTab} className="flex-1 flex flex-col overflow-hidden">
<TabsList className="flex-none mt-4 border-none rounded-none">
<TabsTrigger value="layers" className="flex-1 h-10">레이어</TabsTrigger>
{isSearch && (
<button
type="button"
onClick={() => setIsSearchModalOpen(true)}
className="h-10 w-10 flex items-center justify-center px-0"
>
<Search size={18} className="text-gray-700" />
</button>
// <TabsTrigger value="search" className="flex-1 h-10 flex items-center justify-center">
// <Search size={18} />
// </TabsTrigger>
)}
</TabsList>
{/* GisTree는 항상 마운트되며, 탭 상태에 따라 보여주기만 함 */}
<div
className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${activeTab === 'layers' ? 'block' : 'hidden'
}`}
>
<GisTree />
</div>
{/* GisSearch도 동일하게 처리 */}
{/* {isSearch && (
<div
className={`grow overflow-y-auto p-2 pt-0 border-none shadow-none ${
activeTab === 'search' ? 'block' : 'hidden'
}`}
>
<GisSearch />
</div>
)} */}
{/* 🔍 검색 모달 */}
<SearchModal open={isSearchModalOpen} onOpenChange={setIsSearchModalOpen} />
</Tabs>
{/* 접기 버튼 */}
<button
onClick={() => setVisible(false)}
className="absolute top-1/2 right-[-3px] transform -translate-y-1/2 z-50 bg-white border border-l border-gray-300 rounded-l-none rounded-r px-1 py-2 shadow-sm"
>
<ChevronLeft size={16} />
</button>
</div>
{/* 열기 버튼 */}
{!visible && (
<button
onClick={() => setVisible(true)}
className="absolute top-1/2 left-[-3px] transform -translate-y-1/2 z-50 bg-white border border-r border-gray-300 rounded-r px-1 py-2 shadow-sm"
>
<ChevronRight size={16} />
</button>
)}
</>
);
}
export default React.memo(GisTab);
@@ -23,7 +23,6 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
setNodes(nodeData);
gisCore.setAllLayersOnMap(false);
}
console.log(treeData)
}, [treeData]);
useEffect(() => {
@@ -37,7 +36,6 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
setExpanded(defaultExpanded);
gisCore.setLayerOnMap(defaultChecked, true);
}
console.log(nodes)
}, [nodes]);
const getDefaultCheckedNodes = (nodes, values = []) => {
@@ -113,27 +111,11 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
parent: item.upperLyrSn,
droppable: !!item.children,
data: item,
icon: src ? <img src={src} alt={item.lyrNm} className="w-4 h-4" /> : '',
icon: src ? <img src={src} alt={item.lyrNm} /> : '',
};
});
};
const findUpLyrId = (nodes, targetLyrId) => {
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (node.data && node.data.lyrSn === targetLyrId) {
return node.data.upperLyrSn;
}
if (node.children) {
const upLyrId = findUpLyrId(node.children, targetLyrId);
if (upLyrId) {
return upLyrId;
}
}
}
return null;
};
const makeLegendSrc = layerinfo => {
if(!layerinfo.gobjTy) return null;
@@ -208,18 +190,13 @@ export default React.memo(function GisTree({ checkedNodes = [], setCheckedNodes
style={{ marginInlineStart: depth * 16 + (!node.droppable ? 16 : 0) }}
>
{node.droppable && (
<button onClick={onToggle} className="text-sm w-4 focus:outline-none" title={isOpen ? '닫기' : '열기'}>
{isOpen ? '▾' : '▸'}
</button>
<i onClick={onToggle} className={`diveicon di-arrow-forward mr-2 text-base text-label ${isOpen ? 'rotate-90' : ''}`}
title={isOpen ? '닫기' : '열기'}>
</i>
)}
<input
type="checkbox"
checked={checked.includes(node.id)}
onChange={() => handleCheck(node.id)}
className="cursor-pointer"
/>
{node.icon && <span className="inline-block w-4 h-4 mr-1">{node.icon}</span>}
<span className="text-sm truncate">{node.text}</span>
<input type="checkbox" checked={checked.includes(node.id)} onChange={() => handleCheck(node.id)} className="cursor-pointer"/>
{node.icon && <span>{node.icon}</span>}
<span className="text-[1.3rem] font-medium text-label">{node.text}</span>
</div>
)}
sort={(a, b) => {
@@ -0,0 +1,377 @@
import React from 'react';
import axios from 'axios';
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogClose,
} from '@common/components/ui/dialog';
import { Button } from '@common/components';
import { UiTable } from '../../ui';
const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`;
const TABS = [
{ key: 'basic', label: '기본정보' },
{ key: 'operation', label: '운영정보' },
{ key: 'report', label: '하수도정비기본계획보고서' },
];
const WORK_TYPES = [
{ key: 'maintenance', label: '보수 및 갱신' },
{ key: 'cleaning', label: '청소 및 준설' },
{ key: 'inspection', label: '점검 및 진단' },
];
const YEARS = Array.from({ length: 150 }, (_, i) => `${2025 - i}`);
const tableHeadlist = [
{ id: 'no', title: 'NO' },
{ id: 'fileNm', title: '파일명' },
{ id: 'manageYear', title: '년도' },
{ id: 'bungi', title: '분기' },
{ id: 'registDt', title: '등록 일자' },
{ id: 'registUsr', title: '등록자' }
]
const tableData = [
{ 'no': '1', 'fileNm': '파일명', 'manageYear': '2023', 'registDt': '2025-04-16', 'registUsr': 'me', 'bungi': '1분기' },
{ 'no': '2', 'fileNm': '파일명', 'manageYear': '2024', 'registDt': '2025-04-16', 'registUsr': 'me2', 'bungi': '1분기' },
{ 'no': '3', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '4', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '5', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '6', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '7', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '8', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '9', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' },
{ 'no': '10', 'fileNm': '파일명', 'manageYear': '2025', 'registDt': '2025-04-16', 'registUsr': 'me3', 'bungi': '1분기' }
]
const BASIC_TYPES = [
{ key: 'SEWER_PIPE', label: '하수관로' },
{ key: 'TREATMENT_FACILITY', label: '하수처리시설' },
{ key: 'TREATMENT_AREA', label: '하수처리구역' },
{ key: 'MANHOLE', label: '하수맨홀' },
{ key: 'WASTEWATER_PUMP', label: '오수펌프' },
{ key: 'RAINWATER_PUMP', label: '빗물펌프' },
{ key: 'OUTFALL', label: '우수토실' },
{ key: 'RETENTION_FACILITY', label: '하수저류시설' },
{ key: 'PRIORITY_OUTFALL', label: '중점우수토실' },
];
const sidoList = ['선택', '서울', '경기', '부산'];
const sigunguList = ['선택', '강남구', '서초구', '수원시'];
const 처리구역List = ['선택', 'A', 'B'];
const 하수관용도List = ['선택', '우수', '오수'];
const 관재질List = ['선택', 'PVC', 'PE'];
const 설치년도List = ['선택', ...YEARS];
const 경과년도List = ['선택', '1', '2', '3'];
// tableHeadlist, tableData 타입 예시 (실제 타입에 맞게 수정)
type TableHead = {
key: string;
label: string;
};
type TableRow = Record<string, any>;
interface SearchModalProps {
open: boolean;
onOpenChange: (open: boolean) => void;
}
const SearchModal: React.FC<SearchModalProps> = ({ open, onOpenChange }) => {
const [activeTab, setActiveTab] = React.useState('operation');
const [workType, setWorkType] = React.useState(WORK_TYPES[0]?.key ?? '');
const [startYear, setStartYear] = React.useState('');
const [endYear, setEndYear] = React.useState('');
const [showTable, setShowTable] = React.useState(false);
const [curPage, setCurPage] = React.useState(1);
const [basicType, setBasicType] = React.useState(BASIC_TYPES[0]?.key ?? '');
const [관리번호, set관리번호] = React.useState('');
const [시도, set시도] = React.useState('');
const [시군구, set시군구] = React.useState('');
const [처리구역, set처리구역] = React.useState('');
const [하수관용도, set하수관용도] = React.useState('');
const [관재질, set관재질] = React.useState('');
const [설치년도1, set설치년도1] = React.useState('');
const [설치년도2, set설치년도2] = React.useState('');
const [경과년도, set경과년도] = React.useState('');
const [연장1, set연장1] = React.useState('');
const [연장2, set연장2] = React.useState('');
// cellClick 함수 타입 지정
const handleCellClick = (row: TableRow, col: TableHead) => {
// 원하는 동작 구현
console.log(row, col);
};
const modalMinWidth = 'min-w-[900px]';
const modalMaxWidth = 'max-w-6xl';
// 모달 높이 동적 계산
const contentRef = React.useRef<HTMLDivElement>(null);
const [dynamicHeight, setDynamicHeight] = React.useState<number | undefined>(undefined);
// API 호출 테스트 (axios 사용)
React.useEffect(() => {
// API_URL root 경로 확인 테스트
console.log('API_URL:', API_URL);
// lyrTypeNm과 cql_filter에 따른 API 호출 테스트
axios.get(`${API_URL}/v1/map/features?lyrTypeNm=tb_ms_swage_prcs_zone&cql_filter=ctpv_nm='전라북도'`)
.then(res => {
console.log('API DATA:', res.data); // 실제 JSON 데이터 출력
})
.catch(err => {
console.error('API ERROR:', err);
});
}, []);
React.useEffect(() => {
if (contentRef.current) {
setDynamicHeight(contentRef.current.scrollHeight + 60); // 여유 padding
}
}, [activeTab, showTable, curPage, tableData.length]);
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className={`
${modalMaxWidth} ${modalMinWidth}
transition-all duration-300
w-full overflow-hidden
`}
style={{ minHeight: showTable ? 600 : 220 }}
>
<DialogHeader>
<DialogTitle>검색</DialogTitle>
</DialogHeader>
{/* 탭 영역 */}
<div className="flex gap-2 mb-4">
{TABS.map(tab => (
<button
key={tab.key}
className={`px-4 py-2 rounded-t border border-b-0 text-base font-semibold
${activeTab === tab.key
? 'bg-[#bfcfe6] text-black'
: 'bg-[#e6e6e6] text-gray-700'
}`}
style={{
borderColor: '#888',
borderBottom: activeTab === tab.key ? '2px solid white' : undefined,
minWidth: 140,
fontSize: '1.1rem'
}}
onClick={() => setActiveTab(tab.key)}
>
{tab.label}
</button>
))}
</div>
{/* 기본정보 탭 */}
{activeTab === 'basic' && (
<div className="border rounded p-6 mb-4">
{/* 구분 */}
<div className="flex items-center mb-3">
<label className="font-semibold mr-2">구분</label>
<select className="border rounded px-2 py-1" value={basicType} onChange={e => setBasicType(e.target.value)}>
{BASIC_TYPES.map(opt => (
<option key={opt.key} value={opt.key}>{opt.label}</option>
))}
</select>
</div>
{/* 관리번호, 시도, 시군구 한 줄 */}
<div className="flex items-center mb-3">
<label className="font-semibold mr-2">관리번호</label>
<input className="border rounded px-2 py-1 mr-4" value={관리번호} onChange={e => set관리번호(e.target.value)} />
<label className="font-semibold mr-2">시도</label>
<select className="border rounded px-2 py-1 mr-4" value={시도} onChange={e => set시도(e.target.value)}>
{sidoList.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<label className="font-semibold mr-2">시군구</label>
<select className="border rounded px-2 py-1" value={시군구} onChange={e => set시군구(e.target.value)}>
{sigunguList.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
</div>
{/* 처리구역, 하수관용도, 관재질 한 줄 */}
<div className="flex items-center mb-3">
<label className="font-semibold mr-2">처리구역</label>
<select className="border rounded px-2 py-1 mr-4" value={처리구역} onChange={e => set처리구역(e.target.value)}>
{처리구역List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<label className="font-semibold mr-2">하수관용도</label>
<select className="border rounded px-2 py-1 mr-4" value={하수관용도} onChange={e => set하수관용도(e.target.value)}>
{하수관용도List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<label className="font-semibold mr-2">관재질</label>
<select className="border rounded px-2 py-1" value={관재질} onChange={e => set관재질(e.target.value)}>
{관재질List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
</div>
{/* 설치년도, 경과년도 한 줄 */}
<div className="flex items-center mb-3">
<label className="font-semibold mr-2">설치년도</label>
<select className="border rounded px-2 py-1 mr-2" value={설치년도1} onChange={e => set설치년도1(e.target.value)}>
{설치년도List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<span className="mx-1">~</span>
<select className="border rounded px-2 py-1 mr-6" value={설치년도2} onChange={e => set설치년도2(e.target.value)}>
{설치년도List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<label className="font-semibold mr-2">경과년도</label>
<select className="border rounded px-2 py-1" value={경과년도} onChange={e => set경과년도(e.target.value)}>
{경과년도List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
</div>
{/* 연장 한 줄 */}
<div className="flex items-center mb-4">
<label className="font-semibold mr-2">연장(m)</label>
<input className="border rounded px-2 py-1 mr-2" value={연장1} onChange={e => set연장1(e.target.value)} />
<span className="mx-1">~</span>
<input className="border rounded px-2 py-1" value={연장2} onChange={e => set연장2(e.target.value)} />
</div>
{/* 조회 버튼 중앙 정렬 */}
<div className="flex justify-center">
<Button className="w-40 text-base py-2">조회</Button>
</div>
</div>
)}
{/* 운영정보 탭 */}
{activeTab === 'operation' && (
<div className="border rounded p-6 mb-4">
<div className="flex items-center gap-6 mb-6">
<label className="w-24 font-semibold text-base">업무구분</label>
<select
className="border rounded px-3 py-2 text-base"
value={workType}
onChange={e => setWorkType(e.target.value)}
style={{ minWidth: 140 }}
>
{WORK_TYPES.map(w => (
<option key={w.key} value={w.key}>{w.label}</option>
))}
</select>
<label className="w-16 text-center font-semibold text-base">년도</label>
<select
className="border rounded px-3 py-2 text-base"
value={startYear}
onChange={e => setStartYear(e.target.value)}
style={{ minWidth: 100 }}
>
<option value="">선택</option>
{YEARS.map(y => (
<option key={y} value={y}>{y}</option>
))}
</select>
<span className="mx-2 text-lg">~</span>
<select
className="border rounded px-3 py-2 text-base"
value={endYear}
onChange={e => setEndYear(e.target.value)}
style={{ minWidth: 100 }}
>
<option value="">선택</option>
{YEARS.map(y => (
<option key={y} value={y}>{y}</option>
))}
</select>
</div>
<div className="flex justify-center">
<Button className="w-40 text-base py-2" onClick={() => setShowTable(true)}>
조회
</Button>
</div>
</div>
)}
{/* 하수도정비기본계획보고서서 탭 */}
{activeTab === 'report' && (
<div className="border rounded p-6 mb-4">
{/* 시도, 시군구, 하수처리구역 한 줄 */}
<div className="flex items-center mb-3">
<label className="font-semibold mr-2">시도</label>
<select className="border rounded px-2 py-1 mr-4" value={시도} onChange={e => set시도(e.target.value)}>
{sidoList.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<label className="font-semibold mr-2">시군구</label>
<select className="border rounded px-2 py-1 mr-4" value={시군구} onChange={e => set시군구(e.target.value)}>
{sigunguList.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<label className="font-semibold mr-2">하수처리구역</label>
<select className="border rounded px-2 py-1 mr-2" value={처리구역} onChange={e => set처리구역(e.target.value)}>
{처리구역List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<input className="border rounded px-2 py-1 w-24" placeholder="0000" />
</div>
{/* 승인년도 한 줄 */}
<div className="flex items-center mb-4">
<label className="font-semibold mr-2">승인년도</label>
<select className="border rounded px-2 py-1 mr-2" value={설치년도1} onChange={e => set설치년도1(e.target.value)}>
{설치년도List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
<span className="mx-1">~</span>
<select className="border rounded px-2 py-1" value={설치년도2} onChange={e => set설치년도2(e.target.value)}>
{설치년도List.map(opt => (
<option key={opt} value={opt}>{opt}</option>
))}
</select>
</div>
{/* 조회 버튼 중앙 정렬 */}
<div className="flex justify-center">
<Button className="w-40 text-base py-2">조회</Button>
</div>
</div>
)}
{/* 📋 결과 리스트 */}
<div className="border-t pt-6 space-y-2">
{/* 선택된 탭의 label */}
<div className="text-2xl font-bold mb-2">
{TABS.find(tab => tab.key === activeTab)?.label}
</div>
{/* "▶" + 선택된 탭 label + " 조회 결과" */}
<div className="text-lg font-semibold mb-6">
▶ {TABS.find(tab => tab.key === activeTab)?.label} 조회 결과
</div>
<UiTable headName='' tableData={tableData} headlist={tableHeadlist}
pageSize={10} total={20} children={undefined}
cellClick={() => { }} onPageChange={function (page: number): void {
throw new Error('Function not implemented.')
}}>
</UiTable>
</div>
</DialogContent>
</Dialog>
);
}
export default React.memo(SearchModal);
@@ -102,7 +102,7 @@
.tool-bar {
position: absolute;
top: 140px;
top: 70px;
right: 20px;
z-index: 2;
}
@@ -244,7 +244,7 @@
background: url(../images/toolbar/btn_cont_zoomin_on.png) no-repeat center #67aee3;
}
.btn_control_zoomout {
background: url(../images/toolbar/btn_cont_zoomout.png) no-repeat center !important;
background: url(../images/toolbar/btn_cont_zoomout.png) no-repeat center;
}
.btn_control_zoomout:hover {
background: url(../images/toolbar/btn_cont_zoomout_on.png) no-repeat center #67aee3;
@@ -346,7 +346,7 @@
.select_control {
position: absolute;
top: 80px;
left: 250px;
left: 450px;
}
.select_control h3 {
overflow: hidden;
@@ -759,8 +759,6 @@
.puGrayTb {
position: relative;
width: 98.3%;
cellpadding: 0;
cellspcing: 0;
margin-top: 5px;
table-layout: fixed;
font-family: Verdana;
@@ -48,19 +48,31 @@ GisOlSelect.prototype = {
this.removeInteration();
}
let baseStyle = new Style({
stroke: new Stroke({
color: 'rgba(135, 116, 243, 0.4)',
width: 10,
image : new CircleStyle({
fill : new Fill({
color : 'rgba(135, 116, 243, 0.4)',
}),
radius : 30
}),
stroke : new Stroke({
color : 'rgba(135, 116, 243, 0.4)',
width : 10,
})
});
this.selectInteraction = new Select({
style: function (feature) {
style: function (feature, resolution) {
let styles = [];
let layer = feature.getLayer();
let style = GisApp.Module.style.getLayerStyle(layer, null);
if (style) {
styles.push(style);
let styleFn = GisApp.Module.style.getLayerStyleFunction(layer, null);
if (styleFn) {
const style = styleFn(feature, resolution);
if (Array.isArray(style)) {
styles.push(...style);
} else {
styles.push(style);
}
}
styles.push(baseStyle);
return styles;
@@ -72,9 +84,25 @@ GisOlSelect.prototype = {
condition: click,
hitTolerance: me.defaults.hitTolerance,
});
map.addInteraction(this.selectInteraction);
map.addInteraction(this.selectInteraction);
this.selectedFeatures = this.selectInteraction.getFeatures();
// 선택된 피처 중심으로 지도 이동
this.selectInteraction.on('select', function (e) {
const feature = e.selected[0];
if (feature) {
const geometry = feature.getGeometry();
if (geometry) {
const extent = geometry.getExtent();
map.getView().fit(extent, {
duration: 300,
padding: [50, 50, 50, 50],
maxZoom: 16
});
}
}
});
},
/**
* SELECT 피처 초기화
@@ -0,0 +1,18 @@
export default function SearchIcon() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
className="w-6 h-6 text-gray-700"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M21 21l-4.35-4.35M17 11A6 6 0 105 11a6 6 0 0012 0z"
/>
</svg>
);
}