수요처 관리 조회

This commit is contained in:
jyha00
2025-06-05 10:15:20 +09:00
parent 789b9d38ae
commit 605e2212c2
8 changed files with 264 additions and 38 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());
+29 -15
View File
@@ -1,34 +1,51 @@
"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 { getCityOrSgg, tableData } from "@/components/lib/func/commom";
import {
ContentsDiv,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
type ReturnType
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
export default function coSttn() {
const [bdstTable, setBdstTable] = useState<customCoBdst[]>();
const [bdstTable, setBdstTable] = useState<customCoSttnBdst[]>();
const [pageNation, setPageNation] = useState(1);
const { code, coSttn } = useWrStore(
(state) => state
);
const { code, coSttn, coSttnInit } = useWrStore((state) => state);
const { coSttnRes } = coSttn;
const ref = useRef<ReturnType>({} as ReturnType);
const codeData = getCityOrSgg(ref);
const excelClick = useCallback(() => {
}, []);
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])
return(
<>
<ContentsDiv>
@@ -86,9 +103,6 @@ export default function coSttn() {
<UiTable
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={coSttn.coSttNodeList} />
}
headlist={coSttn.coSttHeadList}
pageSize={20}
total={10000}
@@ -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());
+5
View File
@@ -134,6 +134,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>
+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,
+41 -8
View File
@@ -1,16 +1,28 @@
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";
// 테이블 헤드 리스트
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 +31,7 @@ export type coSttnState = {
};
type coSttnActions = {
coSttnInit:(con:string) => void
};
export type coSttnType = coSttnState & coSttnActions;
@@ -28,7 +40,7 @@ export const coSttnStateExport: coSttnState = {
coSttn: {
coSttHeadList: coSttHeadList,
coSttNodeList: coSttNodeList,
coSttnRes: [],
coSttnRes: coSttnRes,
excelList: [],
isInit: false,
},
@@ -38,6 +50,27 @@ export const coSttnActionsExport: (set: any) => coSttnActions = (
set: any
) => {
return {
coSttnInit: async (con: string) => {
try {
const coSttnRes = await getFetch(
fetchType.WR,
`/reuseFc/request/마인드원/3`
);
console.log(coSttnRes, "ㅠㅠ")
set((state: coSttnState) => {
return {
...state,
coSttn: {
...state.coSttn,
coSttnRes: coSttnRes,
isInit: false,
},
};
});
} catch (e) {
console.log(e)
}
},
}
}
@@ -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,
},
];