테이블 데이터 변수명 및 스토어명, 필요없는 코드 삭제
This commit is contained in:
@@ -11,7 +11,7 @@ export default function Home() {
|
||||
<Link href="reuseFaciltyManage/reuseFacilityInsert/publicReuseFaciltyInsert"> 하수재이용 시설 등록</Link>
|
||||
</Button>
|
||||
<Button className='place-self-auto'>
|
||||
<Link href="reuseFaciltyManage/reuseFacilityInsert/waterReuseFaciltyInsert"> 물재이용 시설 등록</Link>
|
||||
<Link href="reuseFaciltyManage/reuseFacilityInsert/rainReuseFaciltyInsert"> 물재이용 시설 등록</Link>
|
||||
</Button>
|
||||
|
||||
</div>
|
||||
|
||||
+5
-26
@@ -4,34 +4,13 @@ import { ScrollArea, SearchDiv, SelectBox, UiTable } from '@common/business_comp
|
||||
import { Button, TableHead, TableRow } from '@common/components';
|
||||
import { PublicReuseFaciltyFormInsert } from '../../../../components/ui/publicReuseInsertForm';
|
||||
import { useWrStore } from '../../../store';
|
||||
import type { TableUpperProps } from '../../../store/publicReuseFaciltyInsert';
|
||||
|
||||
|
||||
|
||||
|
||||
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return ( <>
|
||||
<TableRow>{
|
||||
upHeadList.map((head: TableUpperProps) =>
|
||||
(!head.upSequnce?<TableHead rowSpan={2}key={head.id}>{head.title}</TableHead>:
|
||||
head.upName === 'upChangeRe'&& head.upSequnce=== 1?<TableHead key={head.id} rowSpan={1} colSpan={3}>{'중축 개축 증축 '}</TableHead>:null))}
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
{upHeadList.map((head: TableUpperProps) =>
|
||||
(head.upName === 'upChangeRe'?<TableHead key={head.id}>{head.title}</TableHead>:null))}
|
||||
</TableRow>
|
||||
</> )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export default function PublicReuseFaciltyInsert() {
|
||||
const {building} = useWrStore((state) => state);
|
||||
const { upHeadList, publicReuseFacilityUper} = building;
|
||||
const nodeList= headMakeColSpan(upHeadList);
|
||||
const total = 100;
|
||||
|
||||
const {pubFac} = useWrStore((state) => state);
|
||||
const { pubFacHeadList, publicReuseFacilityData, selectLabel} = pubFac;
|
||||
console.log(pubFacHeadList)
|
||||
|
||||
const searchDiv ='시군구'
|
||||
const selectBox = [{text:'한양', value:1}]
|
||||
@@ -54,8 +33,8 @@ import type { TableUpperProps } from '../../../store/publicReuseFaciltyInsert';
|
||||
</div>
|
||||
|
||||
<div className="col-span-1">
|
||||
<UiTable publicReuseFacility={publicReuseFacilityUper} headlist={upHeadList} pageSize={100} total={total} headName={headName()}>
|
||||
{nodeList}
|
||||
<UiTable tableData={publicReuseFacilityData} headlist={pubFacHeadList} pageSize={100} total={10} headName={headName()} children={undefined}>
|
||||
|
||||
</ UiTable>
|
||||
</div>
|
||||
<div className="col-span-1 max-h-full overflow-y-scroll">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client'
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type { TableUpperProps } from "@/app/store/publicReuseFaciltyInsert";
|
||||
import type { TableUpperProps } from "@/app/store/rainReuseFacilityInsert"
|
||||
import { RainReuseFaciltyInsertForm } from "@/components/ui/rainReuseInsertForm";
|
||||
import { SearchDiv, SearchInput, UiTable } from "@common/business_components";
|
||||
import { Button, TableHead, TableRow } from "@common/components";
|
||||
@@ -50,7 +50,7 @@ export default function Home() {
|
||||
<div className="grid grid-cols-2 gap-4">
|
||||
|
||||
<div className="colsapn-1 ">
|
||||
<UiTable publicReuseFacility={building.buildingObject} headlist={building.upHeadList} pageSize={100} total={total} headName={headName()}>
|
||||
<UiTable tableData={building.buildingObject} headlist={building.upHeadList} pageSize={100} total={10} headName={headName()}>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
export type TableUpperProps = {
|
||||
export type TableProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
}
|
||||
type PublicReuseFacility = {
|
||||
|
||||
export type selectLabel={
|
||||
title:string,
|
||||
val:string
|
||||
}
|
||||
|
||||
type publicReuseFacilityData = {
|
||||
sido: string,
|
||||
sigungo: string,
|
||||
facilityName: string,
|
||||
@@ -16,19 +20,27 @@ type PublicReuseFacility = {
|
||||
area?: string,
|
||||
reuse?: string,
|
||||
register?: string
|
||||
|
||||
|
||||
}
|
||||
const upHeadList:TableUpperProps[] = [
|
||||
|
||||
|
||||
const selectLabel:selectLabel[]=[
|
||||
{title:'test',val:'1'}
|
||||
]
|
||||
|
||||
|
||||
const pubFacHeadList:TableProps[] = [
|
||||
{ id: "sido", title: "시도"},
|
||||
{ id: "sigungo", title: "시군구"},
|
||||
{ id: "facilityName", title: "시설명"},
|
||||
{ id: "location", title: "위치"},
|
||||
{ id: "locationgubun", title: "지역구분"},
|
||||
{ id: "facilityCapacity", title: "시설용량"},
|
||||
{ id: "yn", title: '여부', upName:'upChangeRe' , upSequnce:1 },
|
||||
{ id: "authoDay", title: '허가일',upName:'upChangeRe', upSequnce:2 },
|
||||
{ id: "area", title: '면적' ,upName:'upChangeRe',upSequnce:3 }];
|
||||
{ id: "yn", title: '재이용여부' },
|
||||
{ id: "authoDay", title: '등록여부'}];
|
||||
|
||||
const publicReuseFacilityUper:PublicReuseFacility[] = [
|
||||
const publicReuseFacilityData:publicReuseFacilityData[] = [
|
||||
{
|
||||
sido: "서울",
|
||||
sigungo: "강남구",
|
||||
@@ -62,31 +74,33 @@ const publicReuseFacilityUper:PublicReuseFacility[] = [
|
||||
},
|
||||
]
|
||||
|
||||
export type tableState = {pubFac:{
|
||||
export type pubFacState = {pubFac:{
|
||||
isInit: boolean;
|
||||
upHeadList: TableUpperProps[];
|
||||
publicReuseFacilityUper: PublicReuseFacility[];
|
||||
pubFacHeadList: TableProps[];
|
||||
publicReuseFacilityData: publicReuseFacilityData[];
|
||||
selectLabel:selectLabel[];
|
||||
}}
|
||||
type tableActions = {
|
||||
type pubFacActions = {
|
||||
decrementList: () => void
|
||||
}
|
||||
|
||||
export type tableType = tableState & tableActions;
|
||||
export type pubFacType = pubFacState & pubFacActions;
|
||||
|
||||
export const tableStateExport:tableState= {pubFac:{
|
||||
export const pubFacStateExport:pubFacState= {pubFac:{
|
||||
isInit:false,
|
||||
upHeadList: upHeadList,
|
||||
publicReuseFacilityUper: publicReuseFacilityUper,
|
||||
pubFacHeadList: pubFacHeadList,
|
||||
publicReuseFacilityData: publicReuseFacilityData,
|
||||
selectLabel:selectLabel
|
||||
}}
|
||||
export const tableActionsExport:(set:any)=>tableActions=(set: any) => {
|
||||
export const pubFacActionsExport:(set:any)=>pubFacActions=(set: any) => {
|
||||
return {
|
||||
decrementList:()=>set(
|
||||
(state:tableState) => {
|
||||
(state:pubFacState) => {
|
||||
return (
|
||||
{pubFac:{
|
||||
upHeadList: state.pubFac.upHeadList,
|
||||
pubFacheadList: state.pubFac.pubFacHeadList,
|
||||
publicReuseFacilityUper:
|
||||
state.pubFac.publicReuseFacilityUper.slice(0, state.pubFac.publicReuseFacilityUper.length - 1)
|
||||
state.pubFac.publicReuseFacilityData.slice(0, state.pubFac.publicReuseFacilityData.length - 1)
|
||||
}})}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ type buildingOfType = {
|
||||
register?: string,
|
||||
legalTargetYn:string,
|
||||
}
|
||||
|
||||
const upHeadList:TableUpperProps[] = [
|
||||
{ id: "sido", title: "시도"},
|
||||
{ id: "sigungo", title: "시군구"},
|
||||
@@ -92,6 +93,7 @@ export const buildingtableStateExport:buildingTableState= {building:{
|
||||
isInit:false,
|
||||
upHeadList: upHeadList,
|
||||
buildingObject: buildingObject,
|
||||
|
||||
}}
|
||||
export const buildingTableActionsExport:(set:any)=>buildingTableActions=(set: any) => {
|
||||
return {
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { createStore } from 'zustand/vanilla';
|
||||
import { tableActionsExport, tableStateExport, type tableState, type tableType } from './publicReuseFaciltyInsert/index';
|
||||
import { pubFacActionsExport, pubFacStateExport, type pubFacState, type pubFacType } from './publicReuseFaciltyInsert/index';
|
||||
import { buildingTableActionsExport, buildingtableStateExport, type buildingTableType } from './rainReuseFacilityInsert';
|
||||
export type WrStore = tableType & buildingTableType;
|
||||
export const StoreZus = (initState: tableState = tableStateExport) => {
|
||||
export type WrStore = pubFacType & buildingTableType;
|
||||
export const StoreZus = (initState: pubFacState = pubFacStateExport) => {
|
||||
return createStore<WrStore>()((set) => {
|
||||
return {
|
||||
...initState,
|
||||
...tableActionsExport(set),
|
||||
...pubFacActionsExport(set),
|
||||
...buildingtableStateExport,
|
||||
...buildingTableActionsExport(set)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user