중수도시설현황 엑셀 다운로드 수정
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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.
Reference in New Issue
Block a user