Merge commit '98f976eaeaf62ef29abe0c5e27f171a9628fb2df' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run
iipbs_wr / build (push) Waiting to run
This commit is contained in:
@@ -15,6 +15,7 @@ import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/b
|
||||
import CoDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/coDatailModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
downloadExcel,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
@@ -34,7 +35,7 @@ export default function LdrmntCoSttn() {
|
||||
const { code, ldrmnt, ldrmntInit, ldrmntSearch, } = useWrStore(
|
||||
(state) => state
|
||||
);
|
||||
const { ldrmntRes } = ldrmnt;
|
||||
const { ldrmntRes, excelList } = ldrmnt;
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customLdrmnt | undefined }>({ data: undefined, isOpen: false })
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [selectSgg, setSelectSgg] = useState<SelectDataType[] | []>()
|
||||
@@ -42,7 +43,8 @@ export default function LdrmntCoSttn() {
|
||||
const [bdstTable, setBdstTable] = useState<customLdrmnt[]>();
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const codeData = getCityOrSgg(ref);
|
||||
const [excelData, setExcelData] = useState<any[]>();
|
||||
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
excelDownload(
|
||||
@@ -54,6 +56,15 @@ export default function LdrmntCoSttn() {
|
||||
);
|
||||
}, []);
|
||||
|
||||
const excelDownloadClick = () => {
|
||||
downloadExcel({
|
||||
data: excelData ?? [],
|
||||
fileName: "잠재수요처 관리",
|
||||
sheetNameArray: ["Sheet1"],
|
||||
headerRange: "A1:F1"
|
||||
})
|
||||
}
|
||||
|
||||
const [isExcelOpen, setIsExcelOpen] = useState<{
|
||||
isModal: boolean;
|
||||
}>({ isModal: false });
|
||||
@@ -78,7 +89,7 @@ export default function LdrmntCoSttn() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!ldrmnt.isInit) {
|
||||
ldrmntInit(codeData ?? "0");
|
||||
ldrmntInit("0");
|
||||
}
|
||||
}, [ldrmnt.isInit, ldrmntInit]);
|
||||
|
||||
@@ -88,15 +99,61 @@ export default function LdrmntCoSttn() {
|
||||
const tbData = Array.isArray(data)
|
||||
? data.map((item: customLdrmnt) => ({
|
||||
...item,
|
||||
ctpvCd: item.fctryAddr.split(" ")[0] || "",
|
||||
ctpvCd: item.fctryAddr.split(" ")[0] || "",
|
||||
sggCd: item.fctryAddr.split(" ")[1] || ""
|
||||
|
||||
|
||||
}))
|
||||
: [];
|
||||
|
||||
|
||||
setBdstTable(tbData);
|
||||
}, [ldrmntRes, code]);
|
||||
|
||||
useEffect(() => {
|
||||
const transData = Array.isArray(excelList) ? excelList : [excelList];
|
||||
const exData = tableData(transData, { code });
|
||||
const data = Array.isArray(exData)
|
||||
? exData.map((item: customLdrmnt) => {
|
||||
return {
|
||||
"시도": item.fctryAddr.split(" ")[0] || "",
|
||||
"시군구": item.fctryAddr.split(" ")[1] || "",
|
||||
"회사명": item.dmdCoNm,
|
||||
"공장주소": item.fctryAddr,
|
||||
"공장관리번호": item.fctryMngNo,
|
||||
"전화번호": item.telno
|
||||
}
|
||||
}) : [];
|
||||
setExcelData(data)
|
||||
}, [excelList])
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
let cityTxt = '';
|
||||
let sggTxt = '';
|
||||
|
||||
if (objSearch?.city.toString().length > 0) {
|
||||
cityTxt = code.cityCd.find((item) => item.val === objSearch?.city)?.text ?? '';
|
||||
}
|
||||
|
||||
if (objSearch?.sgg.toString().length > 1) {
|
||||
sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? '';
|
||||
}
|
||||
|
||||
let cityNm = "";
|
||||
|
||||
if (sggTxt !== "0") {
|
||||
cityNm = cityTxt + " " + sggTxt;
|
||||
} else {
|
||||
cityNm = cityTxt;
|
||||
}
|
||||
|
||||
if (cityNm) {
|
||||
if (cityTxt === '') cityNm = "0";
|
||||
ldrmntSearch(pageNation, cityNm, searchTxt || "");
|
||||
} else {
|
||||
ldrmntSearch(pageNation, "", searchTxt || "");
|
||||
}
|
||||
}, [pageNation, objSearch, code, searchTxt, ldrmntSearch])
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
@@ -148,18 +205,17 @@ export default function LdrmntCoSttn() {
|
||||
sggTxt = code.sggCd.find((item) => item.val === objSearch?.sgg)?.text ?? '';
|
||||
}
|
||||
|
||||
let url = ""
|
||||
let cityNm = ""
|
||||
|
||||
if (sggTxt !== "0") {
|
||||
url = cityTxt + " " + sggTxt
|
||||
cityNm = cityTxt + " " + sggTxt
|
||||
} else {
|
||||
url = cityTxt
|
||||
cityNm = cityTxt
|
||||
}
|
||||
|
||||
|
||||
if (url) {
|
||||
if(cityTxt === '') url = "0";
|
||||
ldrmntSearch(url, searchTxt || "");
|
||||
if (cityNm) {
|
||||
if (cityTxt === '') cityNm = "0";
|
||||
ldrmntSearch(pageNation, cityNm, searchTxt || "");
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -177,9 +233,7 @@ export default function LdrmntCoSttn() {
|
||||
<Button
|
||||
size={"sm"}
|
||||
className={btnClass}
|
||||
onClick={() => {
|
||||
/* 저장 로직 */
|
||||
}}
|
||||
onClick={() => excelDownloadClick()}
|
||||
>
|
||||
다운로드
|
||||
</Button>
|
||||
|
||||
@@ -6,12 +6,14 @@ import type {
|
||||
chgBuilding,
|
||||
customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
|
||||
import {
|
||||
excelDownload,
|
||||
getCityOrSgg,
|
||||
tableData,
|
||||
} from "@/components/lib/func/commom";
|
||||
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchBaseForm,
|
||||
@@ -21,12 +23,9 @@ import {
|
||||
type ReturnType,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { makeFcltRegHead } from "@common/business_components/ui/table/makeFcltRegHead";
|
||||
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
|
||||
import BdstChgModal from "@/components/ui/modal/fcltReg/bdstChgModal/bdstChgModal";
|
||||
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { excelHtdflSttnParsing } from "@/app/store/ruseFcltMng/fcltSttn/htdflSttn/excel";
|
||||
|
||||
export default function HtdflSttn() {
|
||||
const { code, htdflSttn, htdflSttnSearch, initHtdfl } = useWrStore(
|
||||
@@ -139,7 +138,7 @@ export default function HtdflSttn() {
|
||||
} else {
|
||||
con = returnType.sidoValue;
|
||||
}
|
||||
// rainSttnSearch(1, "20", con);
|
||||
htdflSttnSearch(pageNation, "20", con);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {}}
|
||||
@@ -155,7 +154,7 @@ export default function HtdflSttn() {
|
||||
headName={[]}
|
||||
tableData={bdstTable || []}
|
||||
children={
|
||||
<makeFcltRegHead upHeadList={htdflSttn.htdflSttNodeList} />
|
||||
<HeadMakeColSpan upHeadList={htdflSttn.htdflSttNodeList} />
|
||||
}
|
||||
headlist={htdflSttn.htdflSttHeadList}
|
||||
pageSize={20}
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function RainSttn() {
|
||||
const [pageNation, setPageNation] = useState(1);
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const [bdstTable, setBdstTable] = useState<customRainBdst[]>();
|
||||
const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customRainBdst|undefined}>({data:undefined,isOpen:false })
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRainBdst | undefined }>({ data: undefined, isOpen: false })
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chBuilding: chgBuilding[];
|
||||
@@ -42,23 +42,22 @@ export default function RainSttn() {
|
||||
|
||||
const codeData = getCityOrSgg(ref);
|
||||
|
||||
const cellClick=(index:number|undefined, headId: string)=>{
|
||||
const cellClick = (index: number | undefined, headId: string) => {
|
||||
|
||||
if(headId!=='chBuildingYn' && index!==undefined && bdstTable!==undefined){
|
||||
setDetailModal({isOpen:true ,data:bdstTable[index] })
|
||||
}else if( headId==='chBuildingYn' && index!==undefined && bdstTable!==undefined){
|
||||
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
setDetailModal({ isOpen: true, data: bdstTable[index] })
|
||||
} else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
if (
|
||||
bdstTable[index] &&
|
||||
bdstTable[index]?.chgBuilding[0]?.bdstChgNm!==null
|
||||
|
||||
bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null
|
||||
|
||||
) {
|
||||
setBdstChgProps({ isOpen:true , chBuilding: bdstTable[index].chgBuilding});
|
||||
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (!rainSttn.isInit) {
|
||||
rainSttnInit(codeData ?? "0");
|
||||
@@ -73,7 +72,7 @@ export default function RainSttn() {
|
||||
...item,
|
||||
...item.reuseBuilding[0],
|
||||
...item.reuseBuilding[0].rainyObj,
|
||||
chBuildingYn:item.chgBuilding[0]?.bdstChgNm!==null?'Y':'N'
|
||||
chBuildingYn: item.chgBuilding[0]?.bdstChgNm !== null ? 'Y' : 'N'
|
||||
|
||||
}))
|
||||
.filter((item: any) => item.rainyObj !== undefined);
|
||||
@@ -92,14 +91,15 @@ export default function RainSttn() {
|
||||
excelDownload(
|
||||
rainSttn.excelList,
|
||||
"빗물재이용시설 현황",
|
||||
"sample_rainSttn.xlsx"
|
||||
"sample_rainSttn.xlsx",
|
||||
"A1:W3"
|
||||
);
|
||||
}
|
||||
}, [rainSttn.excelList]);
|
||||
|
||||
const excelClick = useCallback(() => {
|
||||
if (codeData) rainSttnSearch(1, "10000", codeData);
|
||||
}, [rainSttnSearch,codeData]);
|
||||
}, [rainSttnSearch, codeData]);
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -136,7 +136,7 @@ export default function RainSttn() {
|
||||
rainSttnSearch(1, "20", con);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {}}
|
||||
initClick={function (): void { }}
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
/>
|
||||
@@ -154,7 +154,7 @@ export default function RainSttn() {
|
||||
headlist={rainSttn.rainSttHeadList}
|
||||
pageSize={20}
|
||||
total={100000}
|
||||
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
|
||||
cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }}
|
||||
onPageChange={setPageNation}
|
||||
></UiTable>
|
||||
</ListDiv>
|
||||
@@ -177,12 +177,12 @@ export default function RainSttn() {
|
||||
}
|
||||
/>
|
||||
<UiModal
|
||||
open={detailModal.isOpen}
|
||||
onOpenChange={()=>{
|
||||
setDetailModal({...detailModal, isOpen:!detailModal.isOpen})
|
||||
}}
|
||||
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
|
||||
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data}/>}/>
|
||||
open={detailModal.isOpen}
|
||||
onOpenChange={() => {
|
||||
setDetailModal({ ...detailModal, isOpen: !detailModal.isOpen })
|
||||
}}
|
||||
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
|
||||
body={<SttnDetailModal type={"RNB"} formObj={detailModal.data} />} />
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function RswtSttn() {
|
||||
const [isChHead, setIsChHead] = useState(false);
|
||||
const ref = useRef<ReturnType>({} as ReturnType);
|
||||
const [bdstTable, setBdstTable] = useState<customRswtBdst[]>();
|
||||
const [detailModal, setDetailModal] = useState<{isOpen:boolean,data:customRswtBdst|undefined}>({data:undefined,isOpen:false })
|
||||
const [detailModal, setDetailModal] = useState<{ isOpen: boolean, data: customRswtBdst | undefined }>({ data: undefined, isOpen: false })
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chBuilding: chgBuilding[];
|
||||
@@ -43,18 +43,18 @@ export default function RswtSttn() {
|
||||
const codeCityOrSgg = getCityOrSgg(ref);
|
||||
|
||||
|
||||
const cellClick=(index:number|undefined, headId: string)=>{
|
||||
const cellClick = (index: number | undefined, headId: string) => {
|
||||
|
||||
if(headId!=='chBuildingYn' && index!==undefined && bdstTable!==undefined){
|
||||
setDetailModal({isOpen:true ,data:bdstTable[index] })
|
||||
}else if( headId==='chBuildingYn' && index!==undefined && bdstTable!==undefined){
|
||||
if (headId !== 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
setDetailModal({ isOpen: true, data: bdstTable[index] })
|
||||
} else if (headId === 'chBuildingYn' && index !== undefined && bdstTable !== undefined) {
|
||||
if (
|
||||
bdstTable[index] &&
|
||||
bdstTable[index]?.chBuildingYn ==='Y'
|
||||
|
||||
bdstTable[index]?.chBuildingYn === 'Y'
|
||||
|
||||
) {
|
||||
|
||||
setBdstChgProps({ isOpen:true , chBuilding: bdstTable[index].chgBuilding});
|
||||
setBdstChgProps({ isOpen: true, chBuilding: bdstTable[index].chgBuilding });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ const cellClick=(index:number|undefined, headId: string)=>{
|
||||
...item,
|
||||
...item.reuseBuilding[0],
|
||||
...item.reuseBuilding[0]?.rswtrObj,
|
||||
chBuildingYn:item?.chgBuilding[0]?.bdstChgNm!==null &&item?.chgBuilding.length>0?'Y':'N'
|
||||
chBuildingYn: item?.chgBuilding[0]?.bdstChgNm !== null && item?.chgBuilding.length > 0 ? 'Y' : 'N'
|
||||
}))
|
||||
.filter(
|
||||
(item: customRswtBdst) =>
|
||||
@@ -91,17 +91,18 @@ const cellClick=(index:number|undefined, headId: string)=>{
|
||||
excelDownload(
|
||||
rswtSttn.excelList,
|
||||
"중수도시설 현황",
|
||||
"sample_rswtSttn.xlsx"
|
||||
"sample_rswtSttn.xlsx",
|
||||
"A1:W3",
|
||||
);
|
||||
}
|
||||
}, [rswtSttn.excelList]);
|
||||
|
||||
const excelClick = useCallback(
|
||||
(returnType: ReturnType) => {
|
||||
if(codeCityOrSgg)
|
||||
rswtSttnSearch(1, "10000", codeCityOrSgg);
|
||||
if (codeCityOrSgg)
|
||||
rswtSttnSearch(1, "10000", codeCityOrSgg);
|
||||
},
|
||||
[rswtSttnSearch,codeCityOrSgg]
|
||||
[rswtSttnSearch, codeCityOrSgg]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -134,11 +135,11 @@ const cellClick=(index:number|undefined, headId: string)=>{
|
||||
leftChildren={undefined}
|
||||
queryClick={function (returnType: ReturnType): void {
|
||||
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
|
||||
if(codeCityOrSgg)
|
||||
rswtSttnSearch(1, "20", codeCityOrSgg);
|
||||
if (codeCityOrSgg)
|
||||
rswtSttnSearch(1, "20", codeCityOrSgg);
|
||||
}}
|
||||
excelClick={excelClick}
|
||||
initClick={function (): void {}}
|
||||
initClick={function (): void { }}
|
||||
btnClass={btnClass}
|
||||
ref={ref}
|
||||
/>
|
||||
@@ -156,7 +157,7 @@ const cellClick=(index:number|undefined, headId: string)=>{
|
||||
headlist={rswtSttn.rswtSttHeadList}
|
||||
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>
|
||||
|
||||
@@ -19,16 +19,22 @@ export type ldrmntState = {
|
||||
ldrmnt: {
|
||||
ldrmntHeadList: CommonTableProps[];
|
||||
ldrmntNodeList: CommonTableProps[];
|
||||
excelList: [];
|
||||
excelList: ExcelType[];
|
||||
isInit: boolean;
|
||||
ldrmntRes: customLdrmnt[];
|
||||
};
|
||||
};
|
||||
|
||||
type ExcelType = {
|
||||
[key: string]: string | number | undefined;
|
||||
};
|
||||
|
||||
const excelDownList: ExcelType[] = [];
|
||||
|
||||
type ldrmntActions = {
|
||||
ldrmntRegData: (data: any[]) => void,
|
||||
ldrmntInit: (con: string) => void
|
||||
ldrmntSearch: (sggCd: string, coNm: string) => void;
|
||||
ldrmntSearch: (page: number, sggCd: string, coNm: string) => void;
|
||||
ldrmntUpdate: (ldrmntRes: customLdrmnt) => void;
|
||||
ldrmntDelete: () => void;
|
||||
};
|
||||
@@ -51,12 +57,10 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
return {
|
||||
ldrmntInit: async (con: string) => {
|
||||
try {
|
||||
console.log("con", con)
|
||||
const ldrmntRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/reuseFc/request/temp/1/20/${con}`
|
||||
);
|
||||
console.log("initres", ldrmntRes)
|
||||
set((state: ldrmntState) => {
|
||||
return {
|
||||
...state,
|
||||
@@ -73,7 +77,6 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
},
|
||||
ldrmntRegData: async (data) => {
|
||||
try {
|
||||
|
||||
const response = await postFectch(
|
||||
"/reuseFc/request/temp",
|
||||
data,
|
||||
@@ -98,32 +101,41 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
|
||||
}
|
||||
},
|
||||
ldrmntSearch: async (sggCd: string, coNm: string) => {
|
||||
ldrmntSearch: async (page: number, sggCd: string, coNm: string) => {
|
||||
let searchUrl = "";
|
||||
console.log("인덱스", sggCd)
|
||||
|
||||
if (sggCd !== "") {
|
||||
if (coNm !== "") {
|
||||
searchUrl = `/reuseFc/request/temp/1/20/${sggCd}/${coNm}`;
|
||||
searchUrl = `/reuseFc/request/temp/${page}/20/${sggCd}/${coNm}`;
|
||||
} else {
|
||||
searchUrl = `/reuseFc/request/temp/1/20/${sggCd}`;
|
||||
searchUrl = `/reuseFc/request/temp/${page}/20/${sggCd}`;
|
||||
}
|
||||
}
|
||||
console.log("searchUrl", searchUrl)
|
||||
|
||||
|
||||
try {
|
||||
const ldrmntRes = await getFetch(
|
||||
fetchType.WR,
|
||||
searchUrl
|
||||
);
|
||||
console.log("search", ldrmntRes)
|
||||
|
||||
ldrmntRes.forEach((item: customLdrmnt) => {
|
||||
excelDownList.push({
|
||||
ctpvCd: item.ctpvCd,
|
||||
sggCd: item.sggCd,
|
||||
dmdCoNm: item.dmdCoNm,
|
||||
fctryAddr: item.fctryAddr,
|
||||
fctryMngNo: item.fctryMngNo,
|
||||
telno: item.telno,
|
||||
})
|
||||
})
|
||||
|
||||
set((state: ldrmntState) => {
|
||||
return {
|
||||
...state,
|
||||
ldrmnt: {
|
||||
...state.ldrmnt,
|
||||
ldrmntRes: ldrmntRes,
|
||||
excelList: excelDownList,
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -134,7 +146,6 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = (
|
||||
ldrmntUpdate: async (ldrmntRes: customLdrmnt) => {
|
||||
try {
|
||||
ldrmntRes.rgtr = TEST_UUID;
|
||||
console.log("ldrmntRes", ldrmntRes);
|
||||
const response = await putFectch(
|
||||
`/reuseFc/request/temp`,
|
||||
ldrmntRes
|
||||
|
||||
@@ -14,13 +14,13 @@ export type htdflSttnState = {
|
||||
isInit: boolean;
|
||||
htdflSttHeadList: z.infer<typeof sttnHeadListType>;
|
||||
htdflSttNodeList: CommonTableProps[];
|
||||
htdflSttnRes:customHtdflBdst[]
|
||||
htdflSttnRes: customHtdflBdst[]
|
||||
excelList: [];
|
||||
|
||||
};
|
||||
};
|
||||
type htdflSttnActions = {
|
||||
initHtdfl:(con:string) => void;
|
||||
initHtdfl: (con: string) => void;
|
||||
htdflSttnSearch: (page: number, total: string, con: string) => void;
|
||||
htdflChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
@@ -33,16 +33,16 @@ export const htdflSttnStateExport: htdflSttnState = {
|
||||
htdflSttn: {
|
||||
htdflSttHeadList: htdflSttHeadList,
|
||||
htdflSttNodeList: htdflSttNodeList,
|
||||
htdflSttnRes:[],
|
||||
excelList:[],
|
||||
htdflSttnRes: [],
|
||||
excelList: [],
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
const initFetch = async (code:string|number) => {
|
||||
const initFetch = async (code: string | number) => {
|
||||
const htdflRes = await getFetch(
|
||||
"wr",
|
||||
`/drain/facilityList/1/20/${code}`)
|
||||
|
||||
|
||||
return htdflRes;
|
||||
};
|
||||
|
||||
@@ -50,74 +50,72 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
initHtdfl: async (code: string | number) => {
|
||||
try {
|
||||
const htdflSttnRes = await initFetch(code);
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
initHtdfl: async (code: string | number) => {
|
||||
try {
|
||||
const htdflSttnRes = await initFetch(code);
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
htdflSttnSearch: async (page: number, total: string, con: string) => {
|
||||
try {
|
||||
const htdflSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/drain/facilityList/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
|
||||
|
||||
set((state: htdflSttnState) => {
|
||||
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
excelList: htdflSttnRes,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (erTxt) {
|
||||
console.log("error", erTxt);
|
||||
}
|
||||
},
|
||||
htdflChSttnHead: async (
|
||||
headList: z.infer<typeof sttnHeadListType>
|
||||
): Promise<void> => {
|
||||
|
||||
const changeNodeList = controlHeadView(headList, htdflSttNodeList)
|
||||
|
||||
return set((state: htdflSttnState) => ({
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttHeadList: headList,
|
||||
htdflSttNodeList: changeNodeList,
|
||||
},
|
||||
htdflSttnSearch: async (page: number, total: string, con: string) => {
|
||||
try {
|
||||
console.log(page)
|
||||
const htdflSttnRes = await getFetch(
|
||||
fetchType.WR,
|
||||
`/drain/facilityList/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
|
||||
|
||||
set((state: htdflSttnState) => {
|
||||
}));
|
||||
},
|
||||
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
excelList: htdflSttnRes,
|
||||
},
|
||||
};
|
||||
});
|
||||
} else
|
||||
set((state: htdflSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttnRes: htdflSttnRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
});
|
||||
} catch (erTxt) {
|
||||
console.log("error", erTxt);
|
||||
}
|
||||
},
|
||||
htdflChSttnHead: async (
|
||||
headList: z.infer<typeof sttnHeadListType>
|
||||
): Promise<void> => {
|
||||
|
||||
console.log('head ', headList)
|
||||
const changeNodeList= controlHeadView(headList,htdflSttNodeList)
|
||||
|
||||
return set((state: htdflSttnState) => ({
|
||||
htdflSttn: {
|
||||
...state.htdflSttn,
|
||||
htdflSttHeadList: headList,
|
||||
htdflSttNodeList: changeNodeList,
|
||||
},
|
||||
}));
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,24 +5,25 @@ export const excelRSwtSttnParsing = (data: customRswtBdst[]): string[][] => {
|
||||
|
||||
data.forEach((item) => {
|
||||
excelExportData.push([
|
||||
String(item.cityText),
|
||||
String(item.sggText),
|
||||
String(item.ctpvCd),
|
||||
String(item.sggCd),
|
||||
item.bdstNm ?? "",
|
||||
item.daddr ?? "",
|
||||
String(item.bdstUsgText ?? ""),
|
||||
String(item.frstArchPrmsnDt ?? ""),
|
||||
String(item.archArea ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""),
|
||||
String(item.chgBuilding.length>0 ? "Y" :"N"),
|
||||
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""),
|
||||
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""),
|
||||
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]?.rswtrObj.wtrUsqty ?? "0"), //물사용량
|
||||
String(item.chgBuilding.length>0 ? "Y" :"N"), //중축・개축・재축여부
|
||||
String(item.reuseBuilding?.[0]?.lawTrgtYn ?? ""), //법적의무대상여부
|
||||
String(item.reuseBuilding?.[0]?.rswtrObj.oblgTrgtWtrUsqty ?? ""), //의무대상물사용량
|
||||
String(item.reuseBuilding?.[0]?.instlCmptnDt ?? ""), //설치완료일시
|
||||
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 ?? ""),
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { CommonTableProps } from "@/app/store/common/type/header";
|
||||
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";
|
||||
import type { z } from "zod";
|
||||
import type { customRswtBdst } from "../../fcltReg/rswtReg";
|
||||
import { controlHeadView } from "../rainSttn";
|
||||
import type { sttnHeadListType } from "../rainSttn/headList";
|
||||
import { excelRSwtSttnParsing } from "./excel";
|
||||
import { rswtSttHeadListExport, rswtSttNodeListExport } from "./headList";
|
||||
|
||||
|
||||
|
||||
// 테이블 헤드 리스트
|
||||
const rswtSttNodeList = rswtSttNodeListExport;
|
||||
const rswtSttHeadList = rswtSttHeadListExport;
|
||||
const rswtSttHeadList = rswtSttHeadListExport;
|
||||
const rswtSttnRes: customRswtBdst[] = [];
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export type rswtSttnState = {
|
||||
|
||||
|
||||
type rswtSttnActions = {
|
||||
rswtSttnInit:(con:string) => void;
|
||||
rswtSttnInit: (con: string) => void;
|
||||
rswtSttnSearch: (page: number, total: string, con: string) => void;
|
||||
rswtChSttnHead: (
|
||||
headList: z.infer<typeof sttnHeadListType>,
|
||||
@@ -56,27 +56,27 @@ 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)
|
||||
}
|
||||
},
|
||||
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(
|
||||
@@ -84,13 +84,13 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
`/reuseFc/waterreuseFc/${page}/${total}/${con}`
|
||||
);
|
||||
if (Number(total) > 9000) {
|
||||
const rainExcel = excelRainSttnParsing(rswtSttnRes);
|
||||
const rswtExcel = excelRSwtSttnParsing(rswtSttnRes);
|
||||
set((state: rswtSttnState) => {
|
||||
return {
|
||||
...state,
|
||||
rswtSttn: {
|
||||
...state.rswtSttn,
|
||||
excelList: rainExcel,
|
||||
excelList: rswtExcel,
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -114,8 +114,7 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = (
|
||||
headList: z.infer<typeof sttnHeadListType>
|
||||
): Promise<void> => {
|
||||
|
||||
console.log('head ', headList)
|
||||
const changeNodeList= controlHeadView(headList,rswtSttNodeList)
|
||||
const changeNodeList = controlHeadView(headList, rswtSttNodeList)
|
||||
|
||||
return set((state: rswtSttnState) => ({
|
||||
rswtSttn: {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user