Compare commits

..
34 Commits
Author SHA1 Message Date
leedj312 f731d0f9f0 변경사항 2025-07-21 19:04:13 +09:00
leedj312 069e489d03 온배수 현황 수질 작업중 2025-07-21 17:59:55 +09:00
leedj312 990dffc11c 물재이용 / 이동시 메인으로 이동 2025-07-21 17:59:38 +09:00
leedj312 ae97a48ba2 사이드바 매뉴이동 수정 2025-07-17 17:25:05 +09:00
leedj312 db70ba56c6 개발서버 env변경 2025-07-17 16:26:47 +09:00
leedj312 3fa1c526fe env 변경 2025-07-17 16:20:13 +09:00
leedj312 992893510e Merge remote-tracking branch 'origin/iipbs/wr/pfmncSttn' into iipbs/wr/dev 2025-07-17 16:05:11 +09:00
leedj312 5fe4bc94da Merge commit 'c22e07bc16afbc2888806b4e0d36606b8ea0d35f' into iipbs/wr/dev 2025-07-17 16:00:31 +09:00
leedj312 c22e07bc16 로딩바 className으로 z-index변경할수 있도록 수정 2025-07-17 15:59:22 +09:00
leedj312 5f302a5711 로그인 테스트 작업중 2025-07-17 15:57:20 +09:00
jyha00 cc749c0c24 Merge remote-tracking branch 'origin/iipbs/common/main' into iipbs/wr/pfmncSttn 2025-07-17 13:16:56 +09:00
jyha00 18ec5c937f 도넛차트 custom label 추가 2025-07-17 13:08:14 +09:00
leedj312 bd6dfd31fd 엑셀 중수도 지도점검 데이터 확인 2025-07-16 19:27:24 +09:00
jyha00 5aaa55d0c9 수요매칭검토 기본사항 readonly 추가 2025-07-16 16:29:25 +09:00
jyha00 8b1e8ae2eb datepicker 날짜가 하루 전 날로 들어가는 오류 수정 2025-07-16 15:33:57 +09:00
jyha00 5a3ef19e5d 하수재이용실적 현황 검색조건 수정 2025-07-16 15:32:18 +09:00
jyha00 01cb48e5b6 하수재이용시설 등록 보증수질 input 변경, 신규등록 저장 버튼 위치 수정, 상단 고정 추가 2025-07-16 14:55:44 +09:00
leedj312 ea7536bea3 안쓰는 함수 제거 2025-07-16 13:58:19 +09:00
leedj312 2356c10d34 빗물지도점검 오류 검증 2025-07-16 13:43:03 +09:00
jyha00 8b2dd27a79 하수재이용시설 등록 저장 버튼 위치 변경 2025-07-16 13:37:57 +09:00
YangJinSoo94 e0171a5a28 바차트 색상 구성 수정 2025-07-16 13:30:25 +09:00
jyha00 079542cf74 Merge branch 'iipbs/common/main' into iipbs/wr/pfmncSttn 2025-07-16 13:20:32 +09:00
jyha00 43f210a141 searchBaseForm, searchFormLeft에 className 프로퍼티 추가 2025-07-16 13:17:04 +09:00
leedj312 35ff13fb38 헤드리스트 수정 중 2025-07-15 20:27:43 +09:00
leedj312 231c0c2940 Merge commit 'a92f567e5c624486d80984c5e4427543aafdfdde' into iipbs/wr/dev 2025-07-15 20:27:30 +09:00
jyha00 a92f567e5c 재이용실적 현황 페이지 오류 수정 2025-07-15 20:23:02 +09:00
leedj312 ff9d373fcd Merge commit 'c111c2c084cfe533453f568d17c9fa5bcba02797' into iipbs/wr/dev 2025-07-15 20:22:57 +09:00
leedj312 c111c2c084 서버설정 작업 완료 2025-07-15 20:22:31 +09:00
leedj312 2d5a08a271 안쓰는 코드 삭제 2025-07-15 17:16:37 +09:00
leedj312 9a8abee77c 빌드에러 수정 2025-07-15 16:52:42 +09:00
jyha00 4c30c2fa47 물재이용 페이지별 오류 수정 2025-07-15 15:40:55 +09:00
leedj312 0cca1c8dbe 빌드 확인필요 2025-07-15 15:39:32 +09:00
jyha00 def7b2b01c 지도점검 등록 및 현황 단위 추가, 용수명 가운데 정렬로 수정 2025-07-15 13:54:30 +09:00
jyha00 4891725f68 물재이용 페이지 단위 추가 2025-07-15 11:11:29 +09:00
136 changed files with 3059 additions and 2611 deletions
@@ -185,15 +185,6 @@ function PostingDialog({ postingType, postingTargets }: PostingDialogProps) {
...prev,
[siteId]: value,
}));
// 상시 선택 시 게시 기간 미설정
if (value === "99") {
handleUpdateFields(siteId)({
pstgPrdSeCd: value,
});
return;
}
setRememberPeriodDate((prev) => ({
...prev,
[siteId]: { from, to },
@@ -20,7 +20,7 @@ import {
Skeleton,
} from "@common/components";
import { AttachmentApi } from "@/entities/attachment";
import { PostApi, PostPageGuard, type PostParams } from "@/entities/post";
import { PostApi, type PostParams } from "@/entities/post";
import { useAlertStore, useMenuStore, useUserStore } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
import dayjs from "dayjs";
@@ -103,147 +103,143 @@ function FaqPage({ bbsId }: { bbsId: string }) {
};
return (
<PostPageGuard bbsId={bbsId}>
<div className="card card-border !mt-6">
<div className="card card-border">
<form onSubmit={handleSubmit} className="flex items-center gap-2 p-2">
<Label className="mr-2 text-label">검색</Label>
<Select
value={postParams.keywordType}
onValueChange={(keywordType) => {
setPostParams({ ...postParams, keywordType });
}}
>
<SelectTrigger className="h-[3.2rem] w-[10rem]">
<SelectValue placeholder="선택" />
</SelectTrigger>
<SelectContent>
<SelectItem value="title">제목</SelectItem>
<SelectItem value="all">제목+내용</SelectItem>
<SelectItem value="writer">작성자</SelectItem>
</SelectContent>
</Select>
<Input
value={postParams.keyword}
onChange={(e) =>
setPostParams({ ...postParams, keyword: e.target.value })
}
className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]"
/>
<Button className="h-[3.2rem]" type="submit">
조회
</Button>
</form>
<div className="card card-border !mt-6">
<div className="card card-border">
<form onSubmit={handleSubmit} className="flex items-center gap-2 p-2">
<Label className="mr-2 text-label">검색</Label>
<Select
value={postParams.keywordType}
onValueChange={(keywordType) => {
setPostParams({ ...postParams, keywordType });
}}
>
<SelectTrigger className="h-[3.2rem] w-[10rem]">
<SelectValue placeholder="선택" />
</SelectTrigger>
<SelectContent>
<SelectItem value="title">제목</SelectItem>
<SelectItem value="all">제목+내용</SelectItem>
<SelectItem value="writer">작성자</SelectItem>
</SelectContent>
</Select>
<Input
value={postParams.keyword}
onChange={(e) =>
setPostParams({ ...postParams, keyword: e.target.value })
}
className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]"
/>
<Button className="h-[3.2rem]" type="submit">
조회
</Button>
</form>
</div>
<div className="card card-border">
<div className="card-header">
<div className="flex w-full items-center justify-between">
<h3 className="text-2xl font-medium text-label">콘텐츠 목록</h3>
<div className="flex gap-2">
{pageMenuAuthority?.regAuthrtYn === "Y" && (
<Button onClick={() => router.push(`${pathname}/register`)}>
등록
</Button>
)}
{pageMenuAuthority?.delAuthrtYn === "Y" && (
<Button
color="red"
onClick={onSelectedPostDelete}
disabled={!selectedPostNumbers.length}
>
선택삭제
</Button>
)}
</div>
</div>
</div>
<div className="card card-border">
<div className="card-header">
<div className="flex w-full items-center justify-between">
<h3 className="text-2xl font-medium text-label">콘텐츠 목록</h3>
<div className="flex gap-2">
{pageMenuAuthority?.regAuthrtYn === "Y" && (
<Button onClick={() => router.push(`${pathname}/register`)}>
등록
</Button>
)}
{pageMenuAuthority?.delAuthrtYn === "Y" && (
<Button
color="red"
onClick={onSelectedPostDelete}
disabled={!selectedPostNumbers.length}
<div className="card !m-[1.2rem] h-full overflow-auto !p-0">
<div className="mb-4 flex items-center gap-2 rounded-sm border border-border bg-background p-4">
<Checkbox
id="all-select"
checked={selectedPostNumbers.length === postList?.content.length}
onClick={(e) => e.stopPropagation()}
onCheckedChange={handleAllCheckboxChange}
/>
<Label htmlFor="all-select" className="text-2xl">
전체선택
</Label>
</div>
{isFetched ? (
<Accordion
type="multiple"
className="secondary flex flex-col gap-4"
>
{postList?.content.map((item) => (
<div key={item.pstNo} className="flex items-start gap-2">
<Checkbox
id={item.pstNo.toString()}
checked={selectedPostNumbers.includes(item.pstNo)}
onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) =>
handleCheckboxChange(item.pstNo, checked)
}
className="mx-2 my-6"
/>
<AccordionItem
value={item.pstNo.toString()}
className="w-full"
>
선택삭제
</Button>
)}
</div>
</div>
</div>
<div className="card !m-[1.2rem] h-full overflow-auto !p-0">
<div className="mb-4 flex items-center gap-2 rounded-sm border border-border bg-background p-4">
<Checkbox
id="all-select"
checked={
selectedPostNumbers.length === postList?.content.length
}
onClick={(e) => e.stopPropagation()}
onCheckedChange={handleAllCheckboxChange}
/>
<Label htmlFor="all-select" className="text-2xl">
전체선택
</Label>
</div>
{isFetched ? (
<Accordion
type="multiple"
className="secondary flex flex-col gap-4"
>
{postList?.content.map((item) => (
<div key={item.pstNo} className="flex items-start gap-2">
<Checkbox
id={item.pstNo.toString()}
checked={selectedPostNumbers.includes(item.pstNo)}
onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) =>
handleCheckboxChange(item.pstNo, checked)
}
className="mx-2 my-6"
/>
<AccordionItem
value={item.pstNo.toString()}
className="w-full"
>
<AccordionTrigger>
<div className="flex flex-1 items-center justify-between">
<div className="flex items-center gap-4">
<span className="text-primary">Q</span>
<span>{item.pstTtl}</span>
</div>
<span className="px-4 text-[1.2rem] font-normal text-label">
등록일: {dayjs(item.regDt).format("YYYY-MM-DD")}
</span>
<AccordionTrigger>
<div className="flex flex-1 items-center justify-between">
<div className="flex items-center gap-4">
<span className="text-primary">Q</span>
<span>{item.pstTtl}</span>
</div>
</AccordionTrigger>
<AccordionContent>
<div className="flex items-start gap-4">
<span className="text-[1.4rem] font-bold text-label">
A
</span>
<div className="flex-1">
<pre className="whitespace-pre-wrap font-noto text-[1.4rem] tracking-tighter text-foreground">
{item.pstCn}
</pre>
<Attachment atflCd={item.atflCd} />
</div>
<div className="flex justify-end gap-2">
<Button
size="icon"
color="white"
onClick={() =>
router.push(`${pathname}/${item.pstNo}`)
}
>
<i className="diveicon di-pencil" />
</Button>
<Button
size="icon"
color="white"
onClick={() => handleDeletePost(item.pstNo)}
>
<i className="diveicon di-trash" />
</Button>
</div>
<span className="px-4 text-[1.2rem] font-normal text-label">
등록일: {dayjs(item.regDt).format("YYYY-MM-DD")}
</span>
</div>
</AccordionTrigger>
<AccordionContent>
<div className="flex items-start gap-4">
<span className="text-[1.4rem] font-bold text-label">
A
</span>
<div className="flex-1">
<pre className="whitespace-pre-wrap font-noto text-[1.4rem] tracking-tighter text-foreground">
{item.pstCn}
</pre>
<Attachment atflCd={item.atflCd} />
</div>
</AccordionContent>
</AccordionItem>
</div>
))}
</Accordion>
) : (
<Skeleton className="h-[36rem] w-full" />
)}
</div>
<div className="flex justify-end gap-2">
<Button
size="icon"
color="white"
onClick={() =>
router.push(`${pathname}/${item.pstNo}`)
}
>
<i className="diveicon di-pencil" />
</Button>
<Button
size="icon"
color="white"
onClick={() => handleDeletePost(item.pstNo)}
>
<i className="diveicon di-trash" />
</Button>
</div>
</div>
</AccordionContent>
</AccordionItem>
</div>
))}
</Accordion>
) : (
<Skeleton className="h-[36rem] w-full" />
)}
</div>
</div>
</PostPageGuard>
</div>
);
}
+8 -27
View File
@@ -1,12 +1,5 @@
import { NextRequest, NextResponse } from "next/server";
import {
CLAIM_NAME,
AUTH_USER_ID,
PORT,
PROXY_HOST,
SERVER_API_URL,
SITE_ID,
} from "./src/shared/config";
import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config";
const serverApiUrl =
process.env.NEXT_PUBLIC_SERVER_API_URL ?? "http://localhost:3000";
@@ -14,23 +7,17 @@ const serverApiUrl =
export function middleware(req: NextRequest) {
const pathname = req.nextUrl.pathname;
const searchParams = req.nextUrl.searchParams;
const logMessages: string[] = [
`[Middleware Request] ${new Date().toISOString()}`,
`[Environment]\n Mode: ${process.env.NODE_ENV}\n Port: ${PORT}\n Proxy Host: ${PROXY_HOST}\n Server API URL: ${SERVER_API_URL}\n Site ID: ${SITE_ID}`,
`[Request]\n Original Pathname: ${pathname}`,
];
if (pathname.startsWith("/server")) {
const queryParams = searchParams.toString();
const decodedParams = Array.from(searchParams.entries())
.map(([key, value]) => `${key}=${decodeURIComponent(value)}`)
.join("&");
const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${
queryParams ? `?${queryParams}` : ""
decodedParams ? `?${decodedParams}` : ""
}`;
logMessages.push(` Rewritten URL: ${newUrl}`);
logMessages.push("\n--------------------------------\n");
console.log(logMessages.join("\n"));
return NextResponse.rewrite(new URL(newUrl));
}
@@ -43,10 +30,6 @@ export function middleware(req: NextRequest) {
if (token) requestHeaders.set(CLAIM_NAME, token);
if (userId) requestHeaders.set(AUTH_USER_ID, userId);
logMessages.push(` Rewritten URL: ${newUrl}`);
logMessages.push("\n--------------------------------\n");
console.log(logMessages.join("\n"));
return NextResponse.rewrite(new URL(newUrl), {
headers: requestHeaders,
});
@@ -56,8 +39,6 @@ export function middleware(req: NextRequest) {
return NextResponse.redirect(new URL("/dashboard", req.url));
}
logMessages.push("\n--------------------------------\n");
console.log(logMessages.join("\n"));
return NextResponse.next();
}
@@ -67,22 +67,11 @@ export const contentsDetailSchema = z.object({
useYn: z.string(),
});
export const contentsFormSchema = contentsDetailSchema
.omit({
contsVer: true,
aprvDt: true,
autzr: true,
})
.extend({
contsSn: z.number().optional(),
aprvCd: z
.enum([
CONTENTS_APPROVE_STATUS.DRAFT,
CONTENTS_APPROVE_STATUS.REQUESTED,
CONTENTS_APPROVE_STATUS.APPROVED,
])
.optional(),
});
export const contentsFormSchema = contentsDetailSchema.omit({
contsVer: true,
aprvDt: true,
autzr: true,
});
export type Contents = z.infer<typeof contentsSchema>;
export type ContentsDetail = z.infer<typeof contentsDetailSchema>;
@@ -6,7 +6,6 @@ import type {
MenuItem,
MenuFormData,
MenuTemporarilyStoredData,
SiteMapFormData,
} from "../model/menu-interface";
export class MenuApiService implements MenuService {
@@ -66,14 +65,6 @@ export class MenuApiService implements MenuService {
);
return response.data;
}
public async publishSiteMap(data: SiteMapFormData["siteMap"]): Promise<void> {
const response = await client.post<void>(
`${ENDPOINT.CMS_SERVICE.MENUS}/sitemap/publish`,
data,
);
return response.data;
}
}
export const MenuApi = new MenuApiService();
-3
View File
@@ -2,11 +2,8 @@ export { MenuApi } from "./api/menu-service";
export {
MENU_TYPE,
menuFormSchema,
siteMapFormSchema,
type MenuType,
type MenuItem,
type MenuFormData,
type SiteMapFormData,
type SiteMapPayloadData,
} from "./model/menu-interface";
export { MenuWrapper } from "./lib/menu-wrapper";
@@ -72,19 +72,8 @@ export const menuFormSchema = z.object({
menuPicDsgnYmd: z.string().nullish(),
});
export const siteMapPayloadSchema = z.object({
menuCd: z.number(),
menuSubKornNm: z.string(),
otptYn: z.string(),
});
export const siteMapFormSchema = z.object({
siteMap: z.array(siteMapPayloadSchema),
});
export type MenuFormData = z.infer<typeof menuFormSchema>;
export type SiteMapFormData = z.infer<typeof siteMapFormSchema>;
export type SiteMapPayloadData = z.infer<typeof siteMapPayloadSchema>;
export type Menu = Omit<MenuFormData, "iconNm"> & {
menuCd: number;
iconName?: string;
@@ -103,5 +92,4 @@ export interface MenuService {
getMenuTemporarilyStoredData: (
menuCd: number,
) => Promise<MenuTemporarilyStoredData[]>;
publishSiteMap: (data: SiteMapFormData["siteMap"]) => Promise<void>;
}
@@ -194,15 +194,6 @@ function PostingDialog({
...prev,
[siteId]: value,
}));
// 상시 선택 시 게시 기간 미설정
if (value === "99") {
handleUpdateFields(siteId)({
pstgPrdSeCd: value,
});
return;
}
setRememberPeriodDate((prev) => ({
...prev,
[siteId]: { from, to },
-2
View File
@@ -1,2 +0,0 @@
export { TreeMenuApi } from "./api/tree-menu-service";
export type { TreeMenu, TreeNode } from "./model/tree-menu-interface";
-1
View File
@@ -4,7 +4,6 @@ export {
userSaveSchema,
userPasswordUpdateSchema,
userUpdateSchema,
type UserStateCode,
type UserSearchParams,
type UserListResponse,
type UserSaveData,
@@ -9,8 +9,7 @@ export const USER_STATE_CODE = {
삭제: "09",
} as const;
export type UserStateCode =
(typeof USER_STATE_CODE)[keyof typeof USER_STATE_CODE];
type UserStateCode = (typeof USER_STATE_CODE)[keyof typeof USER_STATE_CODE];
// 사용자 검색 파라미터
export interface UserSearchParams extends PageableParams {
+133 -138
View File
@@ -23,7 +23,6 @@ import {
import { AttachmentApi } from "@/entities/attachment";
import {
PostApi,
PostPageGuard,
deleteReasonMessages,
type PostParams,
} from "@/entities/post";
@@ -121,147 +120,143 @@ function FaqPage({ bbsId }: { bbsId: string }) {
};
return (
<PostPageGuard bbsId={bbsId}>
<div className="card card-border !mt-6">
<div className="card card-border">
<form onSubmit={handleSubmit} className="flex items-center gap-2 p-2">
<Label className="mr-2 text-label">검색</Label>
<Select
value={postParams.keywordType}
onValueChange={(keywordType) => {
setPostParams({ ...postParams, keywordType });
}}
>
<SelectTrigger className="h-[3.2rem] w-[10rem]">
<SelectValue placeholder="선택" />
</SelectTrigger>
<SelectContent>
<SelectItem value="title">제목</SelectItem>
<SelectItem value="all">제목+내용</SelectItem>
<SelectItem value="writer">작성자</SelectItem>
</SelectContent>
</Select>
<Input
value={postParams.keyword}
onChange={(e) =>
setPostParams({ ...postParams, keyword: e.target.value })
}
className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]"
/>
<Button className="h-[3.2rem]" type="submit">
조회
</Button>
</form>
</div>
<div className="card card-border">
<div className="card-header">
<div className="flex w-full items-center justify-between">
<h3 className="text-2xl font-medium text-label">콘텐츠 목록</h3>
<div className="flex gap-2">
<AuthorityButton
authority="regAuthrtYn"
onClick={() => router.push(`${pathname}/register`)}
>
등록
</AuthorityButton>
<AuthorityButton
authority="delAuthrtYn"
color="red"
onClick={onSelectedPostDelete}
disabled={!selectedPostNumbers.length}
>
선택삭제
</AuthorityButton>
</div>
</div>
</div>
<div className="card !m-[1.2rem] h-full overflow-auto !p-0">
<div className="mb-4 flex items-center gap-2 rounded-sm border border-border bg-background p-4">
<Checkbox
id="all-select"
checked={
selectedPostNumbers.length === postList?.content.length
}
onClick={(e) => e.stopPropagation()}
onCheckedChange={handleAllCheckboxChange}
/>
<Label htmlFor="all-select" className="text-2xl">
전체선택
</Label>
</div>
{isFetched ? (
<Accordion
type="multiple"
className="secondary flex flex-col gap-4"
<div className="card card-border !mt-6">
<div className="card card-border">
<form onSubmit={handleSubmit} className="flex items-center gap-2 p-2">
<Label className="mr-2 text-label">검색</Label>
<Select
value={postParams.keywordType}
onValueChange={(keywordType) => {
setPostParams({ ...postParams, keywordType });
}}
>
<SelectTrigger className="h-[3.2rem] w-[10rem]">
<SelectValue placeholder="선택" />
</SelectTrigger>
<SelectContent>
<SelectItem value="title">제목</SelectItem>
<SelectItem value="all">제목+내용</SelectItem>
<SelectItem value="writer">작성자</SelectItem>
</SelectContent>
</Select>
<Input
value={postParams.keyword}
onChange={(e) =>
setPostParams({ ...postParams, keyword: e.target.value })
}
className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]"
/>
<Button className="h-[3.2rem]" type="submit">
조회
</Button>
</form>
</div>
<div className="card card-border">
<div className="card-header">
<div className="flex w-full items-center justify-between">
<h3 className="text-2xl font-medium text-label">콘텐츠 목록</h3>
<div className="flex gap-2">
<AuthorityButton
authority="regAuthrtYn"
onClick={() => router.push(`${pathname}/register`)}
>
{postList?.content.map((item) => (
<div key={item.pstNo} className="flex items-start gap-2">
<Checkbox
id={item.pstNo.toString()}
checked={selectedPostNumbers.includes(item.pstNo)}
onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) =>
handleCheckboxChange(item.pstNo, checked)
}
className="mx-2 my-6"
/>
<AccordionItem
value={item.pstNo.toString()}
className="w-full"
>
<AccordionTrigger>
<div className="flex flex-1 items-center justify-between">
<div className="flex items-center gap-4">
<span className="text-primary">Q</span>
<span>{item.pstTtl}</span>
</div>
<span className="px-4 text-[1.2rem] font-normal text-label">
등록일: {dayjs(item.regDt).format("YYYY-MM-DD")}
</span>
</div>
</AccordionTrigger>
<AccordionContent>
<div className="flex items-start gap-4">
<span className="text-[1.4rem] font-bold text-label">
A
</span>
<div className="flex-1">
<pre className="whitespace-pre-wrap font-noto text-[1.4rem] tracking-tighter text-foreground">
{item.pstCn}
</pre>
<Attachment atflCd={item.atflCd} />
</div>
<div className="flex justify-end gap-2">
<Button
size="icon"
color="white"
onClick={() =>
router.push(`${pathname}/${item.pstNo}`)
}
>
<i className="diveicon di-pencil" />
</Button>
<Button
size="icon"
color="white"
onClick={() => handleDeletePost(item.pstNo)}
>
<i className="diveicon di-trash" />
</Button>
</div>
</div>
</AccordionContent>
</AccordionItem>
</div>
))}
</Accordion>
) : (
<Skeleton className="h-[36rem] w-full" />
)}
등록
</AuthorityButton>
<AuthorityButton
authority="delAuthrtYn"
color="red"
onClick={onSelectedPostDelete}
disabled={!selectedPostNumbers.length}
>
선택삭제
</AuthorityButton>
</div>
</div>
</div>
<div className="card !m-[1.2rem] h-full overflow-auto !p-0">
<div className="mb-4 flex items-center gap-2 rounded-sm border border-border bg-background p-4">
<Checkbox
id="all-select"
checked={selectedPostNumbers.length === postList?.content.length}
onClick={(e) => e.stopPropagation()}
onCheckedChange={handleAllCheckboxChange}
/>
<Label htmlFor="all-select" className="text-2xl">
전체선택
</Label>
</div>
{isFetched ? (
<Accordion
type="multiple"
className="secondary flex flex-col gap-4"
>
{postList?.content.map((item) => (
<div key={item.pstNo} className="flex items-start gap-2">
<Checkbox
id={item.pstNo.toString()}
checked={selectedPostNumbers.includes(item.pstNo)}
onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) =>
handleCheckboxChange(item.pstNo, checked)
}
className="mx-2 my-6"
/>
<AccordionItem
value={item.pstNo.toString()}
className="w-full"
>
<AccordionTrigger>
<div className="flex flex-1 items-center justify-between">
<div className="flex items-center gap-4">
<span className="text-primary">Q</span>
<span>{item.pstTtl}</span>
</div>
<span className="px-4 text-[1.2rem] font-normal text-label">
등록일: {dayjs(item.regDt).format("YYYY-MM-DD")}
</span>
</div>
</AccordionTrigger>
<AccordionContent>
<div className="flex items-start gap-4">
<span className="text-[1.4rem] font-bold text-label">
A
</span>
<div className="flex-1">
<pre className="whitespace-pre-wrap font-noto text-[1.4rem] tracking-tighter text-foreground">
{item.pstCn}
</pre>
<Attachment atflCd={item.atflCd} />
</div>
<div className="flex justify-end gap-2">
<Button
size="icon"
color="white"
onClick={() =>
router.push(`${pathname}/${item.pstNo}`)
}
>
<i className="diveicon di-pencil" />
</Button>
<Button
size="icon"
color="white"
onClick={() => handleDeletePost(item.pstNo)}
>
<i className="diveicon di-trash" />
</Button>
</div>
</div>
</AccordionContent>
</AccordionItem>
</div>
))}
</Accordion>
) : (
<Skeleton className="h-[36rem] w-full" />
)}
</div>
</div>
</PostPageGuard>
</div>
);
}
+1 -1
View File
@@ -38,7 +38,7 @@ function AdminPage() {
const alert = useAlertStore((state) => state.setMessage);
const { confirm } = useConfirm();
const [keywordType, setKeywordType] = useState("userId");
const [keywordType, setKeywordType] = useState("");
const [keyword, setKeyword] = useState("");
const [grpId, setGrpId] = useState("");
const [searchParams, setSearchParams] = useState<UserSearchParams>({
+2 -1
View File
@@ -15,7 +15,8 @@ import {
SelectTrigger,
SelectValue,
} from "@common/components";
import { ApiLogApi, type ApiLogParams } from "@/entities/apilog";
import { ApiLogApi } from "@/entities/apilog";
import { type ApiLogParams } from "@/entities/apilog/model/apilog-interface";
import { useDataTable } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
import { columns } from "@/pages/apilog/model/table-columns";
@@ -35,14 +35,9 @@ export const columns: ColumnDef<Post>[] = [
accessorKey: "pstgPrdSeNm",
header: "게시기간",
cell: ({ row }) => {
const pstgPrdSeCd = row.original.pstgPrdSeCd;
const pstgPrdSeNm = row.original.pstgPrdSeNm;
const pstgBgngDt = row.original.pstgBgngDt;
const pstgEndDt = row.original.pstgEndDt;
if (pstgPrdSeCd === "99") {
return pstgPrdSeNm;
}
return `${pstgPrdSeNm} (${dayjs(pstgBgngDt).format("YYYY-MM-DD")} ~ ${dayjs(pstgEndDt).format("YYYY-MM-DD")})`;
},
},
@@ -34,7 +34,7 @@ function CreatePage() {
<div className="card-header">
<h3 className="text-2xl font-medium text-label">콘텐츠 등록</h3>
</div>
<ContentsForm isEditable form={form} handleSave={createContents} />
<ContentsForm form={form} handleSave={createContents} />
</div>
);
}
+7 -13
View File
@@ -1,6 +1,5 @@
"use client";
import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
@@ -25,7 +24,6 @@ import { useAlertStore, useMutationWrapper } from "@/shared/lib";
import { ContentsForm } from "./contents-form";
function ModifyPage({ sequential }: { sequential: string }) {
const router = useRouter();
const { confirm } = useConfirm();
const queryClient = useQueryClient();
const alert = useAlertStore((state) => state.setMessage);
@@ -53,11 +51,9 @@ function ModifyPage({ sequential }: { sequential: string }) {
mutationFn: (data: ContentsFormData) => ContentsApi.createContents(data),
onSuccess: () => {
setContsVer(0);
alert("수정되었습니다.", () => {
queryClient.invalidateQueries({
queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn],
});
router.back();
alert("수정되었습니다.");
queryClient.invalidateQueries({
queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn],
});
},
});
@@ -66,7 +62,7 @@ function ModifyPage({ sequential }: { sequential: string }) {
mutationFn: (data: ContentsFormData) =>
ContentsApi.updateContents(contsSn, contsVer, data),
onSuccess: () => {
alert("수정되었습니다.", router.back);
alert("수정되었습니다.");
},
});
@@ -74,11 +70,9 @@ function ModifyPage({ sequential }: { sequential: string }) {
mutationFn: () => ContentsApi.deleteContents(contsSn, contsVer),
onSuccess: () => {
setContsVer(0);
alert("삭제되었습니다.", () => {
queryClient.invalidateQueries({
queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn],
});
router.back();
alert("삭제되었습니다.");
queryClient.invalidateQueries({
queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn],
});
},
});
+2 -1
View File
@@ -39,7 +39,8 @@ function FilePage() {
mutationFn: (atflId: string) =>
AttachmentApi.deleteAttachmentByAtflId(atflId),
onSuccess: () => {
alert("삭제되었습니다.", query.refetch);
query.refetch();
alert("삭제되었습니다.");
},
});
+20 -56
View File
@@ -1,6 +1,6 @@
"use client";
import { useState, useEffect } from "react";
import { useState } from "react";
import {
keepPreviousData,
useQuery,
@@ -22,7 +22,6 @@ import {
DialogFooter,
Input,
Checkbox,
Label,
} from "@common/components";
import {
UserApi,
@@ -42,8 +41,7 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) {
const alert = useAlertStore((state) => state.setMessage);
const [open, setOpen] = useState(false);
const [userName, setUserName] = useState("");
const [searchParam, setSearchParam] = useState<UserSearchParams>({
const [userSearchQuery, setUserSearchQuery] = useState<UserSearchParams>({
userName: "",
});
const [pagination, setPagination] = useState<PaginationState>({
@@ -55,10 +53,10 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) {
);
const query = useQuery({
queryKey: [ENDPOINT.USER_SERVICE.USERS, searchParam, pagination],
queryKey: [ENDPOINT.USER_SERVICE.USERS, userSearchQuery, pagination],
queryFn: () =>
UserApi.findPageUser({
...searchParam,
...userSearchQuery,
page: pagination.pageIndex,
size: pagination.pageSize,
}),
@@ -120,9 +118,6 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) {
onRowSelectionChange: setUserRowSelection,
getRowId: (row) => row.userUnqId,
},
dataTableOptions: {
viewPagination: true,
},
});
const handleAddUsers = async () => {
@@ -149,30 +144,10 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) {
}
};
const handleSearch = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
e.stopPropagation();
setPagination({
...pagination,
pageIndex: 0,
});
setSearchParam({ userName });
const handleSearch = () => {
setPagination({ pageIndex: 0, pageSize: 10 });
};
const resetSearch = () => {
setPagination({
pageIndex: 0,
pageSize: 10,
});
setUserName("");
setSearchParam({ userName: "" });
setUserRowSelection({});
};
useEffect(() => {
if (open) resetSearch();
}, [open]);
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
@@ -182,31 +157,20 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) {
<DialogHeader>
<DialogTitle>사용자 추가</DialogTitle>
</DialogHeader>
<form onSubmit={handleSearch} className="mb-4 flex items-end gap-2">
<div className="flex items-center gap-2">
<Label htmlFor="userName" className="mr-2 text-label">
사용자 이름
</Label>
<Input
id="userName"
className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]"
value={userName}
onChange={(e) => setUserName(e.target.value)}
placeholder="사용자 이름으로 검색"
/>
</div>
<Button className="h-[3.2rem]" type="submit">
조회
</Button>
<Button
type="button"
color="white"
className="h-[3.2rem]"
onClick={resetSearch}
>
초기화
</Button>
</form>
<div className="mb-4 flex items-end gap-2">
<Input
value={userSearchQuery.userName}
onChange={(e) =>
setUserSearchQuery({
...userSearchQuery,
userName: e.target.value,
})
}
className="!text-[1.3rem]"
placeholder="사용자 이름으로 검색"
/>
<Button onClick={handleSearch}>검색</Button>
</div>
{tableComponent}
<DialogFooter>
<Button color="white" onClick={() => setOpen(false)}>
@@ -35,14 +35,9 @@ export const columns: ColumnDef<Post>[] = [
accessorKey: "pstgPrdSeNm",
header: "게시기간",
cell: ({ row }) => {
const pstgPrdSeCd = row.original.pstgPrdSeCd;
const pstgPrdSeNm = row.original.pstgPrdSeNm;
const pstgBgngDt = row.original.pstgBgngDt;
const pstgEndDt = row.original.pstgEndDt;
if (pstgPrdSeCd === "99") {
return pstgPrdSeNm;
}
return `${pstgPrdSeNm} (${dayjs(pstgBgngDt).format("YYYY-MM-DD")} ~ ${dayjs(pstgEndDt).format("YYYY-MM-DD")})`;
},
},
@@ -16,7 +16,8 @@ import {
SelectValue,
LoadingWithImage,
} from "@common/components";
import { LoginlogApi, type LoginlogParams } from "@/entities/loginlog";
import { LoginlogApi } from "@/entities/loginlog";
import { type LoginlogParams } from "@/entities/loginlog/model/loginlog-interface";
import { useDataTable } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
import { columns } from "@/pages/loginlog/model/table-columns";
+1 -1
View File
@@ -3,7 +3,7 @@ import type {
TreeUserOrganization,
TreeUser,
} from "@/entities/user-organization";
import type { TreeMenu, TreeNode } from "@/entities/tree-menu";
import type { TreeMenu, TreeNode } from "../model/tree-menu-interface";
export const generateMenuTreeData = (
data: TreeMenu[],
@@ -19,7 +19,6 @@ export interface TreeMenu extends Omit<TreeNode, "name" | "icon" | "children"> {
qrcd?: string;
useYn: string;
otptYn: string;
menuSubKornNm?: string;
requiredUrlPath?: boolean;
}
+16 -29
View File
@@ -1,6 +1,5 @@
import type { ComponentProps } from "react";
import { Button, Input } from "@common/components";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
type EditableNodeProps = {
depth?: number;
@@ -21,34 +20,22 @@ function EditableNode({
>
<Input {...props} className="h-[2.5rem] !text-[1.3rem] text-foreground" />
<div className="flex items-center gap-1">
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
className="size-8 !bg-transparent"
onClick={onSave}
aria-label="저장"
>
<i className="diveicon di-check text-2xl" />
</Button>
</TooltipTrigger>
<TooltipContent>저장</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
className="size-8 !bg-transparent"
onClick={onCancel}
aria-label="취소"
>
<i className="diveicon di-x" />
</Button>
</TooltipTrigger>
<TooltipContent>취소</TooltipContent>
</Tooltip>
<Button
variant="ghost"
size="icon"
className="size-8 !bg-transparent"
onClick={onSave}
>
<i className="diveicon di-check text-2xl" />
</Button>
<Button
variant="ghost"
size="icon"
className="size-8 !bg-transparent"
onClick={onCancel}
>
<i className="diveicon di-x" />
</Button>
</div>
</div>
);
+2 -1
View File
@@ -2,9 +2,10 @@ import { useEffect, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import type { NodeModel, TreeMethods } from "@minoru/react-dnd-treeview";
import { Button, cn } from "@common/components";
import { TreeMenuApi, type TreeMenu } from "@/entities/tree-menu";
import { useMutationWrapper } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
import { TreeMenuApi } from "../api/tree-menu-service";
import type { TreeMenu } from "../model/tree-menu-interface";
import { EditableNode } from "./editable-node";
type MenuNodeProps = {
+2 -1
View File
@@ -21,10 +21,11 @@ import {
type MenuFormData,
} from "@/entities/menu";
import { SiteApi } from "@/entities/site";
import { TreeMenuApi, type TreeMenu } from "@/entities/tree-menu";
import { ENDPOINT } from "@/shared/config";
import { useAlertStore, useMutationWrapper } from "@/shared/lib";
import { generateMenuTreeData } from "../lib/utils";
import { TreeMenuApi } from "../api/tree-menu-service";
import type { TreeMenu } from "../model/tree-menu-interface";
import { MenuTree } from "./menu-tree";
import { MenuForm } from "./menu-form";
+2 -5
View File
@@ -12,11 +12,8 @@ import { Button } from "@common/components";
import { ENDPOINT } from "@/shared/config";
import { useMutationWrapper } from "@/shared/lib";
import type { MenuFormData } from "@/entities/menu";
import {
TreeMenuApi,
type TreeMenu,
type TreeNode,
} from "@/entities/tree-menu";
import { TreeMenuApi } from "../api/tree-menu-service";
import type { TreeMenu, TreeNode } from "../model/tree-menu-interface";
import { handleDropNode, handleSelectNode } from "../lib/utils";
import { MenuNode } from "./menu-node";
import { EditableNode } from "./editable-node";
@@ -72,7 +72,7 @@ function AddUserDialog({ onAddUsers, ...props }: AddUserDialogProps) {
</DialogTrigger>
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
<DialogHeader>
<DialogTitle>사용자 조회</DialogTitle>
<DialogTitle>콘텐츠 조회</DialogTitle>
</DialogHeader>
<div className="flex flex-col gap-4">
<div className="card card-border !m-0 flex w-full items-center gap-2">
@@ -242,16 +242,6 @@ function UserOrganizationSection({ ognzSn }: UserOrganizationSectionProps) {
</div>
<div className="card max-h-[calc(100vh-58rem)] overflow-auto !p-0">
<Table>
<colgroup>
<col width="5%" />
<col width="5%" />
<col width="auto" />
<col width="10%" />
<col width="10%" />
<col width="10%" />
<col width="15%" />
<col width="15%" />
</colgroup>
<TableHeader className="sticky top-0">
<TableRow>
<TableHead>
@@ -310,9 +300,6 @@ const UserCells = memo(
jobPositionCodeData,
jobGradeCodeData,
}: UserCellsProps) => {
const [jbpsSeCd, setJbpsSeCd] = useState(user.jbpsSeCd);
const [jbgdSeCd, setJbgdSeCd] = useState(user.jbgdSeCd);
const updateMode = (index: number) => {
const mode = form.watch(`userOrganization.${index}.mode`);
if (mode === "R") {
@@ -335,33 +322,17 @@ const UserCells = memo(
<CodeSelect
codeData={jobPositionCodeData}
defaultValue={user.jbpsSeCd}
onValueChange={(value) => {
setJbpsSeCd(value);
updateFormValue(index, "jbpsSeCd")(value);
}}
onValueChange={updateFormValue(index, "jbpsSeCd")}
{...form.register(`userOrganization.${index}.jbpsSeCd`)}
/>
{!jbpsSeCd && (
<p className="pt-1 text-base text-destructive">
직위를 선택해주세요.
</p>
)}
</TableCell>
<TableCell align="center">
<CodeSelect
codeData={jobGradeCodeData}
defaultValue={user.jbgdSeCd}
onValueChange={(value) => {
setJbgdSeCd(value);
updateFormValue(index, "jbgdSeCd")(value);
}}
onValueChange={updateFormValue(index, "jbgdSeCd")}
{...form.register(`userOrganization.${index}.jbgdSeCd`)}
/>
{!jbgdSeCd && (
<p className="pt-1 text-base text-destructive">
직급을 선택해주세요.
</p>
)}
</TableCell>
<TableCell align="center">
<Input
@@ -33,14 +33,9 @@ export const columns: ColumnDef<Post>[] = [
accessorKey: "pstgPrdSeNm",
header: "게시기간",
cell: ({ row }) => {
const pstgPrdSeCd = row.original.pstgPrdSeCd;
const pstgPrdSeNm = row.original.pstgPrdSeNm;
const pstgBgngDt = row.original.pstgBgngDt;
const pstgEndDt = row.original.pstgEndDt;
if (pstgPrdSeCd === "99") {
return pstgPrdSeNm;
}
return `${pstgPrdSeNm} (${dayjs(pstgBgngDt).format("YYYY-MM-DD")} ~ ${dayjs(pstgEndDt).format("YYYY-MM-DD")})`;
},
},
@@ -15,10 +15,8 @@ import {
SelectTrigger,
SelectValue,
} from "@common/components";
import {
PrivacyLogPrivacy,
type PrivacyLogParams,
} from "@/entities/privacylog";
import { PrivacyLogPrivacy } from "@/entities/privacylog";
import type { PrivacyLogParams } from "@/entities/privacylog/model/privacylog-interface";
import { useDataTable } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
import { columns } from "@/pages/privacylog/model/table-columns";
@@ -1,28 +0,0 @@
import { client } from "@/shared/api";
import type {
SiteAuthorityCreatePayload,
SiteAuthorityList,
SiteAuthoritySearchParams,
SiteAuthorityService,
} from "../model/site-authority-interface";
import { ENDPOINT } from "@/shared/config";
export class SiteAuthorityApiService implements SiteAuthorityService {
public async getSiteAuthorityList(
params: SiteAuthoritySearchParams,
): Promise<SiteAuthorityList> {
const response = await client.get<SiteAuthorityList>(
ENDPOINT.CMS_SERVICE.SITE_AUTHORITY,
{ params },
);
return response.data;
}
public async createSiteAuthority(
data: SiteAuthorityCreatePayload[],
): Promise<void> {
await client.post(ENDPOINT.CMS_SERVICE.SITE_AUTHORITY, data);
}
}
export const SiteAuthorityApi = new SiteAuthorityApiService();
@@ -1,24 +0,0 @@
import type { PageableList, PageableParams } from "@/shared/model";
export interface SiteAuthoritySearchParams extends PageableParams {
siteId?: string;
authrtId?: string;
}
export interface SiteAuthority {
siteId: string;
authrtId: string;
siteNm: string;
mode: string;
}
export type SiteAuthorityCreatePayload = Omit<SiteAuthority, "siteNm">;
export type SiteAuthorityList = PageableList<SiteAuthority>;
export interface SiteAuthorityService {
getSiteAuthorityList: (
params: SiteAuthoritySearchParams,
) => Promise<SiteAuthorityList>;
createSiteAuthority: (data: SiteAuthorityCreatePayload[]) => Promise<void>;
}
+2 -18
View File
@@ -3,13 +3,8 @@ import { useState } from "react";
import type { Role } from "@/entities/role";
import type { ColumnDef } from "@tanstack/react-table";
import { MappingRoleDialog } from "../ui/mapping-role-dialog";
import { Button } from "@common/components";
export const createColumns = ({
deleteRole,
}: {
deleteRole: (roleId: string) => void;
}): ColumnDef<Role>[] => [
export const columns: ColumnDef<Role>[] = [
{
id: "no",
header: "NO",
@@ -44,18 +39,7 @@ export const createColumns = ({
{
id: "action",
header: "관리",
cell: ({ row }) => (
<div className="flex items-center justify-center gap-2">
<MappingRoleButton roleId={row.original.roleId} />
<Button
size="sm"
color="red"
onClick={() => deleteRole(row.original.roleId)}
>
삭제
</Button>
</div>
),
cell: ({ row }) => <MappingRoleButton roleId={row.original.roleId} />,
},
];
@@ -1,6 +1,5 @@
import { useState, useRef } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { getCoreRowModel, type ColumnDef } from "@tanstack/react-table";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import {
Dialog,
DialogTrigger,
@@ -9,7 +8,6 @@ import {
DialogTitle,
Button,
Switch,
Input,
} from "@common/components";
import {
RoleAuthorizationsApi,
@@ -33,18 +31,12 @@ function MappingRoleDialog({
}: MappingRoleDialogProps) {
const queryClient = useQueryClient();
const alert = useAlertStore((state) => state.setMessage);
const inputRef = useRef<HTMLInputElement>(null);
const [searchParams, setSearchParams] = useState({
keyword: "",
keywordType: "authorizationName",
});
const query = useQuery({
queryKey: [ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS, searchParams],
queryKey: [ENDPOINT.USER_SERVICE.AUTHORIZATIONS],
queryFn: () =>
RoleAuthorizationsApi.getRoleAuthorizationsListByRoleId({
roleId,
...searchParams,
}),
enabled: open,
});
@@ -54,7 +46,7 @@ function MappingRoleDialog({
RoleAuthorizationsApi.createRoleAuthorizations(data),
onSuccess: () => {
queryClient.invalidateQueries({
queryKey: [ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS],
queryKey: [ENDPOINT.USER_SERVICE.AUTHORIZATIONS],
});
alert("권한 맵핑이 완료되었습니다.");
},
@@ -74,26 +66,6 @@ function MappingRoleDialog({
);
};
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const formData = new FormData(e.target as HTMLFormElement);
const keyword = formData.get("keyword") as string;
setSearchParams({
...searchParams,
keyword,
});
};
const handleReset = () => {
if (inputRef.current) {
inputRef.current.value = "";
}
setSearchParams({
...searchParams,
keyword: "",
});
};
const { tableComponent } = useDataTable({
query,
tableOptions: {
@@ -107,31 +79,21 @@ function MappingRoleDialog({
<DialogTrigger asChild>
<Button size="sm">권한맵핑</Button>
</DialogTrigger>
<DialogContent className="max-w-[80rem]" aria-describedby={undefined}>
<DialogContent className="max-w-[60rem]" aria-describedby={undefined}>
<DialogHeader>
<DialogTitle>모듈 목록</DialogTitle>
</DialogHeader>
<div className="flex items-center justify-between">
<form onSubmit={handleSubmit} className="flex items-center gap-2">
<Input
ref={inputRef}
type="text"
name="keyword"
className="w-[32rem]"
/>
<Button type="submit">검색</Button>
<Button type="button" color="white" onClick={handleReset}>
초기화
<div className="max-h-[40rem] overflow-y-auto">
<div className="mb-4 flex justify-end gap-2">
<Button size="sm" onClick={() => handleApplyAll("Y")}>
일괄적용
</Button>
</form>
<div className="flex items-center justify-end gap-2">
<Button onClick={() => handleApplyAll("Y")}>일괄적용</Button>
<Button color="gray" onClick={() => handleApplyAll("N")}>
<Button size="sm" color="gray" onClick={() => handleApplyAll("N")}>
일괄해제
</Button>
</div>
{tableComponent}
</div>
<div className="max-h-[60rem] overflow-y-auto">{tableComponent}</div>
</DialogContent>
</Dialog>
);
+6 -87
View File
@@ -1,9 +1,7 @@
import { useEffect, useState } from "react";
import { useQuery, useQueryClient } from "@tanstack/react-query";
import { useState } from "react";
import type { UseFormReturn } from "react-hook-form";
import {
Button,
Checkbox,
Input,
Label,
RadioGroup,
@@ -18,9 +16,6 @@ import { FormWrapper } from "@/widgets/form-wrapper";
import { RoleApi, type RoleFormData } from "@/entities/role";
import { FormField, FormItem, FormControl } from "@/shared/ui/form";
import { useAlertStore, useMutationWrapper } from "@/shared/lib";
import { ENDPOINT } from "@/shared/config";
import { SiteAuthorityApi } from "../api/site-authority-service";
import type { SiteAuthorityCreatePayload } from "../model/site-authority-interface";
type RoleFormProps = {
roleId?: string;
@@ -29,24 +24,12 @@ type RoleFormProps = {
handleDelete?: () => Promise<void>;
};
function RoleForm({ roleId, form, handleSave, ...props }: RoleFormProps) {
function RoleForm({ roleId, form, ...props }: RoleFormProps) {
const isModifyMode = !!roleId;
const queryClient = useQueryClient();
const alert = useAlertStore((state) => state.setMessage);
const [isValidRoleId, setIsValidRoleId] = useState(false);
const [checkedSiteAuthority, setCheckedSiteAuthority] = useState<string[]>(
[],
);
const { data: siteAuthorityList } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.SITE_AUTHORITY, roleId],
queryFn: () =>
SiteAuthorityApi.getSiteAuthorityList({
authrtId: roleId,
page: 0,
size: 100,
}),
});
const alert = useAlertStore((state) => state.setMessage);
const [isValidRoleId, setIsValidRoleId] = useState(false);
const { mutateAsync: checkDuplicateRoleId } = useMutationWrapper({
mutationFn: (roleId: string) => RoleApi.checkDuplicateRoleId(roleId),
@@ -60,49 +43,8 @@ function RoleForm({ roleId, form, handleSave, ...props }: RoleFormProps) {
},
});
const handleSiteAuthorityChecked = (checked: boolean, siteId: string) => {
if (checked) {
setCheckedSiteAuthority((prev) => [...prev, siteId]);
} else {
setCheckedSiteAuthority((prev) => prev.filter((id) => id !== siteId));
}
};
const saveInterceptor = async (data: RoleFormData) => {
const siteAuthorityPayload: SiteAuthorityCreatePayload[] =
checkedSiteAuthority.map((siteId) => ({
siteId,
authrtId: data.roleId,
mode: "C",
}));
try {
await handleSave(data);
if (data.mngrYn === "N") return;
await SiteAuthorityApi.createSiteAuthority(siteAuthorityPayload);
queryClient.invalidateQueries({
queryKey: [ENDPOINT.CMS_SERVICE.SITE_AUTHORITY],
});
} catch (error) {
console.error(error);
}
};
useEffect(() => {
if (!siteAuthorityList?.content.length) return;
const checkedSiteAuthority = siteAuthorityList.content.filter(
(item) => item.mode === "R",
);
setCheckedSiteAuthority(checkedSiteAuthority.map((item) => item.siteId));
}, [siteAuthorityList]);
return (
<FormWrapper
form={form}
isModifyMode={isModifyMode}
handleSave={saveInterceptor}
{...props}
>
<FormWrapper form={form} isModifyMode={isModifyMode} {...props}>
<div className="card">
<Table variant="secondary">
<colgroup>
@@ -223,29 +165,6 @@ function RoleForm({ roleId, form, handleSave, ...props }: RoleFormProps) {
/>
</TableCell>
</TableRow>
{form.watch("mngrYn") === "Y" && (
<TableRow>
<TableHead data-required>관리사이트</TableHead>
<TableCell className="border">
<div className="flex flex-wrap items-center gap-4">
{siteAuthorityList?.content.map((item) => (
<div
key={item.siteId}
className="flex items-center gap-2"
>
<Checkbox
defaultChecked={item.mode === "R"}
onCheckedChange={(checked: boolean) => {
handleSiteAuthorityChecked(checked, item.siteId);
}}
/>
<span className="whitespace-nowrap">{item.siteNm}</span>
</div>
))}
</div>
</TableCell>
</TableRow>
)}
<TableRow>
<TableHead data-required>사용여부</TableHead>
<TableCell className="border">
+3 -13
View File
@@ -7,12 +7,11 @@ import { getCoreRowModel, type PaginationState } from "@tanstack/react-table";
import { Button, Input, Label } from "@common/components";
import { RoleApi, type Role, type RoleParams } from "@/entities/role";
import { ENDPOINT } from "@/shared/config";
import { useAlertStore, useDataTable, useMutationWrapper } from "@/shared/lib";
import { createColumns } from "../model/table-columns";
import { useDataTable } from "@/shared/lib";
import { columns } from "../model/table-columns";
function RolePage() {
const router = useRouter();
const alert = useAlertStore((state) => state.setMessage);
const [keyword, setKeyword] = useState("");
const [searchParams, setSearchParams] = useState<RoleParams>({
@@ -34,13 +33,6 @@ function RolePage() {
}),
});
const { mutateAsync: deleteRole } = useMutationWrapper({
mutationFn: (roleId: string) => RoleApi.deleteRole(roleId),
onSuccess: () => {
alert("삭제되었습니다.", query.refetch);
},
});
const handleRowClick = (row: Role) => {
router.push(`/role/register/${row.roleId}`);
};
@@ -48,9 +40,7 @@ function RolePage() {
const { tableComponent } = useDataTable({
query,
tableOptions: {
columns: createColumns({
deleteRole,
}),
columns,
state: {
pagination,
},
-24
View File
@@ -1,24 +0,0 @@
import type { NodeModel } from "@minoru/react-dnd-treeview";
import type { TreeMenu } from "@/entities/tree-menu";
export const generateMenuTreeData = (
data: TreeMenu[],
): NodeModel<TreeMenu>[] => {
return data.reduce<NodeModel<TreeMenu>[]>((acc, menu) => {
const node: NodeModel<TreeMenu> = {
id: menu.menuCd ?? 0,
parent: menu.parentId ?? 0,
text: menu.menuSubKornNm ?? "",
droppable: true,
data: menu,
};
acc.push(node);
if (menu.children?.length) {
acc.push(...generateMenuTreeData(menu.children));
}
return acc;
}, []);
};
@@ -1,32 +1,6 @@
import dayjs from "dayjs";
import { memo, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useQuery } from "@tanstack/react-query";
import { type ColumnDef } from "@tanstack/react-table";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
import {
Button,
Checkbox,
Dialog,
DialogClose,
DialogContent,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@common/components";
import type { Site } from "@/entities/site";
import { TreeMenuApi } from "@/entities/tree-menu";
import {
MenuApi,
siteMapFormSchema,
type SiteMapFormData,
} from "@/entities/menu";
import { ENDPOINT } from "@/shared/config";
import { useAlertStore, useMutationWrapper } from "@/shared/lib";
import { MenuTree } from "../ui/menu-tree";
import { generateMenuTreeData } from "../lib/utils";
export const columns: ColumnDef<Site>[] = [
{
@@ -71,81 +45,4 @@ export const columns: ColumnDef<Site>[] = [
return date.format("YYYY-MM-DD");
},
},
{
id: "action",
header: "관리",
cell: ({ row }) => {
return (
<div onClick={(e) => e.stopPropagation()}>
<ActionCell data={row.original} />
</div>
);
},
},
];
const ActionCell = memo(({ data }: { data: Site }) => {
const { confirm } = useConfirm();
const alert = useAlertStore((state) => state.setMessage);
const [open, setOpen] = useState(false);
const { data: menuTreeData, refetch } = useQuery({
queryKey: [ENDPOINT.CMS_SERVICE.MENUS, data.siteId],
queryFn: () => TreeMenuApi.getTreeMenuList(data.siteId),
select: (data) => generateMenuTreeData(data),
enabled: !!data.siteId && open,
});
const { mutate: publishSiteMap } = useMutationWrapper({
mutationFn: (data: SiteMapFormData["siteMap"]) =>
MenuApi.publishSiteMap(data),
onSuccess: () => {
alert("사이트맵이 저장되었습니다.", () => {
setOpen(false);
refetch();
});
},
});
const form = useForm<SiteMapFormData>({
resolver: zodResolver(siteMapFormSchema),
});
const fieldArray = useFieldArray({
control: form.control,
name: "siteMap",
});
const handlePublishSiteMap = async () => {
if (await confirm("저장하시겠습니까?")) {
publishSiteMap(form.getValues("siteMap"));
}
};
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button size="sm">사이트맵</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>{data.siteNm} - 사이트맵 관리</DialogTitle>
</DialogHeader>
<div>
<div className="flex items-center justify-end gap-2 p-2">
<span className="text-xl">표시여부</span>
<Checkbox checked />
</div>
<MenuTree tree={menuTreeData ?? []} fieldArray={fieldArray} />
</div>
<DialogFooter>
<Button onClick={handlePublishSiteMap}>저장</Button>
<DialogClose asChild>
<Button color="white">취소</Button>
</DialogClose>
</DialogFooter>
</DialogContent>
</Dialog>
);
});
ActionCell.displayName = "ActionCell";
@@ -1,58 +0,0 @@
import type { ComponentProps } from "react";
import { Button, Input } from "@common/components";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/shared/ui/tooltip";
type EditableNodeProps = {
depth?: number;
onSave: () => void;
onCancel: () => void;
} & ComponentProps<typeof Input>;
function EditableNode({
depth,
onSave,
onCancel,
...props
}: EditableNodeProps) {
return (
<div
className="flex items-center gap-2 rounded-sm bg-accent p-2"
style={{ marginInlineStart: !depth ? 0 : depth * 5 + 5 }}
onClick={(e) => e.stopPropagation()}
>
<Input {...props} className="h-[2.5rem] !text-[1.3rem] text-foreground" />
<div className="flex items-center gap-1">
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
className="size-8 !bg-transparent"
onClick={onSave}
aria-label="저장"
>
<i className="diveicon di-check text-2xl" />
</Button>
</TooltipTrigger>
<TooltipContent>저장</TooltipContent>
</Tooltip>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
className="size-8 !bg-transparent"
onClick={onCancel}
aria-label="취소"
>
<i className="diveicon di-x" />
</Button>
</TooltipTrigger>
<TooltipContent>취소</TooltipContent>
</Tooltip>
</div>
</div>
);
}
export { EditableNode };
-128
View File
@@ -1,128 +0,0 @@
import { useState } from "react";
import type { NodeModel } from "@minoru/react-dnd-treeview";
import type { UseFieldArrayReturn } from "react-hook-form";
import { Button, Checkbox, cn } from "@common/components";
import { type TreeMenu } from "@/entities/tree-menu";
import type { SiteMapFormData, SiteMapPayloadData } from "@/entities/menu";
import { EditableNode } from "./editable-node";
type MenuNodeProps = {
node: NodeModel<TreeMenu>;
depth: number;
isOpen: boolean;
fieldArray: UseFieldArrayReturn<SiteMapFormData>;
onToggle: (id: NodeModel["id"]) => void;
};
function MenuNode({
node,
depth,
isOpen,
fieldArray,
onToggle,
}: MenuNodeProps) {
const { id, text, data } = node;
const indent = depth * 10 + 5;
const [editMode, setEditMode] = useState(false);
const [nodeName, setNodeName] = useState(text);
const [otptYn, setOtptYn] = useState(data?.otptYn ?? "N");
const updateField = (id: number, newField: SiteMapPayloadData) => {
const existingFieldIndex = fieldArray.fields.findIndex(
(field) => field.menuCd === id,
);
if (existingFieldIndex !== -1) {
fieldArray.update(existingFieldIndex, newField);
} else {
fieldArray.append(newField);
}
};
const handleToggle = () => onToggle(id);
const handleSave = async () => {
const newField = {
menuCd: id as number,
menuSubKornNm: nodeName,
otptYn,
};
updateField(id as number, newField);
setEditMode(false);
};
const handleCancel = () => {
setEditMode(false);
setNodeName(text);
};
const handleOtptYnChange = (checked: boolean) => {
const newField = {
menuCd: id as number,
menuSubKornNm: nodeName,
otptYn: checked ? "Y" : "N",
};
updateField(id as number, newField);
setOtptYn(checked ? "Y" : "N");
};
return (
<div
style={{ paddingInlineStart: indent }}
className={cn(
"group flex cursor-pointer items-center gap-2 rounded-sm p-2 hover:bg-accent",
editMode && "p-0 pr-2 hover:bg-transparent",
)}
onClick={(e) => {
e.stopPropagation();
handleToggle();
}}
>
{editMode ? (
<EditableNode
value={nodeName}
onChange={(e) => setNodeName(e.target.value)}
onSave={handleSave}
onCancel={handleCancel}
/>
) : (
<div className="flex w-full items-center justify-between">
<div className="flex items-center">
{data?.children?.length && (
<i
className={cn(
"diveicon di-arrow-forward mr-2 text-base text-label",
isOpen && "rotate-90",
)}
/>
)}
<span className="text-[1.4rem] font-medium text-label">
{nodeName}
</span>
</div>
<Button
variant="ghost"
size="icon"
className="invisible !bg-transparent group-hover:visible"
onClick={(e) => {
e.stopPropagation();
setEditMode(true);
}}
>
<i className="diveicon di-pencil" />
</Button>
</div>
)}
<Checkbox
className="ml-auto"
checked={otptYn === "Y"}
onClick={(e) => {
e.stopPropagation();
}}
onCheckedChange={handleOtptYnChange}
/>
</div>
);
}
export { MenuNode };
-70
View File
@@ -1,70 +0,0 @@
"use client";
import { useRef } from "react";
import type { UseFieldArrayReturn } from "react-hook-form";
import {
Tree,
type NodeModel,
type TreeMethods,
} from "@minoru/react-dnd-treeview";
import { Button } from "@common/components";
import type { SiteMapFormData } from "@/entities/menu";
import { type TreeMenu } from "@/entities/tree-menu";
import { MenuNode } from "./menu-node";
type MenuTreeProps = {
tree: NodeModel<TreeMenu>[];
fieldArray: UseFieldArrayReturn<SiteMapFormData>;
};
function MenuTree({ tree, fieldArray }: MenuTreeProps) {
const treeMethods = useRef<TreeMethods>(null);
return (
<>
<div className="max-h-[calc(100vh-33.5rem)] min-h-[40vh] overflow-auto">
<Tree
tree={tree}
rootId={0}
ref={treeMethods}
render={(node: NodeModel<TreeMenu>, props) => {
return <MenuNode node={node} fieldArray={fieldArray} {...props} />;
}}
onDrop={() => {}}
canDrag={() => false}
canDrop={() => false}
classes={{
container: "flex flex-col",
dropTarget: "!bg-[rgba(32,148,250,0.5)] rounded-sm",
placeholder: "relative",
}}
sort={false}
/>
</div>
<div className="flex gap-2">
<Button
color="lightGray"
className="flex-1 items-center px-0"
onClick={() => {
treeMethods.current?.openAll();
}}
>
<i className="diveicon di-arrows-angle-expand" />
전체펼침
</Button>
<Button
color="lightGray"
className="flex-1 items-center px-0"
onClick={() => {
treeMethods.current?.closeAll();
}}
>
<i className="diveicon di-arrows-angle-contract" />
전체접기
</Button>
</div>
</>
);
}
export { MenuTree };
@@ -36,14 +36,9 @@ export const columns: ColumnDef<Post>[] = [
accessorKey: "pstgPrdSeNm",
header: "게시기간",
cell: ({ row }) => {
const pstgPrdSeCd = row.original.pstgPrdSeCd;
const pstgPrdSeNm = row.original.pstgPrdSeNm;
const pstgBgngDt = row.original.pstgBgngDt;
const pstgEndDt = row.original.pstgEndDt;
if (pstgPrdSeCd === "99") {
return pstgPrdSeNm;
}
return `${pstgPrdSeNm} (${dayjs(pstgBgngDt).format("YYYY-MM-DD")} ~ ${dayjs(pstgEndDt).format("YYYY-MM-DD")})`;
},
},
@@ -1,11 +1,6 @@
import dayjs from "dayjs";
import type { ColumnDef } from "@tanstack/react-table";
import {
USER_STATE_CODE,
type UserListResponse,
type UserStateCode,
} from "@/entities/user";
import { Badge } from "@common/components";
import type { UserListResponse } from "@/entities/user";
export const columns: ColumnDef<UserListResponse>[] = [
{
@@ -47,11 +42,8 @@ export const columns: ColumnDef<UserListResponse>[] = [
header: "기관/부서",
},
{
accessorKey: "userStateCode",
accessorKey: "userStateCodeName",
header: "회원상태",
cell: ({ row }) => {
return getUserStateBadge(row.original.userStateCode);
},
},
{
accessorKey: "aprvYmd",
@@ -71,18 +63,3 @@ export const columns: ColumnDef<UserListResponse>[] = [
},
},
];
const getUserStateBadge = (userStateCode: UserStateCode) => {
switch (userStateCode) {
case USER_STATE_CODE.대기:
return <Badge color="gray">대기</Badge>;
case USER_STATE_CODE.정상:
return <Badge color="green">정상</Badge>;
case USER_STATE_CODE.정지:
return <Badge color="yellow">정지</Badge>;
case USER_STATE_CODE.탈퇴:
return <Badge color="purple">탈퇴</Badge>;
case USER_STATE_CODE.삭제:
return <Badge color="red">삭제</Badge>;
}
};
@@ -16,11 +16,20 @@ function CreatePage() {
defaultValues: {
userId: "",
userName: "",
email: "",
password: "",
pswdHnt: "",
pswdAns: "",
mphn: "",
telno: "",
zip: "",
addr: "",
daddr: "",
laeSeCd: "",
ogdpSeCd: "",
expryYmd: "",
instSeCd: "",
enoCd: "",
},
});
-1
View File
@@ -53,7 +53,6 @@ export const ENDPOINT = {
GROUP_USERS: "/cms-service/api/v1/group-users",
MANAGER_IP: "/cms-service/api/v1/mgrip",
APILOG: "/cms-service/api/v1/api-logs",
SITE_AUTHORITY: "/cms-service/api/v1/site-authrt",
},
BOARD_SERVICE: {
BBS: "/board-service/api/v1/bbs",
-2
View File
@@ -1,11 +1,9 @@
NEXT_PUBLIC_SITE_ID = SN
NEXT_PUBLIC_PORT = 11302
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11302
NEXT_PUBLIC_ADDR_URL = http://con.mind-one.co.kr:11082
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver #TODO 운영에서 바꿔야 함
NEXT_PUBLIC_RSONE_DC_URL = https://apigateway.rsonesoft.com #자료관 데이터
NEXT_PUBLIC_CLAIM_NAME = Authorization
NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token
+90 -117
View File
@@ -1,6 +1,7 @@
import FeatureClickEventPopup from './featureClickEventPopup';
import React, { useEffect, useState } from 'react';
import axios from 'axios';
import { UiModal, UiTable, DatePickerRange, SelectBox } from '@common/business_components/ui';
import { UiModal, UiTable, DatePickerRange } from '@common/business_components/ui';
import { Button, Input, Label } from '@common/components';
import { UiTable2 } from '@common/business_components/ui/table/index-2';
import { UITab2 } from '@common/business_components/ui/tab/index-2';
@@ -10,9 +11,8 @@ import { SidoSigunguSelectBox } from '@/components/ui/SidoSigunguSelectBox';
import { MsSwagePplCol2, SwtrmtFcltCol2, SwtrmtPrcsZoneCol2, MsSwageMhlCol2, ExclnSewagePumpCol2, stofcbrCol2 } from './components/common/table';
import LoadingOverlay from '@/components/ui/LoadingBar';
//import { useDcTree, flattenFolders, useSggCd, useCityCd } from './components/searchModalReportApi';
import { useDcTree, flattenFolders, useSggCd, useCityCd, addFileName, getFileDownload } from './components/searchModalReportApi';
import { useDcTree,flattenFolders, useSggCd, useCityCd, addFileName, getFileDownload } from './components/searchModalReportApi';
import { useCityCdStore, type SelectDataType } from './commonStore';
import { MS_SWAGE_PPL_USE_CODES, MS_SWAGE_PPL_CODES, MS_SWAGE_MHL_USE_CODES } from '../map/components/common/table';
const API_URL = `${process.env.NEXT_PUBLIC_SEWERAGE_API_URL}`;
@@ -95,10 +95,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [tableCount, setTableCount] = useState<number>(0);
const [curPage, setCurPage] = useState(1);
const [basicType, setBasicType] = useState(BASIC_TYPES[0]?.val ?? "");
const [시도, set시도] = useState(0);
const [시군구, set시군구] = useState(0);
const [ctpvCd, setCtpvCd] = useState('0');
const [sigungu, setSigungu] = useState('0');
const [ctpvCd, setCtpvCd] = useState('0');
const [sigungu, setSigungu] = useState('0');
//const [swageProcessingZone, set처리구역] = useState("");
const [gubun, setGubun] = useState(""); // 하수정비기본계획 report
// 날짜 상태 선언
@@ -106,8 +104,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [시작2, set시작2] = useState("");
const [종료1, set종료1] = useState("");
const [종료2, set종료2] = useState("");
const [변수1, set변수1] = useState<string>("");
const [변수2, set변수2] = useState<string>("");
const [변수1, set변수1] = useState("");
const [변수2, set변수2] = useState("");
const [변수3, set변수3] = useState("");
const [변수4, set변수4] = useState("");
// 시작, 종료, 경과년도
@@ -123,7 +121,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
const [가동개시_종료_일, set가동개시_종료_일] = useState('');
const [fromDate, setFromDate] = useState(() => { const date = new Date(); date.setDate(date.getDate() - 7); return date })
const [toDate, setToDate] = useState(new Date())
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
const [filteredSiguns, setFilteredSiguns] = useState<SelectDataType[]>([{ val: '0', text: '전체', sido: '0' }]);
// 로딩바
const [isLoading, setIsLoading] = useState(false);
@@ -131,7 +129,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
const sidos = useCityCd();
const siguns = useSggCd();
const reportOriginData = useDcTree(""); //:Folder[]
// 오늘 날짜 구하기
const today = new Date();
const todayYear = today.getFullYear().toString();
@@ -164,7 +162,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
else if (basicType === 'tb_ms_swage_pmstn') dynamicHeadlist = ExclnSewagePumpCol2; // 하수펌프장
else if (basicType === 'tb_ms_stofcbr') dynamicHeadlist = stofcbrCol2; // 우수토실
// 조회 버튼 클릭 시 1페이지로 이동하도록 수정
const handleSearch = () => {
setCurPage(1); // 페이지를 1로 초기화
@@ -189,17 +187,17 @@ const SearchModal: React.FC<SearchModalProps> = ({
}
};
const handleCtpvCdChange = (val: string | number) => { // 하수도정비기본계획.시도
const handleCtpvCdChange = (val: string|number) => { // 하수도정비기본계획.시도
const sidoOption = sidos.find((n) => n.val === val);
setCtpvCd(String(val));
if (val !== '0') {
const filterSiguns = siguns.filter(item => item.sido === sidoOption?.text);
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
filterSiguns.unshift({ val: '0', text: '전체', sido: '0' });
setFilteredSiguns(filterSiguns);
}
}
setSigungu("0");
setGubun("");
setYearFilter({ 시작: "", 종료: "", });
setYearFilter({시작: "",종료: "",});
}
useEffect(() => {
@@ -217,8 +215,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
set가동개시_종료_월("");
set가동개시_시작_일("");
set가동개시_종료_일("");
set시도(0);
set시군구(0);
setCtpvCd('0');
setSigungu('0');
setYearFilter({
@@ -241,7 +237,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
}
}, [curPage]);
// 검색 API 호출 함수
const fetchFilteredData = async () => {
setIsLoading(true); // 로딩 시작
@@ -252,7 +248,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
size: '10',
sort: 'string',
});
console.log('basicType', basicType);
let cqlFilters: string[] = [];
if (activeTab === 'basic') {
@@ -277,27 +272,27 @@ const SearchModal: React.FC<SearchModalProps> = ({
if (ctpvCd !== "0") { // 시도검색
const sidoOption = sidos.find((n) => n.val === ctpvCd);
filterReportData = filterReportData.filter(item => item.sido === sidoOption?.text);
}
}
if (sigungu !== "0") { // 시군구검색
const sigunguOption = filteredSiguns.find((n) => n.val === sigungu);
filterReportData = filterReportData.filter(item => item.sigungu === sigunguOption?.text);
}
if (yearFilter.시작 != "" && yearFilter.종료 == "") //승인년도검색
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear >= yearFilter.시작 + "년" : null);
if (yearFilter.시작 == "" && yearFilter.종료 != "")
filterReportData = filterReportData.filter(item => (item.approvalYear) ? item.approvalYear <= yearFilter.종료 + "년" : null);
filterReportData = filterReportData.filter(item => (item.approvalYear)? item.approvalYear >= yearFilter.시작+"년" : null);
if (yearFilter.시작 == "" && yearFilter.종료 != "")
filterReportData = filterReportData.filter(item => (item.approvalYear)? item.approvalYear <= yearFilter.종료+"년" : null);
if (yearFilter.시작 != "" && yearFilter.종료 != "") {
filterReportData = filterReportData.filter(item => {
return (item.approvalYear) ? item.approvalYear >= yearFilter.시작 + "년" && item.approvalYear <= yearFilter.종료 + "년" : null;
return (item.approvalYear)? item.approvalYear >= yearFilter.시작+"년" && item.approvalYear <= yearFilter.종료+"년": null;
});
}
if (gubun !== "") { // 구분검색
filterReportData = filterReportData.filter(item => (item.plantZoneGugun) ? String(item.plantZoneGugun).includes(String(gubun)) : null);
filterReportData = filterReportData.filter(item => (item.plantZoneGugun)? String(item.plantZoneGugun).includes(String(gubun)) : null);
}
console.log('report count:', filterReportData.length);
setTableCount(filterReportData.length || 0);
filterReportData = filterReportData.slice((curPage - 1) * 10, curPage * 10); // paging
filterReportData = filterReportData?.map((item, index) => ({ ...item, no: (curPage - 1) * 10 + index + 1 }));
filterReportData = filterReportData.slice((curPage-1)*10, curPage*10); // paging
filterReportData = filterReportData?.map((item, index)=>({...item, no:(curPage-1)*10+index+1}));
//const fileList = await getDcFile("CLS20250530000041");
addFileName(filterReportData).then(data => {
filterReportData = data;
@@ -383,11 +378,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
cqlFilters.push(`fclt_cpct BETWEEN ${시작1} AND ${종료1}`);
else if (시작1) cqlFilters.push(`fclt_cpct >= ${시작1}`);
else if (종료1) cqlFilters.push(`fclt_cpct <= ${종료1}`);
// 처리구역 면적
if (시작2 && 종료2)
cqlFilters.push(`prcsZoneAreaSum BETWEEN ${시작2} AND ${종료2}`);
else if (시작2) cqlFilters.push(`prcsZoneAreaSum >= ${시작2}`);
else if (종료2) cqlFilters.push(`prcsZoneAreaSum <= ${종료2}`);
// 하수처리시설명
if (변수1) cqlFilters.push(`swtrmt_fclt_nm ILIKE '%${변수1}%'`);
return cqlFilters;
@@ -396,8 +386,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
// 하수처리구역용 CQL 필터 생성
const zoneCqlFilters = () => {
const cqlFilters: string[] = [];
if (시도) cqlFilters.push(`ctpv_cd='${시도}'`);
if (시군구) cqlFilters.push(`sgg_cd='${시군구}'`);
if (ctpvCd) cqlFilters.push(`ctpv_cd='${ctpvCd}'`);
if (sigungu) cqlFilters.push(`sgg_cd='${sigungu}'`);
if (변수1) cqlFilters.push(`swtrmt_zone_nm ILIKE '%${변수1}%'`);
if (변수2) cqlFilters.push(`swtrmt_fclt_nm ILIKE '%${변수2}%'`);
return cqlFilters;
@@ -422,7 +412,8 @@ const SearchModal: React.FC<SearchModalProps> = ({
cqlFilters.push(
`instl_ymd >= '${startDate}' and instl_ymd <= '${endDate}'`,
);
if (변수1) cqlFilters.push(`usg_cd='${변수1}'`);
// if (변수1) cqlFilters.push(`경과년도='${변수1}'`);
if (변수2) cqlFilters.push(`usg_cd='${변수2}'`);
// 구경(mm) 범위
if (시작1 && 종료1) cqlFilters.push(`swage_mh_diam BETWEEN ${시작1} AND ${종료1}`);
else if (시작1) cqlFilters.push(`swage_mh_diam >= ${시작1}`);
@@ -456,7 +447,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
cqlFilters.push(`daily_prcs_cpct BETWEEN ${시작1} AND ${종료1}`);
else if (시작1) cqlFilters.push(`daily_prcs_cpct >= ${시작1}`);
else if (종료1) cqlFilters.push(`daily_prcs_cpct <= ${종료1}`);
// 양수능력 범위
// 우수양수능력 범위
if (시작2 && 종료2)
cqlFilters.push(`excln_wpmp_ablt BETWEEN ${시작2} AND ${종료2}`);
else if (시작2) cqlFilters.push(`excln_wpmp_ablt >= ${시작2}`);
@@ -523,7 +514,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
// 설치년도 범위
if (ctpvCd) cqlFilters.push(`ctpv_cd='${ctpvCd}'`);
if (sigungu) cqlFilters.push(`sgg_cd='${sigungu}'`);
return cqlFilters;
};
@@ -592,32 +583,38 @@ const SearchModal: React.FC<SearchModalProps> = ({
}}
/>
</div> */}
{/* 용도 */}
<SelectBox2
className="w-60 mr-8 z-[102]"
selectClass="rounded-lg bg-white text-xl"
label="용도"
selectArray={MS_SWAGE_PPL_USE_CODES}
{/* 용도코드 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
용도코드
</Label>
<Input
className="mr-8 w-[100px] !text-xl placeholder:text-center"
placeholder="입력"
value={변수1}
onSelectValue={(val) => {
set변수1(String(val));
onChange={(e) => {
// 숫자만 입력 허용
const val = e.target.value.replace(/[^0-9]/g, "");
set변수1(val);
}}
/>
{/* 재질 */}
<SelectBox2
className="w-60 mr-8 z-[102]"
selectClass="rounded-lg bg-white text-xl"
label="재질"
selectArray={MS_SWAGE_PPL_CODES}
{/* 재질코드 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
재질코드
</Label>
<Input
className="mr-8 w-[100px] !text-xl placeholder:text-center"
placeholder="입력"
value={변수2}
onSelectValue={(val) => {
set변수2(String(val));
onChange={(e) => {
// 숫자만 입력 허용
const val = e.target.value.replace(/[^0-9]/g, "");
set변수2(val);
}}
/>
</div>
<div className="flex items-center mb-2">
{/* 행정읍면동코드 */}
{/* <Label className="mr-2 w-auto text-xl text-gray-600">
<Label className="mr-2 w-auto text-xl text-gray-600">
행정읍면동코드
</Label>
<Input
@@ -629,7 +626,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
const val = e.target.value.replace(/[^0-9]/g, "");
set변수3(val);
}}
/> */}
/>
{/* 관경 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
관경(mm)
@@ -703,7 +700,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
/>
{/* 시설용량 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
시설용량(㎥/d)
시설용량
</Label>
<Input
className="w-[100px] !text-xl placeholder:text-center"
@@ -726,33 +723,6 @@ const SearchModal: React.FC<SearchModalProps> = ({
set종료1(val);
}}
/>
</div>
<div className="mb-2 flex items-center">
{/* 처리구역 면적 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
처리구역 면적(m²)
</Label>
<Input
className="w-[100px] !text-xl placeholder:text-center"
placeholder="입력"
value={시작2}
onChange={(e) => {
// 숫자만 입력 허용
const val = e.target.value.replace(/[^0-9]/g, "");
set시작2(val);
}}
/>
<span className="mx-2 text-xl font-semibold">~</span>
<Input
className="mr-8 w-[100px] !text-xl placeholder:text-center"
placeholder="입력"
value={종료2}
onChange={(e) => {
// 숫자만 입력 허용
const val = e.target.value.replace(/[^0-9]/g, "");
set종료2(val);
}}
/>
{/* 하수처리시설명 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
하수처리시설명
@@ -773,13 +743,13 @@ const SearchModal: React.FC<SearchModalProps> = ({
<div className="mb-3">
<div className="mb-2 flex items-center">
<SidoSigunguSelectBox
sido={시도}
sigungu={시군구}
sido={ctpvCd}
sigungu={sigungu}
onSidoChange={(sidoId) => {
set시도(sidoId);
set시군구(0);
setCtpvCd(sidoId);
setSigungu(0);
}}
onSigunguChange={set시군구}
onSigunguChange={setSigungu}
/>
<Label className="mr-2 w-auto text-xl text-gray-600">
하수처리구역명
@@ -838,15 +808,18 @@ const SearchModal: React.FC<SearchModalProps> = ({
setYearFilter({ ...yearFilter, 경과년도: val });
}}
/> */}
{/* 용도 */}
<SelectBox2
className="w-60 mr-8 z-[102]"
selectClass="rounded-lg bg-white text-xl"
label="용도"
selectArray={MS_SWAGE_MHL_USE_CODES}
{/* 용도코드 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
용도코드
</Label>
<Input
className="mr-8 w-[100px] !text-xl placeholder:text-center"
placeholder="입력"
value={변수1}
onSelectValue={(val) => {
set변수1(String(val));
onChange={(e) => {
// 숫자만 입력 허용
const val = e.target.value.replace(/[^0-9]/g, "");
set변수1(val);
}}
/>
{/* 하수맨홀 구경 */}
@@ -903,7 +876,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
/> */}
{/* 일일처리용량 - 오수맨홀 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
일일처리용량(㎥)
일일처리용량
</Label>
<Input
className="w-[100px] !text-xl placeholder:text-center"
@@ -926,9 +899,9 @@ const SearchModal: React.FC<SearchModalProps> = ({
set종료1(val);
}}
/>
{/* 양수능력 - 우수맨홀 */}
{/* 우수양수능력 - 우수맨홀 */}
<Label className="mr-2 w-auto text-xl text-gray-600">
양수능력(m²/d)
우수양수능력
</Label>
<Input
className="w-[100px] !text-xl placeholder:text-center"
@@ -1085,21 +1058,21 @@ const SearchModal: React.FC<SearchModalProps> = ({
{/* 시도, 시군구, 하수처리구역 한 줄 */}
<div className="mb-6 flex items-center">
<SelectBox2
className="w-[150px] mr-8"
selectClass="rounded-lg bg-white"
label="시도"
selectArray={sidos}
value={ctpvCd}
onSelectValue={handleCtpvCdChange}
/>
<SelectBox2
className="w-48"
selectClass="w-48 rounded-lg bg-white truncate"
label="시군구"
selectArray={filteredSiguns}
value={sigungu}
onSelectValue={val => setSigungu(String(val))}
/>
className="w-[150px] mr-8"
selectClass="rounded-lg bg-white"
label="시도"
selectArray={sidos}
value={ctpvCd}
onSelectValue={handleCtpvCdChange}
/>
<SelectBox2
className="w-48"
selectClass="w-48 rounded-lg bg-white truncate"
label="시군구"
selectArray={filteredSiguns}
value={sigungu}
onSelectValue={val => setSigungu(String(val))}
/>
</div>
<div className="flex justify-between items-center mb-6">
<div className="flex items-center gap-4">
@@ -1122,7 +1095,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
endLabel=""
/>
</div>
{/* 조회 버튼 중앙 정렬 */}
<div className="absolute bottom-4 right-4 mr-2">
<Button className="text-base py-2" onClick={handleSearch}>조회</Button>
@@ -1160,7 +1133,7 @@ const SearchModal: React.FC<SearchModalProps> = ({
pageSize={tableData.length < 10 ? tableData.length : 10}
total={tableCount}
children={undefined}
cellClick={(activeTab !== 'report') ? handleCellClick : handleReportCellClick}
cellClick={(activeTab!=='report')?handleCellClick:handleReportCellClick}
onPageChange={setCurPage}
resetPageNo={false}
cur={curPage}
@@ -1,155 +0,0 @@
import { MS_SWAGE_PPL_USE_CODES, MS_SWAGE_PPL_CODES, MS_SWAGE_MHL_CODES, MS_SWAGE_MHL_USE_CODES, DRTW_SEWAGE_PUMP_USE_CODES } from './table';
interface CodeMapperProps {
layerName: string;
data: any;
}
/**
* 레이어별 코드 변환 함수
* @param layerName - 레이어 이름
* @param data - 변환할 데이터 객체
* @returns 변환된 데이터 객체
*/
export const codeMapper = ({ layerName, data }: CodeMapperProps): any => {
if (!data) return data;
const processedData = { ...data };
switch (layerName) {
case '하수관로':
// usg_cd 값 변환 (용도코드)
if (processedData.usg_cd) {
const usageCodeItem = MS_SWAGE_PPL_USE_CODES.find(
code => code.val === processedData.usg_cd.trim()
);
if (usageCodeItem) {
processedData.usg_cd = usageCodeItem.text;
}
}
// mqlt_cd 값 변환 (재질코드)
if (processedData.mqlt_cd) {
const materialCodeItem = MS_SWAGE_PPL_CODES.find(
code => code.val === processedData.mqlt_cd.trim()
);
if (materialCodeItem) {
processedData.mqlt_cd = materialCodeItem.text;
}
}
break;
case '하수맨홀':
// usg_cd 값 변환 (용도코드)
if (processedData.usg_cd) {
const usageCodeItem = MS_SWAGE_MHL_USE_CODES.find(
code => code.val === processedData.usg_cd.trim()
);
if (usageCodeItem) {
processedData.usg_cd = usageCodeItem.text;
}
}
// mqlt_cd 값 변환 (재질코드)
if (processedData.mqlt_cd) {
const materialCodeItem = MS_SWAGE_MHL_CODES.find(
code => code.val === processedData.mqlt_cd.trim()
);
if (materialCodeItem) {
processedData.mqlt_cd = materialCodeItem.text;
}
}
break;
case '하수펌프장':
// usg_cd 값 변환 (용도코드)
if (processedData.usg_cd) {
const usageCodeItem = DRTW_SEWAGE_PUMP_USE_CODES.find(
code => code.val === processedData.usg_cd.trim()
);
if (usageCodeItem) {
processedData.usg_cd = usageCodeItem.text;
}
}
break;
case '우수토실':
// prrtymngYn 값 변환 (중점여부)
if (processedData.prrtymngYn) {
if (processedData.prrtymngYn === 'Y') {
processedData.prrtymngYn = '중점우수토실';
} else if (processedData.prrtymngYn === 'N') {
processedData.prrtymngYn = '우수토실';
}
}
break;
case '중점우수토실':
if (processedData.manage_no) {
processedData.mqlt_cd = processedData.manage_no;
}
break;
default:
// 다른 레이어는 변환하지 않음
break;
}
return processedData;
};
/**
* 저장 시 코드 역변환 함수 (한글 → 코드)
* @param layerName - 레이어 이름
* @param data - 역변환할 데이터 객체
* @returns 역변환된 데이터 객체
*/
export const reverseCodeMapper = ({ layerName, data }: CodeMapperProps): any => {
if (!data) return data;
const processedData = { ...data };
switch (layerName) {
case '하수맨홀':
// mqlt_cd 값 역변환 (텍스트 → 코드)
if (processedData.mqlt_cd && typeof processedData.mqlt_cd === 'string') {
const materialCodeItem = MS_SWAGE_MHL_CODES.find(
code => code.text === processedData.mqlt_cd.trim()
);
if (materialCodeItem) {
processedData.mqlt_cd = materialCodeItem.val;
}
}
break;
case '우수토실':
// prrtymngYn 값 역변환 (텍스트 → Y/N)
if (processedData.prrtymngYn) {
if (processedData.prrtymngYn === '중점우수토실') {
processedData.prrtymngYn = 'Y';
} else if (processedData.prrtymngYn === '우수토실') {
processedData.prrtymngYn = 'N';
}
}
break;
case '하수펌프장':
// usg_cd 값 역변환 (텍스트 → 코드)
if (processedData.usg_cd && typeof processedData.usg_cd === 'string') {
const usageCodeItem = DRTW_SEWAGE_PUMP_USE_CODES.find(
code => code.text === processedData.usg_cd.trim()
);
if (usageCodeItem) {
processedData.usg_cd = usageCodeItem.val;
}
}
break;
default:
break;
}
return processedData;
};
// 기본 내보내기
export default { codeMapper, reverseCodeMapper };
@@ -6,8 +6,8 @@ export const MsSwagePplCol = [
{ id: 'mapsht_no', title: '도엽번호' },
{ id: 'pdmt', title: '관경(mm)' },
{ id: 'prlg', title: '연장(m)' },
{ id: 'usg_cd', title: '용도' },
{ id: 'mqlt_cd', title: '재질' },
{ id: 'usg_cd', title: '용도코드' },
{ id: 'mqlt_cd', title: '재질코드' },
{ id: 'avg_grdn', title: '평균구배(m/m)' },
{ id: 'drtw_mltv_area', title: '오수배수면적(m²)' },
{ id: 'excln_mltv_area', title: '우수배수면적(m²)' },
@@ -63,6 +63,7 @@ export const MS_SWAGE_PPL_USE_CODES = [
{ val: "SBA003", text: "우수관" },
{ val: "SBA004", text: "오수관" },
{ val: "SBA999", text: "기타" },
{ val: "그 외", text: "미분류" },
];
// 하수관로 재질 코드표
export const MS_SWAGE_PPL_CODES = [
@@ -259,6 +260,7 @@ export const MS_SWAGE_PPL_CODES = [
{ val: "MOP948", text: "PE다중벽관" },
{ val: "MOP977", text: "전주용입상관" },
{ val: "MOP978", text: "MD관" },
{ val: "그 외", text: "미분류" },
];
// 하수처리시설
@@ -376,7 +378,7 @@ export const MsSwageMhlCol = [
// { id: 'fclty_shp_cd', title: '시설물형태코드' },
// { id: 'mhl_knd_cd', title: '맨홀종류코드' },
{ id: 'swage_mh_diam', title: '하수맨홀구경(mm)' },
{ id: 'mqlt_cd', title: '재질' },
{ id: 'mqlt_cd', title: '재질코드' },
{ id: 'wdth_len', title: '가로길이(m)' },
{ id: 'vrtc_len', title: '세로길이(m)' },
// { id: 'ang_dir', title: '표고' },
@@ -561,12 +563,13 @@ export const DRTW_SEWAGE_PUMP_USE_CODES = [
{ val: "SBE900", text: "오수배제" },
{ val: "SBE901", text: "우수배제" },
{ val: "SBE999", text: "기타" },
{ val: "그 외", text: "미분류" },
];
// 우수토실
export const stofcbrCol = [
// { id: 'ftre_smbol_cd', title: '지형지물부호코드' },
{ id: 'fclt_mng_no', title: '시설관리번호' },
{ id: 'pbadms_emd_cd', title: '시설관리번호' },
// { id: 'pbadms_emd_cd', title: '행정읍면동코드' },
{ id: 'mapsht_no', title: '도엽번호' },
// { id: 'mng_inst_cd', title: '관리기관코드' },
@@ -60,11 +60,12 @@ const MsSwagePpl = ({ featureData, onSaveClick }: { featureData: any, onSaveClic
return (
<>
<VerticalTable
headName='입력정보'
headName='자체 입력정보'
tableData={featureData ? [formData] : []}
headlist={inputColumn}
pageSize={20}
total={0}
children={undefined}
cellClick={undefined}
isEditable={true}
onPageChange={function (page: number): void {
@@ -184,7 +184,7 @@ const Ssc = ({ featureData, isMainSsc, rainMeasureData, onSaveClick }: {
<div>
{!isMainSsc && (
<VerticalTable
headName='입력정보'
headName='자체 입력정보'
tableData={featureData ? [formData] : []}
headlist={inputColumn}
pageSize={0}
@@ -107,9 +107,6 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
};
const closePopup = () => { // 팝업 닫기
setPopupOpen(false);
}
const infilRsltChart = () => { // 그래프 & 팝업 닫기
fn.selectInftwtAnlsRslt(selectedInftwtAnls, pplMngNo).then((data) => {// 침입수분석 결과 조회
const rsltData = fn.getChartDataInftwtAnlsRslt(data ?? []);
@@ -253,9 +250,6 @@ const InfilChart = ({ pplMngNo }: ModalOpenProp) => {
</div>
<div className="flex justify-end mt-4 space-x-2">
<button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}>
닫기
</button>
<button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={infilRsltChart}>
분석결과 도표
</button>
</div>
@@ -96,9 +96,6 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => {
}, [rainInfwtAnlsSn]);
const closePopup = () => { // 팝업 닫기
setPopupOpen(false);
}
const rdiiRsltChart = () => { // 그래프 & 팝업 닫기
fn.selectRdiiAnlsRslt(rainInfwtAnlsSn, pplMngNo).then((data) => {// 강우유입수분석 결과 조회
const rsltData1 = fn.getChartDataRdiiAnlsRslt(data ?? []);
//const rsltData2 = fn.getChartDataRdiiAnlsRsltMinq(data ?? []);
@@ -239,9 +236,6 @@ const RdiiChart = ({ pplMngNo }: ModalOpenProp) => {
</div>
<div className="flex justify-end mt-4 space-x-2">
<button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={closePopup}>
닫기
</button>
<button className="px-4 py-2 bg-gray-600 text-white rounded" onClick={rdiiRsltChart}>
분석결과 도표
</button>
</div>
@@ -38,7 +38,7 @@ const sewagePump = ({ featureData, isDrtwSewagePump, onSaveClick }: { featureDat
return (
<VerticalTable
headName='입력정보'
headName='자체 입력정보'
tableData={featureData ? [formData] : []}
headlist={isDrtwSewagePump ? drtwInputColumn : exclnInputColumn}
pageSize={0}
@@ -32,7 +32,7 @@ const Smh = ({ featureData, onSaveClick }: { featureData: any, onSaveClick?: ()
return (
<VerticalTable
headName='입력정보'
headName='자체 입력정보'
tableData={featureData ? [formData] : []}
headlist={inputColumn}
pageSize={20}
@@ -10,7 +10,7 @@ const StormWaterPump = ({ featureData }: { featureData: Record<string, any> }) =
const filteredData = featureData && Object.entries(featureData).filter(([key]) => validKey.includes(key)).reduce((obj: Record<string, any>, [key, value]) => { obj[key] = value; return obj; }, {});
return (
<VerticalTable
headName='입력정보'
headName='자체 입력정보'
tableData={[filteredData]}
headlist={inputColumn}
pageSize={0}
@@ -11,20 +11,18 @@ import InfilChart from './components/popupComponent/chart/infilChart';
import RdiiChart from './components/popupComponent/chart/rdiiChart';
import { useInfilChartModalStore, useRdiiChartModalStore } from "./components/popupComponent/chartModalStore";
import { formatDisplayData } from '@/components/lib/utils/formatDisplayValue';
import { codeMapper } from "./components/common/codeMapper";
// TODO:
const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void, featureData: any }) => {
const { gisMap } = useGisContext() as unknown as { checkedLayerIds: React.MutableRefObject<number[]>; treeData: { lyrSn: number }[] | null; gisCore: any; gisMap: any; };
const [layerNm, setLayerNm] = useState<string>(""); // 레이어 이름 상태
const [layerSpecificNm, setLayerSpecificNm] = useState<string>(""); // 레이어 이름 상태
const [tableData, setTableData] = useState<any>(null); // 피처 데이터
const [rainMeasureData, setRainMeasureData] = useState<any[]>([]); // 강우/측정 측정 정보
const [headlist, setHeadlist] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태
const [headlist2, setHeadlist2] = useState<{ id: string; title: string; }[]>([]); // 컬럼리스트 변경상태
const [buttonChk, setButtonChk] = useState(true)
const [fetchData, setFetchData] = useState<any>(); // api 호출여부
const [fetchData, setfetchData] = useState<any>(); // api 호출여부
const contentRef = useRef<HTMLDivElement>(null);
const [isModalOpen, setIsModalOpen] = useState(false); // 모달 열기 상태
const [isMainSsc, setIsMainSsc] = useState(false); // 중점우수토실 여부
@@ -135,48 +133,10 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
// 🎯 기본 데이터 포맷팅
const formattedData = formatDisplayData(data);
if (featureData.values_.fclt_mng_no) setLayerSpecificNm(featureData.values_.fclt_mng_no);
else if (featureData.values_.swtrmt_fclt_cd) setLayerSpecificNm(featureData.values_.swtrmt_fclt_cd);
else setLayerSpecificNm(featureData.values_.manage_no);
setFetchData(formattedData);
setfetchData(formattedData);
setTableData(formattedData);
switch (selectedLayerName) {
case '하수관로':
setHeadlist(MsSwagePplCol)
setButtonChk(true)
// ✅ codeMapper 사용하여 API 결과도 변환
setTableData(codeMapper({
layerName: selectedLayerName,
data: { ...formattedData }
}));
// setFetchData(mappedData);
// setTableData(mappedData);
break;
case '하수맨홀':
setHeadlist(MsSwageMhlCol)
setButtonChk(true)
// ✅ codeMapper 사용하여 API 결과도 변환
setTableData(codeMapper({
layerName: selectedLayerName,
data: { ...formattedData }
}));
// setFetchData(mappedData);
// setTableData(mappedData);
break;
case '하수펌프장':
setHeadlist(ExclnSewagePumpCol)
setButtonChk(true)
setTableData(codeMapper({
layerName: selectedLayerName,
data: { ...formattedData }
}));
// setFetchData(mappedData);
// setTableData(mappedData);
break;
case '하수처리시설':
setHeadlist(SwtrmtFcltCol);
setButtonChk(false)
@@ -185,11 +145,6 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
setHeadlist(SwtrmtPrcsZoneCol)
setButtonChk(false)
break;
case '우수토실':
setHeadlist(stofcbrCol)
setButtonChk(true)
setIsMainSsc(false)
break;
case '중점우수토실':
setHeadlist(untrtSwgRainCol1)
setHeadlist2(untrtSwgRainCol2)
@@ -198,33 +153,51 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
// 🎯 processedData도 포맷팅하여 설정
const processedFormattedData = formatDisplayData(processedData);
setFetchData([processedFormattedData])
setfetchData([processedFormattedData])
setTableData(processedFormattedData);
// setIsLoading(false); // 기본 렌더링 완료
setTableData(codeMapper({
layerName: selectedLayerName,
data: { ...processedFormattedData }
}));
// 강우/측정 정보 데이터 호출
if (tableData?.chmbr_xcnts && tableData?.chmbr_ydnts) {
fetchRainMeasureData(tableData.chmbr_xcnts, tableData.chmbr_ydnts)
if (data?.chmbr_xcnts && data?.chmbr_ydnts) {
fetchRainMeasureData(data.chmbr_xcnts, data.chmbr_ydnts)
.then(response => {
console.log('additionalResponse', response);
setRainMeasureData(response || []);
})
.catch(error => {
console.error('추가 데이터 로딩 실패:', error);
setRainMeasureData([]);
setRainMeasureData(false);
});
}
break;
case '우수토실':
setHeadlist(stofcbrCol)
setButtonChk(true)
setIsMainSsc(false)
break;
case '하수관로':
setHeadlist(MsSwagePplCol)
setButtonChk(true)
break;
// case '오수펌프':
// setButtonChk(true)
// break;
// case '빗물펌프':
// setButtonChk(true)
// break;
case '하수펌프장':
setHeadlist(ExclnSewagePumpCol)
setButtonChk(true)
break;
case '하수맨홀':
setHeadlist(MsSwageMhlCol)
setButtonChk(true)
break;
default:
break;
}
// 자체입력정보 API 엔드포인트 선택
// API 엔드포인트 선택
let apiEndpoint = '';
const getFeatureId = featureId.toString().split('.').pop() || null;
if (selectedLayerName === '하수관로') apiEndpoint = `v1/fcltppl/${getFeatureId}`;
@@ -241,13 +214,35 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
if (result) {
console.log('API 데이터 로드 성공:', result);
// ✅ codeMapper 사용하여 API 결과도 변환
const processedApiData = codeMapper({
layerName: selectedLayerName,
data: { ...result, ...tableData }
});
// 하수맨홀인 경우 용도코드를 텍스트로 변환
if (selectedLayerName === '하수맨홀') {
const processedData = { ...result };
setFetchData(processedApiData);
// mqlt_cd 값 변환 (재질코드)
if (processedData.mqlt_cd) {
const materialCodeItem = MS_SWAGE_MHL_CODES.find(
code => code.val === processedData.mqlt_cd.trim()
);
if (materialCodeItem) {
processedData.mqlt_cd = `${materialCodeItem.text}`;
}
}
setfetchData(processedData);
} // 🎯 우수토실인 경우 prrtymngYn 값 변환
else if (selectedLayerName === '우수토실' && data) {
const processedData = { ...result, ...data };
// prrtymngYn 값 변환
if (processedData.prrtymngYn === 'Y') processedData.prrtymngYn = '중점우수토실';
else if (processedData.prrtymngYn === 'N') processedData.prrtymngYn = '우수토실';
console.log('processedData', processedData);
setfetchData(processedData);
} else {
setfetchData(result);
}
}
} catch (apiError) {
console.error('API 데이터 로딩 중 오류:', apiError);
@@ -261,7 +256,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
fetchData();
}, [featureId, processedData]);
// 🎯 추가 데이터 API 호출 함수
// 🎯 추가 데이터 API 호출 함수 (독립적으로 실행)
const fetchRainMeasureData = useCallback(async (chmbrXcnts: string, chmbrYdnts: string) => {
if (!chmbrXcnts || !chmbrYdnts) {
console.warn('추가 데이터 호출 실패: 필수 매개변수 누락', { chmbrXcnts, chmbrYdnts });
@@ -325,7 +320,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
})
.catch(error => {
console.error('추가 데이터 최종 로딩 실패:', error);
setRainMeasureData([]);
setRainMeasureData(false);
});
}
}
@@ -399,7 +394,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
if (result) {
alert('저장되었습니다');
setFetchData(result.data || result);
setfetchData(result.data || result);
} else {
alert('저장에 실패했습니다');
console.error('API 응답 오류:', result);
@@ -418,13 +413,8 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
<div id="popup" className="absolute top-0 right-0 w-[350px] h-[calc(100vh-10rem)] bg-white border-r border-gray-300 flex flex-col overflow-hidden transition-all duration-300 z-[50]">
<div className="card-header bg-primary flex items-center justify-between p-4">
<div className="flex items-center">
<h3 className="text-2xl font-medium text-white text-label whitespace-nowrap mr-4">{layerNm}
{tableData?.usg_cd && (
<>
({tableData.usg_cd})
</>
)} 정보 <br />관리번호 : {layerSpecificNm}
</h3>
<h3 className="text-2xl font-medium text-white text-label whitespace-nowrap">{layerNm} 정보</h3>
{/* <div className="font-medium text-white text-label">(00구 00리 하수관로)</div> */}
</div>
<div className="flex items-center space-x-3">
@@ -447,7 +437,7 @@ const FeatureClickEventPopup = ({ onClose, featureData }: { onClose: () => void,
)}
<Button
onClick={onClose}
className="text-white hover:text-gray-300 focus:outline-none"
className="text-white hover:text-gray-300 focus:outline-none ml-2"
>
✕
</Button>
@@ -1,99 +0,0 @@
'use client'
// FileUpload.js
import React, { useState } from 'react';
import axios from 'axios';
const SEWERAGE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
function FileUpload() {
const [file, setFile] = useState(null);
const [text, setText] = useState('');
const handleFileChange = (e) => {
setFile(e.target.files[0]);
};
const handleTextChange = (e) => {
setText(e.target.value);
};
function getCookie(name:string) {
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
if (match && match[2]) {
return decodeURIComponent(match[2]);
}
return null;
}
const handleFindUser = (e) => {
const auth = getCookie("Authorization");
if (auth) console.log("쿠키 auth : " + auth);
fetch(SEWERAGE_URL+"/v1/inftwtAnls/users/65a00f65-8460-49af-98ec-042977e56f4b", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({authToken: auth})
}).then((data) => {
console.log(data);
});
};
const handleFindUserOna = (e) => {
const auth = getCookie("Authorization");
if (auth) console.log("쿠키 auth : " + auth);
fetch("/server/user-service/api/v1/users/65a00f65-8460-49af-98ec-042977e56f4b").then((data) => {
console.log(data);
});
};
const handleSubmit = async (e) => {
e.preventDefault();
if (!file) {
alert('파일을 선택하세요.');
return;
}
const jsonData = {
aplcnYm: '202507',
enoCd: 'ABC'
};
// JSON → Blob 으로 변환 + MIME 지정
const jsonBlob = new Blob([JSON.stringify(jsonData)], {
type: 'application/json'
});
const formData = new FormData();
formData.append('data', jsonBlob);
formData.append('inpFile', file);
try {
const response = await axios.post('http://localhost:8883/sewerage-service/api/v1/rdiiAnls/savewithfile', formData);
alert('업로드 성공: ' + response.data.message);
} catch (err) {
console.error(err);
alert('업로드 실패');
}
};
return (
<form onSubmit={handleSubmit} className="text-2xl">
<div>
<label>텍스트 입력:</label>
<input type="text" value={text} onChange={handleTextChange} />
</div>
<div>
<label>파일 선택:</label>
<input type="file" onChange={handleFileChange} />
</div>
<button type="submit" className="px-4 py-2 bg-gray-500 text-white rounded">업로드</button>
<button type="button" className="px-4 py-2 bg-gray-400 text-white rounded"
onClick={handleFindUser}>사용자조회</button>
<button type="button" className="px-4 py-2 bg-gray-200 text-white rounded"
onClick={handleFindUserOna}>사용자조회ona</button>
</form>
);
}
export default FileUpload;
@@ -13,12 +13,6 @@ import { excelToFlowRateData, excelToMatchingResultData, excelToTimePatternData
import BaseLayout from '../BaseLayout'
import { validateMultipleFiles, FILE_EXTENSIONS, type FileValidationConfig } from '../../fileValidation';
import { validateBasicSelectionsWithAlert } from '../../selectionValidation';
import { tokenManager } from '@/entities/auth/lib/token-manager';
import { AUTH_USER_ID } from "@/shared/config";
import { useQuery } from "@tanstack/react-query";
import { ENDPOINT } from "@common/components/config";
import { getUserInfo } from "@common/components/api";
const formSchema = z.object({
managenm: z.string(),
@@ -47,22 +41,6 @@ interface ApiSelectOption {
}
const IrSetting = () => {
const [input1, setInput1] = useState('');
const [input2, setInput2] = useState('');
const [select1, setSelect1] = useState('0'); // 환경청코드
const [select2, setSelect2] = useState('0'); // 시도코드
const [select3, setSelect3] = useState<ApiSelectOption>({ val: '0', text: '전체' }); // 시군구 상태를 객체로 변경
const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장코드
const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역코드
const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태
const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태
const { data: userInfo } = useQuery({
queryKey: [ENDPOINT.USER_SERVICE.USERS],
queryFn: () => getUserInfo(),
enabled: true,
});
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
@@ -90,6 +68,15 @@ const IrSetting = () => {
const month = String(now.getMonth() + 1).padStart(2, '0');
return `${year}${month}`;
});
const [input1, setInput1] = useState('');
const [input2, setInput2] = useState('');
const [select1, setSelect1] = useState('0'); // 환경청코드
const [select2, setSelect2] = useState('0'); // 시도코드
const [select3, setSelect3] = useState<ApiSelectOption>({ val: '0', text: '전체' }); // 시군구 상태를 객체로 변경
const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장코드
const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역코드
const [formResetKey, setFormResetKey] = useState(0); // FileUploadForm 리셋을 위한 key 상태
const [isLoadingResult, setIsLoadingResult] = useState<boolean>(false); // 로딩 상태
// 폼 초기화 함수
const resetAllForms = () => {
@@ -311,8 +298,6 @@ const IrSetting = () => {
aplcnYm: selectedDate, // 적용연월
drtwSwtcRt: parseFloat(input1) || null, // 오수전환율 (숫자로 변환)
anlsInfo: input2, // 분석정보
rgtr: tokenManager.getToken(AUTH_USER_ID) || null, // 등록자 (사용자 ID)
rgtrNm: userInfo?.userName, // 등록자 (사용자 ID)
atflCd: file1?.atflCd, // 첨부파일CD (오수관망도)
atflId: file1?.atflId, // 첨부파일ID (오수관망도)
atflInpNm: file1?.file?.name, // 오수관망도 파일명
@@ -15,11 +15,6 @@ import { excelToMatchingResultData, excelToRainData } from '@/components/lib/uti
import { EditableFormTable, type EditableTableHeadItem } from '../../../components/ui/EditableFormTable'
import { validateMultipleFiles, FILE_EXTENSIONS, type FileValidationConfig } from '../../fileValidation';
import { validateBasicSelectionsWithAlert } from '../../selectionValidation';
import { tokenManager } from '@/entities/auth/lib/token-manager';
import { AUTH_USER_ID } from "@/shared/config";
import { useQuery } from "@tanstack/react-query";
import { ENDPOINT } from "@common/components/config";
import { getUserInfo } from "@common/components/api";
// zod 스키마 정의
@@ -120,12 +115,6 @@ export default function RTKForm() {
const [select4, setSelect4] = useState<string | number>('0'); // 하수처리장 (swageTmplntCd)
const [select5, setSelect5] = useState<string | number>('0'); // 하수처리구역 (swtrmtZoneCd)
const { data: userInfo } = useQuery({
queryKey: [ENDPOINT.USER_SERVICE.USERS],
queryFn: () => getUserInfo(),
enabled: true,
});
// form 인스턴스 생성
const form = useForm<FormSchemaType>({
resolver: zodResolver(formSchema),
@@ -339,8 +328,6 @@ export default function RTKForm() {
drtwSwtcRt: parseFloat(formData.rate || "0"), // 오수전환율
anlsInfo: formData.analysisInfo, // 분석정보
rgtr: tokenManager.getToken(AUTH_USER_ID) || null, // 등록자 (사용자 ID)
rgtrNm: userInfo?.userName, // 등록자 (사용자 ID)
tbSnRcptrMhlMpng: matchingResultData, // 수용가-맨홀 매칭결과
tbSnRainData: rainData, // 강우자료
@@ -92,8 +92,6 @@ const Result = () => {
const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => {
setIsLoadingResult(true);
setResetSelection(true);
const formValues = customFormValues || form.getValues(); // react-hook-form에서 현재 값 가져오기
console.log("formValues", formValues);
@@ -158,10 +156,8 @@ const Result = () => {
};
});
// 선택된 행 초기화
setSelectedRowData(null);
setSelectedRowIndex(undefined);
// setTableData(data.content || []);
// setTotalData(tableData.length);
setTableData(dataWithRowNumber);
setTotalData(dataWithRowNumber.length);
console.log("response:", data);
@@ -174,7 +170,6 @@ const Result = () => {
setTableData([]);
setTotalData(0);
}
setResetSelection(false);
};
// 테이블 셀 클릭 핸들러 추가
@@ -269,6 +264,9 @@ const Result = () => {
};
await handleSearchButtonClick(customFormValues);
// 선택된 행 초기화
setSelectedRowData(null);
setSelectedRowIndex(undefined);
setIsLoadingResult(false);
alert('삭제가 완료되었습니다.');
@@ -1,5 +1,5 @@
'use client'
import { deleteData, getData, useCookieAuth } from '@/components/lib/api'
import { deleteData, getData } from '@/components/lib/api'
import { UiTable, downloadExcel, downloadExcelWithKoreanHeaders } from '@common/business_components/ui'
import { zodResolver } from '@hookform/resolvers/zod'
import { useState, useEffect } from 'react'
@@ -83,13 +83,12 @@ const Result = () => {
const [resetSelection, setResetSelection] = useState<boolean>(false);
useEffect(() => {
// setCurPage(1);
handleSearchButtonClick();
}, [])
const auth = useCookieAuth();
// setCurPage(1);
handleSearchButtonClick();
}, [])
const handleSearchButtonClick = async (customFormValues?: Partial<ResultFormValues>) => {
setIsLoadingResult(true);
setResetSelection(true);
const formValues = customFormValues || form.getValues(); // react-hook-form에서 현재 값 가져오기
console.log("formValues", formValues);
@@ -113,7 +112,6 @@ const Result = () => {
"sggCd": formValues.sggCd,
"swageTmplntCd": processedSwageTmplntCd,
// "swtrmtZoneCd": formValues.swtrmtZoneCd,
"auth" : auth,
};
} else {
inftwtAnlsSearchDto = {
@@ -124,7 +122,6 @@ const Result = () => {
"sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val,
"swageTmplntCd": processedSwageTmplntCd,
// "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd,
"auth" : auth,
};
}
console.log("Search DTO:", inftwtAnlsSearchDto);
@@ -157,11 +154,8 @@ const Result = () => {
scsYn: item.scsYn === null || item.scsYn === undefined ? 'N' : item.scsYn // scsYn이 null이면 'N'으로 변경
};
});
// 선택된 행 초기화
setSelectedRowData(null);
setSelectedRowIndex(undefined);
// setTableData(data.content || []);
// setTotalData(tableData.length);
setTableData(dataWithRowNumber);
setTotalData(dataWithRowNumber.length);
console.log("response:", data);
@@ -173,10 +167,7 @@ const Result = () => {
alert("분석결과 조회 중 오류가 발생했습니다.");
setTableData([]);
setTotalData(0);
setSelectedRowData(null);
setSelectedRowIndex(undefined);
}
setResetSelection(false);
};
// 테이블 셀 클릭 핸들러 추가
@@ -274,11 +265,16 @@ const Result = () => {
};
await handleSearchButtonClick(customFormValues);
// 선택된 행 초기화
setSelectedRowData(null);
setSelectedRowIndex(undefined);
setIsLoadingResult(false);
alert('삭제가 완료되었습니다.');
setResetSelection(false);
setTimeout(() => {
setResetSelection(false);
}, 100);
} catch (error) {
setIsLoadingResult(false);
console.error("분석결과 파일 삭제 중 오류 발생:", error);
@@ -286,7 +282,7 @@ const Result = () => {
}
};
return (
<BaseLayout
@@ -26,12 +26,10 @@ const Page = () => {
const [totalData, setTotalData] = useState(0) //총 데이터 수
const [isLoading, setIsLoading] = useState(true) //로딩 상태
const [isModalOpen, setIsModalOpen] = useState(false) // 모달 상태
const [resetSelection, setResetSelection] = useState<boolean>(false); // 선택 초기화 상태
// 조회
const fetchData = async () => {
setIsLoading(true)
setResetSelection(true);
// searchCmmnCd('SITEKNDCD')
try {
const { data, total } = await searchData('v1/sbmrgPrevnt', {
@@ -56,7 +54,6 @@ const Page = () => {
setAtflId('');
setSbmrgPrevntBizSn('');
setIsLoading(false);
setResetSelection(false);
}
}
@@ -88,9 +85,6 @@ const Page = () => {
fetchData()
}
}
else {
alert('삭제에 실패했습니다.')
}
}
// 현황 등록
@@ -103,8 +97,8 @@ const Page = () => {
atflId: id,
sbmrgPrevntBizNm: fileName
})
if (data) {
alert('파일이 등록되었습니다.');
if (data) {
alert('파일이 등록되었습니다.');
setIsModalOpen(false);
fetchData();
}
@@ -189,7 +183,6 @@ const Page = () => {
}
}}
onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}
resetSelection={resetSelection}
/>
</ListDiv>
{/* 파일 업로드 모달 */}
@@ -24,12 +24,10 @@ const Page = () => {
const [totalData, setTotalData] = useState(0) //총 데이터 수
const [isLoading, setIsLoading] = useState(true) //로딩 상태
const [isModalOpen, setIsModalOpen] = useState(false) // 모달 상태
const [resetSelection, setResetSelection] = useState<boolean>(false); // 선택 초기화 상태
// 데이터 조회
const fetchData = async () => {
setIsLoading(true)
setResetSelection(true);
try {
const { data, total } = await searchData('v1/dcrpPpl', {
fromRegDt: formatDate(fromDate),
@@ -53,7 +51,6 @@ const Page = () => {
setAtflId('');
setDcrpPplMtncBizSn('');
setIsLoading(false)
setResetSelection(false);
}
}
@@ -185,7 +182,6 @@ const Page = () => {
}
}}
onPageChange={async (page: number) => { setCurPage(page); await fetchData() }}
resetSelection={resetSelection}
/>
</ListDiv>
{/* 파일 업로드 모달 */}
+1 -27
View File
@@ -1,5 +1,4 @@
import {useState, useEffect} from 'react';
const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || "";
const BASE_URL = 'http://con.mind-one.co.kr:11083/sewerage-service/api';
export const postData = async (url: string, data: object): Promise<any> => {
const options: RequestInit = {
@@ -80,29 +79,4 @@ export const deleteData = async (url: string, data?: object): Promise<any> => {
const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, options);
if (res.status === 204) return true
return res;
};
export function getCookie(name:string) {
const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
if (match && match[2]) {
return decodeURIComponent(match[2]);
}
return null;
}
export const useCookieAuth = () => {
const [data, setData] = useState("");
useEffect(() => {
const fetch = async () => {
const result = getCookie("Authorization");
if (result) {
setData(result);
}
};
fetch();
console.log("useCookieAuth 호출");
}, []);
return data;
};
+18 -1
View File
@@ -1,13 +1,30 @@
import type { NextConfig } from "next";
const geoServerUrl =
process.env.NEXT_PUBLIC_GEOSERVER_URL?.replace(/\/$/, "") ?? "";
const cnServerUrl =
process.env.NEXT_PUBLIC_SERVER_API_URL?.replace(/\/$/, "") ?? "";
const nextConfig: NextConfig = {
output: "standalone",
// basePath: "/sn",
typescript: {
ignoreBuildErrors: true, // 이 줄 추가
},
eslint: {
ignoreDuringBuilds: true,
},
// async rewrites() {
// return [
// {
// source: '/geoserver/:hasudo*',
// destination: `${geoServerUrl}/:hasudo*`,
// },
// {
// source: '/attach-service/:path*',
// destination: `${cnServerUrl}/attach-service/:path*`,
// },
// ];
// },
};
export default nextConfig;
+8 -4
View File
@@ -12,14 +12,12 @@
"@common/assets": "workspace:*",
"@common/business_components": "workspace:*",
"@common/components": "workspace:*",
"@fontsource-variable/noto-sans-kr": "^5.2.5",
"@frontend-opensource/use-react-hooks": "^1.1.4",
"@hookform/resolvers": "^4.1.3",
"@minoru/react-dnd-treeview": "3.5.1-alpha.1",
"@radix-ui/react-label": "^2.1.2",
"@radix-ui/react-slot": "^1.1.2",
"@tanstack/react-query": "^5.67.1",
"@tanstack/react-query-devtools": "^5.75.5",
"@tanstack/react-table": "^8.21.2",
"axios": "^1.8.1",
"chart.js": "^4.4.8",
@@ -31,9 +29,12 @@
"react-dnd": "^16.0.1",
"react-hook-form": "^7.54.2",
"tailwindcss-animate": "^1.0.7",
"tus-js-client": "^4.3.1",
"zod": "^3.24.2",
"zustand": "^5.0.3"
"zustand": "^5.0.3",
"ol": "^7.3.0",
"ol-ext": "^4.0.11",
"proj4": "^2.9.0",
"tus-js-client": "^4.3.1"
},
"devDependencies": {
"@eslint/eslintrc": "^3",
@@ -51,3 +52,6 @@
"typescript": "^5"
}
}
+17 -1
View File
@@ -1,7 +1,23 @@
# NEXT_PUBLIC_SITE_ID = WR
# NEXT_PUBLIC_PORT = 11301
# NEXT_PUBLIC_PROXY_HOST = http://localhost:3001
# NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
# NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
# NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
# NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
# NEXT_PUBLIC_CLAIM_NAME = Authorization
# NEXT_PUBLIC_AUTH_USER_ID = token-id
# NEXT_PUBLIC_ACCESS_TOKEN = access-token
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 11301
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
NEXT_PUBLIC_CLAIM_NAME = Authorization
+8 -3
View File
@@ -1,14 +1,19 @@
NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 3001
NEXT_PUBLIC_PROXY_HOST = http://localhost:3001
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
NEXT_PUBLIC_CLAIM_NAME = Authorization
NEXT_PUBLIC_AUTH_USER_ID = token-id
NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
# NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.128:8883/sewerage-service/api # 최용성
#NEXT_PUBLIC_SEWERAGE_API_URL=http://192.168.1.66:8883/sewerage-service/api # 박이정
+20 -1
View File
@@ -1,7 +1,24 @@
# NEXT_PUBLIC_SITE_ID = WR
# NEXT_PUBLIC_PORT = 11301
# NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
# NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
# NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
# NEXT_PUBLIC_CLAIM_NAME = Authorization
# NEXT_PUBLIC_AUTH_USER_ID = token-id
# NEXT_PUBLIC_ACCESS_TOKEN = access-token
# NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SITE_ID = WR
NEXT_PUBLIC_PORT = 11301
NEXT_PUBLIC_PROXY_HOST = http://con.mind-one.co.kr:11301
NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
# NEXT_PUBLIC_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_SERVER_API_URL = http://con.mind-one.co.kr:11080/api/v1
NEXT_PUBLIC_FO_SERVER_API_URL = http://con.mind-one.co.kr:11082/api/v1
NEXT_PUBLIC_CS_SERVER_API_URL = http://dev.onasys.co.kr:8000
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
NEXT_PUBLIC_GEOSERVER_URL = http://rsone.iptime.org:10010/geoserver
NEXT_PUBLIC_LX_GEOSERVER_URL = http://con.mind-one.co.kr:11306/geoserver
NEXT_PUBLIC_CLAIM_NAME = Authorization
@@ -10,3 +27,5 @@ NEXT_PUBLIC_ACCESS_TOKEN = access-token
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
NEXT_PUBLIC_SEWERAGE_API_URL=http://con.mind-one.co.kr:11083/sewerage-service/api # 개발 서버 API
+26
View File
@@ -0,0 +1,26 @@
"use client"
import { BaseLayout } from "@common/components/ui";
import { useWrStore } from "./store";
import { MainDiv } from "@common/business_components/ui";
import type { MenuItem } from "./store/common/type/menu";
export default function Base({
children,
changeMenu,
}: Readonly<{
children: React.ReactNode;
changeMenu: (path: string) => void;
}>) {
const { getMenuAuthrts } = useWrStore((state) => state);
return (
<BaseLayout
handleMenuClick={(e: MenuItem) => {
getMenuAuthrts(e.menuCd);
changeMenu(e.urlPath);
}}
>
<MainDiv>{children}</MainDiv>
</BaseLayout>
);
}
+21 -14
View File
@@ -1,11 +1,11 @@
'use client'
import { BaseLayout } from "@common/components";
"use client";
import "./globals.css";
import { StoreProvider } from "./store";
import { MainDiv } from "@common/business_components";
import koBase from '../public/locales/ko/message.json';
import { StoreProvider} from "./store";
import koBase from "../public/locales/ko/message.json";
import i18next from "i18next";
import { I18nextProvider } from "react-i18next";
import Base from "./base";
import { useRouter } from "next/navigation"; // ✅ App Router 전용
export default function RootLayout({
children,
@@ -13,28 +13,35 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
i18next.init({
lng: 'ko',
fallbackLng: 'ko',
lng: "ko",
fallbackLng: "ko",
resources: {
ko: {
base: koBase,
},
}
},
});
const router = useRouter();
const changeMenu = (path: string) => {
router.push(path);
};
return (
<html lang="en">
<body>
<I18nextProvider i18n={i18next}>
<StoreProvider>
<BaseLayout>
<MainDiv>
{children}
</MainDiv>
</BaseLayout>
<Base
changeMenu={changeMenu}
>
{children}
</Base>
</StoreProvider>
</I18nextProvider>
</body>
</html >
</html>
);
}
-5
View File
@@ -146,11 +146,6 @@ export default function Home() {
중수도시설통계
</Button>
</div>
<div className="col-span-2">
<Button className="w-full" onClick={() => {router.push('/stats/matStat')}}>
물재이용사례 관리
</Button>
</div>
</div>
</div>
@@ -316,8 +316,8 @@ export default function PublicReuseFaciltyInsert() {
</div>
</div>
<div className="grid grid-cols-6 gap-4 h-full">
<div className="col-span-4 h-full min-h-0">
<div className="grid grid-cols-8 gap-4 h-full">
<div className="col-span-5 h-full min-h-0">
<ListDiv className="min-h-0">
<ScrollArea className="h-[60vh]">
{" "}
@@ -335,24 +335,26 @@ export default function PublicReuseFaciltyInsert() {
</ScrollArea>
</ListDiv>
</div>
<ListDiv className="col-span-2 pr-6 ">
<ListDiv className="col-span-3 pr-6 ">
{formWatch && formWatch[0]?.pbnstRuseFcltId ? (
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
<TabsList className="">
<TabsTrigger className="!text-xl" value="mng">
시설정보
</TabsTrigger>
<TabsTrigger className="!text-xl" value="buse">
차수별정보
</TabsTrigger>
<div className="flex justify-between items-center">
<TabsList className="">
<TabsTrigger className="!text-xl" value="mng">
시설정보
</TabsTrigger>
<TabsTrigger className="!text-xl" value="buse">
차수별정보
</TabsTrigger>
</TabsList>
<Button
size={"sm"}
onClick={form.handleSubmit(onSubmit, onInvalid)}
className="!justify-end" // 저장 버튼 위치 조정
className="mr-5 mt-2"
>
저장
</Button>
</TabsList>
</div>
<ScrollArea className="h-[60vh]">
<TabsContent className="max-h-full" value="mng">
<PbnstMngForm
@@ -375,6 +377,7 @@ export default function PublicReuseFaciltyInsert() {
indexBiz={indexBiz}
/>
</TabsContent>
</ScrollArea>
</Tabs>
) : (
@@ -119,6 +119,9 @@ export default function PbnstSttn() {
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightClassName="ml-auto mr-6 flex items-center space-x-1"
leftClassName="flex gap-5 w-9/12 m-4"
leftSelectClassName="w-1/4"
rightChildren={
<Button
className={btnClass}
@@ -141,11 +144,11 @@ export default function PbnstSttn() {
setSearchYear(String(val))
}
/>
<Label className="w-64 mt-2 mx-4 text-xl text-gray-600">
{"하수처리시설명 "}
<Label className="w-full mt-2 ml-4 text-xl text-gray-600">
{"하수처리시설명"}
</Label>
<SearchInput
className={"text-2xl w-full ㅍ"}
className={"text-2xl w-full"}
label=""
textValue={pbnRuseNm || ""}
setText={(e) => {
@@ -313,7 +313,7 @@ export default function PrfmncPrfmncReg() {
<ScrollArea className="h-[60vh]">
<div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m3) 등록결과"}
{"하수처리수재이용 실적(m³) 등록결과"}
</h3>
</div>
<Table variant="secondary">
@@ -5,13 +5,15 @@ import { btnClass } from "@/app/store/common/code";
import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType, type PrfType } from "@/app/store/prfmncReg/pbnstPrfmncReg/type";
import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel";
import { excelDownload, yearOptions } from "@/components/lib/func/commom";
import { InputTableBody } from "@/components/lib/func/TableData";
import SearchInputText from "@/components/ui/searchInput/searchInput";
import { CHART_FORM, ContentsDiv, MainChart, SearchBaseForm, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div";
import { Label } from "@common/components/ui";
import { Label, Table, TableBody, TableHeader } from "@common/components/ui";
import { useCallback, useEffect, useRef, useState } from "react";
import toast, { Toaster } from "react-hot-toast";
import { useTranslation } from "react-i18next";
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead";
export default function PbnstPrfmncSttn() {
const {
@@ -88,11 +90,11 @@ export default function PbnstPrfmncSttn() {
const prfTableData = (prfList: PrfType[], year: string) => {
const inUsageData = structuredClone(initValInUsage).map(row => ({
...row
// 구분: "장내용수",
// 구분: "장내용수",
}));
const outUsageData = structuredClone(initValOutUsage).map(row => ({
...row
// 구분: "장외용수",
// 구분: "장외용수",
}));
const inSubtotal = { ...structuredClone(subTotalObj), 구분: "장내용수" };
const outSubtotal = { ...structuredClone(subTotalObj), 구분: "장외용수" };
@@ -505,7 +507,7 @@ export default function PbnstPrfmncSttn() {
useEffect(() => {
if (pbnRuseNm.length > 1)
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear,[]);
pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear, []);
}, [pbnRuseNm]);
const cellClick = (index: number | undefined, headId: string) => {
@@ -528,19 +530,28 @@ export default function PbnstPrfmncSttn() {
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={undefined}
rightClassName="ml-auto mr-6 flex items-center space-x-1"
leftClassName="flex gap-5 w-9/12 m-4"
leftSelectClassName="w-1/6"
leftChildren={<div className="col-span-5">
<div className="flex flex-row">
<div className="flex flex-row items-center">
<Label className="text-xl text-gray-600">하수 재이용년도</Label>
{/* <div className="flex flex-row items-center"> */}
<div className="flex flex-row items-center gap-x-4 flex-nowrap">
{/* <Label className="w-full text-xl text-gray-600"> */}
<Label className="flex-none whitespace-nowrap text-xl text-gray-600">
하수 재이용년도</Label>
<SelectBox
className="h-full text-2xl"
// className="w-full h-full text-2xl mx-4"
className="flex-none w-32 h-full text-2xl"
label=""
selectClass={""}
selectArray={yearOptions}
value={fromDate}
onSelectValue={(val: string | number) => setFromDate(String(val))} />
<span> ~</span>
<SelectBox
className="h-full text-2xl"
// className="w-full h-full text-2xl mx-4"
className="flex-none w-32 h-full text-2xl mr-4"
label=""
selectClass={""}
selectArray={yearOptions}
@@ -554,7 +565,7 @@ export default function PbnstPrfmncSttn() {
setPbnRuseNm(searchNm || "");
}}
setRtnData={/*function (rtnData: any[]): void {setbdstTable(rtnData);}*/
()=>{}
() => { }
}
searchList={pbnstSttn.pbnstSearchData || []}
></SearchInputText>
@@ -575,7 +586,7 @@ export default function PbnstPrfmncSttn() {
if (fromNum > toNum) {
toast.error("시작년도가 종료년도 이후로 설정할 수 없습니다.");
} else {
if (toNum - fromNum > 5) {
if (toNum - fromNum > 4) {
toast.error("최대 5년까지 선택 가능합니다.");
} else {
tableHeadMaker(fromNum, toNum);
@@ -594,7 +605,7 @@ export default function PbnstPrfmncSttn() {
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
headName={undefined}
tableData={bdstTable || []}
headlist={pbnstPrfHeadList}
pageSize={20}
@@ -602,8 +613,7 @@ export default function PbnstPrfmncSttn() {
cellClick={(index: number | undefined, headId: string) => {
cellClick(index ?? undefined, headId);
}}
onPageChange={() => { }
}
onPageChange={() => { }}
index={0}
/>
@@ -611,47 +621,47 @@ export default function PbnstPrfmncSttn() {
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">하수재이용실적 상세현황</h3>
<SelectBox
className="h-full w-1/12 text-2xl"
className="h-full w-1/12 text-2xl mt-2"
label=""
selectClass={""}
selectArray={selectYearList}
value={year}
onSelectValue={(val: string | number) => setYear(String(val))} />
<h1 className="">장내·외 용도별 하수재이용실적 현황(계)</h1>
<h1 className="my-2">장내·외 용도별 하수재이용실적 현황(계)</h1>
<div className="flex">
<div className="w-1/3">
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적"} chartForm={CHART_FORM.DN} />
<MainChart chartConfig={chartConfig} chartData={chartData} chartTitle={"장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DN} />
</div>
<div className="w-1/3">
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적"} chartForm={CHART_FORM.DN} />
<MainChart chartConfig={dnInChartConfig} chartData={dnInUsage} chartTitle={"장내용수 실적(m³)"} chartForm={CHART_FORM.DN} />
</div>
<div className="w-1/3">
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적"} chartForm={CHART_FORM.DN} />
<MainChart chartConfig={dnOutChartConfig} chartData={dnOutUsage} chartTitle={"장외용수 실적(m³)"} chartForm={CHART_FORM.DN} />
</div>
</div>
<h1 className="">장내·외 월별 하수재이용실적 현황</h1>
<div className="flex">
<div className="w-1/3">
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
<MainChart chartConfig={barChartConfig} chartData={barData} chartTitle={"월별 장내·외 용수 총 실적(m³)"} chartForm={CHART_FORM.DOUBLEBAR} showLegend={true} />
</div>
<div className="w-1/3">
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적"} chartForm={CHART_FORM.LINE} />
<MainChart chartConfig={lnInChartConfig} chartData={inLineData} chartTitle={"월별 장내 용수 실적(m³)"} chartForm={CHART_FORM.LINE} />
</div>
<div className="w-1/3">
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적"} chartForm={CHART_FORM.LINE} />
<MainChart chartConfig={lnOutChartConfig} chartData={outLineData} chartTitle={"월별 장외 용수 총 실적(m³)"} chartForm={CHART_FORM.LINE} />
</div>
</div>
<h1 className="">하수재이용실적 현황</h1>
<ListDiv className="col-span-8 pr-6 ">
{/* <ScrollArea className="h-[60vh]"> */}
{/* <div className="card-header">
<h1 className="">하수재이용실적 현황 (단위: m³)</h1>
{/* <ListDiv className="col-span-8 pr-6 "> */}
{/* <ScrollArea className="h-[60vh]"> */}
{/* <div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m3) 등록결과"}
{"하수처리수재이용 실적(m³) 등록결과"}
</h3>
</div> */}
<UiTable
{/* <UiTable
headName={undefined}
tableData={prfData || []}
headlist={monthHeadList}
@@ -659,30 +669,31 @@ export default function PbnstPrfmncSttn() {
total={0}
cellClick={undefined}
onPageChange={()=>{}}>
</UiTable>
</UiTable> */}
{/* <ListDiv className="col-span-8 pr-6 ">
<ScrollArea className="h-[60vh]">
<div className="card-header">
<ListDiv className="col-span-8 pr-6 ">
<ScrollArea className={prfData && prfData.length > 0 ? "h-[60vh]" : ""}>
{/* <div className="card-header">
<h3 className="text-2xl font-medium text-label">
{"하수처리수재이용 실적(m3) 등록결과"}
{"하수재이용실적 현황 (단위: m³)"}
</h3>
</div>
</div> */}
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(monthHeadList, [])}
</TableHeader>
<TableBody>
{InputTableBody(prfData ?? [], monthHeadList, setPrfData)}
</TableBody>
</Table>
</ScrollArea>
</ListDiv> */}
{/* </ScrollArea> */}
<Table variant="secondary">
<TableHeader className="font-bold">
{headMakeprfmnc(monthHeadList, [])}
</TableHeader>
<TableBody>
{/* {InputTableBody(prfData ?? [], monthHeadList, setPrfData)} */}
{InputTableBody(prfData ?? [], monthHeadList, setPrfData, false)}
</TableBody>
</Table>
</ScrollArea>
</ListDiv>
{/* </ScrollArea> */}
</ListDiv>
{/* </ListDiv> */}
</div>
</div>
</ContentsDiv>
+75
View File
@@ -0,0 +1,75 @@
import { getFetch, getFetchWithCount } from "@/components/lib/api";
import toast from "react-hot-toast";
export const getMenuAuthrts = async (menuCd: number) => {
const response = await getFetch(
"LOCAL",
`/cms-service/api/v1/menu-authrts/pageinfo/${menuCd}`
);
authStateExport.auth = {
mngAuthrtYn: response[0].mngAuthrtYn,
inqAuthrtYn: response[0].mngAuthrtYn,
regAuthrtYn: response[0].mngAuthrtYn,
mdfcnAuthrtYn: response[0].mngAuthrtYn,
delAuthrtYn: response[0].mngAuthrtYn,
};
};
export type authState = {
auth: {
mngAuthrtYn: string;
inqAuthrtYn: string;
regAuthrtYn: string;
mdfcnAuthrtYn: string;
delAuthrtYn: string;
};
};
export type authType = authState & authActions;
export const authStateExport: authState = {
auth: {
mngAuthrtYn: "Y",
inqAuthrtYn: "Y",
regAuthrtYn: "Y",
mdfcnAuthrtYn: "Y",
delAuthrtYn: "Y",
},
};
export type authActions = {
getMenuAuthrts: (menuCd: number) => void;
};
export const authActionsExport: (set: any) => authActions = (set: any) => {
return {
getMenuAuthrts: async (menuCd: number) => {
try{
const response = await getFetchWithCount( 'LOCAL',
`/cms-service/api/v1/menu-authrts/pageinfo/${menuCd}`
);
set((state: authState) => {
return {
...state,
auth: {
mngAuthrtYn: response[0].mngAuthrtYn,
inqAuthrtYn: response[0].mngAuthrtYn,
regAuthrtYn: response[0].mngAuthrtYn,
mdfcnAuthrtYn: response[0].mngAuthrtYn,
delAuthrtYn: response[0].mngAuthrtYn,
},
};
});
}catch(e){
toast.error('권한 정보를 가져오는 중 오류가 발생했습니다. 관리자에게 문의하세요.');
console.error('Error fetching menu authorities:', e);
}
},
};
};
+32
View File
@@ -0,0 +1,32 @@
import { cmsPostFectch } from "@/components/lib/api";
export const isLogin = async () => {
const headers = {
accept: "application/json",
"Content-Type": "application/json",
"X-Site-Id": "WR",
"Access-Control-Expose-Headers" : ["Authorization","refresh-token","token-id"]
};
const param = { userId: "tuser10003", password: "test1234!" };
await cmsPostFectch("/user-service/login",param,headers);
};
// export type LoginState = {
// login: {} as any;
// };
// export type loginType = LoginState & LoginActions;
// export const loginState: LoginState = {
// login: {},
// };
// export type LoginActions = {
// isLogin: () => void;
// };
// export const loginActionExport: (set: any) => LoginActions = (set: any) => {
// return {
// isLogin: async () => {},
// };
// };
@@ -0,0 +1,19 @@
export interface MenuItem {
menuCd: number;
menuKornNm: string;
menuEngNm: string;
parentId: number | null;
sortSeq: number;
iconNm?: string;
children: MenuItem[] | null;
levelNo: number;
urlPath: string;
menuLnkgTypeCd: string;
menuLnkgSn: number;
menuPath: string;
qrcd: string;
useYn: string;
otptYn: string;
newWndwYn: string;
requiredUrlPath: boolean;
}
+7 -8
View File
@@ -35,13 +35,12 @@ export const drgtStateExport: drgtState = {
}
}
const initFetch = async (fromDate: string, toDate: string, sido:string[]) => {
console.log("sido",sido)
const initFetch = async (fromDate: string, toDate: string, sido: string[]) => {
const drgtData = await postFectch(
`/il/getDataCount/${fromDate}/${toDate}`,
sido,
fetchType.WR
);
`/il/getDataCount/${fromDate}/${toDate}`,
sido,
fetchType.WR
);
//주의, 관심, 정상 추출
const statusData = Array.from(
@@ -99,10 +98,10 @@ export const drgtActionsExport: (set: any) => drgtActions = (
const year = today.getFullYear();
const month = String(today.getMonth() + 1).padStart(2, '0');
const formatted = `${year}${month}`;
const fromDate = formatted;
const toDate = formatted;
//FIXME: 페이지 처음 로딩될때 데이터 보려고 6월로 박아놓음 이거 fromDate로 고치기
const drgtRes = await initFetch("202506", toDate, []);
const drgtRes = await initFetch(fromDate, toDate, []);
set((state: drgtState) => {
return {
...state,
@@ -1,6 +1,11 @@
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { SelectDataType } from "@common/business_components";
import type { rainChkZodType } from ".";
import {
isInvalidDate,
isInvalidNumber,
parseRawValue,
} from "@/components/lib/func/excelFunc";
export const useTypes = [
"조경용수",
"청소화장실용수",
@@ -28,7 +33,7 @@ export type Buildingtype = {
export const buildingToExcelType = (
buildings: Buildingtype[],
sidoCode: SelectDataType[],
sggCdoe: SelectDataType[],
sggCdoe: SelectDataType[]
) => {
const excelData: string[][] = [];
buildings.forEach((building) => {
@@ -37,8 +42,8 @@ export const buildingToExcelType = (
building.bdstInfoSn.toString(),
sidoCode.find((sido) => sido.val === building.ctpvCd.toString())
?.text || "",
sggCdoe.find((sido) => sido.val === building.sggCd.toString())
?.text || "",
sggCdoe.find((sido) => sido.val === building.sggCd.toString())?.text ||
"",
building.daddr,
building.bdstNm,
"",
@@ -80,121 +85,125 @@ export const buildingToExcelType = (
});
});
return excelData;
};
export const excelToRainChkData = (excelData: any, year: string) => {
// const errors: string[] = [];
const rainChkgdData: rainChkZodType[] = excelData.map((item: any) => {
if (item["점검일"] !== undefined) {
const checkYmd = item["점검일"].replace(/\./g, "")
let vltnDt = item["과태료 부과일(위반일)"]
if (vltnDt !== undefined) {
vltnDt = vltnDt ? vltnDt.replace(/\./g, "") : "";
}
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
let month = `${i + 1}`;
const splyData = item[`대체_${month}월`];
const ruseData = item[`빗물_${month}월`];
if (month.length < 2) month = "0" + month;
return {
utztnUsgCd: item["이용용도"],
ym: year + month,
chckYmd: checkYmd,
splyUswtrUtztnQnt: Number(splyData) || 0,
ruseFcltUtztnQnt: Number(ruseData) || 0,
flg: "RNB",
};
});
return {
bdstNm:item["시설명"] ?? "",
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
spwtPositn: item["유량측정방법"] ?? "",
rgtr: TEST_UUID,
oilqMeasMthd: item["운영관리형태"] ?? "",
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
operMngCd: item["유량측정방법"] ?? "",
guideDetails: makeGuidDetail,
rainyDetails: [
{
utztnUsgCd: item["이용용도"] ?? "",
ph: Number(item["PH"] || 0),
trbt: Number(item["탁도"] || 0),
grssClfg: Number(item["총대장균군수"] || 0),
etc: item["기타"] || "", // 필드 누락 방지
vltnDt: vltnDt || "-",
vltnMttr: item["위반사항"] || "-",
levyAmt: Number(item["과태료부과금액(천원)"] || 0),
// const errors: string[] = [];
const issues: string[] = [];
const rainChkgdData: rainChkZodType[] = excelData
.map((item: any) => {
if (item["점검일"] !== undefined) {
const checkYmd = item["점검일"].replace(/\./g, "");
let vltnDt = item["과태료 부과일(위반일)"];
if (vltnDt !== undefined) {
vltnDt = vltnDt ? vltnDt.replace(/\./g, "") : "";
}
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
let month = `${i + 1}`;
const splyData = parseRawValue(item[`대체_${month}월`]);
const ruseData = parseRawValue(item[`빗물_${month}월`]);
if (month.length < 2) month = "0" + month;
return {
utztnUsgCd: item["이용용도"],
ym: year + month,
chckYmd: checkYmd,
splyUswtrUtztnQnt: splyData,
ruseFcltUtztnQnt: ruseData,
flg: "RNB",
};
});
if (checkYmd.length > 7) {
return {
bdstNm: item["시설명"] ?? "",
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
spwtPositn: item["유량측정방법"] ?? "",
rgtr: TEST_UUID,
},
],
};
}
}).filter((el: any) => el !== undefined);
oilqMeasMthd: item["운영관리형태"] ?? "",
anlOperCst: parseRawValue(item["연간운영비(원/년)"]),
operMngCd: item["유량측정방법"] ?? "",
guideDetails: makeGuidDetail,
rainyDetails: [
{
utztnUsgCd: item["이용용도"],
trbt: parseRawValue(item["탁도"]),
grssClfg: parseRawValue(item["총대장균군수"]),
etc: item["기타"] || "", // 필드 누락 방지
vltnDt: vltnDt || "-",
vltnMttr: item["위반사항"] || "-",
levyAmt: parseRawValue(item["과태료부과금액(천원)"]),
rgtr: TEST_UUID,
},
],
};
}
}
})
.filter((el: any) => el !== undefined);
return rainChkgdData;
// // ✨ 오류 검사 - 가공된 데이터 기준
// const isInvalidNumber = (val: any) =>
// val !== undefined && val !== null && val !== "" && isNaN(Number(val));
if (rainChkgdData.length > 0) {
rainChkgdData.forEach((rain: any) => {
const defaultMessage = `[시설명: ${rain.bdstNm}, 점검일: ${rain.chckYmd}, 이용용도: ${rain.guideDetails[0]?.utztnUsgCd}] 항목에서 `;
// const isInvalidDate = (val: any) =>
// typeof val === "string" && !/^\d{4}\.\d{2}\.\d{2}$/.test(val.trim());
if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
issues.push(
defaultMessage + `점검일: 날짜 형식 아님 (${rain.chckYmd})`
);
}
if (rain.anlOperCst.length > 2 && isInvalidNumber(rain.anlOperCst)) {
issues.push(
defaultMessage +
` 연간운영비(원/년): 숫자 형식 아님 (${rain.anlOperCst})`
);
}
rain.rainyDetails?.forEach((key) => {
if (key.ph?.length > 1 && isInvalidNumber(key.ph)) {
issues.push(defaultMessage + `PH: 숫자 형식 아님 (${key.ph})`);
}
if (key.trbt?.length > 1 && isInvalidNumber(key.trbt)) {
issues.push(defaultMessage + `탁도: 숫자 형식 아님 (${key.trbt})`);
}
if (key.grssClfg?.length > 1 && isInvalidNumber(key.grssClfg)) {
issues.push(
defaultMessage + `총대장균군수: 숫자 형식 아님 (${key.grssClfg})`
);
}
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
issues.push(
defaultMessage +
`과태료부과금액(천원): 숫자 형식 아님 (${key.levyAmt})`
);
}
if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) {
issues.push(
defaultMessage +
`과태료 부과일(위반일): 날짜 형식 아님 (${key.vltnDt})`
);
}
});
rain.guideDetails?.forEach((guide) => {
const mm = guide.ym.substring(4);
if (isInvalidNumber(guide.splyUswtrUtztnQnt)) {
issues.push(
defaultMessage +
`대체_${mm}: 숫자 형식 아님 (${guide.splyUswtrUtztnQnt})`
);
}
if (isInvalidNumber(guide.ruseFcltUtztnQnt)) {
issues.push(
defaultMessage +
`빗물_${mm}: 숫자 형식 아님 (${guide.ruseFcltUtztnQnt})`
);
}
});
});
}
// const buildErrorMessage = (item: any, issues: string[]): string => {
// const 시설명 = item.bdstNm ?? "";
// const 점검일 = item.chckYmd ?? "";
// const 이용용도 = item.utztnUsgCd ?? "";
// return `시설명: ${시설명}, 점검일: ${점검일}, 이용용도: ${이용용도} (=> ${issues.join(", ")})`;
// };
if (issues.length > 0) {
return { rainChkgdData: [], issues };
}
// if (rainChkgdData.length > 0) {
// rainChkgdData.forEach((rain: any) => {
// const item = rain.__origin; // 원본 item
// const issues: string[] = [];
// if (rain.chckYmd && isInvalidDate(rain.chckYmd)) {
// issues.push(`점검일: 날짜 형식 아님 (${rain.chckYmd})`);
// }
// if (rain.vltnDt && isInvalidDate(rain.vltnDt)) {
// issues.push(`과태료 부과일(위반일): 날짜 형식 아님 (${rain.vltnDt})`);
// }
// // [
// // "연간운영비(원/년)", "PH", "탁도", "총대장균군수", "과태료부과금액(천원)"
// // ].forEach((key) => {
// // if (isInvalidNumber(item[key])) {
// // issues.push(`${key}: 숫자 형식 아님 (${item[key]})`);
// // }
// // }
// // );
// for (let i = 1; i <= 12; i++) {
// const month = `${i}월`;
// if (isInvalidNumber(item[`대체_${month}`])) {
// issues.push(`대체_${month}: 숫자 형식 아님 (${item[`대체_${month}`]})`);
// }
// if (isInvalidNumber(item[`빗물_${month}`])) {
// issues.push(`빗물_${month}: 숫자 형식 아님 (${item[`빗물_${month}`]})`);
// }
// }
// if (issues.length > 0) {
// errors.push(buildErrorMessage(item, issues));
// }
// });
// }
// if (errors.length > 0) {
// return { rainChkgdData: [], errors };
// }
// return { rainChkgdData, errors: [] };
// return rainChkgdData;
return { rainChkgdData, issues: [] };
};
@@ -36,6 +36,7 @@ export const rainChkZod = z.object({
cityText:z.string().nullish(),
sggText:z.string().nullish(),
prcsCpct: z.number().nullable(),
anlOperCst:z.number().nullish(),
spwtPositn: z.string().nullable(),
regDt: z.string().nullable(),
rgtr: z.string().nullable(),
@@ -150,7 +151,7 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
{
id: "ph",
title: "PH",
title: "수소이온농도(PH)",
upName: "useQuilty",
upSequnce: 1,
type: "number",
@@ -158,7 +159,7 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
},
{
id: "trbt",
title: "탁도",
title: "탁도(NTU)",
upName: "useQuilty",
upSequnce: 2,
type: "number",
@@ -166,7 +167,7 @@ export const rainChkgdnHeadListExport: TableUpperProps[] = [
},
{
id: "grssClfg",
title: "총대장균군수",
title: "총대장균군수(개/mg)",
upName: "useQuilty",
upSequnce: 3,
type: "number",
@@ -84,6 +84,7 @@ type rainChkgdnActions = {
sggCd: string,
txt: string
) => void;
setRainChkLoading:(status:boolean) =>void
};
export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
@@ -375,6 +376,17 @@ export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
} catch (error) {
console.log(error);
}
},
},setRainChkLoading:(status:boolean) =>{
set((state: rainChkgdnState) => ({
...state,
rainChkgdn: {
...state.rainChkgdn,
isLoading: status,
},
}));
}
};
};
@@ -2,6 +2,11 @@ import type { SelectDataType } from "@common/business_components/ui";
import { useTypes, type Buildingtype } from "../rainChkgdn/excel";
import { TEST_UUID } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { rswtChkZodType } from ".";
import {
isInvalidDate,
isInvalidNumber,
parseRawValue,
} from "@/components/lib/func/excelFunc";
export const rswtMakeExcelSample = (
buildings: Buildingtype[],
@@ -125,17 +130,20 @@ export const rswtMakeExcelSample = (
return excelSite;
};
export const excelToRswtGuideData = (excelData: any, year: string) => {
const rainChkgdData: rswtChkZodType[] = excelData
export const excelToRswtGuideData = (
excelData: any,
year: string,
issues: string[]
) => {
const rswtChkgdData: rswtChkZodType[] = excelData
.map((item: any) => {
if (item["점검일"] !== undefined) {
const checkYmd = item["점검일"].replace(/\./g, "");
const checkYmd = item["점검일"].replace(/\./g, "")
const makeGuidDetail = Array.from({ length: 12 }, (_, i) => {
let month = `${i + 1}`;
const splyData = item[`대체수_${month}월`];
const rswtData = item[`중수_${month}월`];
const splyData = parseRawValue(item[`대체수_${month}월`]);
const rswtData = parseRawValue(item[`중수_${month}월`]);
if (month.length < 2) month = "0" + month;
return {
ym: year + month,
@@ -144,85 +152,91 @@ export const excelToRswtGuideData = (excelData: any, year: string) => {
ruseFcltUtztnQnt: rswtData !== "" ? rswtData : 0,
};
});
return {
bdstRuseFcltSn: Number(item["NO"]),
operMngCd: item["운영관리형태"],
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
prcsCpct: item["처리용량(m³)"],
spwtPositn: item["채수지점"],
chckYmd:checkYmd,
utztnUsgCd: item["이용용도"],
guideDetails: makeGuidDetail,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
};
if (checkYmd.length > 7) {
return {
bdstRuseFcltSn: Number(item["NO"]),
operMngCd: item["운영관리형태"],
anlOperCst: parseRawValue(item[`연간운영비(원/년)`]),
prcsCpct: parseRawValue(item[`처리용량(m³)`]),
spwtPositn: item["채수지점"],
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
guideDetails: makeGuidDetail,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
};
}
}
})
.filter((el: any) => el !== undefined);
return rainChkgdData;
if (rswtChkgdData.length > 0) {
rswtExcelDataCheck(rswtChkgdData,issues)
}
if (issues.length > 0) {
return { data: [], issues };
}
return { data:rswtChkgdData, issues: [] };
};
export const excelToRswtPolution = (excelData: any) => {
const rainChkgdData: rswtChkZodType[] = excelData
export const excelToRswtPolution = (excelData: any, issues: string[]) => {
const rswtChkgdData: rswtChkZodType[] = excelData
.map((item: any) => {
if (item["점검일"] !== undefined) {
const checkYmd = item["점검일"].replace(/\./g, "")
let vltnDt = item["과태료 부과일(위반일)"]
if (vltnDt !== undefined) {
vltnDt = vltnDt .replace(/\./g, "")
const checkYmd = item["점검일"].replace(/\./g, "");
let vltnDt = item["과태료 부과일(위반일)"];
if (vltnDt !== undefined) {
vltnDt = vltnDt.replace(/\./g, "");
}
const makePoluttion = Array.from({ length: 4 }, (_, i) => {
const quarter = `${i+1}`;
const grssClfgUswtr = item[`${quarter}분기_총대장균군수`];
const combResdch = item[`${quarter}분기_결합잔류염소`];
const trbt = item[`${quarter}분기_탁도`];
const bod = item[`${quarter}분기_BOD`];
const smll = item[`${quarter}분기_냄새`];
const crmty = item[`${quarter}분기_색도`];
const tph = item[`${quarter}분기_T-P`];
const tn = item[`${quarter}분기_T-N`];
const ph = item[`${quarter}분기_PH`];
const clIonQnt = item[`${quarter}분기_염화물`];
const quarter = `${i + 1}`;
const grssClfgUswtr = parseRawValue(
item[`${quarter}분기_총대장균군수`]
);
const combResdch = parseRawValue(item[`${quarter}분기_결합잔류염소`]);
const trbt = parseRawValue(item[`${quarter}분기_탁도`]);
const bod = parseRawValue(item[`${quarter}분기_BOD`]);
const smll = parseRawValue(item[`${quarter}분기_냄새`]);
const crmty = parseRawValue(item[`${quarter}분기_색도`]);
const tph = parseRawValue(item[`${quarter}분기_T-P`]);
const tn = parseRawValue(item[`${quarter}분기_T-N`]);
const ph = parseRawValue(item[`${quarter}분기_PH`]);
const clIonQnt = parseRawValue(item[`${quarter}분기_염화물`]);
return {
node: quarter,
chckYmd: checkYmd,
grssClfgUswtr: grssClfgUswtr !== "" ? grssClfgUswtr : 0,
combResdch: combResdch !== "" ? combResdch : 0,
trbt: trbt !== "" ? trbt : 0,
bod: bod !== "" ? bod : 0,
smll: smll !== "" ? smll : 0,
crmty: crmty !== "" ? crmty : 0,
tph: tph !== "" ? tph : 0,
tn: tn !== "" ? tn : 0,
ph: ph !== "" ? ph : 0,
clIonQnt: clIonQnt !== "" ? clIonQnt : 0,
grssClfgUswtr: grssClfgUswtr,
combResdch: combResdch,
trbt: trbt,
bod: bod,
smll: smll,
crmty: crmty,
tph: tph,
tn: tn,
ph: ph,
clIonQnt: clIonQnt,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
};
});
return {
bdstRuseFcltSn: Number(item["NO"]),
chckYmd: checkYmd,
utztnUsgCd: item["이용용도"],
operMngCd: item["운영관리형태"],
anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0,
prcsCpct: item["처리용량(m³)"],
spwtPositn: item["채수지점"],
rswtrPollutions: makePoluttion,
anlOperCst: parseRawValue(item["연간운영비(원/년)"]),
prcsCpct: parseRawValue(item["처리용량(m³)"]),
spwtPositn: item["채수지점"],
rswtrPollutions: makePoluttion,
rgtr: TEST_UUID,
mdfr: TEST_UUID,
rswtrDetails: [
{
{
utztnUsgCd: item["이용용도"],
vltnDt:vltnDt,
vltnDt: vltnDt,
vltnMttr: item["위반사항"],
levyAmt: Number(item["과태료 부과금액(천원)"]) ?? 0,
rgtr: TEST_UUID,
@@ -233,5 +247,118 @@ export const excelToRswtPolution = (excelData: any) => {
}
})
.filter((el: any) => el !== undefined);
return rainChkgdData;
if (rswtChkgdData.length > 0) {
rswtExcelDataCheck(rswtChkgdData,issues)
}
if (issues.length > 0) {
return { data: [], issues };
}
return { data:rswtChkgdData, issues: [] };
};
const rswtExcelDataCheck=(rswtChkgdData:rswtChkZodType[], issues:string[]) =>{
rswtChkgdData.forEach((rswt: any) => {
const defaultMessage = `*중수도 수질 [NO: ${rswt.bdstRuseFcltSn}, 점검일: ${rswt.chckYmd}, 이용용도: ${rswt.utztnUsgCd}] 항목에서 `;
if (rswt.chckYmd && isInvalidDate(rswt.chckYmd)) {
issues.push(
defaultMessage + `점검일: 날짜 형식 아님 (${rswt.chckYmd})`
);
}
if (rswt.anlOperCst.length > 2 && isInvalidNumber(rswt.anlOperCst)) {
issues.push(
defaultMessage +
` 연간운영비(원/년): 숫자 형식 아님 (${rswt.anlOperCst})`
);
}
if (rswt.prcsCpct.length > 2 && isInvalidNumber(rswt.prcsCpct)) {
issues.push(
defaultMessage + ` 처리용량(m³): 숫자 형식 아님 (${rswt.prcsCpct})`
);
}
if (rswt?.rswtrPollutions && rswt?.rswtrPollutions.length > 0) {
rswt.rswtrPollutions.forEach((pol) => {
if (isInvalidNumber(pol.grssClfgUswtr)) {
issues.push(
defaultMessage +
`${pol.node}분기_총대장균군수: 숫자 형식 아님 (${pol.grssClfgUswtr})`
);
}
if (isInvalidNumber(pol.combResdch)) {
issues.push(
defaultMessage +
`${pol.node}분기_결합잔류염소: 숫자 형식 아님 (${pol.combResdch})`
);
}
if (isInvalidNumber(pol.trbt)) {
issues.push(
defaultMessage +
`${pol.node}분기_탁도: 숫자 형식 아님 (${pol.trbt})`
);
}
if (isInvalidNumber(pol.bod)) {
issues.push(
defaultMessage +
`${pol.node}분기_BOD: 숫자 형식 아님 (${pol.bod})`
);
}
if (isInvalidNumber(pol.smll)) {
issues.push(
defaultMessage +
`${pol.node}분기_냄새: 숫자 형식 아님 (${pol.smll})`
);
}
if (isInvalidNumber(pol.crmty)) {
issues.push(
defaultMessage +
`${pol.node}분기_색도: 숫자 형식 아님 (${pol.crmty})`
);
}
if (isInvalidNumber(pol.tph)) {
issues.push(
defaultMessage +
`${pol.node}분기_T-P: 숫자 형식 아님 (${pol.tph})`
);
}
if (isInvalidNumber(pol.tn)) {
issues.push(
defaultMessage + `${pol.node}분기_T-N: 숫자 형식 아님 (${pol.tn})`
);
}
if (isInvalidNumber(pol.ph)) {
issues.push(
defaultMessage + `${pol.node}분기_PH: 숫자 형식 아님 (${pol.ph})`
);
if (isInvalidNumber(pol.clIonQnt)) {
issues.push(
defaultMessage +
`${pol.node}분기_PH: 숫자 형식 아님 (${pol.clIonQnt})`
);
}
}
});
}
if (rswt?.rswtrDetails && rswt?.rswtrDetails.length > 0) {
rswt?.rswtrDetails.forEach((key) => {
if (key.levyAmt?.length > 1 && isInvalidNumber(key.levyAmt)) {
issues.push(
defaultMessage +
`과태료부과금액(천원): 숫자 형식 아님 (${key.levyAmt})`
);
}
if (key.vltnDt?.length > 2 && isInvalidDate(key.vltnDt)) {
issues.push(
defaultMessage +
`과태료 부과일(위반일): 날짜 형식 아님 (${key.vltnDt})`
);
}
});
}
})
}
@@ -149,26 +149,26 @@ export const rswtChkHeadListExport: TableUpperProps[] = [
{
id: "grssClfgUswtr",
title: "총대장균군수",
title: "총대장균군수(개/mg)",
upName: "useQuilty",
upSequnce: 1,
type: "number"
},
{
id: "combResdch",
title: "결합잔류염소",
title: "결합잔류염소(mh/L)",
upName: "useQuilty",
upSequnce: 2,
type: "number"
},
{ id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 3 ,type: "number"},
{ id: "bod", title: "BOD", upName: "useQuilty", upSequnce: 4 ,type: "number"},
{ id: "trbt", title: "탁도(NTU)", upName: "useQuilty", upSequnce: 3 ,type: "number"},
{ id: "bod", title: "BOD(mg/L)", upName: "useQuilty", upSequnce: 4 ,type: "number"},
{ id: "smll", title: "냄새", upName: "useQuilty", upSequnce: 5 ,type: "number"},
{ id: "crmty", title: "색도", upName: "useQuilty", upSequnce: 6 ,type: "number"},
{ id: "tn", title: "T-N", upName: "useQuilty", upSequnce: 7 ,type: "number"},
{ id: "tph", title: "T-P", upName: "useQuilty", upSequnce: 8 ,type: "number"},
{ id: "ph", title: "PH", upName: "useQuilty", upSequnce: 9,type: "number" },
{ id: "clIonQnt", title: "염화물", upName: "useQuilty", upSequnce: 10 ,type: "number"},
{ id: "crmty", title: "색도(도)", upName: "useQuilty", upSequnce: 6 ,type: "number"},
{ id: "tn", title: "총질소(T-N)(mg/L)", upName: "useQuilty", upSequnce: 7 ,type: "number"},
{ id: "tph", title: "총인(T-P)(mg/L)", upName: "useQuilty", upSequnce: 8 ,type: "number"},
{ id: "ph", title: "수소이온농도(PH)", upName: "useQuilty", upSequnce: 9,type: "number" },
{ id: "clIonQnt", title: "염화물(mg/L)", upName: "useQuilty", upSequnce: 10 ,type: "number"},
{
id: "vltnDt",
@@ -15,21 +15,21 @@ export const rainChkgdnHeadSttnExport: TableUpperProps[] = [
{ id: "totalRuseFcltUtztnQnt", title: "연간빗물이용량(m³)" },
{
id: "ph",
title: "PH",
title: "수소이온농도(PH)",
upName: "useQuilty",
upSequnce: 1,
type: "number",
},
{
id: "trbt",
title: "탁도",
title: "탁도(NTU)",
upName: "useQuilty",
upSequnce: 2,
type: "number",
},
{
id: "grssClfg",
title: "총대장균군수",
title: "총대장균군수(개/mg)",
upName: "useQuilty",
upSequnce: 3,
type: "number",
@@ -16,28 +16,28 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
{
id: "grssClfgUswtr",
title: "총대장균군수",
title: "총대장균군수(개/mg)",
upName: "useQuilty",
upSequnce: 1,
type: "number",
},
{
id: "combResdch",
title: "결합잔류염소",
title: "결합잔류염소(mh/L)",
upName: "useQuilty",
upSequnce: 2,
type: "number",
},
{
id: "trbt",
title: "탁도",
title: "탁도(NTU)",
upName: "useQuilty",
upSequnce: 3,
type: "number",
},
{
id: "bod",
title: "BOD",
title: "BOD(mg/L)",
upName: "useQuilty",
upSequnce: 4,
type: "number",
@@ -51,23 +51,23 @@ export const rswtChkSttnHeadListExport: TableUpperProps[] = [
},
{
id: "crmty",
title: "색도",
title: "색도(도)",
upName: "useQuilty",
upSequnce: 6,
type: "number",
},
{ id: "tn", title: "T-N", upName: "useQuilty", upSequnce: 7, type: "number" },
{ id: "tn", title: "총질소(T-N)(mg/L)", upName: "useQuilty", upSequnce: 7, type: "number" },
{
id: "tph",
title: "T-P",
title: "총인(T-P)(mg/L)",
upName: "useQuilty",
upSequnce: 8,
type: "number",
},
{ id: "ph", title: "PH", upName: "useQuilty", upSequnce: 9, type: "number" },
{ id: "ph", title: "수소이온농도(PH)", upName: "useQuilty", upSequnce: 9, type: "number" },
{
id: "clIonQnt",
title: "염화물",
title: "염화물(mg/L)",
upName: "useQuilty",
upSequnce: 10,
type: "number",
@@ -43,17 +43,17 @@ export const pbnstYearHeadListExport: TableUpperProps[] = [
},
{
id: "total",
title: "계",
title: "계(m³)",
row: 1
},
{
id: "inUsage",
title: "장내용수",
title: "장내용수(m³)",
row: 1
},
{
id: "outUsage",
title: "장외용수",
title: "장외용수(m³)",
row: 1
},
]
@@ -79,6 +79,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
if (yearHead) {
yearHead.forEach((item: { id?: string; }) => {
if (item.id) {
if(item.id === "year") {item.id = ""; return;}
item.id = i + item.id;
}
})
@@ -202,7 +203,6 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions
resData.push({ ...acc, ...data })
}
})
console.log("resData", resData)
return set((state: pbnstPrfmncSttnState) => ({
...state,
pbnstPrfmncSttn: {
@@ -11,14 +11,14 @@ import type { TableUpperProps } from "@/app/store/common/type/header";
{ id: "bdstNm", title: "시설명" },
{ id: "daddr", title: "위치" },
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
{ id: "archArea", title: "건축면적", },
{ id: "archArea", title: "건축면적(㎡)", },
];
const bdstChgHeadList: TableUpperProps[] = [
{ id: "bdstChgNm", title: "구분" },
{ id: "archChgPrmsnDt", title: "허가일" },
{ id: "archChgArea", title: "변경면적" },
{ id: "archChgArea", title: "변경면적(㎡)" },
];
@@ -6,5 +6,5 @@ export const htdTableHeadList: TableUpperProps[] = [
{ id: "bdstNm", title: "시설명" },
{ id: "daddr", title: "위치" },
{ id: "frstArchPrmsnDt", title: "준공년도" },
{ id: "archArea", title: "건축면적" },
{ id: "archArea", title: "건축면적(㎡)" },
];
@@ -42,17 +42,17 @@ const hdtflObjSchema = z.object({
utztnUsg: z
.string()
.min(1, { message: validationMessages.required("이용 용도") }),
grssClfg: z.number().default(0), // Measurements, 0 is fine as default
combResdch: z.number().default(0), // Measurements, 0 is fine as default
trbt: z.number().default(0), // Measurements, 0 is fine as default
bod: z.number().default(0), // Measurements, 0 is fine as default
smll: z.number().default(0), // Measurements, 0 is fine as default
crmty: z.number().default(0), // Measurements, 0 is fine as default
tn: z.number().default(0), // Measurements, 0 is fine as default
tph: z.number().default(0), // Measurements, 0 is fine as default
ph: z.number().default(0), // Measurements, 0 is fine as default
clIonQnt: z.number().default(0), // Measurements, 0 is fine as default
cdtnv: z.number().default(0), // Measurements, 0 is fine as default
grssClfg: z.number().default(0).nullish(), // Measurements, 0 is fine as default
combResdch: z.number().default(0).nullish(), // Measurements, 0 is fine as default
trbt: z.number().default(0).nullish(), // Measurements, 0 is fine as default
bod: z.number().default(0).nullish(), // Measurements, 0 is fine as default
smll:z.string().default('').nullish(), // Measurements, 0 is fine as default
crmty: z.number().default(0).nullish(), // Measurements, 0 is fine as default
tn: z.number().default(0).nullish(), // Measurements, 0 is fine as default
tph:z.number().default(0).nullish(),// Measurements, 0 is fine as default
ph: z.string().default('').nullish(), // Measurements, 0 is fine as default
clIonQnt: z.number().default(0).nullish(), // Measurements, 0 is fine as default
cdtnv: z.number().default(0).nullish(), // Measurements, 0 is fine as default
emsnExitTp: z.number()
.max(100, { message: "온도는 100이상이 될 수 없습니다." })
.default(0), // Changed max to 100 based on message, // Measurements, 0 is fine as default
@@ -1,3 +1,4 @@
import { numSize, txtSize } from "@/app/store/common/code/basicCode";
import type { TableUpperProps } from "@/app/store/common/type/header";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
@@ -14,8 +15,13 @@ export const pubFacHeadListExport: TableUpperProps[] = [
export const pbnstMngUpHeadListExport: TableUpperProps[] = [
{ id: "choose", title: "선택", type: "checkbox" },
{ id: "operMthd", title: "운영방식",type: "select", selectData: "ruseMngMtd" },
{ id: "rprtvBzenty", title: "대행업체", edit: true ,maxLength:10 },
{
id: "operMthd",
title: "운영방식",
type: "select",
selectData: "ruseMngMtd",
},
{ id: "rprtvBzenty", title: "대행업체", edit: true, maxLength: 10 },
{
id: "bgngDt",
title: "시작일",
@@ -47,7 +53,7 @@ export const pbnstDemandHeadListExport: TableUpperProps[] = [
export const pbnstOrgwtHeadListRxport: TableUpperProps[] = [
{ id: "ruseUtztnFcltNm", title: "하수처리장명" },
{ id: "orgwtWtritQnt", title: "원수취수량" , type:'number'},
{ id: "orgwtWtritQnt", title: "원수취수량", type: "number" },
{ id: "tmsYn", title: "하수처리량TMS 전후" },
{ id: "dschgFmYn", title: "하수처리장 방류 유량계 전·후​" },
{ id: "dtlPstnExpln", title: "상세위치", edit: true },
@@ -60,7 +66,6 @@ export const fcOrgwtsHeadListExport: TableUpperProps[] = [
{ id: "addr", title: "위치" },
];
export const pbnstMngNmExport: chHeadType[] = [
{ headNm: "upChangeRe", text: "운영대행기간", length: 2 },
];
@@ -69,65 +74,91 @@ export type formDetailType = {
id: string;
lable: string;
type?: string;
maxLenght?: number;
selectData?: string; // select box일 경우
option?:string
option?: string;
};
export const wasteWaterFcltINfo: formDetailType[] = [
{ id: "wwtEmsnFcltPrmsnYn", lable: "폐수배출물신고 허가여부", type: "select" , selectData: "yn"},
{ id: "tmsInstlYn", lable: "Tms설치여부", type: "select" , selectData: "yn" },
{ id: "pbnstDrngInflwExclYn", lable: "공공하수도유입제외 허가여부", type: "select" , selectData: "yn" },
{
id: "wwtEmsnFcltPrmsnYn",
lable: "폐수배출물신고 허가여부",
type: "select",
selectData: "yn",
},
{ id: "tmsInstlYn", lable: "Tms설치여부", type: "select", selectData: "yn" },
{
id: "pbnstDrngInflwExclYn",
lable: "공공하수도유입제외 허가여부",
type: "select",
selectData: "yn",
},
];
export const concentratedWaterInfo: formDetailType[] = [
{ id: "erctWtrOcrnCpct", lable: "눙축수 발생량(m³/일)", type: "number" },
{ id: "erctUswtrLinkSpt", lable: "눙축수연계지점" },
{ id: "erctUswtrFcltCpct", lable: "시설용량(m³/일)", type: "number" },
{ id: "erctUswtrPrcsMeth", lable: "눙축수처리방식", type : "select", selectData: "erctUswtrPrcsMeth" },
{ id: "erctUswtrPrcsMsrcCd", lable: "눙축수처리공법" },
{ id: "erctWtrOcrnCpct", lable: "눙축수 발생량(m³/일)", type: "number",maxLenght:numSize },
{ id: "erctUswtrLinkSpt", lable: "눙축수연계지점", maxLenght:txtSize },
{ id: "erctUswtrFcltCpct", lable: "시설용량(m³/일)", type: "number" ,maxLenght:numSize },
{
id: "erctUswtrPrcsMeth",
lable: "눙축수처리방식",
type: "select",
selectData: "erctUswtrPrcsMeth",
},
{ id: "erctUswtrPrcsMsrcCd", lable: "눙축수처리공법" ,maxLenght:txtSize},
];
export const ruseFcltinfo: formDetailType[] = [
{ id: "rprcsFcltCpct", lable: "시설용량(m³/일)", type: "number" },
{ id: "majorPrcsMsrcCd", lable: "주처리공법" },
{ id: "addr", lable: "위치(주소)" },
{ id: "rprcsMthdCd", lable: "재처리방식", type: "select", selectData: "rusePrcsMthdCd" },
{ id: "inoutYn", lable: "위치(처리장 내외)" ,type: "select" , selectData: "yn"}, // 머가 내? 외?,
{ id: "mainSplyPumpCpct", lable: "메인공급펌프 용량", type: "number" },
{ id: "rprcsFcltCpct", lable: "시설용량(m³/일)", type: "number", maxLenght:numSize },
{ id: "majorPrcsMsrcCd", lable: "주처리공법", maxLenght:txtSize },
{ id: "addr", lable: "위치(주소)", maxLenght:txtSize},
{
id: "rprcsMthdCd",
lable: "재처리방식",
type: "select",
selectData: "rusePrcsMthdCd",
},
{
id: "inoutYn",
lable: "위치(처리장 내외)",
type: "select",
selectData: "yn",
}, // 머가 내? 외?,
{ id: "mainSplyPumpCpct", lable: "메인공급펌프 용량", type: "number" , maxLenght:numSize},
];
export const businessMoneyInfo: formDetailType[] = [
{ id: "gvsbs", lable: "국고", type: "number" },
{ id: "lcep", lable: "지방비", type: "number" },
{ id: "cusrAlotm", lable: "민간투자비", type: "number" },
{ id: "etc", lable: "기타" },
{ id: "totalMoney", lable: "합계", type: "number" ,option:"disabled" },
{ id: "gvsbs", lable: "국고", type: "number" , maxLenght:numSize},
{ id: "lcep", lable: "지방비", type: "number" , maxLenght:numSize},
{ id: "cusrAlotm", lable: "민간투자비", type: "number" , maxLenght:numSize},
{ id: "etc", lable: "기타" , maxLenght:numSize},
{ id: "totalMoney", lable: "합계", type: "number", option: "disabled" },
];
export const businessSttnInfo: formDetailType[] = [
{ id: "seCd", lable: "구분", type: "select", selectData: "ruseSeCd" },
{ id: "bizMthdCd", lable: "사업방식", type: "select", selectData: "ruseBizMthdCd" },
{ id: "seCd", lable: "구분", type: "select", selectData: "ruseSeCd" },
{
id: "bizMthdCd",
lable: "사업방식",
type: "select",
selectData: "ruseBizMthdCd",
},
{ id: "bizCmcnDay", lable: "사업준공일", type: "date" },
{ id: "instlAprvSncnDt", lable: "설치승인인가일", type: "date" },
];
export const ruseFcltIntakeList: formDetailType[] = [
{ id: "seCd", lable: "구분" },
{ id: "bizMthdCd", lable: "사업방식" },
{ id: "bizCmcnDay", lable: "사업준공일", type: "date" },
{ id: "instlAprvSncnDt", lable: "설치승인인가일", type: "date" },
];
export const ruseWaterQulityList: formDetailType[] = [
{ id: "bod", lable: "BOD(mg/L)", type: "text" },
{ id: "grssClfg", lable: "총대장균군수(개/mg)", type: "text" },
{ id: "combResdch", lable: "결합잔류염소(mh/L)", type: "text" },
{ id: "trbt", lable: "탁도(NTU)", type: "text" },
{ id: "smll", lable: "냄새", type: "text" },
{ id: "crmty", lable: "색도", type: "text" },
{ id: "tn", lable: "총질소(mg/L)", type: "text" },
{ id: "tph", lable: "총인(mg/L)", type: "text" },
{ id: "ph", lable: "수소이온농도", type: "text" },
{ id: "clIonQnt", lable: "염화물(mg/L)", type: "text" },
{ id: "cdtnv", lable: "전기전도도(μs/cm)​", type: "text" },
{ id: "bod", lable: "BOD(mg/L)", type: "text", maxLenght:numSize },
{ id: "grssClfg", lable: "총대장균군수(개/mg)", type: "text" , maxLenght:numSize},
{ id: "combResdch", lable: "결합잔류염소(mh/L)", type: "text" , maxLenght:numSize},
{ id: "trbt", lable: "탁도(NTU)", type: "text" , maxLenght:numSize},
{ id: "smll", lable: "냄새", type: "text", maxLenght:numSize },
{ id: "crmty", lable: "색도", type: "text", maxLenght:numSize },
{ id: "tn", lable: "총질소(mg/L)", type: "text", maxLenght:numSize },
{ id: "tph", lable: "총인(mg/L)", type: "text" , maxLenght:numSize},
{ id: "ph", lable: "수소이온농도", type: "text", maxLenght:numSize},
{ id: "clIonQnt", lable: "염화물(mg/L)", type: "text", maxLenght:numSize },
{ id: "cdtnv", lable: "전기전도도(μs/cm)​", type: "text", maxLenght:numSize },
];
@@ -59,7 +59,7 @@ export const upHeadList: TableUpperProps[] = [
{ id: "daddr", title: "위치" },
{ id: "bdsgUsgText", title: "건축물용도" },
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
{ id: "archArea", title: "건축면적" },
{ id: "archArea", title: "건축면적(㎡)" },
{ id: "lawTrgtYn", title: "법적의무대상여부" },
{ id: "bdstChgYn", title: "건축물변경여부" },
];
+13 -4
View File
@@ -96,6 +96,9 @@ import {
} from "./ruseFcltMng/fcltSttn/rswtSttn";
import { rainStatActionsExport, rainStatExport, type rainStatState, type rainStatType } from "./stats/rainStat";
import { rswtStatActionsExport, rswtStatExport, type rswtStatState, type rswtStatType } from "./stats/rswtStat";
//import { isLogin } from "./common/login";
import { LoginApi } from "@/src/entities/auth";
import { authActionsExport, authStateExport, type authState, type authType } from "./common/auth";
export type WrStore = comCodeType &
pubFacType &
@@ -122,7 +125,9 @@ export type WrStore = comCodeType &
ruseCaseType&
rainStatType&
rswtStatType&
comFcltType
comFcltType &
authType
;
export const StoreZus = (
@@ -151,7 +156,8 @@ export const StoreZus = (
drgtState&
ruseCaseState&
rainStatState&
rswtStatState
rswtStatState&
authState
= {
...comCodeStateExport,
...pubFacStateExport,
@@ -178,7 +184,8 @@ export const StoreZus = (
...ruseCaseStateExport,
...rainStatExport,
...rswtStatExport,
...comFcltStateExport
...comFcltStateExport,
...authStateExport
}
) => {
return createStore<WrStore>()((set) => {
@@ -188,6 +195,7 @@ export const StoreZus = (
getMiddleRegionCd(set);
getUnitWaterShedCd(set);
getEnvPartCd(set);
LoginApi.login({userId: "tuser10003", password: "test1234!"})
return {
...initState,
...comFcltSearchAction(set),
@@ -215,7 +223,8 @@ export const StoreZus = (
...drgtActionsExport(set),
...ruseCaseActionsExport(set),
...rainStatActionsExport(set),
...rswtStatActionsExport(set)
...rswtStatActionsExport(set),
...authActionsExport(set)
};
});
};
+18
View File
@@ -108,6 +108,24 @@ export const postFectch = async (url: string, params: any, type?: string) => {
return await response.json();
};
export const cmsPostFectch = async (url: string, params: any,headers:any) => {
const response = fetch(url, {
method: "POST",
headers:headers ,
body: JSON.stringify(params),
}).then((res) =>
{
console.log(' res ' , res)
console.log(' access-token ' , res.headers.get('access-token'))
console.log(' refresh-token ' , res.headers.get('refresh-token'))
console.log(' token-id ' , res.headers.get('token-id'))
})
return await response;
};
export const putFectch = async (url: string, params: any,type?:string) => {
const div =
type === fetchType.COMMON

Some files were not shown because too many files have changed in this diff Show More