Merge commit '36f1d50162b401662f2b36dddaf29263888d553f' into iipbs/wr/hasuReg

This commit is contained in:
leedj312
2025-06-05 18:09:02 +09:00
19 changed files with 857 additions and 189 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ import { useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
export default function coMatRvw() {
export default function CoMatRvw() {
const { code, coRvw, } = useWrStore((state) => state);
const { coRvwHeadList, } = coRvw;
const [fromDate, setFromDate] = useState<Date>(new Date());
+162 -74
View File
@@ -1,85 +1,176 @@
"use client";
import { useWrStore } from "@/app/store";
import { Button } from "@common/components/ui";
import { btnClass } from "@/app/store/common/code";
import ListDiv from "@common/business_components/ui/list_div";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import type { customCoSttnBdst } from "@/app/store/matDmd/coSttn";
import { excelDownload, getCity, getCityOrSgg, tableData } from "@/components/lib/func/commom";
import {
ContentsDiv,
SearchBaseForm,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiModal,
UiTable,
type ReturnType,
type SelectDataType
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import SdmInsertForm, { type DemandCompType } from "@common/business_components/ui/sdmInsertForm";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
export default function CoSttn() {
const [bdstTable, setBdstTable] = useState<customCoSttnBdst[]>();
export default function coSttn() {
const [bdstTable, setBdstTabl] = useState<customCoBdst[]>();
const [pageNation, setPageNation] = useState(1);
const { code, coSttn ,getDemandCompList,regDemandCompany,demandCompList} = useWrStore(
(state) => state
);
const [isDmdModal, setIsDmdModal] = useState<{isMoal: boolean, data: DemandCompType}>({isMoal: false, data: {} as DemandCompType})
const { code, coSttn, coSttnInit, coSttnSearch, getDemandCompList, regDemandCompany, demandCompList } = useWrStore((state) => state);
const { coSttnRes } = coSttn;
const [isDmdModal, setIsDmdModal] = useState<{ isMoal: boolean, data: DemandCompType }>({ isMoal: false, data: {} as DemandCompType })
const [fromDate, setFromDate] = useState<Date>(new Date());
const [toDate, setToDate] = useState<Date>(new Date());
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const ref = useRef<ReturnType>({} as ReturnType);
const codeData = getCityOrSgg(ref);
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) })
};
useEffect(() => {
if (!coSttn.isInit) {
coSttnInit(codeData ?? "0");
}
}, [coSttn.isInit, coSttnInit]);
useEffect(() => {
if (coSttnRes.length > 0 && code.cityCd.length > 0) {
const data = tableData(coSttnRes, { code });
const chData = data
.map((item: any) => ({
...item
}))
// .filter((item: any) => item !== undefined);
setBdstTable(chData);
}
}, [coSttnRes]);
useEffect(() => {
if (coSttn.excelList.length > 0) {
if (coSttn.excelList.length === 0) return;
excelDownload(
coSttn.excelList,
"수요처 관리",
"sample_coSttn.xlsx",
"A1:F1",
2
);
}
}, [coSttn.excelList]);
const excelClick = useCallback(() => {
}, []);
console.log("??")
coSttnSearch("마인드원", 1);
}, [coSttnSearch]);
return(
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"수요처 관리"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<div>
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<div className="col-span-5 w-auto">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">수요신청년도</Label>
<div className="flex flex-row w-1/4">
<DatePicker mode={'single'}
selected={fromDate}
onSelect={(date: Date | undefined) => { if (date) setFromDate(date) }} />
<span>~</span>
<DatePicker mode={'single'}
selected={toDate}
onSelect={(date: Date | undefined) => { if (date) setToDate(date) }} />
</div>
</div>
</div>
<SearchInput
className={"text-2xl"}
label="회사명"
textValue={""}
setText={(e) => {
}}
/>
</div>
</SearchFormLeft>
<SearchFormRight
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
className={btnClass}
onClick={() => {
setIsDmdModal({ ...isDmdModal, isMoal:true });
}}
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => {
setIsDmdModal({ ...isDmdModal, isMoal: true });
}}
>
등록
</Button>
<Button
className={btnClass}
onClick={() => {
/* 저장 로직 */
}}
size={"sm"}
className={btnClass}
onClick={() => {
/* 저장 로직 */
}}
>
저장
</Button>
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={excelClick}
>
다운로드
</Button>
</div>
}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
if (returnType.sigunValue != "0") {
con = returnType.sigunValue;
} else {
con = returnType.sidoValue;
}
// coSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
@@ -88,41 +179,38 @@ export default function coSttn() {
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={coSttn.coSttNodeList} />
}
headlist={coSttn.coSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined,headId:string)=>{} }
cellClick={(index: number | undefined, headId: string) => { }}
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
</div>
<UiModal
bodyClass={"w-[40vw] max-w-none h-[90vh]"}
open={isDmdModal.isMoal}
onOpenChange={() => {
setIsDmdModal({ isMoal: false, data: {} as DemandCompType });
}}
body={
<SdmInsertForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
dataList={demandCompList}
rtnValue={(searchText: string, pageCnt: number) => {
getDemandCompList(searchText, pageCnt);
}}
rtnInputData={(data) => {
console.log(" rtn data ", data);
regDemandCompany(data as DemandCompType);
setIsDmdModal({ isMoal: false, data: data as DemandCompType });
}}
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
></SdmInsertForm>
}
></UiModal>
<UiModal
bodyClass={"w-[40vw] max-w-none h-[90vh]"}
open={isDmdModal.isMoal}
onOpenChange={() => {
setIsDmdModal({ isMoal: false, data: {} as DemandCompType });
}}
body={
<SdmInsertForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
dataList={demandCompList}
rtnValue={(searchText: string, pageCnt: number) => {
getDemandCompList(searchText, pageCnt);
}}
rtnInputData={(data) => {
console.log(" rtn data ", data);
regDemandCompany(data as DemandCompType);
setIsDmdModal({ isMoal: false, data: data as DemandCompType });
}}
bodyClassNm={"w-full mx-auto bg-white rounded-lg shadow-md p-6"}
></SdmInsertForm>
}
></UiModal>
</ContentsDiv>
</>
+122 -76
View File
@@ -1,109 +1,158 @@
"use client";
import { useWrStore } from "@/app/store";
import { Button } from "@common/components/ui";
import { btnClass } from "@/app/store/common/code";
import ListDiv from "@common/business_components/ui/list_div";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import {
excelDownload,
getCity,
tableData,
} from "@/components/lib/func/commom";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customCoBdst } from "@/app/store/matDmd/coReg";
import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcel";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
import {
ContentsDiv,
SearchBaseForm,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiModal,
UiTable,
type ReturnType,
type SelectDataType,
} from "@common/business_components/ui";
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
import CoRegExcel from "@/components/ui/modal/coReg/coRegExcel/coRegExcel";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Label } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
export default function ldrmntCoSttn() {
export default function LdrmntCoSttn() {
const { code, ldrmntCoSttn } = useWrStore(
(state) => state
(state) => state
);
const { ldrmntCoSttnRes } = ldrmntCoSttn;
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customCoBdst|undefined}>({data:undefined,isOpen:false })
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customCoBdst | undefined }>({ data: undefined, isOpen: false })
const [pageNation, setPageNation] = useState(1);
const [isRegExcel, setIsRegExcel] = useState(false);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const ref = useRef<ReturnType>({} as ReturnType);
const excelClick = useCallback(() => {
excelDownload(
[[]],
"잠재수요처 관리",
"sample_ldrmntCoSttn.xlsx",
"A1:AL1",
2
);
}, []);
const cellClick=(index:number|undefined, headId: string)=>{
if(index!==undefined && bdstTable!==undefined){
setDetailModal({isOpen:true ,data:bdstTable[index] })
const cellClick = (index: number | undefined, headId: string) => {
if (index !== undefined && bdstTable !== undefined) {
setDetailModal({ isOpen: true, data: bdstTable[index] })
}
}
useEffect(() => {
if (ldrmntCoSttnRes.length > 0 && code.cityCd.length > 0) {
const data = tableData(ldrmntCoSttnRes, { code });
console.log("data", data);
const chData = data
.map((item: any) => ({
...item
}))
.filter((item: any) => item !== undefined);
setBdstTable(chData);
}
}, [code, ldrmntCoSttnRes, ldrmntCoSttn.ldrmntCoSttHeadList]);
const getSelCity = (val: string | number) => {
const cityValue = String(val); // Ensure val is treated as a string
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
return(
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) })
};
useEffect(() => {
if (ldrmntCoSttnRes.length > 0 && code.cityCd.length > 0) {
const data = tableData(ldrmntCoSttnRes, { code });
console.log("data", data);
const chData = data
.map((item: any) => ({
...item
}))
.filter((item: any) => item !== undefined);
setBdstTable(chData);
}
}, [code, ldrmntCoSttnRes, ldrmntCoSttn.ldrmntCoSttHeadList]);
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"잠재수요처 관리"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<div>
<SearchDiv>
<SearchFormLeft>
<div className="col-span-10 flex flex-row">
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/6 h-full text-2xl ml-4"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<SearchInput
className={"text-2xl ml-4"}
label="회사명"
textValue={""}
setText={(e) => {
}}
/>
</div>
</SearchFormLeft>
<SearchFormRight
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="flex flex-row space-x-2">
<Button
className={btnClass}
onClick={() => setIsRegExcel(!isRegExcel)}
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
<Button
size={"sm"}
className={btnClass}
onClick={() => { }}
>
엑셀등록
</Button>
<Button
className={btnClass}
onClick={() => {
// 저장 로직
}}
size={"sm"}
className={btnClass}
onClick={() => {
/* 저장 로직 */
}}
>
다운로드
</Button>
<Button
size={"sm"}
className={`${btnClass} green`}
onClick={excelClick}
>
양식받기
</Button>
</div>
}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
if (returnType.sigunValue != "0") {
con = returnType.sigunValue;
} else {
con = returnType.sidoValue;
}
// ldrmntCoSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
@@ -112,33 +161,30 @@ export default function ldrmntCoSttn() {
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={ldrmntCoSttn.ldrmntCoSttNodeList} />
}
headlist={ldrmntCoSttn.ldrmntCoSttHeadList}
pageSize={20}
total={10000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
<UiModal
<UiModal
open={detailModal.isOpen}
onOpenChange={()=>{
setDetailModal({...detailModal, isOpen:!detailModal.isOpen})
onOpenChange={() => {
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen })
}}
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<CoDetailModal formObj={detailModal.data}/>}/>
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<CoDetailModal formObj={detailModal.data} />} />
<UiModal
bodyClass={"w-[40vw] max-w-none"}
open={isRegExcel}
body={<CoRegExcel></CoRegExcel>}
onOpenChange={setIsRegExcel}
/>
<UiModal
bodyClass={"w-[40vw] max-w-none"}
open={isRegExcel}
body={<CoRegExcel></CoRegExcel>}
onOpenChange={setIsRegExcel}
/>
</div>
</ContentsDiv>
</>
@@ -0,0 +1,127 @@
"use client";
import { useWrStore } from "@/app/store";
import { getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, SearchDiv, SearchFormLeft, SearchFormRight, SearchInput, SelectBox, Title, UiTable, type SelectDataType } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useState } from "react";
export default function RuseCaseMng() {
const { code, } = useWrStore((state) => state);
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
const getSelCity = (val: string | number) => {
const cityValue = String(val);
const data = getCity(cityValue, code.sggCd);
setSelectSgg(data);
setObjSearch({ city: cityValue, sgg: '' });
};
const getSgg = (val: string | number) => {
console.log(val);
setObjSearch({ ...objSearch, sgg: String(val) })
};
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
<Title title={"물재이용사례 관리"} />
<SearchDiv>
<SearchFormLeft>
<div className="col-span-8 flex flex-row">
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시도"
selectClass={""}
selectArray={code.cityCd || []}
onSelectValue={getSelCity}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
/>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="용도"
selectClass={""}
selectArray={[]}
onSelectValue={() => { }}
/>
<SelectBox
className="ml-4 col-span-2 w-1/3 h-full text-2xl"
label=" "
selectClass={""}
selectArray={[]}
onSelectValue={() => { }}
/>
<SearchInput
className={"text-2xl"}
label=""
textValue={""}
setText={(e) => {
}}
/>
</div>
</SearchFormLeft>
<SearchFormRight
className="w-2/12 mx-5 flex flex-col items-center justify-center space-x-2 ">
<div className="space-y">
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
onClick={(e) => { }}
>
조회
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
엑셀등록
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
다운로드
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
양식받기
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={"물재이용사례 현황"}
tableData={[]}
children={undefined}
headlist={[]}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
}}
onPageChange={() => { }}
></UiTable>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
@@ -13,7 +13,7 @@ import { useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
export default function ruseRvwHstry() {
export default function RuseRvwHstry() {
const { code, ruseHstry, } = useWrStore((state) => state);
const { ruseHstryHeadList, } = ruseHstry;
const [fromDate, setFromDate] = useState<Date>(new Date());
+12
View File
@@ -48,6 +48,13 @@ export default function Home() {
</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="ruseFcltMng/prfmncSttn/pbnstPrfmncSttn">
하수재이용실적 현황
</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="ruseFcltMng/prfmncReg/chkgdnReg">
@@ -134,6 +141,11 @@ export default function Home() {
<Link href="matMng/matDmd/ruseRvwHstry">재이용검토이력</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/ruseCaseMng">물재이용사례 관리</Link>
</Button>
</div>
</div>
</div>
</div>
@@ -0,0 +1,126 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import { yearOptions } from "@/components/lib/func/commom";
import { ContentsDiv, SearchBaseForm, SearchDiv, SearchFormLeft, SearchInput, SelectBox, Title, UiTable } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, DatePicker, Label } from "@common/components/ui";
import { useEffect, useState } from "react";
export default function PbnstPrfmncSttn() {
const { code, tableHeadMaker, pbnstPrfmncSttn, pbnstPrfmncSearch } = useWrStore((state) => state);
const { pbnstPrfHeadList } = pbnstPrfmncSttn;
const [isChHead, setIsChHead] = useState(false);
const [fromDate, setFromDate] = useState<string>(String(new Date().getFullYear()));
const [toDate, setToDate] = useState<string>(String(new Date().getFullYear()));
return (
<>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"하수재이용실적 현황"} />
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<Button
className={btnClass}
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>
}
leftChildren={
<div className="col-span-5">
<div className="flex flex-row">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">하수 재이용년도</Label>
<SelectBox
className="h-full text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={fromDate}
onSelectValue={(val: string | number) =>
setFromDate(String(val))
}
/>
<SelectBox
className="h-full text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={toDate}
onSelectValue={(val: string | number) =>
setToDate(String(val))
}
/>
</div>
<SearchInput
className={"text-2xl"}
label="시설명"
textValue={""}
setText={(e) => {
}}
/>
<SelectBox
className="h-full text-2xl"
label="재이용시설명"
selectClass={""}
selectArray={[]}
value={""}
onSelectValue={() => { }}
/>
</div>
</div>
}
queryClick={function (): void {
if (fromDate && toDate) {
const fromNum = Number(fromDate)
const toNum = Number(toDate)
if (fromNum > toNum) {
alert("시작년도가 종료년도 이후로 설정할 수 없습니다.")
} else {
if (toNum - fromNum > 5) {
alert("최대 5년까지 선택 가능합니다.")
} else {
tableHeadMaker(fromNum, toNum)
}
}
}
}}
excelClick={() => { }}
initClick={function (): void { }}
btnClass={btnClass}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={[]}
headlist={pbnstPrfHeadList}
pageSize={20}
total={10000}
cellClick={() => { }}
onPageChange={() => { }}
/>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
)
}
+2 -1
View File
@@ -16,7 +16,8 @@ export type TableUpperProps = {
upSequnce?: number;
edit?:boolean;
visible?:boolean;
rowSpan?: true;
rowSpan?: number;
colSpan?: number;
type?: string;
};
+17
View File
@@ -0,0 +1,17 @@
import type { customCoSttnBdst } from ".";
export const excelCoSttnParsing = (data: customCoSttnBdst[]): string[][] => {
const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
String(item.ctpvCd),
String(item.sggCd),
item.dmdCoNm ?? "",
item.daddr ?? "",
String(item.dmdInfoPk ?? ""),
item.telno ?? ""
]);
});
return excelExportData;
};
+12 -13
View File
@@ -15,41 +15,40 @@ export const coRegExcel = z.object({
export const coSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{
id: "ctpv",
id: "ctpvCd",
title: "시도",
visible: true,
},
{
id: "sgg",
id: "sggCd",
title: "시군구",
visible: true,
},
{
id: "coNm",
id: "dmdCoNm",
title: "회사명",
visible: true,
},
{
id: "addr",
id: "daddr",
title: "공장주소",
visible: true,
},
{
id: "bznmNo",
id: "dmdInfoPk",
title: "공장관리번호",
visible: true,
},
{
id: "telNo",
id: "telno",
title: "전화번호",
visible: true,
},
];
// id는 다확인해야함
export const coSttNodeListExport: CommonTableProps[] = [
{
id: "ctpv",
id: "ctpvCd",
title: "시도",
visible: true,
row: 1,
@@ -57,7 +56,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "sgg",
id: "sggCd",
title: "시군구",
visible: true,
row: 1,
@@ -65,7 +64,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "coNm",
id: "dmdCoNm",
title: "회사명",
visible: true,
row: 1,
@@ -73,7 +72,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "addr",
id: "daddr",
title: "공장주소",
visible: true,
row: 1,
@@ -81,7 +80,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "bznmNo",
id: "dmdInfoPk",
title: "공장관리번호",
visible: true,
row: 1,
@@ -89,7 +88,7 @@ export const coSttNodeListExport: CommonTableProps[] = [
colSpan: 1,
},
{
id: "telNo",
id: "telno",
title: "전화번호",
visible: true,
row: 1,
+74 -8
View File
@@ -1,16 +1,29 @@
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { coSttNodeListExport, coSttHeadListExport } from "./headList";
import type { customCoBdst } from "../../matDmd/coReg";
import type { sttnHeadListType } from "../coSttn/headList";
import { fetchType, getFetch } from "@/components/lib/api";
import { z } from "zod";
import { coSttHeadListExport, coSttNodeListExport } from "./headList";
import { excelCoSttnParsing } from "./excel";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
const coSttHeadList = coSttHeadListExport;
const coSttnRes: customCoSttnBdst[] = [];
const coSttnZod = z.object({
ctpvCd: z.string(),
sggCd: z.string(),
dmdCoNm: z.string().min(1).max(20),
dmdInfoPk: z.string().min(1).min(10).max(14),
daddr: z.string().min(1).min(6).max(20),
telno: z.string().min(11).max(12)
});
export type customCoSttnBdst = z.infer<typeof coSttnZod>;
export type coSttnState = {
coSttn: {
coSttnRes: customCoBdst[];
coSttnRes: customCoSttnBdst[];
coSttHeadList: CommonTableProps[];
coSttNodeList: CommonTableProps[];
excelList: [];
@@ -19,7 +32,8 @@ export type coSttnState = {
};
type coSttnActions = {
coSttnInit:(con:string) => void;
coSttnSearch: (txt: string, cnt: number) => void;
};
export type coSttnType = coSttnState & coSttnActions;
@@ -28,7 +42,7 @@ export const coSttnStateExport: coSttnState = {
coSttn: {
coSttHeadList: coSttHeadList,
coSttNodeList: coSttNodeList,
coSttnRes: [],
coSttnRes: coSttnRes,
excelList: [],
isInit: false,
},
@@ -38,6 +52,58 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
set: any
) => {
return {
coSttnInit: async (con: string) => {
try {
const coSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/request/마인드원/3`
);
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
coSttnRes: coSttnRes,
isInit: false,
},
};
});
} catch (e) {
console.log(e)
}
},
coSttnSearch: async (txt: string, cnt: number) => {
try {
const coSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/request/${txt}/${cnt}`
);
if (Number(cnt) > 0) {
const coExcel = excelCoSttnParsing(coSttnRes);
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
excelList: coExcel,
},
};
});
} else
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
coSttnRes: coSttnRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
}
}
+13 -12
View File
@@ -1,24 +1,25 @@
import type { z } from "zod";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { coSttNodeListExport, coSttHeadListExport } from "../coSttn/headList";
import type { customCoBdst } from "../../matDmd/coReg";
import type { sttnHeadListType } from "../coSttn/headList";
import { coSttHeadListExport, coSttNodeListExport } from "../coSttn/headList";
import type { customCoSttnBdst } from "../coSttn";
// 테이블 헤드 리스트
const coSttNodeList = coSttNodeListExport;
const coSttHeadList = coSttHeadListExport;
const ldrmntCoSttnRes: customCoBdst[] = [];
const ldrmntCoSttnRes: customCoSttnBdst[] = [];
const ldrmntCoList = {ctpv: "이거머임",
sgg: "01",
coNm: "회사요",
const ldrmntCoList = [{
ctpvCd: "이거머임",
sggCd: "01",
dmdCoNm: "회사요",
bznmNo: "abc123",
addr: "서울 강남구",
telNo: "010-1234-5678"}
dmdInfoPk: "1111",
daddr: "서울 강남구",
telno: "010-1234-5678"
}]
export type ldrmntCoSttnState = {
ldrmntCoSttn: {
ldrmntCoSttnRes: customCoBdst[];
ldrmntCoSttnRes: customCoSttnBdst[];
ldrmntCoSttHeadList: CommonTableProps[];
ldrmntCoSttNodeList: CommonTableProps[];
excelList: [];
@@ -35,7 +36,7 @@ export const ldrmntCoSttnStateExport: ldrmntCoSttnState = {
ldrmntCoSttn: {
ldrmntCoSttHeadList: coSttHeadList,
ldrmntCoSttNodeList: coSttNodeList,
ldrmntCoSttnRes: [ldrmntCoList],
ldrmntCoSttnRes: ldrmntCoList,
excelList: [],
isInit: false,
},
@@ -0,0 +1,48 @@
import { z } from "zod";
export const sttnHeadListType = z.array(
z.object({
id: z.string(),
title: z.string(),
visible: z.boolean(),
})
);
//★☆★☆ 여기서부터 수정하기 ★☆★☆
export const coRvwHeadListExport: z.infer<typeof sttnHeadListType> = [
{
id: "ctpv",
title: "시도",
visible: true,
},
{
id: "sgg",
title: "시군구",
visible: true,
},
{
id: "coNm",
title: "회사명",
visible: true,
},
{
id: "addr",
title: "공장주소",
visible: true,
},
{
id: "telNo",
title: "전화번호",
visible: true,
},
{
id: "regDt", //바꾸기
title: "신청일자",
visible: true,
},
{
id: "state", //바꾸기
title: "진행상태",
visible: true,
},
];
@@ -0,0 +1,59 @@
import type { TableUpperProps } from "../../ruseFcltMng/fcltReg/rainReg";
export const pbnstPrfmncSttnHeadListExport: TableUpperProps[] = [
{
id: "number",
title: "No",
rowSpan: 2,
row:0
},
{
id: "sido",
title: "시도",
rowSpan: 2,
row:0
},
{
id: "gugun",
title: "시군구",
rowSpan: 2,
row:0
},
{
id: "bscFctNm",
title: "시설명",
rowSpan: 2,
row:0
},
{
id: "ruseUtztnFcltNm",
title: "재이용시설명",
rowSpan: 2,
row:0
},
]
export const pbnstYearHeadListExport: TableUpperProps[] = [
{
id: "year",
title: "년도",
colSpan: 3,
row:0
},
{
id: "total",
title: "계",
row:1
},
{
id: "jangnae",
title: "장내용수",
row:1
},
{
id: "jangoi",
title: "장외용수",
row:1
},
]
@@ -0,0 +1,71 @@
import { fetchType, getFetch } from "@/components/lib/api";
import type { TableUpperProps } from "../../common/type/headder";
import { pbnstPrfmncSttnHeadListExport, pbnstYearHeadListExport } from "./headList";
type pbnstPrfmncSttnActions = {
tableHeadMaker: (startYear: number, endYear: number) => void;
pbnstPrfmncSearch: () => void;
}
export type pbnstPrfmncSttnState = {
pbnstPrfmncSttn: {
pbnstPrfHeadList: TableUpperProps[];
}
}
export type pbnstPrfmncSttnType = pbnstPrfmncSttnState & pbnstPrfmncSttnActions;
export const pbnstPrfmncSttnExport: pbnstPrfmncSttnState = {
pbnstPrfmncSttn: {
pbnstPrfHeadList: [...pbnstPrfmncSttnHeadListExport]
}
}
export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions = (
set: any
) => {
return {
tableHeadMaker: (startYear: number, endYear: number) => {
let yearHeader: TableUpperProps[] = [...pbnstPrfmncSttnHeadListExport];
for (let i = startYear; i <= endYear; i++) {
const yearHead = JSON.parse(JSON.stringify(pbnstYearHeadListExport));
if (yearHead){
yearHead.forEach((item: { id: number; }) => (item.id = i + item.id))
if(yearHead[0])
yearHead[0].title = i + "년도"
}
yearHeader = [...yearHeader, ...yearHead]
}
set((state: pbnstPrfmncSttnState) => {
return {
...state,
pbnstPrfmncSttn: {
pbnstPrfHeadList: [ ...yearHeader]
},
};
});
},
pbnstPrfmncSearch: async () => {
try {
const pbnstPrfmncRes = await getFetch(
fetchType.WR,
`/reuseFc/pubDetailList/`
);
set((state: pbnstPrfmncSttnState) => {
return {
...state,
pbnstPrfmncSttn: {
...state.pbnstPrfmncSttn,
pbnstPrfmncRes: pbnstPrfmncRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
}
}
@@ -89,9 +89,11 @@ export type TableUpperProps = {
upSequnce?: number;
edit?:boolean;
visible?:boolean;
rowSpan?: true;
rowSpan?: number;
type?: string;
selectData ?:string;
colSpan?:number;
row?:number;
};
export const upHeadList: TableUpperProps[] = [
+7 -2
View File
@@ -91,6 +91,7 @@ import { searchActions, type comFcltActions, type comFcltState } from "./common/
import { pbnstPrfmncActionsExport, pbnstPrfmncStateExport, type pbnstPrfmncState, type pbnstPrfmncType } from "./prfmncReg/pbnstPrfmncReg";
import { coRvwActionsExport, coRvwStateExport, type coRvwState, type coRvwType } from "./matDmd/coMatRvw";
import { ruseHstryActionsExport, ruseHstryStateExport, type ruseHstryState, type ruseHstryType } from "./matDmd/ruseRvwHstry";
import { pbnstPrfmncSttnActionsExport, pbnstPrfmncSttnExport, type pbnstPrfmncSttnState, type pbnstPrfmncSttnType } from "./prfmncSttn/pbnstPrfmncSttn";
export type WrStore = comCodeType &
pubFacType &
@@ -112,7 +113,8 @@ export type WrStore = comCodeType &
ldrmntCoSttnType& // 옮겨야함
pbnstPrfmncType&
coRvwType&
ruseHstryType
ruseHstryType&
pbnstPrfmncSttnType
;
export const StoreZus = (
@@ -135,7 +137,8 @@ export const StoreZus = (
ldrmntCoSttnState& // 옮겨야함
pbnstPrfmncState&
coRvwState&
ruseHstryState
ruseHstryState&
pbnstPrfmncSttnState
= {
...comCodeStateExport,
...pubFacStateExport,
@@ -157,6 +160,7 @@ export const StoreZus = (
...pbnstPrfmncStateExport,
...coRvwStateExport,
...ruseHstryStateExport,
...pbnstPrfmncSttnExport
}
) => {
return createStore<WrStore>()((set) => {
@@ -189,6 +193,7 @@ export const StoreZus = (
...pbnstPrfmncActionsExport(set),
...coRvwActionsExport(set),
...ruseHstryActionsExport(set),
...pbnstPrfmncSttnActionsExport(set)
};
});
};
Binary file not shown.
Binary file not shown.