중수도 시설 현황 작업중
This commit is contained in:
@@ -69,6 +69,13 @@ export default function Home() {
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltSttn/rswtSttn">
|
||||
중수도이용시설현황
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
export const rainSttnHeadListType = z.array(
|
||||
export const sttnHeadListType = z.array(
|
||||
z.object({
|
||||
id: z.string(),
|
||||
title: z.string(),
|
||||
@@ -10,7 +11,7 @@ export const rainSttnHeadListType = z.array(
|
||||
);
|
||||
|
||||
|
||||
export const rainSttHeadListExport: z.infer<typeof rainSttnHeadListType> = [
|
||||
export const rainSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
|
||||
{
|
||||
id: "cityText",
|
||||
|
||||
@@ -3,10 +3,10 @@ import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import {
|
||||
type customRainBdst,
|
||||
} from "../../fcltReg/rainReg";
|
||||
import { excelSttnParsing } from "./excel";
|
||||
import { excelRainSttnParsing } from "./excel";
|
||||
import {
|
||||
rainSttHeadListExport,
|
||||
rainSttnHeadListType,
|
||||
sttnHeadListType,
|
||||
rainSttNodeListExport,
|
||||
} from "./headList";
|
||||
import type { z } from "zod";
|
||||
@@ -92,9 +92,10 @@ export type rainSttnState = {
|
||||
};
|
||||
};
|
||||
type rainSttnActions = {
|
||||
rainSttnSearch: (page: string, total: string, con: string) => void;
|
||||
rainSttnInit:(con:string) => void
|
||||
rainSttnSearch: (page: number, total: string, con: string) => void;
|
||||
rainChSttnHead: (
|
||||
headList: z.infer<typeof rainSttnHeadListType>,
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
) => void;
|
||||
};
|
||||
|
||||
@@ -114,14 +115,35 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rainSttnSearch: async (page: string, total: string, con: string) => {
|
||||
rainSttnInit: async( con:string)=>{
|
||||
try{
|
||||
|
||||
const rainSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/rainyInfoList/1/20/${con}`
|
||||
);
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rainSttn: {
|
||||
...state.rainSttn,
|
||||
rainSttnRes: rainSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
rainSttnSearch: async (page: number, total: string, con: string) => {
|
||||
try {
|
||||
const rainSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/rainyInfoList/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
const rainExcel = excelSttnParsing(rainSttnRes);
|
||||
const rainExcel = excelRainSttnParsing(rainSttnRes);
|
||||
set((state: rainSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -147,7 +169,7 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = (
|
||||
}
|
||||
},
|
||||
rainChSttnHead: async (
|
||||
headList: z.infer<typeof rainSttnHeadListType>
|
||||
headList: z.infer<typeof sttnHeadListType>
|
||||
) => {
|
||||
const changeNodeList= controlHeadView(headList,rainSttNodeList)
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
|
||||
export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => {
|
||||
const excelExportData: string[][] = [];
|
||||
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
String(item.cityText),
|
||||
String(item.sggText),
|
||||
item.bdstNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.bdstUsgText ?? ""),
|
||||
String(item.frstArchPrmsnDt ?? ""),
|
||||
String(item.archArea ?? ""),
|
||||
String(item.chgBuilding.length>0 ? "Y" :"N"),
|
||||
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCst ?? ""),
|
||||
item.reuseBuilding?.[0]?.rswtrObj?.orgwtKndCd ?? "",
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.filtrTrtmfctCpct ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctProcs ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj?.filtrTrtmfctUsgCd ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCstSprtYn ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCstSprtAmt ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertYn ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertYr ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertNo ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.grntchBdstCertGrd ?? "")
|
||||
]);
|
||||
});
|
||||
return excelExportData;
|
||||
};
|
||||
@@ -0,0 +1,400 @@
|
||||
import type { z } from "zod";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
|
||||
export const rswtSttHeadListExport: z.infer<typeof sttnHeadListType> = [
|
||||
{
|
||||
id: "cityText",
|
||||
title: "시도",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "sggText",
|
||||
title: "시군구",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "bdstNm",
|
||||
title: "건축물명",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "daddr",
|
||||
title: "주소",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "bdsgUsgText",
|
||||
title: "건축물용도",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "frstArchPrmsnDt",
|
||||
title: "최초건축허가일시",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "archArea",
|
||||
title: "건축면적",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "wtrUsqty",
|
||||
title: "물사용량",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "chBuildingYn",
|
||||
title: "중축・개축・재축여부",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{
|
||||
id: "lawTrgtYn",
|
||||
title: "법적의무대상여부",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{
|
||||
id: "oblgTrgtWtrUsqty",
|
||||
title: "의무대상물사용량 ",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "instlCmptnDt",
|
||||
title: "설치완료일시",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "instlCst",
|
||||
title: "설치비용",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{
|
||||
id: "orgwtKndCd",
|
||||
title: "원수종류",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{
|
||||
id: "filtrTrtmfctCpct",
|
||||
title: "처리시설용량",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "filtrTrtmfctProcs",
|
||||
title: "주요처리공정",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "filtrTrtmfctUsgCd",
|
||||
title: "이용용도",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{
|
||||
id: "instlCstSprtYn",
|
||||
title: "설치지원비용여부",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "instlCstSprtAmt",
|
||||
title: "설치지원비용",
|
||||
visible: true,
|
||||
},
|
||||
|
||||
{
|
||||
id: "grntchBdstCertYn",
|
||||
title: "녹색건축물인증여부",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCertYr",
|
||||
title: "녹색건축물인증년도",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCertNo",
|
||||
title: "녹색건축물인증번호",
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCertGrd",
|
||||
title: "녹색건축물인증등급",
|
||||
visible: true,
|
||||
},
|
||||
];
|
||||
|
||||
// id는 다확인해야함
|
||||
export const rswtSttNodeListExport: CommonTableProps[] = [
|
||||
{
|
||||
id: "bdnstInfo",
|
||||
title: "1.건축물정보",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 12,
|
||||
},
|
||||
{
|
||||
id: "rswtFcltInfo",
|
||||
title: "2.중수도시설정보",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 5,
|
||||
},
|
||||
{
|
||||
id: "insenInfo",
|
||||
title: "3.인센티브 정보",
|
||||
visible: true,
|
||||
row: 1,
|
||||
rowSpan: 1,
|
||||
colSpan: 6,
|
||||
},
|
||||
{
|
||||
id: "adminDiv",
|
||||
title: "행정구역",
|
||||
visible: true,
|
||||
row: 2,
|
||||
upName: "bdnstInfo",
|
||||
rowSpan: 1,
|
||||
colSpan: 2,
|
||||
},
|
||||
|
||||
// 3번째줄 시작
|
||||
{
|
||||
id: "cityText",
|
||||
title: "시도",
|
||||
visible: true,
|
||||
upName: "adminDiv",
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "sggText",
|
||||
title: "시군구",
|
||||
visible: true,
|
||||
upName: "adminDiv",
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
// 2번째 줄
|
||||
// 1번째 줄 건축물정보 아래의 행으로 만들 헤더
|
||||
{
|
||||
id: "bdstNm",
|
||||
title: "건축물명",
|
||||
visible: true,
|
||||
upName: "bdnstInfo",
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "daddr",
|
||||
title: "주소",
|
||||
visible: true,
|
||||
upName: "bdnstInfo",
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "bdsgUsgText",
|
||||
title: "건축물용도",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "frstArchPrmsnDt",
|
||||
title: "최초건축허가일시",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "archArea",
|
||||
title: "건축면적",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "wtrUsqty",
|
||||
title: "물사용량",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "chBuildingYn",
|
||||
title: "중축・개축・재축여부",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{
|
||||
id: "lawTrgtYn",
|
||||
title: "법적의무대상여부",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "oblgTrgtWtrUsqty",
|
||||
title: "의무대상물사용량",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "instlCmptnDt",
|
||||
title: "설치완료일시",
|
||||
upName: "bdnstInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "instlCst",
|
||||
title: "설치비용",
|
||||
upName: "rswtFcltInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{
|
||||
id: "orgwtKndCd",
|
||||
title: "원수종류",
|
||||
upName: "rswtFcltInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{
|
||||
id: "filtrTrtmfctCpct",
|
||||
title: "처리시설용량",
|
||||
upName: "rswtFcltInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "filtrTrtmfctProcs",
|
||||
title: "주요처리공정",
|
||||
upName: "rswtFcltInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{
|
||||
id: "filtrTrtmfctUsgCd",
|
||||
title: "이용용도",
|
||||
visible: true,
|
||||
upName: "rswtFcltInfo",
|
||||
row: 2,
|
||||
rowSpan: 2,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "instlCstSprtYn",
|
||||
title: "설치지원비용여부",
|
||||
upName: "instlCstSprt",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "instlCstSprtAmt",
|
||||
title: "설치지원비용",
|
||||
upName: "instlCstSprt",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
|
||||
{
|
||||
id: "instlCstSprt",
|
||||
title: "설치비지원",
|
||||
upName: "insenInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 1,
|
||||
colSpan: 2,
|
||||
},
|
||||
|
||||
{
|
||||
id: "grntchBdstCertYn",
|
||||
title: "녹색건축물인증여부",
|
||||
upName: "grntchBdstCert",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCertYr",
|
||||
title: "녹색건축물인증년도",
|
||||
upName: "grntchBdstCert",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCertNo",
|
||||
title: "녹색건축물인증번호",
|
||||
upName: "grntchBdstCert",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCertGrd",
|
||||
title: "녹색건축물인증등급",
|
||||
upName: "grntchBdstCert",
|
||||
visible: true,
|
||||
row: 3,
|
||||
rowSpan: 1,
|
||||
colSpan: 1,
|
||||
},
|
||||
{
|
||||
id: "grntchBdstCert",
|
||||
title: "녹색건축물인증",
|
||||
upName: "insenInfo",
|
||||
visible: true,
|
||||
row: 2,
|
||||
rowSpan: 1,
|
||||
colSpan: 4,
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,129 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/headder";
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import type { z } from "zod";
|
||||
import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
import { fetchType, getFetch } from "@/components/lib/api";
|
||||
import { excelRainSttnParsing } from "../rainSttn/excel";
|
||||
|
||||
|
||||
|
||||
// 테이블 헤드 리스트
|
||||
const rswtSttNodeList = rswtSttNodeListExport;
|
||||
const rswtSttHeadList = rswtSttHeadListExport;
|
||||
const rswtSttnRes: customRswtBdst[] = [];
|
||||
|
||||
|
||||
|
||||
export type rswtSttnState = {
|
||||
rswtSttn: {
|
||||
rswtSttnRes: customRswtBdst[];
|
||||
rswtSttHeadList: CommonTableProps[];
|
||||
rswtSttNodeList: CommonTableProps[];
|
||||
excelList: [];
|
||||
isInit: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
type rswtSttnActions = {
|
||||
rswtSttnInit:(con:string) => void;
|
||||
rswtSttnSearch: (page: number, total: string, con: string) => void;
|
||||
rswtChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
) => void;
|
||||
};
|
||||
|
||||
export type rswtSttnType = rswtSttnState & rswtSttnActions;
|
||||
|
||||
|
||||
|
||||
export const rswtSttnStateExport: rswtSttnState = {
|
||||
rswtSttn: {
|
||||
rswtSttHeadList: rswtSttHeadList,
|
||||
rswtSttNodeList: rswtSttNodeList,
|
||||
rswtSttnRes: rswtSttnRes,
|
||||
excelList: [],
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rswtSttnInit: async( con:string)=>{
|
||||
try{
|
||||
|
||||
const rswtSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc/1/20/${con}`
|
||||
);
|
||||
set((state: rswtSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
rswtSttnRes: rswtSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
rswtSttnSearch: async (page: number, total: string, con: string) => {
|
||||
try {
|
||||
const rswtSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/waterreuseFc/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
const rainExcel = excelRainSttnParsing(rswtSttnRes);
|
||||
set((state: rswtSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
excelList: rainExcel,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else
|
||||
set((state: rswtSttnState) => {
|
||||
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
rswtSttnRes: rswtSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (erTxt) {
|
||||
console.log("error", erTxt);
|
||||
}
|
||||
},
|
||||
rswtChSttnHead: async (
|
||||
headList: z.infer<typeof sttnHeadListType>
|
||||
): Promise<void> => {
|
||||
|
||||
console.log('head ', headList)
|
||||
const changeNodeList= controlHeadView(headList,rswtSttNodeList)
|
||||
|
||||
return set((state: rswtSttnState) => ({
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
rswtSttHeadList: headList,
|
||||
rswtSttNodeList: changeNodeList,
|
||||
},
|
||||
}));
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
type rswtFacType,
|
||||
} from "./ruseFcltMng/fcltReg/rswtReg";
|
||||
import { rainSttnActionsExport, rainSttnStateExport, type rainSttnState, type rainSttnType } from "./ruseFcltMng/fcltSttn/rainSttn";
|
||||
import { rswtSttnActionsExport, rswtSttnStateExport, type rswtSttnState, type rswtSttnType } from "./ruseFcltMng/fcltSttn/rswtSttn";
|
||||
|
||||
export type WrStore = comCodeType&
|
||||
pubFacType &
|
||||
@@ -44,7 +45,8 @@ export type WrStore = comCodeType&
|
||||
bdstFulType&
|
||||
rainChkgdnType&
|
||||
rswtChkgdnType&
|
||||
rainSttnType
|
||||
rainSttnType&
|
||||
rswtSttnType
|
||||
;
|
||||
|
||||
export const StoreZus = (
|
||||
@@ -57,7 +59,9 @@ export const StoreZus = (
|
||||
bdstState &
|
||||
rainChkgdnState&
|
||||
rswtChkgdnState&
|
||||
rainSttnState
|
||||
rainSttnState&
|
||||
rswtSttnState
|
||||
|
||||
= {
|
||||
...comCodeStateExport,
|
||||
...pubFacStateExport,
|
||||
@@ -68,7 +72,8 @@ export const StoreZus = (
|
||||
...bdstStateExport,
|
||||
...rainChkgdnStateExport,
|
||||
...rswtChkgdnStateExport,
|
||||
...rainSttnStateExport
|
||||
...rainSttnStateExport,
|
||||
...rswtSttnStateExport
|
||||
}
|
||||
) => {
|
||||
return createStore<WrStore>()((set) => {
|
||||
@@ -89,7 +94,8 @@ export const StoreZus = (
|
||||
...bdstActionsExport(set),
|
||||
...rainChkgdnActionsExport(set),
|
||||
...rswtChkgdnActionsExport(set),
|
||||
...rainSttnActionsExport(set)
|
||||
...rainSttnActionsExport(set),
|
||||
...rswtSttnActionsExport(set)
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,70 +1,80 @@
|
||||
import type { comCodeState, } from "@/app/store/common/code";
|
||||
import { filePickedBlob, type SelectDataType } from "@common/business_components/ui";
|
||||
|
||||
|
||||
|
||||
|
||||
import type { comCodeState } from "@/app/store/common/code";
|
||||
import {
|
||||
filePickedBlob,
|
||||
type SelectDataType,
|
||||
type ReturnType,
|
||||
} from "@common/business_components/ui";
|
||||
import type { RefObject } from "react";
|
||||
|
||||
export const getCity = (val: string, sggCd: SelectDataType[]) => {
|
||||
const data = sggCd
|
||||
.filter((item) => String(item.val).substring(0, 2) === val)
|
||||
.map((item) => ({
|
||||
val: item.val,
|
||||
text: item.text // 한국어 텍스트
|
||||
}));
|
||||
return data
|
||||
|
||||
};
|
||||
|
||||
const data = sggCd
|
||||
.filter((item) => String(item.val).substring(0, 2) === val)
|
||||
.map((item) => ({
|
||||
val: item.val,
|
||||
text: item.text, // 한국어 텍스트
|
||||
}));
|
||||
return data;
|
||||
};
|
||||
|
||||
// cd text 넣기
|
||||
export const tableData = ( data: any,code:comCodeState)=>{
|
||||
const chCode = code.code;
|
||||
return data?.map((item: { sggCd: string; ctpvCd: string; reuseBuilding: { lawTrgtYn: any , bdstUsgCd:any}[]; }) => {
|
||||
export const tableData = (data: any, code: comCodeState) => {
|
||||
const chCode = code.code;
|
||||
return data?.map(
|
||||
(item: {
|
||||
sggCd: string;
|
||||
ctpvCd: string;
|
||||
reuseBuilding: { lawTrgtYn: any; bdstUsgCd: any }[];
|
||||
}) => {
|
||||
let returnData = {};
|
||||
const sggText = chCode.sggCd.find(
|
||||
(cd) => cd.val === String(item.sggCd)
|
||||
(cd) => cd.val === String(item.sggCd)
|
||||
)?.text;
|
||||
const cityText = chCode.cityCd.find(
|
||||
(cd) => cd.val === String(item.ctpvCd)
|
||||
)?.text;
|
||||
console
|
||||
.log(item?.reuseBuilding)
|
||||
if (item?.reuseBuilding?.length >0) {
|
||||
|
||||
if (item?.reuseBuilding?.length > 0) {
|
||||
const bdsgUsgText = chCode.bdstUsgCd.find(
|
||||
(cd) =>Number(cd.val) === item?.reuseBuilding[0]?.bdstUsgCd
|
||||
)?.text
|
||||
const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn
|
||||
console
|
||||
.log(bdsgUsgText)
|
||||
(cd) => Number(cd.val) === item?.reuseBuilding[0]?.bdstUsgCd
|
||||
)?.text;
|
||||
const lawTrgtYn = item?.reuseBuilding[0]?.lawTrgtYn;
|
||||
|
||||
returnData= { ...item, sggText: sggText??'없음', cityText: cityText??'없음' ,bdsgUsgText:bdsgUsgText ,lawTrgtYn:lawTrgtYn};
|
||||
}else{
|
||||
returnData= { ...item, sggText: sggText??'없음', cityText: cityText??'없음'};
|
||||
returnData = {
|
||||
...item,
|
||||
sggText: sggText ?? "없음",
|
||||
cityText: cityText ?? "없음",
|
||||
bdsgUsgText: bdsgUsgText,
|
||||
lawTrgtYn: lawTrgtYn,
|
||||
};
|
||||
} else {
|
||||
returnData = {
|
||||
...item,
|
||||
sggText: sggText ?? "없음",
|
||||
cityText: cityText ?? "없음",
|
||||
};
|
||||
}
|
||||
|
||||
return returnData;
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const excelDownload =(excelList: [][], fileNm:string ,sampleFile:string, headerRange='A1:V3') =>{
|
||||
if (excelList.length === 0) return;
|
||||
fetch(`/${sampleFile}`, {})
|
||||
.then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText)
|
||||
}
|
||||
// 받은 파일 바인너리 처리
|
||||
const blobRet = await response.arrayBuffer()
|
||||
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
|
||||
await filePickedBlob(blobRet, excelList,fileNm, 4,headerRange)
|
||||
})
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const excelDownload = (
|
||||
excelList: [][],
|
||||
fileNm: string,
|
||||
sampleFile: string,
|
||||
headerRange = "A1:V3"
|
||||
) => {
|
||||
if (excelList.length === 0) return;
|
||||
fetch(`/${sampleFile}`, {}).then(async (response) => {
|
||||
if (!response.ok) {
|
||||
throw Error(response.statusText);
|
||||
}
|
||||
// 받은 파일 바인너리 처리
|
||||
const blobRet = await response.arrayBuffer();
|
||||
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
|
||||
await filePickedBlob(blobRet, excelList, fileNm, 4, headerRange);
|
||||
});
|
||||
};
|
||||
|
||||
// onchange 텍스트를 숫자로 and ,제거
|
||||
export const handleCommaNumberChange = (
|
||||
@@ -82,4 +92,15 @@ export const formatCommaNumber = (
|
||||
): string => {
|
||||
if (value === undefined || value === null || value === "") return "";
|
||||
return Number(value).toLocaleString();
|
||||
};
|
||||
};
|
||||
|
||||
export const getCityOrSgg = (ref: RefObject<ReturnType>) => {
|
||||
let con;
|
||||
if (ref.current != null)
|
||||
if (ref.current.sigunValue != "0") {
|
||||
con = ref.current.sigunValue;
|
||||
} else {
|
||||
con = ref.current.sidoValue;
|
||||
}
|
||||
return con;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user