Files
frontend/apps/sn/app/oper/pplines/page.tsx
T

71 lines
3.1 KiB
TypeScript

'use client'
import { useEffect, useState } from "react";
import { SearchDiv, SelectBox, UiTable } from '@common/business_components';
import { Button, Input } from '@common/components';
import { useRouter } from "next/navigation";
import { pplinesService } from "@service";
const tableHeadlist = [
{ id: "ftreSmbol", title: "지형지물부호"},
{ id: "swageLnkgPplPk", title: "하수연결관로기본키"},
{ id: "pbadmsEmd", title: "행정읍면동"},
{ id: "sttyEmd", title: "법정읍면동"}
];
export default function Pplines() {
const router = useRouter()
const total = 100
const pageSize = 20
const headName = () => {
return(
<div className="card-header">
<h3 className="text-2xl font-medium text-label">현황정보</h3>
</div>
)
}
const [data, setData] = useState<{ content: any[] }>({ content: [] }); // 초기값을 객체 또는 null로 설정
const fetchData = async () => {
try {
const response = await pplinesService.getPplines();
setData(response.data); // API 응답 저장
} catch (error) {
console.error("데이터 불러오기 실패:", error);
}
};
// 컴포넌트 마운트 시 1회 실행
useEffect(() => {
fetchData();
}, []);
return (
<div className="h-auto min-h-full bg-container">
<h2 className="px-[1.8rem] pt-[2rem] text-[2.4rem] font-semibold text-title">
관로시설
</h2>
<SearchDiv>
<form className='grid grid-cols-12 gap-1 w-4/5'>
<SelectBox label='시설물' selectArray={[{text:'관로', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='사용여부' selectArray={[{text:'사용', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='경과년도' selectArray={[{text:'10년', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='경사' selectArray={[{text:'', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='흐름방식' selectArray={[{text:'자연유하', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='용도' selectArray={[{text:'오수관', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='관종' selectArray={[{text:'PE관관', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<SelectBox label='관경' selectArray={[{text:'50', val:'1'}]} className='col-span-3' onSelectValue={(val: string)=>{}} selectClass='w-24' />
<Button className="h-[3.2rem]" onClick={fetchData}>조회</Button>
</form>
</SearchDiv>
<div className="card card-border">
<UiTable tableData={data.content} headlist={tableHeadlist} pageSize={pageSize} total={total} children={null} headName={headName()} cellClick={()=>{}} />
</div>
</div> );
}