Merge commit '789b9d38ae2a853f52fdb32026cf71af4be2cb6a' into iipbs/wr/hasuReg

This commit is contained in:
leedj312
2025-06-05 09:11:35 +09:00
15 changed files with 1289 additions and 40 deletions
+409
View File
@@ -0,0 +1,409 @@
"use client";
import { useWrStore } from "@/app/store";
import { formTableName } from "@/components/lib/class/comClass";
import { getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, Form, FormField, FormUi, ScrollArea, 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, DatePicker, Input, Label } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
export default function coMatRvw() {
const { code, coRvw, } = useWrStore((state) => state);
const { coRvwHeadList, } = coRvw;
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 schema = z.object({
fcltCpct: z.number().optional(),
});
const form = useForm<z.infer<typeof schema>>({
resolver: zodResolver(schema),
defaultValues: {
fcltCpct: 0,
}
});
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) })
};
const {
fields: [],
append,
remove,
} = useFieldArray({
control: form.control,
name: "",
});
useEffect(() => {
if (fromDate > toDate) {
const newFromDate = new Date(toDate);
newFromDate.setDate(toDate.getDate() - 1);
setFromDate(newFromDate);
}
}, [toDate]);
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}
/>
<div className="col-span-5 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">수요신청년도</Label>
<div className="flex flex-row">
<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="space-y">
<div className="flex flex-row space-x-2">
<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={coRvwHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
}}
onPageChange={() => { }}
></UiTable>
<hr />
<Form {...form}>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">표준공사비 산정</h3>
<div className="flex items-center mx-3 mb-3">
<h1 className="">처리시설 표준공사비 산정</h1>
<Button
size={"sm"}
onClick={(e) => { }}
>
계산
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
저장
</Button>
</div>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="용도">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="요구수량(M3/d)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<Label className="">용도에 따른 처리공정<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value || ""}
className="mt-2"
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="처리시설 용량(요구수량 * 365일)">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>처리시설용량에 따른 공사비(백만원)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
공사비 산정표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>시설부대경비 요율(%)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
>
요율표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.01"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<Label>총사업비 (백만원)<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
className="mt-2"
type="number"
step="0.01"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>공급처 선정</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
후보지 선택
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="공급관로 표준공사비(백만원)">
<Input
placeholder=""
type="text"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="mt-4">
<Label>관로 표준공사비 산정 프로그램</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
다운로드
</Button>
</div>
<div className="col-span-4 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<Label className="text-xl">처리시설 + 공급관로 총사업비(백만원)
<FormUi label="">
<Input
placeholder=""
type="text"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
readOnly={true}
value={field.value ?? 0}
/>
</FormUi>
</Label>
)}
/>
</div>
</div>
</div>
</Form>
</ListDiv>
</div>
</div>
</ContentsDiv >
</>
)
}
@@ -0,0 +1,367 @@
"use client";
import { useWrStore } from "@/app/store";
import { formTableName } from "@/components/lib/class/comClass";
import { getCity } from "@/components/lib/func/commom";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import { ContentsDiv, Form, FormField, FormUi, ScrollArea, 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, DatePicker, Input, Label } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { z } from "zod";
export default function ruseRvwHstry() {
const { code, ruseHstry, } = useWrStore((state) => state);
const { ruseHstryHeadList, } = ruseHstry;
const [fromDate, setFromDate] = useState<Date>(new Date());
const [toDate, setToDate] = useState<Date>(new Date());
const schema = z.object({});
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
const [objSearch, setObjSearch] = useState<objSearchType>({ sgg: "", city: "" });
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) })
};
const form = useForm<z.infer<typeof schema>>({
resolver: zodResolver(schema),
defaultValues: {
fcltCpct: 0,
}
});
const {
fields: [],
append,
remove,
} = useFieldArray({
control: form.control,
name: "",
});
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>
<SelectBox
className="col-span-2 w-1/3 h-full text-2xl"
label="시군구"
selectClass={""}
selectArray={selectSgg || []}
onSelectValue={getSgg}
>
{""}
</SelectBox>
<div className="col-span-5 w-full">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">수요신청년도</Label>
<div className="flex flex-row">
<DatePicker mode={'single'}
className="w-full"
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) => {
}}
/>
<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>
</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={ruseHstryHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined, headId: string) => {
}}
onPageChange={() => { }}
></UiTable>
<hr />
<Form {...form}>
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">수요신청 상세현황</h3>
<h1 className="mt-1 ml-3">표준공사비 산정</h1>
<div className="flex items-center mx-3 mb-3">
<h1 className="">처리시설 표준공사비 산정</h1>
<Button
size={"sm"}
onClick={(e) => { }}
>
재계산
</Button>
<Button
size={"sm"}
onClick={(e) => { }}
>
저장
</Button>
</div>
<div className="grid grid-cols-12 gap-4 ml-4 mr-4">
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="용도">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="요구수량(M3/d)">
<Input
placeholder=""
type="number"
step="0.1"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<Label className="">용도에 따른 처리공정<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value || ""}
className="mt-2"
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="처리시설 용량(요구수량 * 365일)">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>처리시설용량에 따른 공사비(백만원)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
공사비 산정표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.001"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>시설부대경비 요율(%)</Label>
<Button
size={"sm"}
onClick={(e) => { }}
>
요율표 보기
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="number"
step="0.01"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<Label>총사업비 (백만원)<i className="diveicon di-search" /></Label>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
className="mt-2"
type="number"
step="0.01"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? 0}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3 mt-4">
<div className="flex items-center justify-between">
<Label>공급처 선정</Label>
<Button
size={"sm"}
onClick={(e) => { }}
className="bg-none"
>
후보지 선택
</Button>
</div>
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="">
<Input
placeholder=""
type="text"
onChange={(e) => {
field.onChange(Number(e.target.value));
}}
value={field.value ?? ""}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-4 mt-4">
<div className="mt-4">
<Label>관로 표준공사비 산정</Label>
</div>
</div>
</div>
</Form>
</ListDiv>
</div>
</div>
</ContentsDiv >
</>
)
}
+17
View File
@@ -119,6 +119,23 @@ export default function Home() {
</div>
</div>
</div>
{/* 수요처 매칭 */}
<div>
<h2 className="text-xl font-semibold mb-4">수요처 매칭</h2>
<div className="grid grid-cols-12 gap-4">
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/coMatRvw">수요처 매칭 검토</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/ruseRvwHstry">재이용검토이력</Link>
</Button>
</div>
</div>
</div>
</div>
</>
);
@@ -15,20 +15,27 @@ import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import { useCallback, useEffect, useRef, useState } from "react";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { excelDownload, getCityOrSgg } from "@/components/lib/func/commom";
export default function PbnstSttn() {
const { code, pbnstSttn } = useWrStore(
(state) => state
);
const { code, pbnstSttn, pbnstSttnSearch } = useWrStore((state) => state);
const ref = useRef<ReturnType>({} as ReturnType);
const codeData = getCityOrSgg(ref);
const [pageNation, setPageNation] = useState(1);
const [isChHead, setIsChHead] = useState(false);
const [bdstTable, setBdstTable] = useState<customPbnst[]>();
const excelClick = useCallback(() => {
}, []);
// if (codeData) pbnstSttnSearch(1, "10000", codeData);
excelDownload(
[[]],
"하수재이용시설 현황",
"sample_pbnstSttn.xlsx",
"A1:U2"
);
}, [pbnstSttnSearch, codeData]);
return (
<>
@@ -65,7 +72,7 @@ export default function PbnstSttn() {
// pbnstSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
initClick={function (): void { }}
btnClass={btnClass}
ref={ref}
/>
@@ -83,7 +90,7 @@ export default function PbnstSttn() {
headlist={pbnstSttn.pbnstSttHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined,headId:string)=>{} }
cellClick={(index: number | undefined, headId: string) => { }}
onPageChange={setPageNation}
></UiTable>
</ListDiv>
@@ -1,8 +1,7 @@
"use client";
import { useWrStore } from "@/app/store";
import type { pubHasuType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg/type";
import { yearOptions } from "@/components/lib/func/commom";
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
import PbnPrfExcelModal from "@/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal";
import {
ContentsDiv,
@@ -18,12 +17,12 @@ import {
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, Label } from "@common/components/ui";
import { useState, useEffect } from "react";
import { useState, useEffect, useCallback } from "react";
import { set } from "react-hook-form";
import { Toaster } from "react-hot-toast";
export default function prfmncPrfmncReg() {
const { code, prfmnc, prfmncHasuInit, searchFclts } = useWrStore(
const { code, prfmnc, prfmncHasuInit, } = useWrStore(
(state) => state
);
const { pbnstPrfmncHeadList, monthHeadList, prfmncRes } = prfmnc;
@@ -34,14 +33,27 @@ export default function prfmncPrfmncReg() {
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
useEffect(() => {
if (!prfmnc.isInit) {
prfmncHasuInit("1", "11");
}
}, [prfmnc.isInit, prfmncHasuInit]);
useEffect(() => {
console.log("prfmnc.prfmncRes", prfmncRes);
}, [prfmncRes]);
const excelClick = useCallback(() => {
console.log("dd")
excelDownload(
[[]],
"하수재이용실적",
"sample_pbnstPrfmncReg.xlsx",
"A1:O1"
);
}, [prfmnc.excelList])
useEffect(() => {
if (!prfmnc.isInit) {
prfmncHasuInit("1", "11");
}
}, [prfmnc.isInit, prfmncHasuInit]);
useEffect(() => {
setbdstTable(prfmncRes)
console.log("prfmnc.prfmncRes", prfmncRes)
}, [prfmncRes]);
return (
<>
@@ -92,7 +104,7 @@ export default function prfmncPrfmncReg() {
<Button size={"sm"} onClick={() => {setIsExcelOPen(true)}}>
파일등록
</Button>
<Button color="green" size={"sm"} onClick={() => {}}>
<Button color="green" size={"sm"} onClick={excelClick}>
양식받기
</Button>
</div>
@@ -140,4 +152,4 @@ export default function prfmncPrfmncReg() {
</>
);
}
}
@@ -0,0 +1,109 @@
import { z } from "zod";
import type { CommonTableProps } from "../../common/type/headder";
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,
},
];
// id는 다확인해야함
export const coRvwNodeListExport: CommonTableProps[] = [
{
id: "ctpv",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sgg",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "coNm",
title: "회사명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "addr",
title: "공장주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "telNo",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "regDt", //바꾸기
title: "신청일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "state", //바꾸기
title: "진행상태",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
@@ -0,0 +1,34 @@
import type { z } from "zod";
import type { sttnHeadListType } from "../coSttn/headList";
import { coRvwHeadListExport, coRvwNodeListExport } from "./headList";
import type { CommonTableProps } from "../../common/type/headder";
const coRvwHeadList = coRvwHeadListExport;
const coRvwNodeList = coRvwNodeListExport;
export type coRvwState = {
coRvw: {
isInit: boolean;
coRvwHeadList: z.infer<typeof sttnHeadListType>;
coRvwNodeList: CommonTableProps[];
};
};
export const coRvwStateExport: coRvwState = {
coRvw: {
isInit: false,
coRvwHeadList: coRvwHeadList,
coRvwNodeList: coRvwNodeList,
}
}
export type coRvwType = coRvwState & coRvwActions;
type coRvwActions = {
};
export const coRvwActionsExport: (set: any) => coRvwActions = (set: any) => {
return {
}
}
@@ -0,0 +1,185 @@
import { z } from "zod";
import type { CommonTableProps } from "../../common/type/headder";
export const sttnHeadListType = z.array(
z.object({
id: z.string(),
title: z.string(),
visible: z.boolean(),
})
);
export const ruseHstryHeadListExport: 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: "rvwDt", //바꾸기
title: "검토일자",
visible: true,
},
{
id: "matDt", //바꾸기
title: "매칭 완료일자",
visible: true,
},
{
id: "gong", //바꾸기
title: "공급처",
visible: true,
},
{
id: "dmndQty", //바꾸기
title: "요구수량(M3/d)",
visible: true,
},
{
id: "useUsgCd", //바꾸기
title: "사용용도",
visible: true,
},
{
id: "state", //바꾸기
title: "진행상태",
visible: true,
},
{
id: "matYn", //바꾸기
title: "매칭완료 여부",
visible: true,
},
];
// id는 다확인해야함
export const ruseHstryNodeListExport: CommonTableProps[] = [
{
id: "ctpv",
title: "시도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "sgg",
title: "시군구",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "coNm",
title: "회사명",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "addr",
title: "공장주소",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "telNo",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "regDt", //바꾸기
title: "신청일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "rvwDt", //바꾸기
title: "검토일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "matDt", //바꾸기
title: "매칭 완료일자",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},{
id: "gong", //바꾸기
title: "공급처",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "dmndQty", //바꾸기
title: "요구수량(M3/d)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "useUsgCd", //바꾸기
title: "사용용도",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "state", //바꾸기
title: "진행상태",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
{
id: "matYn", //바꾸기
title: "매칭완료 여부",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 1,
},
];
@@ -0,0 +1,34 @@
import type { z } from "zod";
import type { sttnHeadListType } from "../coSttn/headList";
import type { CommonTableProps } from "../../common/type/headder";
import { ruseHstryHeadListExport, ruseHstryNodeListExport } from "./headList";
const ruseHstryHeadList = ruseHstryHeadListExport;
const ruseHstryNodeList = ruseHstryNodeListExport;
export type ruseHstryState = {
ruseHstry: {
isInit: boolean;
ruseHstryHeadList: z.infer<typeof sttnHeadListType>;
ruseHstryNodeList: CommonTableProps[];
};
};
export const ruseHstryStateExport: ruseHstryState = {
ruseHstry: {
isInit: false,
ruseHstryHeadList: ruseHstryHeadList,
ruseHstryNodeList: ruseHstryNodeList,
}
}
export type ruseHstryType = ruseHstryState & ruseHstryActions;
type ruseHstryActions = {
};
export const ruseHstryActionsExport: (set: any) => ruseHstryActions = (set: any) => {
return {
}
}
@@ -15,6 +15,7 @@ export type pbnstPrfmncState = {
pbnstPrfmncHeadList: TableUpperProps[];
monthHeadList: TableUpperProps[];
prfmncRes: pubHasuType[];
excelList: Number[];
}
}
@@ -24,6 +25,7 @@ export const pbnstPrfmncStateExport: pbnstPrfmncState = {
pbnstPrfmncHeadList: pbnstPrfmncHeadList,
monthHeadList: monthHeadList,
prfmncRes: [],
excelList: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
}
}
@@ -60,7 +62,7 @@ export const pbnstPrfmncActionsExport: (set: any) => pbnstPrfmncActions = (set:
prfmncHasuInit: async (page: string, sggOrCity: string) => {
try {
const prfmncRes = await hasuListFetch(page, sggOrCity);
console.log("prfmncRes", prfmncRes)
console.log("prfmncRes", prfmncRes)
return set((state: pbnstPrfmncState) => ({
...state,
prfmnc: {
@@ -0,0 +1,28 @@
import type { customPbnst } from "../../fcltReg/pbnstReg/type";
export const excelPbnstSttnParsing = (data: any[]): string[][] => {
const excelExportData: string[][] = [];
data.forEach((item) => {
excelExportData.push([
item.a,
String(item.aaa),
item.aaaa ?? "",
item.operMngCd ?? "",
String(item.cityText ?? ""),
String(item.sggText ?? ""),
String(item.bdnstNm ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
String(item.archArea ?? ""),
])
})
return excelExportData;
}
@@ -3,11 +3,12 @@ import type { z } from "zod";
import {
pbnSttHeadListExport,
pbnstSttNodeListExport
} from "./headList";
} from "./headList";
import { fetchType, getFetch } from "@/components/lib/api";
import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { customPbnst } from "../../fcltReg/pbnstReg/type";
import { excelPbnstSttnParsing } from "./excel";
const pbnstSttHeadList = pbnSttHeadListExport;
const pbnstSttNodeList = pbnstSttNodeListExport;
@@ -26,6 +27,7 @@ type pbnstSttnActions = {
pbnstChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
pbnstSttnSearch: (page: number, total: string, con: string) => void;
};
export type pbnstSttnType = pbnstSttnState & pbnstSttnActions;
@@ -34,8 +36,8 @@ export const pbnstSttnStateExport: pbnstSttnState = {
pbnstSttn: {
pbnstSttHeadList: pbnstSttHeadList,
pbnstSttNodeList: pbnstSttNodeList,
pbnstSttnRes:[],
excelList:[],
pbnstSttnRes: [],
excelList: [],
isInit: false,
},
};
@@ -45,19 +47,52 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
) => {
return {
pbnstChSttnHead: async (
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
console.log('head ', headList)
const changeNodeList= controlHeadView(headList,pbnstSttNodeList)
return set((state: pbnstSttnState) => ({
pbnstSttn: {
...state.pbnstSttn,
pbnstSttHeadList: headList,
pbnstSttNodeList: changeNodeList,
},
}));
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
console.log('head ', headList)
const changeNodeList = controlHeadView(headList, pbnstSttNodeList)
return set((state: pbnstSttnState) => ({
pbnstSttn: {
...state.pbnstSttn,
pbnstSttHeadList: headList,
pbnstSttNodeList: changeNodeList,
},
}));
},
pbnstSttnSearch: async (page: number, total: string, con: string) => {
try {
const pbnstSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/waterreuseFc/${page}/${total}/${con}`
);
if (Number(total) > 9000) {
const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes);
set((state: pbnstSttnState) => {
return {
...state,
pbnstSttn: {
...state.pbnstSttn,
excelList: pbnstExcel,
},
};
});
} else
set((state: pbnstSttnState) => {
return {
...state,
pbnstSttn: {
...state.pbnstSttn,
pbnstSttnRes: pbnstSttnRes,
isInit: false,
},
};
});
} catch (erTxt) {
console.log("error", erTxt);
}
},
}
}
+12 -2
View File
@@ -89,6 +89,8 @@ import { coSttnActionsExport, coSttnStateExport, type coSttnState, type coSttnTy
import { ldrmntCoSttnActionsExport, ldrmntCoSttnStateExport, type ldrmntCoSttnState, type ldrmntCoSttnType } from "./matDmd/ldrmntCoSttn"; // 옮겨야함
import { searchActions, type comFcltActions, type comFcltState } from "./common/searchCode";
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";
export type WrStore = comCodeType &
pubFacType &
@@ -108,7 +110,9 @@ export type WrStore = comCodeType &
comFcltActions&comFcltState&
coSttnType& // 옮겨야함
ldrmntCoSttnType& // 옮겨야함
pbnstPrfmncType
pbnstPrfmncType&
coRvwType&
ruseHstryType
;
export const StoreZus = (
@@ -129,7 +133,9 @@ export const StoreZus = (
pbnstSttnState&
coSttnState& // 옮겨야함
ldrmntCoSttnState& // 옮겨야함
pbnstPrfmncState
pbnstPrfmncState&
coRvwState&
ruseHstryState
= {
...comCodeStateExport,
...pubFacStateExport,
@@ -149,6 +155,8 @@ export const StoreZus = (
...coSttnStateExport, // 옮겨야함
...ldrmntCoSttnStateExport, // 옮겨야함
...pbnstPrfmncStateExport,
...coRvwStateExport,
...ruseHstryStateExport,
}
) => {
return createStore<WrStore>()((set) => {
@@ -179,6 +187,8 @@ export const StoreZus = (
...coSttnActionsExport(set), // 옮겨야함
...ldrmntCoSttnActionsExport(set), // 옮겨야함
...pbnstPrfmncActionsExport(set),
...coRvwActionsExport(set),
...ruseHstryActionsExport(set),
};
});
};
Binary file not shown.
Binary file not shown.