물재이용: 지도점검 조회 코드 로그인 코드로 수정
This commit is contained in:
@@ -1,12 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useWrStore } from "@/app/store";
|
import { useWrStore } from "@/app/store";
|
||||||
import { commonCd, rainPageSize } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
import { rainPageSize } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||||
import { rswtPageSize } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
import { rswtPageSize } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
|
||||||
import {
|
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
|
||||||
excelDownload,
|
|
||||||
yearOptions
|
|
||||||
} from "@/components/lib/func/commom";
|
|
||||||
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
import ChkgdModal from "@/components/ui/modal/chkgd/chkgdModal/chkgdModal";
|
||||||
import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable";
|
import RainChkgdTable from "@/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable";
|
||||||
import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable";
|
import RswtChkgdTable from "@/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable";
|
||||||
@@ -18,7 +15,7 @@ import {
|
|||||||
SearchInput,
|
SearchInput,
|
||||||
SelectBox,
|
SelectBox,
|
||||||
Title,
|
Title,
|
||||||
UiModal
|
UiModal,
|
||||||
} from "@common/business_components/ui";
|
} from "@common/business_components/ui";
|
||||||
import ListDiv from "@common/business_components/ui/list_div";
|
import ListDiv from "@common/business_components/ui/list_div";
|
||||||
import { Button, Label } from "@common/components/ui";
|
import { Button, Label } from "@common/components/ui";
|
||||||
@@ -28,6 +25,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const {
|
const {
|
||||||
|
auth,
|
||||||
rainChkSttn,
|
rainChkSttn,
|
||||||
rswtChkSttn,
|
rswtChkSttn,
|
||||||
rainChkSttnInit,
|
rainChkSttnInit,
|
||||||
@@ -41,6 +39,7 @@ export default function Page() {
|
|||||||
return state;
|
return state;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { laeSeCd } = auth;
|
||||||
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
|
const [selFcltDiv, setSelFcltDiv] = useState("RNB");
|
||||||
const [rainPageNation, setRainPageNation] = useState(1);
|
const [rainPageNation, setRainPageNation] = useState(1);
|
||||||
const [rswtPageNation, setRswtPageNation] = useState(1);
|
const [rswtPageNation, setRswtPageNation] = useState(1);
|
||||||
@@ -49,7 +48,9 @@ export default function Page() {
|
|||||||
open: false,
|
open: false,
|
||||||
data: {},
|
data: {},
|
||||||
});
|
});
|
||||||
const [searchYear, setSearchYear] = useState<string>(String(new Date().getFullYear()));
|
const [searchYear, setSearchYear] = useState<string>(
|
||||||
|
String(new Date().getFullYear())
|
||||||
|
);
|
||||||
const cellClick = () => {
|
const cellClick = () => {
|
||||||
if (searchYear) {
|
if (searchYear) {
|
||||||
if (selFcltDiv === "RNB") {
|
if (selFcltDiv === "RNB") {
|
||||||
@@ -58,11 +59,11 @@ export default function Page() {
|
|||||||
rainPageNation,
|
rainPageNation,
|
||||||
rainPageSize,
|
rainPageSize,
|
||||||
searchYear,
|
searchYear,
|
||||||
commonCd,
|
laeSeCd,
|
||||||
fcltNm
|
fcltNm
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
rainChkSttnInit(rainPageNation, rainPageSize, searchYear, commonCd);
|
rainChkSttnInit(rainPageNation, rainPageSize, searchYear, laeSeCd);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fcltNm) {
|
if (fcltNm) {
|
||||||
@@ -70,11 +71,11 @@ export default function Page() {
|
|||||||
rswtPageNation,
|
rswtPageNation,
|
||||||
rswtPageSize,
|
rswtPageSize,
|
||||||
searchYear,
|
searchYear,
|
||||||
commonCd,
|
laeSeCd,
|
||||||
fcltNm
|
fcltNm
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
rswtChkSttnInit(rswtPageNation, rswtPageSize, searchYear, commonCd);
|
rswtChkSttnInit(rswtPageNation, rswtPageSize, searchYear, laeSeCd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,15 +85,9 @@ export default function Page() {
|
|||||||
if (pageNo > 0) {
|
if (pageNo > 0) {
|
||||||
setRainPageNation(pageNo);
|
setRainPageNation(pageNo);
|
||||||
if (fcltNm) {
|
if (fcltNm) {
|
||||||
rainChkSttnNmSearch(
|
rainChkSttnNmSearch(pageNo, rainPageSize, searchYear, laeSeCd, fcltNm);
|
||||||
pageNo,
|
|
||||||
rainPageSize,
|
|
||||||
searchYear,
|
|
||||||
commonCd,
|
|
||||||
fcltNm
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
rainChkSttnInit(pageNo, rainPageSize, searchYear, commonCd);
|
rainChkSttnInit(pageNo, rainPageSize, searchYear, laeSeCd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -101,38 +96,38 @@ export default function Page() {
|
|||||||
if (pageNo > 0) {
|
if (pageNo > 0) {
|
||||||
setRswtPageNation(pageNo);
|
setRswtPageNation(pageNo);
|
||||||
if (fcltNm) {
|
if (fcltNm) {
|
||||||
rswtChkNmSttnSearch(
|
rswtChkNmSttnSearch(pageNo, rainPageSize, searchYear, laeSeCd, fcltNm);
|
||||||
pageNo,
|
|
||||||
rainPageSize,
|
|
||||||
searchYear,
|
|
||||||
commonCd,
|
|
||||||
fcltNm
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
rswtChkSttnInit(pageNo, rswtPageSize, searchYear, commonCd);
|
rswtChkSttnInit(pageNo, rswtPageSize, searchYear, laeSeCd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!rainChkSttn.isInit) {
|
if (!rainChkSttn.isInit) {
|
||||||
isRainSttn(true)
|
isRainSttn(true);
|
||||||
rainChkSttnInit(1, rainPageSize, new Date().getFullYear().toString(), commonCd);
|
rainChkSttnInit(
|
||||||
|
1,
|
||||||
|
rainPageSize,
|
||||||
|
new Date().getFullYear().toString(),
|
||||||
|
laeSeCd
|
||||||
|
);
|
||||||
setIsModal({ data: {}, open: false });
|
setIsModal({ data: {}, open: false });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [rainChkSttn.isInit, rainChkSttnInit, rainPageSize]);
|
}, [rainChkSttn.isInit, rainChkSttnInit, rainPageSize]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!rswtChkSttn.isInit) {
|
if (!rswtChkSttn.isInit) {
|
||||||
setIsModal({ data: {}, open: false });
|
setIsModal({ data: {}, open: false });
|
||||||
rswtChkSttnInit(1, rswtPageSize, new Date().getFullYear().toString(), commonCd);
|
rswtChkSttnInit(
|
||||||
isRswtSttn(true)
|
1,
|
||||||
|
rswtPageSize,
|
||||||
|
new Date().getFullYear().toString(),
|
||||||
|
laeSeCd
|
||||||
|
);
|
||||||
|
isRswtSttn(true);
|
||||||
}
|
}
|
||||||
}, [rswtChkSttn.isInit, rswtChkSttnInit, rswtPageSize])
|
}, [rswtChkSttn.isInit, rswtChkSttnInit, rswtPageSize]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleClick = useCallback(
|
const handleClick = useCallback(
|
||||||
(data: any) => {
|
(data: any) => {
|
||||||
@@ -140,11 +135,14 @@ export default function Page() {
|
|||||||
},
|
},
|
||||||
[isModal]
|
[isModal]
|
||||||
);
|
);
|
||||||
const { t } = useTranslation('base');
|
const { t } = useTranslation("base");
|
||||||
const excelDown = () => {
|
const excelDown = () => {
|
||||||
if (rainChkSttn.sttnExcelList && selFcltDiv === "RNB") {
|
if (rainChkSttn.sttnExcelList && selFcltDiv === "RNB") {
|
||||||
if (!rainChkSttn.sttnExcelList || rainChkSttn.sttnExcelList.length === 0) {
|
if (
|
||||||
toast.error(t('excelDownErrMsg'));
|
!rainChkSttn.sttnExcelList ||
|
||||||
|
rainChkSttn.sttnExcelList.length === 0
|
||||||
|
) {
|
||||||
|
toast.error(t("excelDownErrMsg"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
excelDownload(
|
excelDownload(
|
||||||
@@ -155,8 +153,11 @@ export default function Page() {
|
|||||||
3
|
3
|
||||||
);
|
);
|
||||||
} else if (rswtChkSttn.sttnExcelList && selFcltDiv === "RST") {
|
} else if (rswtChkSttn.sttnExcelList && selFcltDiv === "RST") {
|
||||||
if (!rswtChkSttn.sttnExcelList || rswtChkSttn.sttnExcelList.length === 0) {
|
if (
|
||||||
toast.error(t('excelDownErrMsg'));
|
!rswtChkSttn.sttnExcelList ||
|
||||||
|
rswtChkSttn.sttnExcelList.length === 0
|
||||||
|
) {
|
||||||
|
toast.error(t("excelDownErrMsg"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
excelDownload(
|
excelDownload(
|
||||||
@@ -167,7 +168,7 @@ export default function Page() {
|
|||||||
3
|
3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContentsDiv>
|
<ContentsDiv>
|
||||||
@@ -177,7 +178,9 @@ export default function Page() {
|
|||||||
<SearchDiv>
|
<SearchDiv>
|
||||||
<SearchFormLeft>
|
<SearchFormLeft>
|
||||||
<div className="col-span-2 flex flex-row space-x-2">
|
<div className="col-span-2 flex flex-row space-x-2">
|
||||||
<Label className="w-48 mt-2 text-xl text-gray-600">{'지도점검년도'}</Label>
|
<Label className="w-48 mt-2 text-xl text-gray-600">
|
||||||
|
{"지도점검년도"}
|
||||||
|
</Label>
|
||||||
<SelectBox
|
<SelectBox
|
||||||
className="w-full h-full text-2xl"
|
className="w-full h-full text-2xl"
|
||||||
label=""
|
label=""
|
||||||
@@ -190,7 +193,9 @@ export default function Page() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-span-2 flex flex-row space-x-2">
|
<div className="col-span-2 flex flex-row space-x-2">
|
||||||
<Label className="w-28 mt-2 text-xl text-gray-600">{'시설구분'}</Label>
|
<Label className="w-28 mt-2 text-xl text-gray-600">
|
||||||
|
{"시설구분"}
|
||||||
|
</Label>
|
||||||
<SelectBox
|
<SelectBox
|
||||||
className={"w-full h-full text-2xl"}
|
className={"w-full h-full text-2xl"}
|
||||||
label={""}
|
label={""}
|
||||||
@@ -198,9 +203,8 @@ export default function Page() {
|
|||||||
selectArray={rainChkSttn.fcltDiv}
|
selectArray={rainChkSttn.fcltDiv}
|
||||||
onSelectValue={(val: string | number) => {
|
onSelectValue={(val: string | number) => {
|
||||||
if (val === "RST") rswtChkPolInit();
|
if (val === "RST") rswtChkPolInit();
|
||||||
setSelFcltDiv(String(val))
|
setSelFcltDiv(String(val));
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val}
|
value={selFcltDiv ?? rainChkSttn.fcltDiv[0]?.val}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -227,7 +231,13 @@ export default function Page() {
|
|||||||
>
|
>
|
||||||
조회
|
조회
|
||||||
</Button>
|
</Button>
|
||||||
<Button color="green" size={"sm"} onClick={() => { excelDown() }}>
|
<Button
|
||||||
|
color="green"
|
||||||
|
size={"sm"}
|
||||||
|
onClick={() => {
|
||||||
|
excelDown();
|
||||||
|
}}
|
||||||
|
>
|
||||||
다운로드
|
다운로드
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -241,8 +251,8 @@ export default function Page() {
|
|||||||
<ListDiv>
|
<ListDiv>
|
||||||
{selFcltDiv === "RNB" ? (
|
{selFcltDiv === "RNB" ? (
|
||||||
<RainChkgdTable
|
<RainChkgdTable
|
||||||
deleteData={() => { }}
|
deleteData={() => {}}
|
||||||
detailUp={() => { }}
|
detailUp={() => {}}
|
||||||
handleClick={handleClick}
|
handleClick={handleClick}
|
||||||
rainChkData={rainChkSttn.rainChkRes}
|
rainChkData={rainChkSttn.rainChkRes}
|
||||||
pageNation={rainPageNation}
|
pageNation={rainPageNation}
|
||||||
@@ -252,8 +262,8 @@ export default function Page() {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<RswtChkgdTable
|
<RswtChkgdTable
|
||||||
detaiRswtlUpdate={() => { }}
|
detaiRswtlUpdate={() => {}}
|
||||||
deleteRswtData={() => { }}
|
deleteRswtData={() => {}}
|
||||||
handleRswtClick={handleClick}
|
handleRswtClick={handleClick}
|
||||||
rswtChkData={rswtChkSttn.rswtChkRes}
|
rswtChkData={rswtChkSttn.rswtChkRes}
|
||||||
pageNation={rswtPageNation}
|
pageNation={rswtPageNation}
|
||||||
@@ -271,7 +281,14 @@ export default function Page() {
|
|||||||
setIsModal({ open: !open, data: {} });
|
setIsModal({ open: !open, data: {} });
|
||||||
}}
|
}}
|
||||||
bodyClass={"w-[80vw] max-w-none"}
|
bodyClass={"w-[80vw] max-w-none"}
|
||||||
body={<ChkgdModal readonly={true} type={selFcltDiv} obj={isModal.data} setIsModal={() => { }} />}
|
body={
|
||||||
|
<ChkgdModal
|
||||||
|
readonly={true}
|
||||||
|
type={selFcltDiv}
|
||||||
|
obj={isModal.data}
|
||||||
|
setIsModal={() => {}}
|
||||||
|
/>
|
||||||
|
}
|
||||||
></UiModal>
|
></UiModal>
|
||||||
<Toaster position="top-center" />
|
<Toaster position="top-center" />
|
||||||
</ContentsDiv>
|
</ContentsDiv>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import {
|
|||||||
} from "./headList";
|
} from "./headList";
|
||||||
|
|
||||||
export const rainPageSize = 5;
|
export const rainPageSize = 5;
|
||||||
export const commonCd = "41";
|
|
||||||
|
|
||||||
export type rainChkZodType = z.infer<typeof rainChkZod>;
|
export type rainChkZodType = z.infer<typeof rainChkZod>;
|
||||||
const fcltDiv = [
|
const fcltDiv = [
|
||||||
@@ -75,7 +74,7 @@ type rainChkgdnActions = {
|
|||||||
sggCode: SelectDataType[],
|
sggCode: SelectDataType[],
|
||||||
sggCd:string
|
sggCd:string
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
rainChkExcelDataUPload(excelData: rainChkZodType[] ,year :string) : Promise<void>;
|
rainChkExcelDataUPload(excelData: rainChkZodType[] ,year :string,laeSeCd:string) : Promise<void>;
|
||||||
rainChkDelete(chkgdnSns: number[] ,year :string): Promise<void>;
|
rainChkDelete(chkgdnSns: number[] ,year :string): Promise<void>;
|
||||||
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void;
|
rainChkHeadChange: (rainChkgdn: rainChkgdnState, isEdit: boolean) => void;
|
||||||
rainChkNmSearch: (
|
rainChkNmSearch: (
|
||||||
@@ -168,7 +167,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
rainChkExcelDataUPload: async (excelData: rainChkZodType[] ,year:string) => {
|
rainChkExcelDataUPload: async (excelData: rainChkZodType[] ,year:string,laeSeCd:string) => {
|
||||||
set((state: rainChkgdnType) => (
|
set((state: rainChkgdnType) => (
|
||||||
{ rainChkgdn: { ...state.rainChkgdn, isLoading: true } }));
|
{ rainChkgdn: { ...state.rainChkgdn, isLoading: true } }));
|
||||||
try {
|
try {
|
||||||
@@ -178,7 +177,7 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
|||||||
1,
|
1,
|
||||||
rainPageSize,
|
rainPageSize,
|
||||||
year,
|
year,
|
||||||
commonCd
|
laeSeCd
|
||||||
);
|
);
|
||||||
set((state: rainChkgdnState) => ({
|
set((state: rainChkgdnState) => ({
|
||||||
...state,
|
...state,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ type rswtChkgdnActions = {
|
|||||||
sggCode: SelectDataType[],
|
sggCode: SelectDataType[],
|
||||||
sggCd: string,
|
sggCd: string,
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
rswtChkExceDataUpload: (excelData: rswtChkZodType[]) => void;
|
rswtChkExceDataUpload: (excelData: rswtChkZodType[],laeSeCd:string) => void;
|
||||||
rswtChkDelete: (chkgdnSns: number[] ,year:string) => void;
|
rswtChkDelete: (chkgdnSns: number[] ,year:string) => void;
|
||||||
rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[] ,year:string) => void;
|
rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[] ,year:string) => void;
|
||||||
rswtChkPolAndGuide: (chkgdnSn: number) => void;
|
rswtChkPolAndGuide: (chkgdnSn: number) => void;
|
||||||
@@ -244,7 +244,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
rswtChkExceDataUpload: async (excelData: rswtChkZodType[]) => {
|
rswtChkExceDataUpload: async (excelData: rswtChkZodType[],laeSeCd:string) => {
|
||||||
try {
|
try {
|
||||||
set((state: rswtChkgdnType) => (
|
set((state: rswtChkgdnType) => (
|
||||||
{ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } }));
|
{ rswtChkgdn: { ...state.rswtChkgdn, isLoading: true } }));
|
||||||
@@ -256,7 +256,7 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const currentYear = new Date().getFullYear().toString();
|
const currentYear = new Date().getFullYear().toString();
|
||||||
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, "0");
|
const rswtChkRes = await initFetch(1, rswtPageSize, currentYear, laeSeCd);
|
||||||
return set((state: rswtChkgdnState) => ({
|
return set((state: rswtChkgdnState) => ({
|
||||||
...state,
|
...state,
|
||||||
rswtChkgdn: {
|
rswtChkgdn: {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export default function ChkgdExcel({
|
|||||||
setYearChange: (year: string) => void;
|
setYearChange: (year: string) => void;
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
|
auth,
|
||||||
rswtChkgdn,
|
rswtChkgdn,
|
||||||
rainChkgdn,
|
rainChkgdn,
|
||||||
rainChkExcelDataUPload,
|
rainChkExcelDataUPload,
|
||||||
@@ -51,6 +52,7 @@ export default function ChkgdExcel({
|
|||||||
|
|
||||||
const [file, setFile] = useState<File | null>(null);
|
const [file, setFile] = useState<File | null>(null);
|
||||||
|
|
||||||
|
const { laeSeCd } = auth;
|
||||||
const clearFile = () => {
|
const clearFile = () => {
|
||||||
if (fileInputRef.current) {
|
if (fileInputRef.current) {
|
||||||
fileInputRef.current.value = ""; // ✅ 파일 선택 비우기
|
fileInputRef.current.value = ""; // ✅ 파일 선택 비우기
|
||||||
@@ -202,7 +204,8 @@ export default function ChkgdExcel({
|
|||||||
} else {
|
} else {
|
||||||
rainChkExcelDataUPload(
|
rainChkExcelDataUPload(
|
||||||
excelData as rainChkZodType[],
|
excelData as rainChkZodType[],
|
||||||
form.getValues("chckYr")
|
form.getValues("chckYr"),
|
||||||
|
laeSeCd
|
||||||
);
|
);
|
||||||
setIsRegExcel(false);
|
setIsRegExcel(false);
|
||||||
setYearChange(form.getValues("chckYr"));
|
setYearChange(form.getValues("chckYr"));
|
||||||
@@ -213,7 +216,7 @@ export default function ChkgdExcel({
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[]);
|
rswtChkExceDataUpload(excelRswtData as rswtChkZodType[], laeSeCd);
|
||||||
setIsRegExcel(false);
|
setIsRegExcel(false);
|
||||||
setYearChange(form.getValues("chckYr"));
|
setYearChange(form.getValues("chckYr"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user