Compare commits
55
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d044750ae | ||
|
|
5f04e775b4 | ||
|
|
4d23e07be0 | ||
|
|
920922e21b | ||
|
|
c66a0be0ea | ||
|
|
74f14dec37 | ||
|
|
2fcd735d18 | ||
|
|
3302f7e8e0 | ||
|
|
9f9c6f30cb | ||
|
|
4a57b363eb | ||
|
|
3637d09d03 | ||
|
|
109c5b14e6 | ||
|
|
7baf877528 | ||
|
|
062e26c6d9 | ||
|
|
9ad2f3944a | ||
|
|
7e241f964c | ||
|
|
6d5ebdc739 | ||
|
|
5f56e9a207 | ||
|
|
871e488216 | ||
|
|
216cec8cc7 | ||
|
|
de1d6f9e43 | ||
|
|
54f834ceff | ||
|
|
2f7f128a48 | ||
|
|
aca72fa4e0 | ||
|
|
f2aaf9696e | ||
|
|
d6d2900142 | ||
|
|
4cd2aee92e | ||
|
|
9fc2fc8942 | ||
|
|
3f63cc915b | ||
|
|
3b170b0992 | ||
|
|
d6a049758e | ||
|
|
f21e902edd | ||
|
|
d98003b3ec | ||
|
|
78defdd050 | ||
|
|
47b582c5cc | ||
|
|
a72e4ae4bd | ||
|
|
af5bbbd56e | ||
|
|
d462c50684 | ||
|
|
3da3b88d05 | ||
|
|
1715c8c88b | ||
|
|
983075e4d0 | ||
|
|
237ec3bc88 | ||
|
|
b5bcdb168f | ||
|
|
5376757f0f | ||
|
|
3bfbc698fe | ||
|
|
44431a7905 | ||
|
|
97ae53ad5d | ||
|
|
a2b0469275 | ||
|
|
13219b7d4e | ||
|
|
4d778af385 | ||
|
|
d976e5fdfa | ||
|
|
1d4329e058 | ||
|
|
6dc42ae4b1 | ||
|
|
ed5971aed7 | ||
|
|
d817292955 |
@@ -102,35 +102,35 @@ function UsersForm<T extends UserSaveData | UserUpdateData>({
|
||||
return (
|
||||
authSeCd?.filter(
|
||||
(code) =>
|
||||
code.lwpoCd === "ROLE_USER1" ||
|
||||
code.lwpoCd === "ROLE_USER2" ||
|
||||
code.lwpoCd === "ROLE_USER3",
|
||||
code.lwpoCd === "ROLE_USER01" ||
|
||||
code.lwpoCd === "ROLE_USER02" ||
|
||||
code.lwpoCd === "ROLE_USER03",
|
||||
) ?? []
|
||||
);
|
||||
if (watchOgdpSeCd === "3" || watchOgdpSeCd === "4")
|
||||
return (
|
||||
authSeCd?.filter(
|
||||
(code) =>
|
||||
code.lwpoCd === "ROLE_USER4" || code.lwpoCd === "ROLE_USER5",
|
||||
code.lwpoCd === "ROLE_USER04" || code.lwpoCd === "ROLE_USER05",
|
||||
) ?? []
|
||||
);
|
||||
return [];
|
||||
}, [authSeCd, watchOgdpSeCd]);
|
||||
|
||||
const laeSeCdSelectData = useMemo(() => {
|
||||
if (watchDtlInstCd === "ROLE_USER1")
|
||||
if (watchDtlInstCd === "ROLE_USER01")
|
||||
return laeSeCd?.filter((code) => code.lwpoCd === "G102") ?? [];
|
||||
if (watchDtlInstCd === "ROLE_USER2")
|
||||
if (watchDtlInstCd === "ROLE_USER02")
|
||||
return laeSeCd?.filter((code) => code.lwpoCd === "G101") ?? [];
|
||||
if (watchDtlInstCd === "ROLE_USER3")
|
||||
if (watchDtlInstCd === "ROLE_USER03")
|
||||
return laeSeCd?.filter((code) => code.lwpoCd.startsWith("G2")) ?? [];
|
||||
if (watchDtlInstCd === "ROLE_USER4")
|
||||
if (watchDtlInstCd === "ROLE_USER04")
|
||||
return (
|
||||
laeSeCd?.filter(
|
||||
(code) => code.lwpoCd.startsWith("G3") && code.lwpoCd.length === 4,
|
||||
) ?? []
|
||||
);
|
||||
if (watchDtlInstCd === "ROLE_USER5")
|
||||
if (watchDtlInstCd === "ROLE_USER05")
|
||||
return (
|
||||
laeSeCd?.filter(
|
||||
(code) => code.lwpoCd.startsWith("G3") && code.lwpoCd.length === 7,
|
||||
@@ -622,8 +622,9 @@ function UsersForm<T extends UserSaveData | UserUpdateData>({
|
||||
onValueChange={field.onChange}
|
||||
disabled={
|
||||
!(
|
||||
watchDtlInstCd === "ROLE_USER4" ||
|
||||
watchDtlInstCd === "ROLE_USER5"
|
||||
watchDtlInstCd === "ROLE_USER03" ||
|
||||
watchDtlInstCd === "ROLE_USER04" ||
|
||||
watchDtlInstCd === "ROLE_USER05"
|
||||
)
|
||||
}
|
||||
>
|
||||
|
||||
@@ -260,3 +260,79 @@ BEGIN
|
||||
|
||||
END
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 템플릿 등록 다이얼로그
|
||||
|
||||
대상 UI: `NtftalkTempRegistDialog` (`apps/cs/src/pages/ntftalk-temp/ui/ntftalk-temp-regist-dialog.tsx`)
|
||||
|
||||
### 9-1. 목적/오픈 조건
|
||||
|
||||
- 목적: 신규 알림톡 템플릿 1건을 등록한다.
|
||||
- 오픈 조건: 영역 B 툴바의 `템플릿등록` 클릭 시 모달 오픈.
|
||||
- 저장 성공 시: 목록 캐시 무효화 후 영역 B 재조회 상태로 복귀(모달 닫힘).
|
||||
|
||||
### 9-2. 다이얼로그 레이아웃
|
||||
|
||||
```
|
||||
┌──────────────────────────────────────────────────────────────────────┐
|
||||
│ 알림 템플릿 등록 │
|
||||
├──────────────────────────────────────────────────────────────────────┤
|
||||
│ 메시지 유형 [기본형(고정)] │
|
||||
│ 채널 [Select(senderKey)] │
|
||||
│ 템플릿코드 [Input] │
|
||||
│ 템플릿명 [Input] │
|
||||
│ 보안템플릿여부 ( )설정 ( )미설정 │
|
||||
│ 템플릿내용 [+ 변수추가] │
|
||||
│ [Textarea] │
|
||||
│ 버튼 Table(버튼타입|버튼명|버튼링크) │
|
||||
│ [CodeSelect(upCd: NTFBUTTONTYPE) | Input | Input] │
|
||||
│ 바로연결 Table(바로연결타입|바로연결명|바로연결링크) │
|
||||
│ [CodeSelect(upCd: NTFQRTYPE) | Input | Input] │
|
||||
├──────────────────────────────────────────────────────────────────────┤
|
||||
│ [저장] [취소] │
|
||||
└──────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### 9-3. 필드 상세
|
||||
|
||||
| 표시명 | Form Key | 입력 유형 | 필수 | 기본값 | 검증/제약 | 저장 Payload 매핑 |
|
||||
| -------------- | ----------------------- | ----------- | ---- | ------------------------------------- | -------------------- | --------------------- |
|
||||
| 메시지 유형 | `templateMessageType` | 고정 텍스트 | Y | `BA` | UI에서 `기본형` 고정 | `templateMessageType` |
|
||||
| 채널 | `senderKey` | Select | Y | `senderQuery.data.senderKey` 자동세팅 | 미선택 불가 | `senderKey` |
|
||||
| 발신키 유형 | `senderKeyType` | hidden 상수 | Y | `S` | submit 시 강제 `S` | `senderKeyType` |
|
||||
| 템플릿코드 | `templateCode` | Input | Y | `""` | 1자 이상 | `templateCode` |
|
||||
| 템플릿명 | `templateName` | Input | Y | `""` | 1자 이상 | `templateName` |
|
||||
| 보안템플릿여부 | `templateEmphasizeType` | Radio | N | `false` | `true` / `false` | `pcflag` |
|
||||
| 템플릿내용 | `templateContent` | Textarea | Y | `""` | 1자 이상 | `templateContent` |
|
||||
| 버튼 | `buttons` | Table | N | `[]` | 빈 배열 | `buttons` |
|
||||
| 바로연결 | `quickReplies` | Table | N | `[]` | 빈 배열 | `quickReplies` |
|
||||
|
||||
### 9-4. 버튼/이벤트 상세
|
||||
|
||||
| 트리거 | 처리 로직 | 비고 |
|
||||
| ---------------- | ----------------------------------------------- | ------------------------------------ |
|
||||
| 템플릿등록(외부) | 다이얼로그 open = true, form reset | 진입 시 초기화 |
|
||||
| 저장 | zod 검증 통과 후 `saveNtftalkTemp` 호출 | 성공 시 `등록되었습니다.` 알림 |
|
||||
| 저장 성공 | `invalidateQueries([NTFTALK_TEMP])` → 모달 닫기 | 목록 최신화 |
|
||||
| 저장 실패 | 공통 mutation error 처리 | 에러 메시지 표시 정책 공통 모듈 따름 |
|
||||
| + 변수추가 | 변수 선택 팝업 open | 9-5 참조 |
|
||||
|
||||
### 9-5. 변수추가 팝업 상세
|
||||
|
||||
| 항목 | 내용 |
|
||||
| ----------- | -------------------------------------------------------------------- |
|
||||
| 팝업명 | 변수 목록 |
|
||||
| 데이터 소스 | `NtftalkVarApi.getNtftalkVarPage` |
|
||||
| 조회 조건 | `sort=regDt,desc`, 페이지네이션(`pageIndex/pageSize`) |
|
||||
| 선택 방식 | 다중 선택 (`RowSelectionState`) |
|
||||
| [추가] 동작 | 선택된 `varCd`를 줄바꿈(`\n`)으로 `templateContent` 하단에 append |
|
||||
| 유효성 체크 | 선택 0건: "추가할 변수를 선택해 주세요." / `varCd` 공백 포함 시 에러 |
|
||||
| [취소] 동작 | 팝업 닫기(선택값 유지 안 함) |
|
||||
|
||||
### 9-6. API 명세
|
||||
|
||||
| 기능 | Method | URL | Request DTO | Response DTO | 클라이언트 API |
|
||||
| ----------- | ------ | --------------- | ------------------------ | ------------- | -------------------------------- |
|
||||
| 템플릿 등록 | POST | `/ntftalk-temp` | `NtftalkTempSavePayload` | `NtftalkTemp` | `NtftalkTempApi.saveNtftalkTemp` |
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { PageableParams, PageableList } from "@/shared/model";
|
||||
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
export interface LwpoCodeParams extends PageableParams {
|
||||
upCd?: string;
|
||||
@@ -36,11 +37,11 @@ export interface LwpoCodeDetail extends LwpoCodeFormData {
|
||||
}
|
||||
|
||||
export const LwpoCodeFormSchema = z.object({
|
||||
lwpoCd: z.string().max(10).nonempty(),
|
||||
upCd: z.string().max(10).nonempty(),
|
||||
lwpoCd: z.string().max(30).nonempty(),
|
||||
upCd: z.string().max(30).nonempty(),
|
||||
lwpoCdNm: z.string().max(100).nonempty(),
|
||||
lwpoCdExpln: z.string().max(1000).nullish(),
|
||||
unit: z.string().max(20).nullish(),
|
||||
unit: z.string().max(50).nullish(),
|
||||
prntLwpoCd: z.string().max(10).nullish(),
|
||||
useYn: z.string(),
|
||||
sortSeq: z.number(),
|
||||
|
||||
@@ -38,7 +38,7 @@ export const upCodeFormSchema = z.object({
|
||||
.nonempty("최소 1자 이상 입력해주세요."),
|
||||
upCdNm: z.string().max(100).nonempty("최소 1자 이상 입력해주세요."),
|
||||
upCdExpln: z.string().max(1000).nullish(),
|
||||
cdSe: z.string().max(10).nonempty(),
|
||||
cdSe: z.string().max(30).nonempty(),
|
||||
siteId: z.string().max(2).nullish(),
|
||||
useYn: z.string(),
|
||||
delYn: z.string(),
|
||||
|
||||
@@ -46,6 +46,7 @@ export interface NtftalkTemp {
|
||||
templateImageUrl: string;
|
||||
inspectionStatus: string;
|
||||
inspectionStatusNm: string;
|
||||
pcflag: string;
|
||||
status: string;
|
||||
statusNm: string;
|
||||
createdAt: string;
|
||||
@@ -85,6 +86,7 @@ export interface NtftalkTempSavePayload {
|
||||
templateEmphasizeType: string;
|
||||
templateImageUrl?: string;
|
||||
inspectionStatus?: string;
|
||||
pcflag?: string;
|
||||
buttons?: NtftalkBtnTempSavePayload[];
|
||||
quickReplies?: NtftalkQuickTempSavePayload[];
|
||||
}
|
||||
@@ -94,6 +96,7 @@ export interface NtftalkTempUpdatePayload {
|
||||
templateContent: string;
|
||||
inspectionStatus?: string;
|
||||
status?: string;
|
||||
pcflag?: string;
|
||||
buttons?: NtftalkBtnTempSavePayload[];
|
||||
quickReplies?: NtftalkQuickTempSavePayload[];
|
||||
}
|
||||
|
||||
@@ -102,29 +102,29 @@ function UsersForm<T extends UserSaveData | UserUpdateData>({
|
||||
return (
|
||||
authSeCd?.filter(
|
||||
(code) =>
|
||||
code.lwpoCd === "ROLE_USER1" ||
|
||||
code.lwpoCd === "ROLE_USER2" ||
|
||||
code.lwpoCd === "ROLE_USER3",
|
||||
code.lwpoCd === "ROLE_USER01" ||
|
||||
code.lwpoCd === "ROLE_USER02" ||
|
||||
code.lwpoCd === "ROLE_USER03",
|
||||
) ?? []
|
||||
);
|
||||
if (watchOgdpSeCd === "3" || watchOgdpSeCd === "4")
|
||||
return (
|
||||
authSeCd?.filter(
|
||||
(code) =>
|
||||
code.lwpoCd === "ROLE_USER4" || code.lwpoCd === "ROLE_USER5",
|
||||
code.lwpoCd === "ROLE_USER04" || code.lwpoCd === "ROLE_USER05",
|
||||
) ?? []
|
||||
);
|
||||
return [];
|
||||
}, [authSeCd, watchOgdpSeCd]);
|
||||
|
||||
const laeSeCdSelectData = useMemo(() => {
|
||||
if (watchDtlInstCd === "ROLE_USER1")
|
||||
if (watchDtlInstCd === "ROLE_USER01")
|
||||
return laeSeCd?.filter((code) => code.lwpoCd === "G102") ?? [];
|
||||
if (watchDtlInstCd === "ROLE_USER2")
|
||||
if (watchDtlInstCd === "ROLE_USER02")
|
||||
return laeSeCd?.filter((code) => code.lwpoCd === "G101") ?? [];
|
||||
if (watchDtlInstCd === "ROLE_USER3")
|
||||
if (watchDtlInstCd === "ROLE_USER03")
|
||||
return laeSeCd?.filter((code) => code.lwpoCd.startsWith("G2")) ?? [];
|
||||
if (watchDtlInstCd === "ROLE_USER4")
|
||||
if (watchDtlInstCd === "ROLE_USER04")
|
||||
return (
|
||||
laeSeCd?.filter(
|
||||
(code) => code.lwpoCd.startsWith("G3") && code.lwpoCd.length === 4,
|
||||
|
||||
@@ -18,9 +18,10 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import { getData, getRawJson } from "../../components/lib/api";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import GeoJSON from "ol/format/GeoJSON.js";
|
||||
import Point from "ol/geom/Point.js";
|
||||
import VectorLayer from "ol/layer/Vector.js";
|
||||
@@ -28,44 +29,35 @@ import { unByKey } from "ol/Observable.js";
|
||||
import VectorSource from "ol/source/Vector.js";
|
||||
import Stroke from "ol/style/Stroke.js";
|
||||
import Style from "ol/style/Style.js";
|
||||
|
||||
import { openWindowPopup } from "@/features/windowPopup/lib/openWindowPopup";
|
||||
import type { WindowPopupKey } from "@/features/windowPopup/model/popupDefinitions";
|
||||
import { WINDOW_POPUP_MESSAGE_TYPE } from "@/features/windowPopup/model/types";
|
||||
import { downloadExcelWithKoreanHeaders } from "@common/business_components/ui";
|
||||
import Gis from "@common/business_components/ui/map/Gis";
|
||||
import GisApp from "@common/business_components/ui/map/lib/gis.core";
|
||||
import SearchModal from "./searchModal/searchModal";
|
||||
import FeatureClickEventPopup from "./components/popupComponent/featureClickEventPopup";
|
||||
import { WaterDepth, WATER_DEPTH_LAYER_TYPES } from "./waterDepth/waterDepth";
|
||||
import { ProcSearchBar } from "@common/business_components/ui/map/searchBar";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import { getData, getRawJson } from "../../components/lib/api";
|
||||
|
||||
import useSearchModalStore from "@/store/useSearchModalStore";
|
||||
import useStore from "@/store/useStore";
|
||||
import { downloadExcelWithKoreanHeaders } from "@common/business_components/ui";
|
||||
import AgedPipeLayerSettingPanel from "./components/agedPipe/AgedPipeLayerSettingPanel";
|
||||
import type { PipeAnalysisDetailRow } from "./components/pipeAnalysis/pipeAnalysisUtils";
|
||||
import {
|
||||
PIPE_ANALYSIS_DETAIL_ROW_SELECT_MESSAGE,
|
||||
type PipeAnalysisDetailRow,
|
||||
} from "./components/pipeAnalysis/pipeAnalysisUtils";
|
||||
import {
|
||||
AGED_PIPE_DEFAULT_FILTERS,
|
||||
AGED_PIPE_EXCEL_HEADER,
|
||||
AGED_PIPE_LAYER_TYPE,
|
||||
AGED_PIPE_MIN_ZOOM,
|
||||
AGED_PIPE_LAYER_TYPE,
|
||||
AGED_PIPE_PAGE_SIZE,
|
||||
type AgedPipeFilters,
|
||||
type AgedPipeRow,
|
||||
buildAgedPipeCqlFilters,
|
||||
isAgedPipeLayerNode,
|
||||
matchesAgedPipeFilters,
|
||||
normalizeAgedPipeFilters,
|
||||
toDisplayPipeRow,
|
||||
validateElapsedYears,
|
||||
type AgedPipeFilters,
|
||||
type AgedPipeRow,
|
||||
AGED_PIPE_DEFAULT_FILTERS,
|
||||
} from "./components/agedPipe/agedPipeUtils";
|
||||
import FeatureClickEventPopup from "./components/popupComponent/featureClickEventPopup";
|
||||
import SearchModal from "./searchModal/searchModal";
|
||||
import { WATER_DEPTH_LAYER_TYPES, WaterDepth } from "./waterDepth/waterDepth";
|
||||
|
||||
import useSearchModalStore from "@/store/useSearchModalStore";
|
||||
import useStore from "@/store/useStore";
|
||||
import { PIPE_ANALYSIS_DETAIL_ROW_SELECT_MESSAGE } from "./components/pipeAnalysis/pipeAnalysisUtils";
|
||||
import { openWindowPopup } from "@/features/windowPopup/lib/openWindowPopup";
|
||||
import type { WindowPopupKey } from "@/features/windowPopup/model/popupDefinitions";
|
||||
import { WINDOW_POPUP_MESSAGE_TYPE } from "@/features/windowPopup/model/types";
|
||||
|
||||
const AnalysisPopupMenu = dynamic(
|
||||
() => import("./components/analysisMenu/AnalysisPopupMenu"),
|
||||
@@ -87,27 +79,18 @@ const SOUTH_KOREA_VIEW_EXTENT: [number, number, number, number] = [
|
||||
// 유하방향은 GeoServer WMS/WFS 레이어가 아니라 BE 보정 GeoJSON API로 그리는 가상 레이어이다.
|
||||
const FLOW_DIRECTION_LAYER_TYPE = "tb_sn_swage_ppl_flow_direction";
|
||||
const FLOW_DIRECTION_LAYER_NAME = "유하방향";
|
||||
const FLOW_DIRECTION_PIPE_LAYER_TYPE = "tb_ms_swage_ppl";
|
||||
const FLOW_DIRECTION_SRS = "EPSG:5179";
|
||||
const FLOW_DIRECTION_DEFAULT_MIN_ZOOM = 13;
|
||||
const FLOW_DIRECTION_DEFAULT_LIMIT = 5000;
|
||||
const FLOW_DIRECTION_DEFAULT_COLOR = "rgba(40, 90, 180, 0.84)";
|
||||
const FLOW_DIRECTION_NETWORK_CORRECTION_COLOR = "rgba(0, 168, 132, 0.95)";
|
||||
const FLOW_DIRECTION_BBOX_BUFFER_RATIO = 0.35;
|
||||
const FLOW_DIRECTION_CACHE_MAX_FEATURES = 10000;
|
||||
|
||||
type FlowDirectionUsageStyle = {
|
||||
color: string;
|
||||
lineColor: string;
|
||||
};
|
||||
|
||||
type FlowDirectionMode = "PIPE_START_END" | "PIPE_DEPTH";
|
||||
|
||||
// /map은 관로 깊이 기준, /map2는 관로 원천 geometry 시점->종점 기준만 유지한다. 두 화면 모두 BBOX 조회만 사용한다.
|
||||
const getFlowDirectionModeByPathname = (pathname: string | null): FlowDirectionMode => {
|
||||
const normalizedPathname = String(pathname ?? "").replace(/\/$/, "");
|
||||
if (normalizedPathname.endsWith("/map2")) return "PIPE_START_END";
|
||||
return "PIPE_DEPTH";
|
||||
};
|
||||
|
||||
const AGED_PIPE_FOCUS_PADDING: [number, number, number, number] = [120, 120, 120, 120];
|
||||
const DEFAULT_FEATURE_FIT_PADDING: [number, number, number, number] = [50, 50, 50, 50];
|
||||
|
||||
@@ -158,19 +141,15 @@ const normalizeFlowDirectionLayerInfos = (data: any[]): any[] => {
|
||||
};
|
||||
|
||||
// 레이어 설정의 최소 표출 줌을 읽되, 값이 없으면 유하방향 기본 줌 기준을 적용한다.
|
||||
const getFiniteNumber = (value: unknown) => {
|
||||
if (value === null || value === undefined || String(value).trim() === "") return null;
|
||||
const parsed = Number(value);
|
||||
return Number.isFinite(parsed) ? parsed : null;
|
||||
};
|
||||
|
||||
const getFlowDirectionMinZoom = (layerInfo: any) => {
|
||||
return getFiniteNumber(layerInfo?.minViewSize ?? layerInfo?.minZoom) ?? FLOW_DIRECTION_DEFAULT_MIN_ZOOM;
|
||||
const minZoom = Number(layerInfo?.minViewSize ?? layerInfo?.minZoom);
|
||||
return Number.isFinite(minZoom) ? minZoom : FLOW_DIRECTION_DEFAULT_MIN_ZOOM;
|
||||
};
|
||||
|
||||
// 유하방향 화살표는 관로 위에 얹는 보조 레이어라 레이어 설정의 drawOrdr를 우선 사용하고 없으면 높은 zIndex를 준다.
|
||||
const getFlowDirectionZIndex = (layerInfo: any) => {
|
||||
return getFiniteNumber(layerInfo?.drawOrdr) ?? 9998;
|
||||
const drawOrder = Number(layerInfo?.drawOrdr);
|
||||
return Number.isFinite(drawOrder) ? drawOrder : 9998;
|
||||
};
|
||||
|
||||
// BE 응답이 FeatureCollection 그대로 오거나 공통 응답 wrapper의 data 안에 들어오는 두 계약을 모두 처리한다.
|
||||
@@ -387,19 +366,8 @@ const createFlowDirectionStyle = (
|
||||
const usageCode = String(feature.get("usgCd") ?? feature.get("usg_cd") ?? "").trim();
|
||||
const usageStyle = usageStyleMap[usageCode];
|
||||
const baseColor = usageStyle?.color ?? FLOW_DIRECTION_DEFAULT_COLOR;
|
||||
const isNetworkCorrected = String(
|
||||
feature.get("networkCorrectionYn") ??
|
||||
feature.get("network_correction_yn") ??
|
||||
"",
|
||||
).toUpperCase() === "Y";
|
||||
|
||||
const styleByConfidence: Record<string, { color: string; lineColor: string; scale: number; width: number; lineDash?: number[] }> = {
|
||||
HIGH: {
|
||||
color: baseColor,
|
||||
lineColor: usageStyle?.lineColor ?? withAlpha(baseColor, 0.42),
|
||||
scale: 1,
|
||||
width: 1.3,
|
||||
},
|
||||
const styleByConfidence: Record<string, { color: string; lineColor: string; scale: number; width: number }> = {
|
||||
MEDIUM: {
|
||||
color: baseColor,
|
||||
lineColor: usageStyle?.lineColor ?? withAlpha(baseColor, 0.42),
|
||||
@@ -413,21 +381,12 @@ const createFlowDirectionStyle = (
|
||||
width: 1.1,
|
||||
},
|
||||
};
|
||||
const style = isNetworkCorrected
|
||||
? {
|
||||
color: FLOW_DIRECTION_NETWORK_CORRECTION_COLOR,
|
||||
lineColor: withAlpha(FLOW_DIRECTION_NETWORK_CORRECTION_COLOR, 0.5),
|
||||
scale: 1.08,
|
||||
width: 2,
|
||||
lineDash: [8, 4],
|
||||
}
|
||||
: styleByConfidence[confidence] ?? styleByConfidence.LOW!;
|
||||
const style = styleByConfidence[confidence] ?? styleByConfidence.LOW!;
|
||||
const styles = [
|
||||
new Style({
|
||||
stroke: new Stroke({
|
||||
color: style.lineColor,
|
||||
width: style.width,
|
||||
lineDash: style.lineDash,
|
||||
lineCap: "round",
|
||||
lineJoin: "round",
|
||||
}),
|
||||
@@ -476,8 +435,8 @@ const extractUsageCodesFromLayerInfo = (layerInfo: any) => {
|
||||
|
||||
// 현재 줌에서 실제 표출 가능한 관로 레이어인지 확인해 숨겨진 관종의 유하방향 요청을 막는다.
|
||||
const isLayerVisibleAtZoom = (layerInfo: any, zoom: number) => {
|
||||
const minZoom = getFiniteNumber(layerInfo?.minViewSize ?? layerInfo?.minZoom);
|
||||
return minZoom === null || zoom >= minZoom;
|
||||
const minZoom = Number(layerInfo?.minViewSize ?? layerInfo?.minZoom);
|
||||
return !Number.isFinite(minZoom) || zoom >= minZoom;
|
||||
};
|
||||
|
||||
// 현재 체크되어 화면에 보이는 관로 레이어의 관종 코드와 선 색상을 유하방향 조회/스타일 기준으로 변환한다.
|
||||
@@ -487,7 +446,6 @@ const extractCheckedPipeUsageStyles = (checkedNodesData: any[], zoom: number) =>
|
||||
checkedNodesData.forEach((node) => {
|
||||
const data = node?.data ?? node;
|
||||
if (!data || isFlowDirectionLayerInfo(data)) return;
|
||||
if (getLayerTypeName(data) !== FLOW_DIRECTION_PIPE_LAYER_TYPE) return;
|
||||
if (!isLayerVisibleAtZoom(data, zoom)) return;
|
||||
|
||||
const usageCodes = extractUsageCodesFromLayerInfo(data);
|
||||
@@ -549,8 +507,6 @@ const appendAgedPipeControlNode = (data: any[]) => {
|
||||
};
|
||||
|
||||
const Map = () => {
|
||||
const pathname = usePathname();
|
||||
const flowDirectionMode = useMemo(() => getFlowDirectionModeByPathname(pathname), [pathname]);
|
||||
const { isSearchModalOpen, setIsSearchModalOpen } = useSearchModalStore();
|
||||
|
||||
const [treeData, setTreeData] = useState<any[]>([]); // 초기값을 객체 또는 null로 설정
|
||||
@@ -594,13 +550,9 @@ const Map = () => {
|
||||
// 같은 관로가 겹치는 BBOX에서 반복 조회될 수 있으므로 고유키와 삽입 순서를 캐시로 관리한다.
|
||||
const flowDirectionFeatureKeySetRef = useRef<Set<string>>(new Set());
|
||||
const flowDirectionFeatureKeyQueueRef = useRef<string[]>([]);
|
||||
// 관종 체크 변경 시 다른 관종 유하방향을 유지하기 위해 현재 source에 남겨둘 관종 코드를 별도로 추적한다.
|
||||
const flowDirectionVisibleUsageCodesRef = useRef<Set<string>>(new Set());
|
||||
// 관종 체크 변경으로 새로 켜진 usgCd만 다음 조회 대상으로 넘겨 기존 관종 재요청을 막는다.
|
||||
const flowDirectionSelectionRequestUsageCodesRef = useRef<string[] | null>(null);
|
||||
// 체크 해제나 재조회 중 늦게 도착한 이전 API 응답이 레이어를 다시 그리지 못하도록 요청 순번을 관리한다.
|
||||
const flowDirectionRequestSeqRef = useRef(0);
|
||||
// 지도 이동이 연속으로 발생하면 이전 유하방향 요청을 중단해 늦은 응답과 불필요한 네트워크 대기를 줄인다.
|
||||
// 지도 이동이 연속으로 발생하면 이전 bbox 요청을 중단해 늦은 응답과 불필요한 네트워크 대기를 줄인다.
|
||||
const flowDirectionAbortControllerRef = useRef<AbortController | null>(null);
|
||||
// 같은 장애 상황에서 alert가 반복 노출되지 않도록 실패 안내 여부를 기억한다.
|
||||
const flowDirectionFailureAlertedRef = useRef(false);
|
||||
@@ -678,7 +630,6 @@ const Map = () => {
|
||||
flowDirectionSourceRef.current = null;
|
||||
flowDirectionFeatureKeySetRef.current.clear();
|
||||
flowDirectionFeatureKeyQueueRef.current = [];
|
||||
flowDirectionVisibleUsageCodesRef.current.clear();
|
||||
}, []);
|
||||
|
||||
// 유하방향 cache/source만 비워 관종 변경처럼 조건이 달라진 경우 이전 조건의 피처가 남지 않게 한다.
|
||||
@@ -686,46 +637,8 @@ const Map = () => {
|
||||
flowDirectionSourceRef.current?.clear();
|
||||
flowDirectionFeatureKeySetRef.current.clear();
|
||||
flowDirectionFeatureKeyQueueRef.current = [];
|
||||
flowDirectionVisibleUsageCodesRef.current.clear();
|
||||
}, []);
|
||||
|
||||
// 체크 해제된 관종의 유하방향 feature/cache만 제거하고, 새로 체크된 관종 코드만 다음 요청 대상으로 돌려준다.
|
||||
const retainFlowDirectionUsageCodes = useCallback((usageCodes: string[]) => {
|
||||
const nextUsageCodes = new Set(usageCodes);
|
||||
const addedUsageCodes = usageCodes.filter((usageCode) =>
|
||||
!flowDirectionVisibleUsageCodesRef.current.has(usageCode),
|
||||
);
|
||||
const source = flowDirectionSourceRef.current;
|
||||
if (source) {
|
||||
source.getFeatures().forEach((feature: any) => {
|
||||
const usageCode = String(feature.get("usgCd") ?? feature.get("usg_cd") ?? "").trim();
|
||||
if (nextUsageCodes.has(usageCode)) return;
|
||||
|
||||
const featureKey = feature.get("flowDirectionCacheKey");
|
||||
if (featureKey) {
|
||||
flowDirectionFeatureKeySetRef.current.delete(String(featureKey));
|
||||
}
|
||||
source.removeFeature(feature);
|
||||
});
|
||||
flowDirectionFeatureKeyQueueRef.current = flowDirectionFeatureKeyQueueRef.current.filter((featureKey) =>
|
||||
flowDirectionFeatureKeySetRef.current.has(featureKey),
|
||||
);
|
||||
}
|
||||
flowDirectionVisibleUsageCodesRef.current = new Set(
|
||||
Array.from(flowDirectionVisibleUsageCodesRef.current).filter((usageCode) =>
|
||||
nextUsageCodes.has(usageCode),
|
||||
),
|
||||
);
|
||||
return addedUsageCodes;
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!flowDirectionCheckedRef.current) return;
|
||||
clearFlowDirectionFeatureCache();
|
||||
flowDirectionSelectionRequestUsageCodesRef.current = null;
|
||||
setFlowDirectionSelectionVersion((version) => version + 1);
|
||||
}, [clearFlowDirectionFeatureCache, flowDirectionMode]);
|
||||
|
||||
// 유하방향 레이어는 하나만 유지하고 source에 피처를 누적한다.
|
||||
const ensureFlowDirectionLayer = useCallback((layerInfo: any) => {
|
||||
const map = gisMaps.current;
|
||||
@@ -791,11 +704,23 @@ const Map = () => {
|
||||
source.addFeatures(nextFeatures);
|
||||
}
|
||||
|
||||
while (flowDirectionFeatureKeyQueueRef.current.length > FLOW_DIRECTION_CACHE_MAX_FEATURES) {
|
||||
const staleKey = flowDirectionFeatureKeyQueueRef.current.shift();
|
||||
if (!staleKey) break;
|
||||
|
||||
const staleFeature = source.getFeatures().find((feature: any) =>
|
||||
feature.get("flowDirectionCacheKey") === staleKey,
|
||||
);
|
||||
if (staleFeature) {
|
||||
source.removeFeature(staleFeature);
|
||||
}
|
||||
flowDirectionFeatureKeySetRef.current.delete(staleKey);
|
||||
}
|
||||
}, [ensureFlowDirectionLayer]);
|
||||
|
||||
// 현재 지도 BBOX와 체크된 관종별 필터로 유하방향 GeoJSON을 각각 조회하고, 최신 요청만 지도에 반영한다.
|
||||
// 현재 지도 BBOX와 체크된 관종 필터로 유하방향 GeoJSON을 조회하고, 최신 요청만 지도에 반영한다.
|
||||
const loadFlowDirectionLayer = useCallback(
|
||||
async (layerInfo: any, requestOnlyUsageCodes?: string[]) => {
|
||||
async (layerInfo: any) => {
|
||||
const map = gisMaps.current;
|
||||
if (!map) return;
|
||||
|
||||
@@ -823,113 +748,45 @@ const Map = () => {
|
||||
removeFlowDirectionLayer();
|
||||
return;
|
||||
}
|
||||
retainFlowDirectionUsageCodes(usageCodes);
|
||||
|
||||
const usageCodeSet = new Set(usageCodes);
|
||||
const requestUsageCodes = requestOnlyUsageCodes
|
||||
? requestOnlyUsageCodes.filter((usageCode) => usageCodeSet.has(usageCode))
|
||||
: usageCodes;
|
||||
const isPartialUsageRequest = Array.isArray(requestOnlyUsageCodes);
|
||||
if (requestUsageCodes.length === 0) {
|
||||
if (flowDirectionAbortControllerRef.current === abortController) {
|
||||
flowDirectionAbortControllerRef.current = null;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const screenExtent = view.calculateExtent(size);
|
||||
const requestExtent = expandFlowDirectionExtent(screenExtent);
|
||||
const screenBbox = formatFlowDirectionBbox(screenExtent);
|
||||
const requestBbox = formatFlowDirectionBbox(requestExtent);
|
||||
const baseParams = new URLSearchParams({
|
||||
srs: FLOW_DIRECTION_SRS,
|
||||
directionMode: flowDirectionMode,
|
||||
searchStrategy: "BBOX",
|
||||
const params = new URLSearchParams({
|
||||
bbox: requestBbox,
|
||||
srs: FLOW_DIRECTION_SRS,
|
||||
limit: String(FLOW_DIRECTION_DEFAULT_LIMIT),
|
||||
usgCd: usageCodes.join(","),
|
||||
});
|
||||
|
||||
try {
|
||||
const settledResponses = await Promise.allSettled(requestUsageCodes.map(async (usageCode) => {
|
||||
const params = new URLSearchParams(baseParams);
|
||||
params.set("usgCd", usageCode);
|
||||
const payload = await getRawJson(
|
||||
`/sewerage-service/api/v1/map/flowDirectionGeometry?${params.toString()}`,
|
||||
{ signal: abortController.signal },
|
||||
);
|
||||
return { usageCode, featureCollection: getFeatureCollection(payload) };
|
||||
}));
|
||||
if (requestSeq !== flowDirectionRequestSeqRef.current) return;
|
||||
if (abortController.signal.aborted) return;
|
||||
|
||||
const responses = settledResponses
|
||||
.filter((result): result is PromiseFulfilledResult<{ usageCode: string; featureCollection: any }> =>
|
||||
result.status === "fulfilled",
|
||||
)
|
||||
.map((result) => result.value);
|
||||
const failedResponses = settledResponses.filter((result) => result.status === "rejected");
|
||||
|
||||
if (responses.length === 0) {
|
||||
if (!isPartialUsageRequest) {
|
||||
removeFlowDirectionLayer();
|
||||
}
|
||||
throw failedResponses[0]?.reason ?? new Error("유하방향 관종별 조회 결과가 없습니다.");
|
||||
}
|
||||
|
||||
if (failedResponses.length > 0) {
|
||||
console.error("유하방향 일부 관종 조회 실패:", failedResponses.map((result) => result.reason));
|
||||
if (!flowDirectionFailureAlertedRef.current) {
|
||||
flowDirectionFailureAlertedRef.current = true;
|
||||
}
|
||||
}
|
||||
|
||||
responses.forEach(({ usageCode, featureCollection }) => {
|
||||
renderFlowDirectionLayer(featureCollection, layerInfo, usageStyleMap);
|
||||
flowDirectionVisibleUsageCodesRef.current.add(usageCode);
|
||||
});
|
||||
const returnedFeaturesByUsage = responses.reduce<Record<string, number>>(
|
||||
(acc, { usageCode, featureCollection }) => {
|
||||
acc[usageCode] = featureCollection.features?.length ?? 0;
|
||||
return acc;
|
||||
},
|
||||
{},
|
||||
const payload = await getRawJson(
|
||||
`/sewerage-service/api/v1/map/flowDirectionGeometry?${params.toString()}`,
|
||||
{ signal: abortController.signal },
|
||||
);
|
||||
const networkCorrectedFeatures = responses.reduce((count, { featureCollection }) => {
|
||||
const correctedCount = featureCollection.features?.filter((feature: any) =>
|
||||
String(
|
||||
feature?.properties?.networkCorrectionYn ??
|
||||
feature?.properties?.network_correction_yn ??
|
||||
"",
|
||||
).toUpperCase() === "Y",
|
||||
).length ?? 0;
|
||||
return count + correctedCount;
|
||||
}, 0);
|
||||
if (requestSeq !== flowDirectionRequestSeqRef.current) return;
|
||||
|
||||
const featureCollection = getFeatureCollection(payload);
|
||||
renderFlowDirectionLayer(featureCollection, layerInfo, usageStyleMap);
|
||||
(window as any).__SN_FLOW_DIRECTION_DEBUG__ = {
|
||||
screenBbox,
|
||||
requestBbox,
|
||||
requestSeq,
|
||||
zoom,
|
||||
directionMode: flowDirectionMode,
|
||||
searchStrategy: "BBOX",
|
||||
usageCodes,
|
||||
requestUsageCodes,
|
||||
requestCount: responses.length,
|
||||
returnedFeaturesByUsage,
|
||||
returnedFeatures: Object.values(returnedFeaturesByUsage).reduce((sum, count) => sum + count, 0),
|
||||
networkCorrectedFeatures,
|
||||
returnedFeatures: featureCollection.features?.length ?? 0,
|
||||
cachedFeatures: flowDirectionSourceRef.current?.getFeatures?.().length ?? 0,
|
||||
};
|
||||
if (failedResponses.length === 0) {
|
||||
flowDirectionFailureAlertedRef.current = false;
|
||||
}
|
||||
flowDirectionFailureAlertedRef.current = false;
|
||||
} catch (error) {
|
||||
if (requestSeq !== flowDirectionRequestSeqRef.current) return;
|
||||
if (typeof error === "object" && error !== null && "name" in error && error.name === "AbortError") return;
|
||||
|
||||
console.error("유하방향 레이어 조회 실패:", error);
|
||||
if (!isPartialUsageRequest) {
|
||||
removeFlowDirectionLayer();
|
||||
}
|
||||
removeFlowDirectionLayer();
|
||||
if (!flowDirectionFailureAlertedRef.current) {
|
||||
alert("유하방향 정보를 불러오지 못했습니다.");
|
||||
flowDirectionFailureAlertedRef.current = true;
|
||||
}
|
||||
} finally {
|
||||
@@ -938,7 +795,7 @@ const Map = () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
[flowDirectionMode, removeFlowDirectionLayer, renderFlowDirectionLayer, retainFlowDirectionUsageCodes],
|
||||
[removeFlowDirectionLayer, renderFlowDirectionLayer],
|
||||
);
|
||||
|
||||
// SearchModal, GisContent 등에서 호출
|
||||
@@ -1233,22 +1090,12 @@ const Map = () => {
|
||||
setIsFlowDirectionChecked(Boolean(nextFlowDirectionLayerInfo));
|
||||
setFlowDirectionLayerInfo(nextFlowDirectionLayerInfo);
|
||||
if (nextFlowDirectionLayerInfo) {
|
||||
const map = gisMaps.current;
|
||||
const zoom = map?.getView?.()?.getZoom?.() ?? 0;
|
||||
const nextUsageStyleMap = extractCheckedPipeUsageStyles(checkedNodesData, zoom);
|
||||
const requestUsageCodes = retainFlowDirectionUsageCodes(Object.keys(nextUsageStyleMap));
|
||||
flowDirectionSelectionRequestUsageCodesRef.current = requestUsageCodes;
|
||||
if (requestUsageCodes.length === 0) {
|
||||
flowDirectionRequestSeqRef.current += 1;
|
||||
flowDirectionAbortControllerRef.current?.abort();
|
||||
flowDirectionAbortControllerRef.current = null;
|
||||
}
|
||||
clearFlowDirectionFeatureCache();
|
||||
setFlowDirectionSelectionVersion((version) => version + 1);
|
||||
}
|
||||
|
||||
if (!nextFlowDirectionLayerInfo) {
|
||||
// 해제 직후 pending API 응답이 늦게 도착해도 renderFlowDirectionLayer가 실행되지 않도록 순번을 무효화한다.
|
||||
flowDirectionSelectionRequestUsageCodesRef.current = null;
|
||||
flowDirectionRequestSeqRef.current += 1;
|
||||
flowDirectionAbortControllerRef.current?.abort();
|
||||
flowDirectionAbortControllerRef.current = null;
|
||||
@@ -1258,7 +1105,7 @@ const Map = () => {
|
||||
|
||||
handleWaterDepthVisibility(checkedIds, checkedNodesData);
|
||||
setIsAgedPipeChecked(checkedNodesData.some((node) => isAgedPipeLayerNode(node)));
|
||||
}, [handleWaterDepthVisibility, removeFlowDirectionLayer, retainFlowDirectionUsageCodes]);
|
||||
}, [clearFlowDirectionFeatureCache, handleWaterDepthVisibility, removeFlowDirectionLayer]);
|
||||
|
||||
const handleOpenLayerPopup = useCallback(
|
||||
(_layerNm: string, node?: any) => {
|
||||
@@ -1347,10 +1194,7 @@ const Map = () => {
|
||||
|
||||
// 트리 체크 상태나 관종 레이어 선택이 바뀌면 유하방향 API vector layer를 추가/갱신/제거한다.
|
||||
if (isFlowDirectionChecked) {
|
||||
const requestUsageCodes = flowDirectionSelectionRequestUsageCodesRef.current;
|
||||
flowDirectionSelectionRequestUsageCodesRef.current = null;
|
||||
if (requestUsageCodes && requestUsageCodes.length === 0) return;
|
||||
loadFlowDirectionLayer(flowDirectionLayerInfo, requestUsageCodes ?? undefined);
|
||||
loadFlowDirectionLayer(flowDirectionLayerInfo);
|
||||
} else {
|
||||
removeFlowDirectionLayer();
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "../map/page";
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useEffect, useMemo } from "react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
import {
|
||||
@@ -11,6 +11,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { getCookie, useAlertStore, useMenuStore } from "@/shared/lib";
|
||||
import { isVerificationSelectionReportMenu } from "@/shared/lib/verification-selection-report";
|
||||
import { StatisticsPageLayout } from "@/shared/ui/statistics-page-layout";
|
||||
import { tokenManager } from "@/entities/auth";
|
||||
import type { MenuItem } from "@/entities/menu";
|
||||
@@ -20,6 +21,8 @@ import { getConfig } from "@common/config";
|
||||
|
||||
import { getTabStoreState, useTabStore } from "@/store/tab-store";
|
||||
|
||||
import VerificationSelectionReport from "@/components/statistics/VerificationSelectionReport";
|
||||
|
||||
const appConfig = getConfig();
|
||||
const userId = getCookie(appConfig.AUTH_USER_ID ?? "");
|
||||
const appSiteId = getCookie("site-id-key") ?? "";
|
||||
@@ -33,6 +36,10 @@ export default function WithBaseLayout({
|
||||
const pathname = usePathname();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
/** 탭 추가 없이 메뉴만 눌렀을 때 패널 유지 (다른 메뉴 클릭해도 유지) */
|
||||
const [isVerificationSelectionReportPanelOpen, setReportPanelOpen] =
|
||||
useState(false);
|
||||
|
||||
const setCurrentMenuInfo = useMenuStore(
|
||||
(state) => state.setCurrentMenuInfo,
|
||||
);
|
||||
@@ -145,6 +152,12 @@ export default function WithBaseLayout({
|
||||
const handleMenuClick = useCallback(
|
||||
(item: MenuItem) => {
|
||||
setCurrentMenuInfo(item);
|
||||
|
||||
if (isVerificationSelectionReportMenu(item)) {
|
||||
setReportPanelOpen(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const addTabResult: boolean = addTab(item);
|
||||
|
||||
// packages/rsone의 스토어에도 동기화
|
||||
@@ -153,11 +166,11 @@ export default function WithBaseLayout({
|
||||
}
|
||||
|
||||
if (!addTabResult) {
|
||||
alert(`최대 추가 할 수 있는 화면 수를 초과 하였습니다.
|
||||
alert(`최대 추가 할 수 있는 화면 수(10개)를 \n초과 하였습니다.
|
||||
기존 화면을 닫은 후 이용해주세요.`);
|
||||
}
|
||||
},
|
||||
[setCurrentMenuInfo, addTab, addTabForGrid, alert],
|
||||
[setCurrentMenuInfo, addTab, addTabForGrid, alert, setReportPanelOpen],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -167,7 +180,14 @@ export default function WithBaseLayout({
|
||||
currentPath={currentPath}
|
||||
handleMenuClick={handleMenuClick}
|
||||
>
|
||||
<StatisticsPageLayout>{children}</StatisticsPageLayout>
|
||||
<div className="flex flex-1 h-full">
|
||||
{isVerificationSelectionReportPanelOpen && (
|
||||
<VerificationSelectionReport
|
||||
onClose={() => setReportPanelOpen(false)}
|
||||
/>
|
||||
)}
|
||||
<StatisticsPageLayout>{children}</StatisticsPageLayout>
|
||||
</div>
|
||||
</BaseLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
"@common/components": "workspace:*",
|
||||
"@common/config": "workspace:*",
|
||||
"@common/network": "workspace:*",
|
||||
"@rsone/components": "workspace:*",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^8.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@faker-js/faker": "^9.9.0",
|
||||
"@fontsource-variable/noto-sans-kr": "^5.2.5",
|
||||
"@frontend-opensource/use-react-hooks": "^1.1.4",
|
||||
@@ -29,6 +31,7 @@
|
||||
"@radix-ui/react-label": "^2.1.2",
|
||||
"@radix-ui/react-slot": "^1.1.2",
|
||||
"@radix-ui/react-tooltip": "^1.1.8",
|
||||
"@rsone/components": "workspace:*",
|
||||
"@tanstack/react-query": "^5.67.1",
|
||||
"@tanstack/react-query-devtools": "^5.75.5",
|
||||
"@tanstack/react-table": "^8.21.2",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
const Dashboard = () => {
|
||||
return (
|
||||
<div>
|
||||
Dashboard
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Dashboard;
|
||||
@@ -35,6 +35,9 @@
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-rowtype-biz-sum {
|
||||
@apply !bg-[#ffe9cf];
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-rowtype-summary {
|
||||
@apply !bg-[#feee85];
|
||||
}
|
||||
.rg-grid .rg-body .rg-table .rg-data-row .rg-data-cell.rg-cell-rowtype-other {
|
||||
@apply !bg-[#fff7bf];
|
||||
}
|
||||
@@ -42,6 +45,9 @@
|
||||
.rg-grid .rg-body .rg-data-cell.rg-cell-rowtype-biz-sum {
|
||||
@apply !bg-[#ffe9cf];
|
||||
}
|
||||
.rg-grid .rg-body .rg-data-cell.rg-cell-rowtype-summary {
|
||||
@apply !bg-[#feee85];
|
||||
}
|
||||
.rg-grid .rg-body .rg-data-cell.rg-cell-rowtype-other {
|
||||
@apply !bg-[#fff7bf];
|
||||
}
|
||||
@@ -49,6 +55,10 @@
|
||||
.rg-grid .rg-fixed-body .rg-data-row .rg-data-cell.rg-cell-rowtype-biz-sum {
|
||||
@apply !bg-[#ffe9cf];
|
||||
}
|
||||
.rg-grid .rg-fixed-body .rg-table .rg-data-row td.rg-cell-rowtype-summary,
|
||||
.rg-grid .rg-fixed-body .rg-data-row .rg-data-cell.rg-cell-rowtype-summary {
|
||||
@apply !bg-[#feee85];
|
||||
}
|
||||
.rg-grid .rg-fixed-body .rg-table .rg-data-row td.rg-cell-rowtype-other,
|
||||
.rg-grid .rg-fixed-body .rg-data-row .rg-data-cell.rg-cell-rowtype-other {
|
||||
@apply !bg-[#fff7bf];
|
||||
@@ -56,13 +66,13 @@
|
||||
|
||||
/* 진행상황: 소프트 인라인 요약 (툴바와 자연스럽게 blend) */
|
||||
.data-grid-status-bubble {
|
||||
@apply rounded-lg border border-slate-200/80 bg-slate-50/90 px-4 py-2.5;
|
||||
@apply rounded-lg border border-slate-200/80 bg-white px-8 py-2.5;
|
||||
box-shadow: none;
|
||||
}
|
||||
.data-grid-status-bubble span {
|
||||
@apply text-base text-slate-700;
|
||||
.data-grid-status-bubble > span {
|
||||
@apply text-xl text-slate-700 font-bold;
|
||||
}
|
||||
.data-grid-status-bubble span + span {
|
||||
.data-grid-status-bubble > span + span {
|
||||
@apply ml-4 border-l border-slate-200/70 pl-4;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@ interface RealGridDataProviderComparer {
|
||||
getValue?(row: number, field: string | number): unknown;
|
||||
}
|
||||
|
||||
type GridViewWithCheckApi = GridViewWithSetColumns & {
|
||||
checkItem?: (itemIndex: number, checked: boolean, exclusive?: boolean) => void;
|
||||
checkRow?: (dataRow: number, checked: boolean, exclusive?: boolean) => void;
|
||||
checkAll?: (checked: boolean) => void;
|
||||
};
|
||||
|
||||
/** columnInfo → RealGrid DataField 배열 (computed → valueCallback 포함, setFields용) */
|
||||
function buildFieldsFromColumns(columns: { fieldName: string; valueType?: ValueType; computed?: import("../type/DataGrid.type").ComputedFieldConfig }[]) {
|
||||
return columns.map((col) => {
|
||||
@@ -72,6 +78,8 @@ const CompactDataGrid = ({
|
||||
getGridDataRef,
|
||||
cellStyleCallback,
|
||||
onRowClick,
|
||||
onItemChecked,
|
||||
onItemAllChecked,
|
||||
compactFullWidth = false,
|
||||
compactGridHeightClass = "h-[65vh]",
|
||||
}: DataGridProps) => {
|
||||
@@ -96,6 +104,32 @@ const CompactDataGrid = ({
|
||||
(dataProvider as { setRows: (r: unknown[]) => void }).setRows(rowData);
|
||||
}
|
||||
|
||||
// __checked 플래그(1/true/Y) 기반으로 체크바 상태 동기화
|
||||
if (showHeaderCheckbox) {
|
||||
const checkGrid = gridView as GridViewWithCheckApi;
|
||||
const checkByRowFlag = (value: unknown) =>
|
||||
value === true ||
|
||||
value === 1 ||
|
||||
value === "1" ||
|
||||
value === "Y" ||
|
||||
value === "y" ||
|
||||
value === "true";
|
||||
try {
|
||||
checkGrid.checkAll?.(false);
|
||||
rowData.forEach((row, itemIndex) => {
|
||||
const checked = checkByRowFlag((row as Record<string, unknown>).__checked);
|
||||
if (!checked) return;
|
||||
if (checkGrid.checkItem) {
|
||||
checkGrid.checkItem(itemIndex, true, false);
|
||||
return;
|
||||
}
|
||||
checkGrid.checkRow?.(itemIndex, true, false);
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn("check sync:", e);
|
||||
}
|
||||
}
|
||||
|
||||
// setDataComparer로 숫자 정렬 (setFields 미사용 → 데이터 유실·필드 중복 오류 없음)
|
||||
const dp = dataProvider as RealGridDataProviderComparer;
|
||||
if (typeof dp.setDataComparer === "function" && typeof dp.getValue === "function") {
|
||||
@@ -337,6 +371,32 @@ const CompactDataGrid = ({
|
||||
};
|
||||
}, [onRowClick]);
|
||||
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
if (!gridView) return;
|
||||
|
||||
if (onItemChecked) {
|
||||
gridView.onItemChecked = (_grid, itemIndex, checked) => {
|
||||
onItemChecked(itemIndex, checked);
|
||||
};
|
||||
} else {
|
||||
gridView.onItemChecked = undefined;
|
||||
}
|
||||
|
||||
if (onItemAllChecked) {
|
||||
gridView.onItemAllChecked = (_grid, checked) => {
|
||||
onItemAllChecked(checked);
|
||||
};
|
||||
} else {
|
||||
gridView.onItemAllChecked = undefined;
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (gridView.onItemChecked) gridView.onItemChecked = undefined;
|
||||
if (gridView.onItemAllChecked) gridView.onItemAllChecked = undefined;
|
||||
};
|
||||
}, [onItemChecked, onItemAllChecked]);
|
||||
|
||||
return (
|
||||
<div className={`flex flex-col gap-[0.6rem] ${compactFullWidth ? "w-full min-w-0" : "w-1/2"}`}>
|
||||
<div className={compactGridHeightClass}>
|
||||
|
||||
@@ -580,10 +580,10 @@ const DataGrid = ({
|
||||
) {
|
||||
const cell =
|
||||
worksheet[
|
||||
XLSX.utils.encode_cell({
|
||||
r: rowIndex,
|
||||
c: col,
|
||||
})
|
||||
XLSX.utils.encode_cell({
|
||||
r: rowIndex,
|
||||
c: col,
|
||||
})
|
||||
];
|
||||
if (
|
||||
cell &&
|
||||
@@ -659,7 +659,7 @@ const DataGrid = ({
|
||||
const col = range.s.c + colIndex;
|
||||
const cell =
|
||||
worksheet[
|
||||
XLSX.utils.encode_cell({ r: row, c: col })
|
||||
XLSX.utils.encode_cell({ r: row, c: col })
|
||||
];
|
||||
const headerName =
|
||||
headers[colIndex] || `Column${colIndex + 1}`;
|
||||
@@ -783,13 +783,13 @@ const DataGrid = ({
|
||||
onSorting?: (g: unknown, f: unknown[], d: unknown[]) => boolean;
|
||||
}
|
||||
).onSorting = enableSort
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
|
||||
(gridView.displayOptions as DisplayOptions).fitStyle =
|
||||
GridFitStyle.EVEN;
|
||||
@@ -959,7 +959,7 @@ const DataGrid = ({
|
||||
) {
|
||||
(
|
||||
column.footer[
|
||||
index
|
||||
index
|
||||
] as FooterItemWithCallback
|
||||
).valueCallback =
|
||||
footerItem.valueCallback;
|
||||
@@ -1012,11 +1012,11 @@ const DataGrid = ({
|
||||
getGridDataRef.current = () => {
|
||||
const gv = gridRef.current?.gridView as
|
||||
| {
|
||||
getDataSource?: () => {
|
||||
getRowCount(): number;
|
||||
getValue(r: number, f: string): unknown;
|
||||
};
|
||||
}
|
||||
getDataSource?: () => {
|
||||
getRowCount(): number;
|
||||
getValue(r: number, f: string): unknown;
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
if (!gv?.getDataSource) return [];
|
||||
const ds = gv.getDataSource();
|
||||
@@ -1189,29 +1189,37 @@ const DataGrid = ({
|
||||
style={{ display: "none" }}
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
<div className="flex items-center justify-end gap-[0.6rem] px-[1.2rem]">
|
||||
<div className={`flex items-center ${statusInfo ? 'justify-between' : 'justify-end'} gap-[0.6rem] pr-[1.2rem]`}>
|
||||
{statusInfo && (
|
||||
<div className="data-grid-status-bubble flex flex-wrap items-center gap-x-4 gap-y-1">
|
||||
<span>
|
||||
진행상황:{" "}
|
||||
{statusInfo.laeSbmsnSttsCd === null ||
|
||||
statusInfo.laeSbmsnSttsCd === "0"
|
||||
statusInfo.laeSbmsnSttsCd === "0"
|
||||
? "미작성"
|
||||
: statusInfo.laeSbmsnSttsCd === "1"
|
||||
? "작성중"
|
||||
: statusInfo.laeSbmsnSttsCd === "2"
|
||||
? "제출"
|
||||
: statusInfo.laeSbmsnSttsCd === "3"
|
||||
? "승인"
|
||||
: statusInfo.laeSbmsnSttsCd === "4"
|
||||
? "반려"
|
||||
: "검증중"}
|
||||
? <span className="animate-pulse">작성중</span>
|
||||
: statusInfo.laeSbmsnSttsCd === "2"
|
||||
? <span className="!text-[#2094fa]">제출</span>
|
||||
: statusInfo.laeSbmsnSttsCd === "3"
|
||||
? <span className="!text-[#1fd078]">승인</span>
|
||||
: statusInfo.laeSbmsnSttsCd === "4"
|
||||
? (
|
||||
<span className="relative inline-flex !text-[#ff6c64] pr-3">
|
||||
반려
|
||||
<span className="absolute -right-0.5 -top-0.5 inline-flex size-[0.6125rem]">
|
||||
<span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-[#ff6c64] opacity-75" />
|
||||
<span className="relative inline-flex size-[0.6125rem] rounded-full bg-[#ff6c64]" />
|
||||
</span>
|
||||
</span>
|
||||
)
|
||||
: <span className="animate-pulse">검증중</span>}
|
||||
</span>
|
||||
<span>
|
||||
제출일:{" "}
|
||||
{statusInfo.laeSbmsnYmd
|
||||
? statusInfo.laeSbmsnYmd.length === 8 &&
|
||||
/^\d{8}$/.test(statusInfo.laeSbmsnYmd)
|
||||
/^\d{8}$/.test(statusInfo.laeSbmsnYmd)
|
||||
? `${statusInfo.laeSbmsnYmd.slice(0, 4)}-${statusInfo.laeSbmsnYmd.slice(4, 6)}-${statusInfo.laeSbmsnYmd.slice(6, 8)}`
|
||||
: statusInfo.laeSbmsnYmd
|
||||
: "미제출"}
|
||||
@@ -1228,26 +1236,28 @@ const DataGrid = ({
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{isExcelImport && (
|
||||
<Button
|
||||
className="h-[3.2rem] w-[96px] bg-gradient-green px-6 hover:bg-gradient-green-hover"
|
||||
type="button"
|
||||
onClick={importExcel}
|
||||
>
|
||||
<i className="diveicon di-file-excel" />
|
||||
<span>가져오기</span>
|
||||
</Button>
|
||||
)}
|
||||
{isExcelExport && (
|
||||
<Button
|
||||
className="h-[3.2rem] w-[96px] bg-gradient-green px-6 hover:bg-gradient-green-hover"
|
||||
type="button"
|
||||
onClick={exportExcel}
|
||||
>
|
||||
<i className="diveicon di-file-excel" />
|
||||
<span>내보내기</span>
|
||||
</Button>
|
||||
)}
|
||||
<div className="flex items-center gap-[0.6rem]">
|
||||
{isExcelImport && (
|
||||
<Button
|
||||
className="h-[3.2rem] w-[96px] bg-gradient-green px-6 hover:bg-gradient-green-hover"
|
||||
type="button"
|
||||
onClick={importExcel}
|
||||
>
|
||||
<i className="diveicon di-file-excel" />
|
||||
<span>가져오기</span>
|
||||
</Button>
|
||||
)}
|
||||
{isExcelExport && (
|
||||
<Button
|
||||
className="h-[3.2rem] w-[96px] bg-gradient-green px-6 hover:bg-gradient-green-hover"
|
||||
type="button"
|
||||
onClick={exportExcel}
|
||||
>
|
||||
<i className="diveicon di-file-excel" />
|
||||
<span>내보내기</span>
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ height: `${gridHeight}vh` }}>
|
||||
<RealGridReact
|
||||
@@ -1266,24 +1276,24 @@ const DataGrid = ({
|
||||
) => boolean;
|
||||
}
|
||||
).onSorting = enableSort
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
const dataProvider = gridRef.current
|
||||
?.dataProvider as unknown as
|
||||
| {
|
||||
setFields?(f: unknown[]): void;
|
||||
setRows?(
|
||||
r: Record<string, string | number>[],
|
||||
): void;
|
||||
getJsonRow?(
|
||||
r: number,
|
||||
): Record<string, unknown>;
|
||||
}
|
||||
setFields?(f: unknown[]): void;
|
||||
setRows?(
|
||||
r: Record<string, string | number>[],
|
||||
): void;
|
||||
getJsonRow?(
|
||||
r: number,
|
||||
): Record<string, unknown>;
|
||||
}
|
||||
| undefined;
|
||||
if (dataProvider?.setFields) {
|
||||
dataProvider.setFields(
|
||||
@@ -1436,14 +1446,14 @@ const DataGrid = ({
|
||||
})}
|
||||
footer={
|
||||
column.footer &&
|
||||
!Array.isArray(column.footer)
|
||||
!Array.isArray(column.footer)
|
||||
? {
|
||||
text: column.footer.text,
|
||||
expression:
|
||||
column.footer.expression,
|
||||
numberFormat:
|
||||
column.footer.numberFormat,
|
||||
}
|
||||
text: column.footer.text,
|
||||
expression:
|
||||
column.footer.expression,
|
||||
numberFormat:
|
||||
column.footer.numberFormat,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
mergeRule={
|
||||
|
||||
@@ -4,15 +4,20 @@ import { useState } from "react";
|
||||
import { Button, Dialog, DialogContent, DialogHeader, DialogTitle } from "@common/components";
|
||||
|
||||
import SidoSggFacilityNameSearchForm from "./SidoSggFacilityNameSearchForm";
|
||||
import type { SearchFormValues } from "../type/SearchForm.type";
|
||||
|
||||
type GridTopActionButtonProps = {
|
||||
text: string;
|
||||
onClick?: (helpers: { openDialog: (title?: string) => void; closeDialog: () => void }) => void;
|
||||
/** 상위 화면 검색 통계연도 — 시설 조회 다이얼로그에 전달 */
|
||||
statsYr?: string;
|
||||
/** 상위 화면 최근 검색조건 */
|
||||
initialSearchValues?: Pick<SearchFormValues, "sido" | "gugun" | "bsnmCd"> | null;
|
||||
/** 다이얼로그 저장 성공 후 부모 갱신 */
|
||||
onSaveSuccess?: () => Promise<void> | void;
|
||||
};
|
||||
|
||||
const GridTopActionButton = ({ text, onClick, statsYr }: GridTopActionButtonProps) => {
|
||||
const GridTopActionButton = ({ text, onClick, statsYr, initialSearchValues, onSaveSuccess }: GridTopActionButtonProps) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [title, setTitle] = useState(text);
|
||||
|
||||
@@ -41,7 +46,11 @@ const GridTopActionButton = ({ text, onClick, statsYr }: GridTopActionButtonProp
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
</DialogHeader>
|
||||
<SidoSggFacilityNameSearchForm statsYr={statsYr} />
|
||||
<SidoSggFacilityNameSearchForm
|
||||
statsYr={statsYr}
|
||||
initialSearchValues={initialSearchValues}
|
||||
onSaveSuccess={onSaveSuccess}
|
||||
/>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
|
||||
@@ -89,6 +89,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
fctName: props.defaultValues?.fctName || "",
|
||||
bsnmCd: props.defaultValues?.bsnmCd || "",
|
||||
isDetail: false,
|
||||
isSummary: props.defaultValues?.isSummary || "",
|
||||
});
|
||||
|
||||
const sggKey: [string, string, string, string] | null =
|
||||
@@ -132,6 +133,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
fctName: "",
|
||||
bsnmCd: "",
|
||||
isDetail: false,
|
||||
isSummary: "",
|
||||
};
|
||||
setValues(resetValues);
|
||||
props.onReset?.();
|
||||
@@ -153,7 +155,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
const selectedBsnm =
|
||||
value === "ALL"
|
||||
? sidoList?.data.sidoList.find((v) => v.sido === values.sido)
|
||||
?.bsnmCd || ""
|
||||
?.bsnmCd || ""
|
||||
: listForBsnm.find((v) => v.gugun === value)?.bsnmCd || "";
|
||||
|
||||
setValues((prev) => ({
|
||||
@@ -248,12 +250,35 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
</Select>
|
||||
</div>
|
||||
)}
|
||||
{mergedProps.fctName && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label
|
||||
htmlFor="fctNmSearchInput"
|
||||
className="mr-2 text-label"
|
||||
>
|
||||
시설명
|
||||
</Label>
|
||||
<Input
|
||||
className="mr-4 h-[3.2rem] w-[14rem] rounded-sm !text-[1.3rem]"
|
||||
id="fctNmSearchInput"
|
||||
value={values.fctName}
|
||||
onChange={(e) =>
|
||||
setValues({
|
||||
...values,
|
||||
fctName: e.target.value,
|
||||
})
|
||||
}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{mergedProps.isDetail && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">
|
||||
<Label className="text-label cursor-pointer" htmlFor="isDetail">
|
||||
세부 데이터 포함
|
||||
</Label>
|
||||
<Checkbox
|
||||
id="isDetail"
|
||||
checked={values.isDetail}
|
||||
onCheckedChange={(value) =>
|
||||
setValues({
|
||||
@@ -264,6 +289,30 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{mergedProps.isSummary && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label cursor-pointer">
|
||||
요약표 포함
|
||||
</Label>
|
||||
<Select
|
||||
value={values.isSummary}
|
||||
onValueChange={(value) =>
|
||||
setValues({ ...values, isSummary: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-[10rem]">
|
||||
<SelectValue placeholder="선택 안함"></SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ALL">선택 안함</SelectItem>
|
||||
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((i) => (
|
||||
<SelectItem value={i.toString()} key={i.toString()}>{`${i}개년`}</SelectItem>
|
||||
))
|
||||
}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
)}
|
||||
{mergedProps.order && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">차수</Label>
|
||||
@@ -296,43 +345,6 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{(mergedProps.fctName || mergedProps.userMenual) && (
|
||||
<div className="flex items-center p-2">
|
||||
{mergedProps.fctName && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label
|
||||
htmlFor="fctNmSearchInput"
|
||||
className="mr-2 text-label"
|
||||
>
|
||||
시설명
|
||||
</Label>
|
||||
<Input
|
||||
className="mr-4 h-[3.2rem] w-[14rem] rounded-sm !text-[1.3rem]"
|
||||
id="fctNmSearchInput"
|
||||
value={values.fctName}
|
||||
onChange={(e) =>
|
||||
setValues({
|
||||
...values,
|
||||
fctName: e.target.value,
|
||||
})
|
||||
}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{mergedProps.userMenual && (
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<Button
|
||||
className="h-[3.2rem] w-[124px]"
|
||||
type="button"
|
||||
>
|
||||
<i className="diveicon di-person-fill" />
|
||||
사용자 메뉴얼
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import useSWR from "swr";
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
@@ -29,8 +29,13 @@ import type { ColumnInfo } from "../type/DataGrid.type";
|
||||
import type {
|
||||
SeweragePipeFacilitiesListRequest,
|
||||
SeweragePipeFacilityAdminAreaListRequest,
|
||||
SeweragePipeFactConnectionSaveRequest,
|
||||
SeweragePipeFactConnectionSaveItem,
|
||||
} from "@/entities/statistics/model/input/statistics-sewage-pipe-input-interface";
|
||||
import { statisticsInputSewPipeApiService } from "@/entities/statistics/api/input/statistics-sewage-pipe-input-service";
|
||||
import type { SearchFormValues } from "../type/SearchForm.type";
|
||||
import { doNameList } from "../util/column/input/DoList";
|
||||
import { getUserInfo } from "../../../../../packages/common/components/src/api";
|
||||
|
||||
/** 다이얼로그 좌측: 처리시설 정보 (순번 없음) */
|
||||
const treatmentFacilityColumnInfo: ColumnInfo = {
|
||||
@@ -48,21 +53,35 @@ const treatmentFacilityColumnInfo: ColumnInfo = {
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "fctNm",
|
||||
fieldName: "fctNm",
|
||||
name: "fcltNm",
|
||||
fieldName: "fcltNm",
|
||||
header: { text: "시설명" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "fctCpc",
|
||||
fieldName: "fctCpc",
|
||||
name: "fcltCd",
|
||||
fieldName: "fcltCd",
|
||||
header: { text: "시설코드" },
|
||||
editable: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
name: "fcltSn",
|
||||
fieldName: "fcltSn",
|
||||
header: { text: "시설일련번호" },
|
||||
editable: false,
|
||||
visible: false,
|
||||
},
|
||||
{
|
||||
name: "fcltCpct",
|
||||
fieldName: "fcltCpct",
|
||||
header: { text: "시설용량(m³/일)" },
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0",
|
||||
editable: false,
|
||||
},
|
||||
],
|
||||
columnLayout: ["ctpvNm", "sggNm", "fctNm", "fctCpc"],
|
||||
columnLayout: ["ctpvNm", "sggNm", "fcltNm", "fcltCpct", "fcltCd"],
|
||||
};
|
||||
|
||||
/** 다이얼로그 우측: 행정구역 정보 (순번 없음, 헤더 체크박스는 showHeaderCheckbox) */
|
||||
@@ -103,12 +122,26 @@ const getSggAllListFetcher = async (
|
||||
type SidoSggFacilityNameSearchFormProps = {
|
||||
/** 상위(SewagePipeInp 등) 검색 조건의 통계연도 — facilitiesList 등 API 필수값 */
|
||||
statsYr?: string;
|
||||
/** 상위(SewagePipeInp) 마지막 검색 조건 */
|
||||
initialSearchValues?: Pick<SearchFormValues, "sido" | "gugun" | "bsnmCd"> | null;
|
||||
/** 저장 성공 후 부모 탭 데이터 재조회 훅 */
|
||||
onSaveSuccess?: () => Promise<void> | void;
|
||||
};
|
||||
|
||||
const SidoSggFacilityNameSearchForm = ({
|
||||
statsYr,
|
||||
initialSearchValues,
|
||||
onSaveSuccess,
|
||||
}: SidoSggFacilityNameSearchFormProps) => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const initialSidoValue =
|
||||
initialSearchValues?.sido && initialSearchValues.sido !== "ALL"
|
||||
? initialSearchValues.sido
|
||||
: "ALL";
|
||||
const initialGugunValue =
|
||||
initialSearchValues?.gugun && initialSearchValues.gugun !== "ALL"
|
||||
? initialSearchValues.gugun
|
||||
: "ALL";
|
||||
|
||||
const { data: sidoList } = useSWR<ApiResponse<SearchCondition>>(
|
||||
"sido-list",
|
||||
@@ -134,9 +167,9 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
},
|
||||
);
|
||||
|
||||
const [sido, setSido] = useState<string>("ALL");
|
||||
const [gugun, setGugun] = useState<string>("ALL");
|
||||
const [fctNm, setFctNm] = useState<string>("");
|
||||
const [sido, setSido] = useState<string>(initialSidoValue);
|
||||
const [gugun, setGugun] = useState<string>(initialGugunValue);
|
||||
const [fcltNm, setFcltNm] = useState<string>("");
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
const [treatmentFacilityRows, setTreatmentFacilityRows] = useState<
|
||||
@@ -145,6 +178,10 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
const [adminRegionRows, setAdminRegionRows] = useState<
|
||||
Record<string, string | number>[]
|
||||
>([]);
|
||||
const [selectedFacilityRow, setSelectedFacilityRow] = useState<
|
||||
Record<string, string | number> | null
|
||||
>(null);
|
||||
const didAutoFetchRef = useRef(false);
|
||||
|
||||
const sggKey: [string, string] | null =
|
||||
sido && sido !== "ALL" ? ["sgg-all", sido] : null;
|
||||
@@ -198,7 +235,7 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
alert("시도를 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
const trimmedFclty = fctNm.trim();
|
||||
const trimmedFclty = fcltNm.trim();
|
||||
|
||||
const sewerBzmnCd = resolveSewerBzmnCd();
|
||||
|
||||
@@ -225,13 +262,15 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
list.map((item) => ({
|
||||
ctpvNm: item.ctpvNm,
|
||||
sggNm: item.sggNm,
|
||||
fctNm: item.bscFctNm,
|
||||
fctCpc: item.fctCpc,
|
||||
bscFctCd: item.bscFctCd,
|
||||
fcltNm: item.fcltNm,
|
||||
fcltCpct: item.fcltCpct,
|
||||
fcltCd: item.fcltCd,
|
||||
fcltSn: item.fcltSn,
|
||||
admdstCd: item.admdstCd,
|
||||
statsYr: item.statsYr,
|
||||
})),
|
||||
);
|
||||
setSelectedFacilityRow(null);
|
||||
setAdminRegionRows([]);
|
||||
} catch {
|
||||
alert("처리시설 목록 조회 중 오류가 발생했습니다.");
|
||||
@@ -247,7 +286,7 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
alert("상단에서 통계연도로 조회한 뒤 이용해 주세요.");
|
||||
return;
|
||||
}
|
||||
const swtrmtFcltCd = String(row.bscFctCd ?? "").trim();
|
||||
const swtrmtFcltCd = String(row.fcltCd ?? "").trim();
|
||||
if (!swtrmtFcltCd) {
|
||||
alert("처리시설 코드가 없습니다.");
|
||||
return;
|
||||
@@ -261,13 +300,14 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
const params: SeweragePipeFacilityAdminAreaListRequest = {
|
||||
statsYr: statsYr.trim(),
|
||||
swtrmtFcltCd,
|
||||
sewerBzmnCd: String(row.admdstCd ?? "").trim(),
|
||||
sewerBzmnCd: initialSearchValues?.bsnmCd || '',
|
||||
ctpvNm,
|
||||
sggNm,
|
||||
...(doNameList.includes(ctpvNm) ? { sggNm } : {}),
|
||||
};
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
setSelectedFacilityRow(row);
|
||||
const response =
|
||||
await statisticsInputSewPipeApiService.getFacilityAdminAreaList(
|
||||
params,
|
||||
@@ -283,6 +323,8 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
sggNm: item.sggNm,
|
||||
emdNm: item.admdstNm,
|
||||
admdstCd: item.admdstCd,
|
||||
isConnection: item.isConnection,
|
||||
__checked: item.isConnection === "1" ? "1" : "0",
|
||||
})),
|
||||
);
|
||||
} catch {
|
||||
@@ -293,9 +335,172 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
};
|
||||
|
||||
const handleSaveAdminRegions = () => {
|
||||
alert("저장 API 연동 예정입니다.");
|
||||
if (!statsYr?.trim()) {
|
||||
alert("상단에서 통계연도로 조회한 뒤 이용해 주세요.");
|
||||
return;
|
||||
}
|
||||
if (!selectedFacilityRow) {
|
||||
alert("처리시설을 먼저 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const hasChanged = adminRegionRows.some(
|
||||
(row) =>
|
||||
(row.__checked === "1" && row.isConnection !== "1") ||
|
||||
(row.__checked !== "1" && row.isConnection === "1"),
|
||||
);
|
||||
|
||||
const saveList: SeweragePipeFactConnectionSaveItem[] = adminRegionRows
|
||||
.filter((row) => row.__checked === "1")
|
||||
.map((row) => ({
|
||||
admdstCd: String(row.admdstCd ?? ""),
|
||||
admdstNm: String(row.emdNm ?? ""),
|
||||
}))
|
||||
.filter((row) => row.admdstCd && row.admdstNm);
|
||||
|
||||
const deleteList = adminRegionRows
|
||||
.filter((row) => row.__checked !== "1" && row.isConnection === "1")
|
||||
.map((row) => String(row.admdstCd ?? ""))
|
||||
.filter(Boolean);
|
||||
|
||||
if (!hasChanged) {
|
||||
alert("변경된 연결 정보가 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const run = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const userInfo = await getUserInfo();
|
||||
const request: SeweragePipeFactConnectionSaveRequest = {
|
||||
ctpvNm: String(selectedFacilityRow.ctpvNm ?? ""),
|
||||
sggNm: String(selectedFacilityRow.sggNm ?? ""),
|
||||
fcltSn: String(selectedFacilityRow.fcltSn ?? ""),
|
||||
statsYr: statsYr.trim(),
|
||||
swtrmtFcltCd: String(selectedFacilityRow.fcltCd ?? ""),
|
||||
swtrmtFcltNm: String(selectedFacilityRow.fcltNm ?? ""),
|
||||
prcsFcltCpct: Number(selectedFacilityRow.fcltCpct ?? 0),
|
||||
sewerBzmnCd: initialSearchValues?.bsnmCd?.trim() ?? "",
|
||||
userId: userInfo.userUnqId,
|
||||
saveList,
|
||||
deleteList,
|
||||
};
|
||||
|
||||
const response =
|
||||
await statisticsInputSewPipeApiService.saveFactConnection(
|
||||
request,
|
||||
);
|
||||
|
||||
if (response.status !== "success") {
|
||||
alert(response.message ?? "연결관계 저장에 실패했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
setAdminRegionRows((prev) =>
|
||||
prev.map((row) => ({
|
||||
...row,
|
||||
isConnection: row.__checked === "1" ? "1" : "0",
|
||||
})),
|
||||
);
|
||||
await onSaveSuccess?.();
|
||||
alert("저장되었습니다.");
|
||||
} catch {
|
||||
alert("연결관계 저장 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
void run();
|
||||
};
|
||||
|
||||
const handleAdminRegionItemChecked = (
|
||||
itemIndex: number,
|
||||
checked: boolean,
|
||||
) => {
|
||||
setAdminRegionRows((prev) =>
|
||||
prev.map((row, idx) =>
|
||||
idx === itemIndex
|
||||
? { ...row, __checked: checked ? "1" : "0" }
|
||||
: row,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const handleAdminRegionItemAllChecked = (checked: boolean) => {
|
||||
setAdminRegionRows((prev) =>
|
||||
prev.map((row) => ({ ...row, __checked: checked ? "1" : "0" })),
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!initialSearchValues?.sido || initialSearchValues.sido === "ALL") return;
|
||||
setSido(initialSearchValues.sido);
|
||||
setGugun(
|
||||
initialSearchValues.gugun && initialSearchValues.gugun !== "ALL"
|
||||
? initialSearchValues.gugun
|
||||
: "ALL",
|
||||
);
|
||||
}, [initialSearchValues?.sido, initialSearchValues?.gugun]);
|
||||
|
||||
useEffect(() => {
|
||||
if (didAutoFetchRef.current) return;
|
||||
if (!statsYr?.trim()) return;
|
||||
if (!initialSearchValues?.sido || initialSearchValues.sido === "ALL") return;
|
||||
|
||||
const nextSido = initialSearchValues.sido;
|
||||
const nextGugun =
|
||||
initialSearchValues.gugun && initialSearchValues.gugun !== "ALL"
|
||||
? initialSearchValues.gugun
|
||||
: "ALL";
|
||||
|
||||
didAutoFetchRef.current = true;
|
||||
setSido(nextSido);
|
||||
setGugun(nextGugun);
|
||||
|
||||
const params: SeweragePipeFacilitiesListRequest = {
|
||||
statsYr: statsYr.trim(),
|
||||
...(initialSearchValues.bsnmCd?.trim()
|
||||
? { sewerBzmnCd: initialSearchValues.bsnmCd.trim() }
|
||||
: {}),
|
||||
ctpvNm: nextSido,
|
||||
...(nextGugun !== "ALL" ? { sggNm: nextGugun } : {}),
|
||||
};
|
||||
|
||||
const run = async () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response =
|
||||
await statisticsInputSewPipeApiService.getFacilitiesList(params);
|
||||
if (response.status !== "success") {
|
||||
alert(response.message ?? "처리시설 목록 조회에 실패했습니다.");
|
||||
return;
|
||||
}
|
||||
const list = response.data ?? [];
|
||||
setTreatmentFacilityRows(
|
||||
list.map((item) => ({
|
||||
ctpvNm: item.ctpvNm,
|
||||
sggNm: item.sggNm,
|
||||
fcltNm: item.fcltNm,
|
||||
fcltCpct: item.fcltCpct,
|
||||
fcltCd: item.fcltCd,
|
||||
fcltSn: item.fcltSn,
|
||||
admdstCd: item.admdstCd,
|
||||
statsYr: item.statsYr,
|
||||
})),
|
||||
);
|
||||
setSelectedFacilityRow(null);
|
||||
setAdminRegionRows([]);
|
||||
} catch {
|
||||
alert("처리시설 목록 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
void run();
|
||||
}, [statsYr, initialSearchValues, alert]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4 pt-2">
|
||||
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
|
||||
@@ -346,8 +551,8 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
<Label className="shrink-0 text-label">시설명</Label>
|
||||
<Input
|
||||
className="min-w-[12rem] flex-1"
|
||||
value={fctNm}
|
||||
onChange={(e) => setFctNm(e.target.value)}
|
||||
value={fcltNm}
|
||||
onChange={(e) => setFcltNm(e.target.value)}
|
||||
placeholder="시설명 입력"
|
||||
/>
|
||||
</div>
|
||||
@@ -396,6 +601,8 @@ const SidoSggFacilityNameSearchForm = ({
|
||||
rowData={adminRegionRows}
|
||||
setRowData={setAdminRegionRows}
|
||||
showHeaderCheckbox
|
||||
onItemChecked={handleAdminRegionItemChecked}
|
||||
onItemAllChecked={handleAdminRegionItemAllChecked}
|
||||
compactFullWidth
|
||||
// compactGridHeightClass="h-[min(40vh,28rem)] min-h-[16rem]"
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
type Dispatch,
|
||||
type MutableRefObject,
|
||||
type SetStateAction,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import type { RealGridReact } from "realgrid-react";
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
@@ -8,25 +19,477 @@ import {
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
LoadingWithAnimation,
|
||||
} from "@common/components";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import { VerificationResultHistoryPagination } from "@/components/module/VerificationResultHistoryPagination";
|
||||
import type { CellEditedCallbackParams, ColumnInfo } from "@/components/type/DataGrid.type";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { VerificationResultListRequest, VerificationResultReportItem } from "@/entities/statistics/model/statistics-interface";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
|
||||
type VerificationResultGridRow = Record<string, string | number>;
|
||||
|
||||
export type VerificationExceptionSubmitItem = {
|
||||
vrfcSn: number;
|
||||
prcsOpnnExpln: string;
|
||||
};
|
||||
|
||||
type GridViewWithCheckItem = {
|
||||
checkItem?: (itemIndex: number, checked: boolean, exclusive?: boolean) => void;
|
||||
};
|
||||
|
||||
function setRowCheckByItemIndex(
|
||||
gridRef: MutableRefObject<RealGridReact | null>,
|
||||
itemIndex: number,
|
||||
checked: boolean,
|
||||
) {
|
||||
const gv = gridRef.current?.gridView as GridViewWithCheckItem | undefined;
|
||||
try {
|
||||
gv?.checkItem?.(itemIndex, checked, false);
|
||||
} catch {
|
||||
/* RealGrid 체크 API 미지원 등 */
|
||||
}
|
||||
}
|
||||
|
||||
const PRCS_YN_LABEL: Record<string, string> = {
|
||||
"0": "미통과",
|
||||
"1": "통과",
|
||||
"2": "예외처리",
|
||||
"3": "반려",
|
||||
};
|
||||
|
||||
/** History와 동일 + 편집 가능한 처리의견(예외사유, API 필드명 `prcsOpnnExpln`과 동일) */
|
||||
const verificationSubmitResultColumnInfo: ColumnInfo = {
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "vrfcTrgtNm", fieldName: "vrfcTrgtNm", header: { text: "검증대상" }, editable: false },
|
||||
{ name: "rsnExpln", fieldName: "rsnExpln", header: { text: "사유" }, editable: false },
|
||||
{ name: "nowVlCn", fieldName: "nowVlCn", header: { text: "입력값" }, editable: false },
|
||||
{ name: "compVlCn", fieldName: "compVlCn", header: { text: "기준값" }, editable: false },
|
||||
{ name: "prcsYn", fieldName: "prcsYn", header: { text: "처리여부" }, editable: false },
|
||||
{ name: "pbcpAprvYn", fieldName: "pbcpAprvYn", header: { text: "공단승인여부" }, editable: false },
|
||||
{ name: "regDt", fieldName: "regDt", header: { text: "등록일시" }, editable: false },
|
||||
{ name: "mdfcnDt", fieldName: "mdfcnDt", header: { text: "갱신일시" }, editable: false },
|
||||
{
|
||||
name: "prcsOpnnExpln",
|
||||
fieldName: "prcsOpnnExpln",
|
||||
header: { text: "예외사유" },
|
||||
editable: true,
|
||||
},
|
||||
],
|
||||
columnLayout: [
|
||||
"ctpvNm",
|
||||
"sggNm",
|
||||
"vrfcTrgtNm",
|
||||
"rsnExpln",
|
||||
"nowVlCn",
|
||||
"compVlCn",
|
||||
"prcsYn",
|
||||
"pbcpAprvYn",
|
||||
"regDt",
|
||||
"mdfcnDt",
|
||||
"prcsOpnnExpln",
|
||||
],
|
||||
};
|
||||
|
||||
export interface VerificationResultDialogQueryContext {
|
||||
sewerBzmnCd: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
statsYr: string;
|
||||
statsCd: string;
|
||||
}
|
||||
|
||||
export interface VerificationResultDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
queryContext?: VerificationResultDialogQueryContext | null;
|
||||
title?: string;
|
||||
emptyMessage?: string;
|
||||
}
|
||||
|
||||
export function VerificationResultDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
queryContext,
|
||||
title = "검증 결과",
|
||||
emptyMessage = "표시할 검증 결과가 없습니다.",
|
||||
}: VerificationResultDialogProps) {
|
||||
/** 부모가 매 렌더마다 새 객체를 넘기면 queryContext 참조만 바뀌어 loadInitial이 재실행되므로 필드 값 기준으로 안정화 */
|
||||
const stableQueryContext = useMemo((): VerificationResultDialogQueryContext | null => {
|
||||
if (!queryContext) return null;
|
||||
return queryContext;
|
||||
}, [
|
||||
queryContext?.sewerBzmnCd,
|
||||
queryContext?.ctpvNm,
|
||||
queryContext?.sggNm,
|
||||
queryContext?.statsYr,
|
||||
queryContext?.statsCd,
|
||||
]);
|
||||
|
||||
const [normalPageIndex, setNormalPageIndex] = useState(0);
|
||||
const [imrPageIndex, setImrPageIndex] = useState(0);
|
||||
const [normalPageCount, setNormalPageCount] = useState(1);
|
||||
const [imrPageCount, setImrPageCount] = useState(1);
|
||||
const [normalLoading, setNormalLoading] = useState(false);
|
||||
const [imrLoading, setImrLoading] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
|
||||
const [normalRows, setNormalRows] = useState<VerificationResultGridRow[]>([]);
|
||||
const [imrRows, setImrRows] = useState<VerificationResultGridRow[]>([]);
|
||||
const [normalCheckedIndices, setNormalCheckedIndices] = useState<Set<number>>(
|
||||
() => new Set(),
|
||||
);
|
||||
const [imrCheckedIndices, setImrCheckedIndices] = useState<Set<number>>(() => new Set());
|
||||
|
||||
const normalGridRef = useRef<RealGridReact | null>(null);
|
||||
const imrGridRef = useRef<RealGridReact | null>(null);
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
|
||||
const onNormalPrcsOpnnExplnEdited = useCallback((params: CellEditedCallbackParams) => {
|
||||
if (params.fieldName !== "prcsOpnnExpln") return;
|
||||
const text = String(params.newValue ?? "");
|
||||
const hasValue = text.trim().length > 0;
|
||||
/** DataGrid는 onCellEdited 시 React rowData를 갱신하지 않아, 제출용 상태를 여기서 맞춤 */
|
||||
setNormalRows((prev) => {
|
||||
const next = [...prev];
|
||||
const row = next[params.itemIndex];
|
||||
if (!row) return prev;
|
||||
next[params.itemIndex] = { ...row, prcsOpnnExpln: text };
|
||||
return next;
|
||||
});
|
||||
setRowCheckByItemIndex(normalGridRef, params.itemIndex, hasValue);
|
||||
setNormalCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (hasValue) next.add(params.itemIndex);
|
||||
else next.delete(params.itemIndex);
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const onImrPrcsOpnnExplnEdited = useCallback((params: CellEditedCallbackParams) => {
|
||||
if (params.fieldName !== "prcsOpnnExpln") return;
|
||||
const text = String(params.newValue ?? "");
|
||||
const hasValue = text.trim().length > 0;
|
||||
setImrRows((prev) => {
|
||||
const next = [...prev];
|
||||
const row = next[params.itemIndex];
|
||||
if (!row) return prev;
|
||||
next[params.itemIndex] = { ...row, prcsOpnnExpln: text };
|
||||
return next;
|
||||
});
|
||||
setRowCheckByItemIndex(imrGridRef, params.itemIndex, hasValue);
|
||||
setImrCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (hasValue) next.add(params.itemIndex);
|
||||
else next.delete(params.itemIndex);
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
|
||||
const resetState = useCallback(() => {
|
||||
setNormalPageIndex(0);
|
||||
setImrPageIndex(0);
|
||||
setNormalPageCount(1);
|
||||
setImrPageCount(1);
|
||||
setNormalLoading(false);
|
||||
setImrLoading(false);
|
||||
setErrorMessage(null);
|
||||
setNormalRows([]);
|
||||
setImrRows([]);
|
||||
setNormalCheckedIndices(new Set());
|
||||
setImrCheckedIndices(new Set());
|
||||
}, []);
|
||||
|
||||
const mapItemToRow = useCallback((item: VerificationResultReportItem): VerificationResultGridRow => {
|
||||
return {
|
||||
vrfcSn: item.vrfcSn,
|
||||
ctpvNm: item.ctpvNm,
|
||||
sggNm: item.sggNm,
|
||||
vrfcTrgtNm: item.vrfcTrgtNm,
|
||||
rsnExpln: item.rsnExpln,
|
||||
nowVlCn: item.nowVlCn ?? "-",
|
||||
compVlCn: item.compVlCn ?? "-",
|
||||
prcsYn: PRCS_YN_LABEL[item.prcsYn] ?? item.prcsYn,
|
||||
pbcpAprvYn: item.pbcpAprvYn,
|
||||
regDt: (item.regDt ?? "").slice(0, 16),
|
||||
mdfcnDt: (item.mdfcnDt ?? "").slice(0, 16),
|
||||
prcsOpnnExpln: item.prcsOpnnExpln ?? "",
|
||||
};
|
||||
}, []);
|
||||
|
||||
const fetchVerificationResultPage = useCallback(
|
||||
async (vrfcMthdCd: "NV" | "IMR", pageIndex: number) => {
|
||||
if (!stableQueryContext) return null;
|
||||
const param: VerificationResultListRequest = {
|
||||
sewerBzmnCd: stableQueryContext.sewerBzmnCd,
|
||||
ctpvNm: stableQueryContext.ctpvNm,
|
||||
sggNm: stableQueryContext.sggNm,
|
||||
statsYr: stableQueryContext.statsYr,
|
||||
statsCd: stableQueryContext.statsCd,
|
||||
pbcpAprvYn: "N",
|
||||
vrfcMthdCd,
|
||||
prcsYnList: "0",
|
||||
page: pageIndex + 1,
|
||||
size: 10000,
|
||||
};
|
||||
return statisticsApi.getVerificationResultList(param);
|
||||
},
|
||||
[stableQueryContext],
|
||||
);
|
||||
|
||||
const loadInitial = useCallback(async () => {
|
||||
if (!stableQueryContext) {
|
||||
setErrorMessage("조회 조건이 없어 검증 결과를 불러올 수 없습니다.");
|
||||
return;
|
||||
}
|
||||
setErrorMessage(null);
|
||||
setNormalLoading(true);
|
||||
setImrLoading(true);
|
||||
setNormalPageIndex(0);
|
||||
setImrPageIndex(0);
|
||||
try {
|
||||
const [nvRes, imrRes] = await Promise.all([
|
||||
fetchVerificationResultPage("NV", 0),
|
||||
fetchVerificationResultPage("IMR", 0),
|
||||
]);
|
||||
const nvList = nvRes?.data?.verifyResultList ?? [];
|
||||
const imrList = imrRes?.data?.verifyResultList ?? [];
|
||||
setNormalRows(nvList.map(mapItemToRow));
|
||||
setImrRows(imrList.map(mapItemToRow));
|
||||
setNormalPageCount(nvRes?.data?.pageInfo?.totalPages ?? 1);
|
||||
setImrPageCount(imrRes?.data?.pageInfo?.totalPages ?? 1);
|
||||
} catch {
|
||||
setNormalRows([]);
|
||||
setImrRows([]);
|
||||
setNormalPageCount(1);
|
||||
setImrPageCount(1);
|
||||
setErrorMessage("검증 결과 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setNormalLoading(false);
|
||||
setImrLoading(false);
|
||||
setNormalCheckedIndices(new Set());
|
||||
setImrCheckedIndices(new Set());
|
||||
}
|
||||
}, [fetchVerificationResultPage, mapItemToRow, stableQueryContext]);
|
||||
|
||||
const handleNormalPageChange = useCallback(
|
||||
async (pageIndex: number) => {
|
||||
if (pageIndex === normalPageIndex || !stableQueryContext) return;
|
||||
setErrorMessage(null);
|
||||
setNormalLoading(true);
|
||||
try {
|
||||
const response = await fetchVerificationResultPage("NV", pageIndex);
|
||||
const list = response?.data?.verifyResultList ?? [];
|
||||
setNormalRows(list.map(mapItemToRow));
|
||||
setNormalPageCount(response?.data?.pageInfo?.totalPages ?? 1);
|
||||
setNormalPageIndex(pageIndex);
|
||||
} catch {
|
||||
setErrorMessage("일반검증 내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setNormalLoading(false);
|
||||
setNormalCheckedIndices(new Set());
|
||||
}
|
||||
},
|
||||
[fetchVerificationResultPage, mapItemToRow, normalPageIndex, stableQueryContext],
|
||||
);
|
||||
|
||||
const handleImrPageChange = useCallback(
|
||||
async (pageIndex: number) => {
|
||||
if (pageIndex === imrPageIndex || !stableQueryContext) return;
|
||||
setErrorMessage(null);
|
||||
setImrLoading(true);
|
||||
try {
|
||||
const response = await fetchVerificationResultPage("IMR", pageIndex);
|
||||
const list = response?.data?.verifyResultList ?? [];
|
||||
setImrRows(list.map(mapItemToRow));
|
||||
setImrPageCount(response?.data?.pageInfo?.totalPages ?? 1);
|
||||
setImrPageIndex(pageIndex);
|
||||
} catch {
|
||||
setErrorMessage("I-MR 검증내역 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setImrLoading(false);
|
||||
setImrCheckedIndices(new Set());
|
||||
}
|
||||
},
|
||||
[fetchVerificationResultPage, mapItemToRow, imrPageIndex, stableQueryContext],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
resetState();
|
||||
return;
|
||||
}
|
||||
void loadInitial();
|
||||
}, [loadInitial, open, resetState]);
|
||||
|
||||
/** 조회된 행에 예외사유 텍스트가 있으면 체크바·체크 인덱스와 맞춤 */
|
||||
useEffect(() => {
|
||||
if (normalLoading) return;
|
||||
const id = requestAnimationFrame(() => {
|
||||
setNormalCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
normalRows.forEach((row, itemIndex) => {
|
||||
const has = String(row.prcsOpnnExpln ?? "").trim().length > 0;
|
||||
setRowCheckByItemIndex(normalGridRef, itemIndex, has);
|
||||
if (has) next.add(itemIndex);
|
||||
});
|
||||
return next;
|
||||
});
|
||||
});
|
||||
return () => cancelAnimationFrame(id);
|
||||
}, [normalRows, normalLoading]);
|
||||
|
||||
useEffect(() => {
|
||||
if (imrLoading) return;
|
||||
const id = requestAnimationFrame(() => {
|
||||
setImrCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
imrRows.forEach((row, itemIndex) => {
|
||||
const has = String(row.prcsOpnnExpln ?? "").trim().length > 0;
|
||||
setRowCheckByItemIndex(imrGridRef, itemIndex, has);
|
||||
if (has) next.add(itemIndex);
|
||||
});
|
||||
return next;
|
||||
});
|
||||
});
|
||||
return () => cancelAnimationFrame(id);
|
||||
}, [imrRows, imrLoading]);
|
||||
|
||||
const handleExceptionSubmitClick = useCallback(() => {
|
||||
const payload: VerificationExceptionSubmitItem[] = [];
|
||||
const pushIfHasExpln = (row: VerificationResultGridRow | undefined) => {
|
||||
if (!row) return;
|
||||
const prcsOpnnExpln = String(row.prcsOpnnExpln ?? "").trim();
|
||||
if (!prcsOpnnExpln) return;
|
||||
payload.push({
|
||||
vrfcSn: Number(row.vrfcSn),
|
||||
prcsOpnnExpln,
|
||||
});
|
||||
};
|
||||
normalCheckedIndices.forEach((idx) => pushIfHasExpln(normalRows[idx]));
|
||||
imrCheckedIndices.forEach((idx) => pushIfHasExpln(imrRows[idx]));
|
||||
if (payload.length === 0) {
|
||||
alert("작성된 예외 제출 항목이 없습니다.");
|
||||
return;
|
||||
}
|
||||
console.log(payload);
|
||||
}, [alert, imrCheckedIndices, imrRows, normalCheckedIndices, normalRows]);
|
||||
|
||||
const renderGrid = (
|
||||
rows: VerificationResultGridRow[],
|
||||
setRows: Dispatch<SetStateAction<VerificationResultGridRow[]>>,
|
||||
pageIndex: number,
|
||||
pageCount: number,
|
||||
onPageIndexChange: (page: number) => void,
|
||||
loading: boolean,
|
||||
gridRef: MutableRefObject<RealGridReact | null>,
|
||||
onPrcsOpnnExplnCellEdited: (params: CellEditedCallbackParams) => void,
|
||||
setCheckedIndices: Dispatch<SetStateAction<Set<number>>>,
|
||||
) => {
|
||||
if (!loading && rows.length === 0) {
|
||||
return <p className="p-6 text-center text-[1.3rem] text-muted-foreground">{emptyMessage}</p>;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative space-y-2">
|
||||
<DataGrid
|
||||
columnInfo={verificationSubmitResultColumnInfo}
|
||||
rowData={rows}
|
||||
setRowData={setRows as Dispatch<SetStateAction<Record<string, string | number>[]>>}
|
||||
isExcelImport={false}
|
||||
isExcelExport={false}
|
||||
showHeaderCheckbox
|
||||
enableSort={false}
|
||||
getGridRef={gridRef}
|
||||
onCellEdited={onPrcsOpnnExplnCellEdited}
|
||||
onItemChecked={(itemIndex, checked) => {
|
||||
setCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (checked) next.add(itemIndex);
|
||||
else next.delete(itemIndex);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
onItemAllChecked={(checked) => {
|
||||
setCheckedIndices(
|
||||
checked ? new Set(rows.map((_, i) => i)) : new Set(),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
<VerificationResultHistoryPagination
|
||||
pageCount={Math.max(pageCount, 1)}
|
||||
pageIndex={Math.max(pageIndex, 0)}
|
||||
onPageIndexChange={onPageIndexChange}
|
||||
className="mx-2 mb-2"
|
||||
/>
|
||||
{loading && (
|
||||
<div className="absolute inset-0 z-10 rounded-md [data-theme='black']:bg-transparent bg-white/40 flex items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const titleSuffix = useMemo(() => {
|
||||
if (!stableQueryContext) return "";
|
||||
const sgg = stableQueryContext.sggNm?.trim() ? ` ${stableQueryContext.sggNm}` : "";
|
||||
return ` - ${stableQueryContext.statsYr} ${stableQueryContext.ctpvNm}${sgg}`;
|
||||
}, [stableQueryContext]);
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="max-w-[640px]" aria-describedby={undefined}>
|
||||
<DialogContent className="max-w-[80%]" aria-describedby={undefined}>
|
||||
<DialogHeader>
|
||||
<DialogTitle>검증 결과</DialogTitle>
|
||||
<DialogTitle>
|
||||
{title}
|
||||
{titleSuffix}
|
||||
</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="min-h-[120px]" />
|
||||
<div className="max-h-[85vh] space-y-5 overflow-auto">
|
||||
{errorMessage && (
|
||||
<p className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[1.2rem] text-destructive">
|
||||
{errorMessage}
|
||||
</p>
|
||||
)}
|
||||
<section className="rounded-md border border-border">
|
||||
<h3 className="border-b border-border px-4 py-2 text-[1.35rem] font-semibold">일반검증 내역</h3>
|
||||
{renderGrid(
|
||||
normalRows,
|
||||
setNormalRows,
|
||||
normalPageIndex,
|
||||
normalPageCount,
|
||||
handleNormalPageChange,
|
||||
normalLoading,
|
||||
normalGridRef,
|
||||
onNormalPrcsOpnnExplnEdited,
|
||||
setNormalCheckedIndices,
|
||||
)}
|
||||
</section>
|
||||
<section className="rounded-md border border-border">
|
||||
<h3 className="border-b border-border px-4 py-2 text-[1.35rem] font-semibold">I-MR 검증내역</h3>
|
||||
{renderGrid(
|
||||
imrRows,
|
||||
setImrRows,
|
||||
imrPageIndex,
|
||||
imrPageCount,
|
||||
handleImrPageChange,
|
||||
imrLoading,
|
||||
imrGridRef,
|
||||
onImrPrcsOpnnExplnEdited,
|
||||
setImrCheckedIndices,
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<Button type="button" color="primary" onClick={handleExceptionSubmitClick}>
|
||||
예외 제출
|
||||
</Button>
|
||||
<DialogClose asChild>
|
||||
<Button type="button" color="gray">
|
||||
닫기
|
||||
@@ -37,4 +500,3 @@ export function VerificationResultDialog({
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { closestCenter, DndContext } from "@dnd-kit/core";
|
||||
import { rectSortingStrategy, SortableContext } from "@dnd-kit/sortable";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { useUserStore } from "@/shared/lib";
|
||||
import { Skeleton } from "@common/components";
|
||||
|
||||
import { useDndSensors } from "@/pages/statistics/lib/hooks/use-dnd-sensors";
|
||||
import { usePanelOrder } from "@/pages/statistics/lib/hooks/use-panel-order";
|
||||
import { getInitialPanels } from "@/pages/statistics/model/panel-config";
|
||||
import { SortablePanel } from "@/pages/statistics/ui/sortable-panel";
|
||||
|
||||
interface PanelItem {
|
||||
id: string;
|
||||
component: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
function Dashboard() {
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const [initialPanels, setInitialPanels] = useState<PanelItem[]>([]);
|
||||
const [isMounted, setIsMounted] = useState(false);
|
||||
const sensors = useDndSensors();
|
||||
|
||||
const { panels, handleDragEnd } = usePanelOrder({
|
||||
initialPanels,
|
||||
storageKey: "statistics-dashboard-panels-order",
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
setIsMounted(true);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!userInfo) return;
|
||||
const initialPanels = getInitialPanels({
|
||||
dashboardParams: {
|
||||
statsYr: String(dayjs().year() - 1),
|
||||
dtlInstCd: userInfo.dtlInstCd,
|
||||
enoCd: userInfo.enoCd,
|
||||
laeSeCd: userInfo.laeSeCd,
|
||||
},
|
||||
scheduleInfoParams: {
|
||||
statsYr: String(dayjs().year() - 1),
|
||||
},
|
||||
});
|
||||
setInitialPanels(initialPanels);
|
||||
}, [userInfo]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{isMounted && initialPanels.length > 0 ? (
|
||||
<DndContext
|
||||
sensors={sensors}
|
||||
collisionDetection={closestCenter}
|
||||
onDragEnd={handleDragEnd}
|
||||
>
|
||||
<SortableContext
|
||||
items={panels.map((p) => p.id)}
|
||||
strategy={rectSortingStrategy}
|
||||
>
|
||||
<div className="grid grid-cols-1 gap-4 p-2 md:grid-cols-2 lg:grid-cols-3">
|
||||
{panels.map((panel) => (
|
||||
<SortablePanel
|
||||
key={panel.id}
|
||||
id={panel.id}
|
||||
className={panel.className}
|
||||
>
|
||||
{panel.component}
|
||||
</SortablePanel>
|
||||
))}
|
||||
</div>
|
||||
</SortableContext>
|
||||
</DndContext>
|
||||
) : (
|
||||
<div className="grid grid-cols-1 gap-4 p-2 md:grid-cols-2 lg:grid-cols-3">
|
||||
<Skeleton className="h-[20rem] rounded-xl bg-muted" />
|
||||
<Skeleton className="h-[20rem] rounded-xl bg-muted" />
|
||||
<Skeleton className="h-[20rem] rounded-xl bg-muted" />
|
||||
<Skeleton className="h-[20rem] rounded-xl bg-muted" />
|
||||
<Skeleton className="h-[20rem] rounded-xl bg-muted" />
|
||||
<Skeleton className="h-[20rem] rounded-xl bg-muted" />
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default Dashboard;
|
||||
@@ -0,0 +1,260 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback } from "react";
|
||||
import { useQueries } from "@tanstack/react-query";
|
||||
import { useTabStore as useGridTabStore } from "@rsone/components";
|
||||
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { VerificationResultReportItem } from "@/entities/statistics/model/statistics-interface";
|
||||
import { useAlertStore, useMenuStore } from "@/shared/lib";
|
||||
import {
|
||||
findMenuItemByUrlPath,
|
||||
resolveInputPageNavigationFromStatsCd,
|
||||
} from "@/shared/lib/stats-cd-input-navigation";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import {
|
||||
Badge,
|
||||
type BadgeProps,
|
||||
LoadingWithAnimation,
|
||||
} from "@common/components";
|
||||
|
||||
const TYPE_CODE_COLOR_MAP: Record<string, BadgeProps["color"]> = {
|
||||
NV: "gray",
|
||||
IMR: "red",
|
||||
};
|
||||
|
||||
const TYPE_CODE_NAME_MAP: Record<string, string> = {
|
||||
NV: "일반",
|
||||
IMR: "I-MR",
|
||||
};
|
||||
|
||||
type VerificationSelectionReportProps = {
|
||||
onClose?: () => void;
|
||||
};
|
||||
|
||||
const VerificationSelectionReport = ({
|
||||
onClose,
|
||||
}: VerificationSelectionReportProps) => {
|
||||
const menuList = useTabStore((s) => s.menuList);
|
||||
const addTab = useTabStore((s) => s.addTab);
|
||||
const setCurrentMenuInfo = useMenuStore((s) => s.setCurrentMenuInfo);
|
||||
const addTabForGrid = useGridTabStore((s) => s.addTab);
|
||||
const setPendingInputTab = useStatisticsInputFocusStore(
|
||||
(s) => s.setPendingInputTab,
|
||||
);
|
||||
const alert = useAlertStore((s) => s.setMessage);
|
||||
|
||||
const statsYr = String(dayjs().year() - 1);
|
||||
|
||||
const baseRequest = {
|
||||
statsYr,
|
||||
pbcpAprvYn: "N" as const,
|
||||
page: 1,
|
||||
size: 10000,
|
||||
prcsYnList: "0",
|
||||
};
|
||||
|
||||
const [nvQuery, imrQuery] = useQueries({
|
||||
queries: [
|
||||
{
|
||||
queryKey: [
|
||||
"verificationResultList",
|
||||
statsYr,
|
||||
"NV",
|
||||
baseRequest.pbcpAprvYn,
|
||||
baseRequest.page,
|
||||
baseRequest.size,
|
||||
baseRequest.prcsYnList,
|
||||
],
|
||||
queryFn: () =>
|
||||
statisticsApi.getVerificationResultList({
|
||||
...baseRequest,
|
||||
vrfcMthdCd: "NV",
|
||||
}),
|
||||
},
|
||||
{
|
||||
queryKey: [
|
||||
"verificationResultList",
|
||||
statsYr,
|
||||
"IMR",
|
||||
baseRequest.pbcpAprvYn,
|
||||
baseRequest.page,
|
||||
baseRequest.size,
|
||||
baseRequest.prcsYnList,
|
||||
],
|
||||
queryFn: () =>
|
||||
statisticsApi.getVerificationResultList({
|
||||
...baseRequest,
|
||||
vrfcMthdCd: "IMR",
|
||||
}),
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
const isLoading = nvQuery.isLoading || imrQuery.isLoading;
|
||||
const error = nvQuery.error ?? imrQuery.error;
|
||||
|
||||
const nvList = nvQuery.data?.data?.verifyResultList ?? [];
|
||||
const imrList = imrQuery.data?.data?.verifyResultList ?? [];
|
||||
|
||||
const openInputFromStatsCd = useCallback(
|
||||
(item: VerificationResultReportItem) => {
|
||||
const nav = resolveInputPageNavigationFromStatsCd(item.statsCd);
|
||||
if (!nav) {
|
||||
alert(
|
||||
`입력 화면으로 연결되지 않는 통계코드입니다: ${item.statsCd}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!menuList) {
|
||||
alert(
|
||||
"메뉴 정보를 불러오는 중입니다. 잠시 후 다시 시도해 주세요.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
const menu = findMenuItemByUrlPath(menuList, nav.urlPath);
|
||||
if (!menu) {
|
||||
alert(
|
||||
"해당 입력 메뉴를 찾을 수 없습니다. 메뉴 권한을 확인해 주세요.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
setPendingInputTab(nav.urlPath, nav.tabKey, {
|
||||
statsYr: item.statsYr,
|
||||
sewerBzmnCd: item.sewerBzmnCd,
|
||||
ctpvNm: item.ctpvNm,
|
||||
sggNm: item.sggNm ?? "",
|
||||
});
|
||||
setCurrentMenuInfo(menu);
|
||||
const ok = addTab(menu);
|
||||
if (ok) {
|
||||
addTabForGrid(menu);
|
||||
} else {
|
||||
alert(`최대 추가 할 수 있는 화면 수(10개)를 \n초과 하였습니다.
|
||||
기존 화면을 닫은 후 이용해주세요.`);
|
||||
}
|
||||
},
|
||||
[
|
||||
menuList,
|
||||
addTab,
|
||||
addTabForGrid,
|
||||
setCurrentMenuInfo,
|
||||
setPendingInputTab,
|
||||
alert,
|
||||
],
|
||||
);
|
||||
|
||||
const renderSection = (
|
||||
typeCode: "IMR" | "NV",
|
||||
items: VerificationResultReportItem[],
|
||||
) => (
|
||||
<section className="flex min-h-0 flex-1 flex-col rounded-sm border border-border h-[50rem]">
|
||||
<div className="flex items-center justify-between border-b border-border px-3 py-2">
|
||||
<Badge color={TYPE_CODE_COLOR_MAP[typeCode]} className="rounded-full px-2 py-1 text-lg">
|
||||
{TYPE_CODE_NAME_MAP[typeCode]} {items.length}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="min-h-0 flex-1 overflow-y-auto p-2">
|
||||
{items.length === 0 ? (
|
||||
<div className="flex h-full min-h-[8rem] items-center justify-center text-lg text-muted-foreground">
|
||||
항목이 없습니다.
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2 tracking-tight">
|
||||
{items.map((item) => (
|
||||
<div
|
||||
key={`${typeCode}-${item.vrfcSn}`}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
className="flex flex-col rounded-sm border border-border p-3 cursor-pointer hover:bg-gray-100"
|
||||
onClick={() => openInputFromStatsCd(item)}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
openInputFromStatsCd(item);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<span className="font-medium">
|
||||
{item.statsNm}
|
||||
</span>
|
||||
<Badge
|
||||
color={
|
||||
TYPE_CODE_COLOR_MAP[item.vrfcMthdCd] ??
|
||||
"gray"
|
||||
}
|
||||
className="text-sm"
|
||||
>
|
||||
{TYPE_CODE_NAME_MAP[item.vrfcMthdCd] ??
|
||||
item.vrfcMthdNm}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="text-lg text-muted-foreground">
|
||||
{item.rsnExpln}
|
||||
</p>
|
||||
<div className="flex justify-between text-lg text-muted-foreground">
|
||||
<span>{item.admdstNm}</span>
|
||||
<span>
|
||||
현재: {item.nowVlCn ?? "-"} / 비교:{" "}
|
||||
{item.compVlCn ?? "-"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="w-1/5 bg-container p-4 !pb-2 flex border-r border-border">
|
||||
<div className="card card-border flex-1 bg-background !px-0">
|
||||
<div className="border-b border-border flex justify-between">
|
||||
<h2 className="text-[2.4rem] font-semibold text-title p-4 ">검증 미통과 내역</h2>
|
||||
<span
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
aria-label="닫기"
|
||||
className="mt-2 mr-4 flex flex-shrink-0 cursor-pointer items-start justify-center text-3xl leading-none hover:text-[#2094fa]"
|
||||
onClick={() => onClose?.()}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
onClose?.();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<i className="ri-close-line" />
|
||||
</span>
|
||||
</div>
|
||||
<div className="card-body max-h-[calc(100%-3.25rem)] p-2.5">
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{!isLoading && !error && (
|
||||
<div className="grid grid-rows-2 gap-6">
|
||||
{renderSection("IMR", imrList)}
|
||||
{renderSection("NV", nvList)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default VerificationSelectionReport;
|
||||
@@ -1,24 +1,20 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
import SearchForm from '@/components/module/SearchForm';
|
||||
import { DataGrid } from '@rsone/components';
|
||||
import DataGrid from '@/components/module/DataGrid';
|
||||
import SplitDataGrid from '@/components/module/SplitDataGrid';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@common/components';
|
||||
import SubmitButton from '@/components/button/SumitButton';
|
||||
import SaveButton from '@/components/button/SaveButton';
|
||||
import SubmitExceptionButton from '@/components/button/SubmitExceptionButton';
|
||||
import OperateDataButton from '@/components/button/OperateDataButton';
|
||||
import UpdateOperateDataButton from "@/components/button/UpdateOperateDataButton"
|
||||
import NotApplicableCheckButton from "@/components/button/NotApplicableCheckButton";
|
||||
import UpdateOperateDataButton from '@/components/button/UpdateOperateDataButton';
|
||||
|
||||
import { PublicSewageFactInpColumn } from '@/components/util/column/input/PublicSewageFactInpColumn';
|
||||
import type { ColumnInfo, ColumnInfoList } from '@/components/type/DataGrid.type';
|
||||
import { PublicSewageFactInpColumnList } from '@/components/util/column/input/PublicSewageFactInpColumn/PublicSewageFactInpColumn';
|
||||
|
||||
// 하수도 통계 관리 > 06. 공공하수처리시설
|
||||
const PublicSewageFacilityInp = () => {
|
||||
|
||||
const SubmitExceptionFunc = () => {
|
||||
console.log('submitException');
|
||||
// 예외제출 로직
|
||||
};
|
||||
|
||||
|
||||
const submitFunc = () => {
|
||||
console.log('submit');
|
||||
// 제출 로직
|
||||
@@ -28,7 +24,7 @@ const PublicSewageFacilityInp = () => {
|
||||
console.log('save');
|
||||
// 저장 로직
|
||||
};
|
||||
|
||||
|
||||
const getOperateDataFunc = () => {
|
||||
console.log('get operate data');
|
||||
// 운영 데이터 가져오기
|
||||
@@ -39,33 +35,109 @@ const PublicSewageFacilityInp = () => {
|
||||
// 운영 데이터 업데이트 로직
|
||||
};
|
||||
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [isNotApplicable, setIsNotApplicable] = useState(false);
|
||||
const [rowDataMap, setRowDataMap] = useState<Map<string, Record<string, string | number>[]>>(new Map());
|
||||
const [activeTab, setActiveTab] = useState<string>(
|
||||
PublicSewageFactInpColumnList[0]?.tabKey ?? 'ST00060001',
|
||||
);
|
||||
|
||||
const getGridColumnInfo = (
|
||||
tab: ColumnInfoList,
|
||||
): ColumnInfo => ({
|
||||
columns: tab.columns ?? [],
|
||||
columnLayout: tab.columnLayout ?? [],
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm fctName={true} />
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<SubmitExceptionButton SubmitExceptionFunc={SubmitExceptionFunc} />
|
||||
<UpdateOperateDataButton updateOperateDataButtonFunc={updateOperateDataButtonFunc} />
|
||||
<OperateDataButton getOperateDataFunc={getOperateDataFunc} />
|
||||
<SubmitButton submitFunc={submitFunc} />
|
||||
<SaveButton saveFunc={saveFunc} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<NotApplicableCheckButton isCheck={isNotApplicable} setIsCheck={setIsNotApplicable} />
|
||||
<UpdateOperateDataButton updateOperateDataButtonFunc={updateOperateDataButtonFunc} />
|
||||
<OperateDataButton getOperateDataFunc={getOperateDataFunc} />
|
||||
</div>
|
||||
</div>
|
||||
<DataGrid
|
||||
columnInfo={ PublicSewageFactInpColumn }
|
||||
rowStartNum={3}
|
||||
fixedColumns={2}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
/>
|
||||
<Tabs value={activeTab} onValueChange={setActiveTab}>
|
||||
<TabsList>
|
||||
{PublicSewageFactInpColumnList.map((tab) => (
|
||||
<TabsTrigger key={tab.tabKey} value={tab.tabKey}>
|
||||
{tab.tabLabel || tab.tabKey}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
|
||||
{PublicSewageFactInpColumnList.map((tab) => {
|
||||
if (tab.isSplitGrid && tab.left && tab.right) {
|
||||
const leftKey = tab.left.tabKey ?? `${tab.tabKey}_left`;
|
||||
const rightKey = tab.right.tabKey ?? `${tab.tabKey}_right`;
|
||||
return (
|
||||
<TabsContent key={tab.tabKey} value={tab.tabKey}>
|
||||
<SplitDataGrid
|
||||
leftColumnInfo={getGridColumnInfo(tab.left)}
|
||||
rightColumnInfo={getGridColumnInfo(tab.right)}
|
||||
leftFixedColumns={tab.left.fixedColumns}
|
||||
rightFixedColumns={tab.right.fixedColumns}
|
||||
showHeaderCheckbox={false}
|
||||
enableSort={false}
|
||||
leftRowData={rowDataMap.get(leftKey) ?? []}
|
||||
rightRowData={rowDataMap.get(rightKey) ?? []}
|
||||
setLeftRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
const cur = next.get(leftKey) ?? [];
|
||||
const n =
|
||||
typeof updater === 'function'
|
||||
? (updater as (p: Record<string, string | number>[]) => Record<string, string | number>[])(cur)
|
||||
: updater;
|
||||
next.set(leftKey, n);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
setRightRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
const cur = next.get(rightKey) ?? [];
|
||||
const n =
|
||||
typeof updater === 'function'
|
||||
? (updater as (p: Record<string, string | number>[]) => Record<string, string | number>[])(cur)
|
||||
: updater;
|
||||
next.set(rightKey, n);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</TabsContent>
|
||||
);
|
||||
}
|
||||
|
||||
const gridColumnInfo = getGridColumnInfo(tab);
|
||||
return (
|
||||
<TabsContent key={tab.tabKey} value={tab.tabKey}>
|
||||
<DataGrid
|
||||
columnInfo={gridColumnInfo}
|
||||
rowStartNum={tab.rowStartNum}
|
||||
fixedColumns={tab.fixedColumns}
|
||||
rowData={rowDataMap.get(tab.tabKey) ?? []}
|
||||
setRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
const cur = next.get(tab.tabKey) ?? [];
|
||||
const n =
|
||||
typeof updater === 'function'
|
||||
? (updater as (p: Record<string, string | number>[]) => Record<string, string | number>[])(cur)
|
||||
: updater;
|
||||
next.set(tab.tabKey, n);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
showHeaderCheckbox={false}
|
||||
enableSort={false}
|
||||
/>
|
||||
</TabsContent>
|
||||
);
|
||||
})}
|
||||
</Tabs>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,10 @@
|
||||
import { useRef, useState } from "react";
|
||||
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import {
|
||||
STATISTICS_INPUT_URL_PATH,
|
||||
verificationSearchToFormValues,
|
||||
} from "@/shared/lib/stats-cd-input-navigation";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
import { sewagePipeMaintainApiService } from "@/entities/statistics/api/input/statistics-input-sewage-pipe-maintain-service";
|
||||
import type { SewagePipeMaintainRequestParams } from "@/entities/statistics/model/input/statistics-input-sewage-pipe-maintain-interface";
|
||||
@@ -16,6 +20,8 @@ import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { PipeDredgingStatusInpColumn } from "@/components/util/column/input/sewagePipeMaintain/PipeDredgingStatusInpColumn";
|
||||
import { RepairStatusInpColumn } from "@/components/util/column/input/sewagePipeMaintain/RepairStatusInpColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
|
||||
function buildSewagePipeMaintainSearchParam(
|
||||
values: SearchFormValues,
|
||||
@@ -40,6 +46,13 @@ const SewagePipeMaintainInp = () => {
|
||||
const [lastSearchedYear, setLastSearchedYear] = useState<string | null>(null);
|
||||
const [hasSearched, setHasSearched] = useState(false);
|
||||
const searchParamRef = useRef<SewagePipeMaintainRequestParams | null>(null);
|
||||
const postVerificationSearchRef = useRef<{
|
||||
values: SearchFormValues;
|
||||
tabKey: string;
|
||||
} | null>(null);
|
||||
const [verificationSearchDefaults, setVerificationSearchDefaults] =
|
||||
useState<SearchFormValues | null>(null);
|
||||
const [searchFormRemountKey, setSearchFormRemountKey] = useState(0);
|
||||
|
||||
// tab List
|
||||
const SewagePipeMaintainInpTabList = [
|
||||
@@ -47,6 +60,24 @@ const SewagePipeMaintainInp = () => {
|
||||
PipeDredgingStatusInpColumn
|
||||
];
|
||||
|
||||
const activeTabId = useTabStore((s) => s.activeTabId);
|
||||
const inputFocusNonce = useStatisticsInputFocusStore((s) => s.nonce);
|
||||
useLayoutEffect(() => {
|
||||
if (activeTabId !== STATISTICS_INPUT_URL_PATH.SEWAGE_PIPE_MAINTAIN) return;
|
||||
const pending = useStatisticsInputFocusStore
|
||||
.getState()
|
||||
.takePendingForUrl(STATISTICS_INPUT_URL_PATH.SEWAGE_PIPE_MAINTAIN);
|
||||
if (!pending) return;
|
||||
const { tabKey, search } = pending;
|
||||
setActiveTab(tabKey);
|
||||
if (search) {
|
||||
const values = verificationSearchToFormValues(search);
|
||||
setVerificationSearchDefaults(values);
|
||||
postVerificationSearchRef.current = { values, tabKey };
|
||||
setSearchFormRemountKey((k) => k + 1);
|
||||
}
|
||||
}, [activeTabId, inputFocusNonce]);
|
||||
|
||||
const SubmitExceptionFunc = () => {
|
||||
console.log('submit exception');
|
||||
// 예외 제출 로직
|
||||
@@ -136,9 +167,14 @@ const SewagePipeMaintainInp = () => {
|
||||
setLastSearchedYear(null);
|
||||
setHasSearched(false);
|
||||
searchParamRef.current = null;
|
||||
setVerificationSearchDefaults(null);
|
||||
setSearchFormRemountKey((k) => k + 1);
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
const handleSearch = async (
|
||||
values: SearchFormValues,
|
||||
opts?: { forcedTabKey?: string },
|
||||
) => {
|
||||
if (!values.sido || values.sido === "ALL") {
|
||||
alert("시도를 선택해주세요.");
|
||||
return;
|
||||
@@ -151,13 +187,18 @@ const SewagePipeMaintainInp = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
const tabForLoad = opts?.forcedTabKey ?? activeTab;
|
||||
if (opts?.forcedTabKey) {
|
||||
setActiveTab(opts.forcedTabKey);
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
const searchParam = buildSewagePipeMaintainSearchParam(values);
|
||||
searchParamRef.current = searchParam;
|
||||
setLastSearchedValues(values);
|
||||
setLastSearchedYear(values.year ?? null);
|
||||
setHasSearched(true);
|
||||
await loadActiveTabData(activeTab, searchParam, false);
|
||||
await loadActiveTabData(tabForLoad, searchParam, false);
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
@@ -165,6 +206,14 @@ const SewagePipeMaintainInp = () => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const job = postVerificationSearchRef.current;
|
||||
if (!job) return;
|
||||
postVerificationSearchRef.current = null;
|
||||
void handleSearch(job.values, { forcedTabKey: job.tabKey });
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- 검색폼 remount 직후 1회 자동 조회
|
||||
}, [searchFormRemountKey]);
|
||||
|
||||
const handleActiveTabChange = async (tabKey: string) => {
|
||||
setActiveTab(tabKey);
|
||||
const hasRows = (rowDataMap.get(tabKey) ?? []).length > 0;
|
||||
@@ -183,7 +232,13 @@ const SewagePipeMaintainInp = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} onValuesChange={setSearchValues} />
|
||||
<SearchForm
|
||||
key={searchFormRemountKey}
|
||||
defaultValues={verificationSearchDefaults ?? undefined}
|
||||
onSubmit={handleSearch}
|
||||
onReset={handleReset}
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{(hasRowData || hasSearched) && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useState, useMemo, useRef } from "react";
|
||||
import { useState, useMemo, useRef, useLayoutEffect, useEffect } from "react";
|
||||
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
// import { DataGrid } from "@rsone/components";
|
||||
@@ -15,6 +15,10 @@ import { ConfirmDialog } from "@/shared/ui/confirm-dialog";
|
||||
import SubmitDailog from "./SubmitDailog";
|
||||
|
||||
import { useAlertStore, useGlobalProgressStore } from "@/shared/lib";
|
||||
import {
|
||||
STATISTICS_INPUT_URL_PATH,
|
||||
verificationSearchToFormValues,
|
||||
} from "@/shared/lib/stats-cd-input-navigation";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import { statisticsInputSewSupplyRateApi } from "@/entities/statistics/api/input/statistics-input-sew-supply-rate-service";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
@@ -24,13 +28,16 @@ import { getUserInfo } from "../../../../../../packages/common/components/src/ap
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import type {
|
||||
SewerageSupplyRateItem,
|
||||
SewerageSupplyRateRequestParams,
|
||||
SewerageSupplyRateSaveItem,
|
||||
SewerageSupplyRateVerificationResult,
|
||||
SewerageSupplyRateSaveRequest,
|
||||
SewerageSupplyRateStatusInfo,
|
||||
import {
|
||||
type CheckInputPeriodItem,
|
||||
type SewerageSupplyRateItem,
|
||||
type SewerageSupplyRateRequestParams,
|
||||
type SewerageSupplyRateSaveItem,
|
||||
type SewerageSupplyRateVerificationResult,
|
||||
type SewerageSupplyRateSaveRequest,
|
||||
type SewerageSupplyRateStatusInfo,
|
||||
getVerificationPeriodActionBlockedMessage,
|
||||
isInputPeriodCurrent,
|
||||
} from "@/entities/statistics/model/input/statistics-sewage-supply-rate-input-interface";
|
||||
import type {
|
||||
cancelSubmitRequest,
|
||||
@@ -40,6 +47,8 @@ import type {
|
||||
import type { StatisticsInputSubmitInfoFormData } from "@/entities/statistics/model/statistics-input-submit-info-schema";
|
||||
import { SeweragePenetrationRateInpColumn } from "@/components/util/column/input/SeweragePenetrationRateInpColumn";
|
||||
import { doList } from "@/components/util/column/input/DoList";
|
||||
import { useStatisticsInputFocusStore } from "@/store/statistics-input-focus-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
|
||||
|
||||
type GridRowWithVerification = Record<string, string | number> & {
|
||||
@@ -100,6 +109,8 @@ const SeweragePenetrationRateInp = () => {
|
||||
const [lastSearchedYear, setLastSearchedYear] = useState<string | null>(null);
|
||||
const [lastSearchedValues, setLastSearchedValues] = useState<SearchFormValues | null>(null);
|
||||
const [statusInfo, setStatusInfo] = useState<SewerageSupplyRateStatusInfo | null>(null);
|
||||
/** 마지막 조회 시 check-input-period 응답 (검증기간 여부 판단) */
|
||||
const [periodCheckList, setPeriodCheckList] = useState<CheckInputPeriodItem[]>([]);
|
||||
const [showDailog, setShowDailog] = useState<boolean>(false);
|
||||
const [verificationHistoryOpen, setVerificationHistoryOpen] = useState(false);
|
||||
const [verificationResultDialogOpen, setVerificationResultDialogOpen] = useState(false);
|
||||
@@ -113,6 +124,27 @@ const SeweragePenetrationRateInp = () => {
|
||||
const hideGlobalProgress = useGlobalProgressStore((state) => state.hide);
|
||||
const globalProgressVisible = useGlobalProgressStore((state) => state.visible);
|
||||
|
||||
const postVerificationSearchRef = useRef<SearchFormValues | null>(null);
|
||||
const [verificationSearchDefaults, setVerificationSearchDefaults] =
|
||||
useState<SearchFormValues | null>(null);
|
||||
const [searchFormRemountKey, setSearchFormRemountKey] = useState(0);
|
||||
|
||||
const activeTabId = useTabStore((s) => s.activeTabId);
|
||||
const inputFocusNonce = useStatisticsInputFocusStore((s) => s.nonce);
|
||||
useLayoutEffect(() => {
|
||||
if (activeTabId !== STATISTICS_INPUT_URL_PATH.SEWERAGE_PENETRATION_RATE) {
|
||||
return;
|
||||
}
|
||||
const pending = useStatisticsInputFocusStore
|
||||
.getState()
|
||||
.takePendingForUrl(STATISTICS_INPUT_URL_PATH.SEWERAGE_PENETRATION_RATE);
|
||||
if (!pending?.search) return;
|
||||
const values = verificationSearchToFormValues(pending.search);
|
||||
setVerificationSearchDefaults(values);
|
||||
postVerificationSearchRef.current = values;
|
||||
setSearchFormRemountKey((k) => k + 1);
|
||||
}, [activeTabId, inputFocusNonce]);
|
||||
|
||||
const { isAdminInfo } = useAdminStore();
|
||||
|
||||
const getGridDataRef = useRef<(() => Record<string, string | number>[]) | null>(null);
|
||||
@@ -147,9 +179,12 @@ const SeweragePenetrationRateInp = () => {
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
setStatusInfo(null);
|
||||
setPeriodCheckList([]);
|
||||
setLastSearchedYear(null);
|
||||
setLastSearchedValues(null);
|
||||
setFooterFromApi(null);
|
||||
setVerificationSearchDefaults(null);
|
||||
setSearchFormRemountKey((k) => k + 1);
|
||||
};
|
||||
|
||||
const fetchSewerageSupplyRate = async (params: SewerageSupplyRateRequestParams, isEnterable: boolean) => {
|
||||
@@ -218,8 +253,9 @@ const SeweragePenetrationRateInp = () => {
|
||||
const response = await statisticsInputSewSupplyRateApi.checkInputPeriod(values.year || '');
|
||||
|
||||
if (response.status === 'success') {
|
||||
const checkEnterable = response.data;
|
||||
// setIsEnterable(response.data);
|
||||
const periods = Array.isArray(response.data) ? response.data : [];
|
||||
setPeriodCheckList(periods);
|
||||
const checkEnterable = isInputPeriodCurrent(periods);
|
||||
setLastSearchedYear(values.year || null);
|
||||
await fetchSewerageSupplyRate(getSewerageSupplyRateParams(values), checkEnterable);
|
||||
setLastSearchedValues(values);
|
||||
@@ -231,7 +267,20 @@ const SeweragePenetrationRateInp = () => {
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const values = postVerificationSearchRef.current;
|
||||
if (!values) return;
|
||||
postVerificationSearchRef.current = null;
|
||||
void handleSearch(values);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- 검색폼 remount 직후 1회 자동 조회
|
||||
}, [searchFormRemountKey]);
|
||||
|
||||
const SubmitExceptionFunc = async (submitInfo: StatisticsInputSubmitInfoFormData) => {
|
||||
const verificationBlocked = getVerificationPeriodActionBlockedMessage(periodCheckList);
|
||||
if (verificationBlocked) {
|
||||
alert(verificationBlocked);
|
||||
return;
|
||||
}
|
||||
const userInfo = await getUserInfo();
|
||||
|
||||
const params: SubmitExceptionRequest = {
|
||||
@@ -309,6 +358,11 @@ const SeweragePenetrationRateInp = () => {
|
||||
};
|
||||
|
||||
const executeSubmit = async (submitInfo: StatisticsInputSubmitInfoFormData) => {
|
||||
const verificationBlocked = getVerificationPeriodActionBlockedMessage(periodCheckList);
|
||||
if (verificationBlocked) {
|
||||
alert(verificationBlocked);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
showGlobalProgress({ label: "제출 진행 중...", progress: 0 });
|
||||
const userInfo = await getUserInfo();
|
||||
@@ -388,7 +442,7 @@ const SeweragePenetrationRateInp = () => {
|
||||
const response = await statisticsInputSewSupplyRateApi.submitSewerageSupplyRate(requestData);
|
||||
if (response.status === 'success') {
|
||||
setGlobalProgress(50);
|
||||
|
||||
|
||||
if (response.data.finalStatus === '5') {
|
||||
const imrParam = {
|
||||
user_id: userInfo.userUnqId,
|
||||
@@ -442,6 +496,11 @@ const SeweragePenetrationRateInp = () => {
|
||||
const saveFunc = async () => {
|
||||
try {
|
||||
if (await confirm('저장 하시겠습니까?')) {
|
||||
const verificationBlocked = getVerificationPeriodActionBlockedMessage(periodCheckList);
|
||||
if (verificationBlocked) {
|
||||
alert(verificationBlocked);
|
||||
return;
|
||||
}
|
||||
showGlobalProgress({ label: "저장 진행 중...", progress: 0 });
|
||||
|
||||
const userInfo = await getUserInfo();
|
||||
@@ -520,9 +579,9 @@ const SeweragePenetrationRateInp = () => {
|
||||
sewerBzmnFrgnrWholPpltnCnt: footerFromApi?.sewerBzmnFrgnrWholPpltnCnt // 행정참고자료 외국인 합계
|
||||
};
|
||||
|
||||
// if (isAdminInfo) {
|
||||
// requestData.superAdmin = 'superAdmin';
|
||||
// }
|
||||
if (isAdminInfo) {
|
||||
requestData.superAdmin = 'superAdmin';
|
||||
}
|
||||
|
||||
const response = await statisticsInputSewSupplyRateApi.saveSewerageSupplyRate(requestData);
|
||||
|
||||
@@ -547,6 +606,11 @@ const SeweragePenetrationRateInp = () => {
|
||||
const cnacelSubmitFunc = async () => {
|
||||
try {
|
||||
if (await confirm('제출된 내용을 취소하시겠습니까?')) {
|
||||
const verificationBlocked = getVerificationPeriodActionBlockedMessage(periodCheckList);
|
||||
if (verificationBlocked) {
|
||||
alert(verificationBlocked);
|
||||
return;
|
||||
}
|
||||
|
||||
const userInfo = await getUserInfo();
|
||||
|
||||
@@ -596,15 +660,21 @@ const SeweragePenetrationRateInp = () => {
|
||||
return (
|
||||
<>
|
||||
<div className="relative">
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} onValuesChange={setSearchValues} />
|
||||
<SearchForm
|
||||
key={searchFormRemountKey}
|
||||
defaultValues={verificationSearchDefaults ?? undefined}
|
||||
onSubmit={handleSearch}
|
||||
onReset={handleReset}
|
||||
onValuesChange={setSearchValues}
|
||||
/>
|
||||
{showActionToolbarCard && (
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] mx-[0.6rem]">
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
/>
|
||||
{showEnterableToolbarButtons && (
|
||||
<>
|
||||
<VerificationResultButton
|
||||
VerificationResultButtonFunc={openVerificationHistoryDialog}
|
||||
/>
|
||||
<LastYearDataButton getLastYearDataFunc={() => getLastYearDataFunc(searchValues ?? {})} />
|
||||
<SubmitButton submitFunc={() => submitFunc(false)} />
|
||||
</>
|
||||
@@ -686,6 +756,20 @@ const SeweragePenetrationRateInp = () => {
|
||||
<VerificationResultDialog
|
||||
open={verificationResultDialogOpen}
|
||||
onOpenChange={setVerificationResultDialogOpen}
|
||||
queryContext={
|
||||
searchValues?.year && searchValues?.sido && searchValues?.bsnmCd && statsCd
|
||||
? {
|
||||
sewerBzmnCd: searchValues.bsnmCd,
|
||||
ctpvNm: searchValues.sido,
|
||||
sggNm:
|
||||
searchValues.gugun === "ALL"
|
||||
? ""
|
||||
: (searchValues.gugun ?? ""),
|
||||
statsYr: searchValues.year,
|
||||
statsCd,
|
||||
}
|
||||
: null
|
||||
}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -175,12 +175,12 @@ const SubmitDailog = ({
|
||||
</TableBody>
|
||||
</Table>
|
||||
<DialogFooter className="mt-6">
|
||||
<Button type="button" color="gray" onClick={handleCancel}>
|
||||
취소
|
||||
</Button>
|
||||
<Button type="submit" color="primary">
|
||||
{submitMode === 'normal' ? '제출' : '예외 제출'}
|
||||
</Button>
|
||||
<Button type="button" color="gray" onClick={handleCancel}>
|
||||
취소
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
|
||||
@@ -12,7 +12,6 @@ import type {
|
||||
ApiResponse,
|
||||
SearchCondition,
|
||||
Sgg,
|
||||
StatisticsLog,
|
||||
StatisticsLogRequest,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
|
||||
@@ -0,0 +1,973 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import {
|
||||
type ColumnDef,
|
||||
getCoreRowModel,
|
||||
type RowSelectionState,
|
||||
useReactTable,
|
||||
} from "@tanstack/react-table";
|
||||
|
||||
import { client } from "@/shared/api/client";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import type { PageableList } from "@/shared/model";
|
||||
import {
|
||||
type AdstZoneResponseDto,
|
||||
type SewerStUserItem,
|
||||
useSewerStUserList,
|
||||
useStAnlsSidoCombo,
|
||||
useStAnlsSigunguCombo,
|
||||
} from "@/entities/statistics";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
DataTable,
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Input,
|
||||
Label,
|
||||
LoadingWithAnimation,
|
||||
Select,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "@common/components";
|
||||
|
||||
interface NtftalkTemplate {
|
||||
templateCode: string;
|
||||
templateName: string;
|
||||
templateContent: string;
|
||||
}
|
||||
|
||||
interface TemplateVariablesResponse {
|
||||
templateCode: string;
|
||||
variables: string[];
|
||||
count: number;
|
||||
}
|
||||
|
||||
interface BusinessSendRequest {
|
||||
templateCode: string;
|
||||
callback?: string;
|
||||
fixedRecipientNum?: string;
|
||||
recipients: Record<string, string>[];
|
||||
}
|
||||
|
||||
interface BusinessSendResponse {
|
||||
success: boolean;
|
||||
sentCount: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface SelectedRecipient extends SewerStUserItem {
|
||||
variableOverrides: Record<string, string>;
|
||||
}
|
||||
|
||||
const EMPTY_ADST_LIST: AdstZoneResponseDto[] = [];
|
||||
const GUBUN_OPTIONS = [
|
||||
{ value: "PIC", label: "입력자" },
|
||||
{ value: "IDFR", label: "승인자" },
|
||||
{ value: "MCTPV", label: "검토자" },
|
||||
] as const;
|
||||
const DEFAULT_TEMPLATE_PARAMS = {
|
||||
sort: "createdAt,desc",
|
||||
senderKey: "",
|
||||
inspectionStatus: "APR",
|
||||
templateMessageType: "BA",
|
||||
page: 0,
|
||||
size: 10,
|
||||
};
|
||||
|
||||
function getDefaultStatsYear(): string {
|
||||
return String(new Date().getFullYear() - 1);
|
||||
}
|
||||
|
||||
function buildTemplateMessage(
|
||||
templateContent: string,
|
||||
variables: Record<string, string>,
|
||||
): string {
|
||||
return templateContent.replace(/#?\{([^}]+)\}/g, (_, key: string) => {
|
||||
const value = variables[key.trim()];
|
||||
return value ?? "";
|
||||
});
|
||||
}
|
||||
|
||||
function getMergedVariables(
|
||||
recipient: SelectedRecipient,
|
||||
commonValues: Record<string, string>,
|
||||
): Record<string, string> {
|
||||
return {
|
||||
...commonValues,
|
||||
...recipient.variableOverrides,
|
||||
TEL_NUM: recipient.telNo,
|
||||
};
|
||||
}
|
||||
|
||||
function NtitlkSndng() {
|
||||
const alert = useAlertStore((state) => state.setMessage);
|
||||
|
||||
const [searchStatsYr, setSearchStatsYr] = useState(getDefaultStatsYear());
|
||||
const [searchSido, setSearchSido] = useState("");
|
||||
const [searchSigungu, setSearchSigungu] = useState("");
|
||||
const [searchGubun, setSearchGubun] = useState("");
|
||||
|
||||
const [appliedParams, setAppliedParams] = useState({
|
||||
statsYr: getDefaultStatsYear(),
|
||||
sewerBzmnCd: "",
|
||||
gubun: "",
|
||||
});
|
||||
|
||||
const [selectedTemplateCode, setSelectedTemplateCode] = useState("");
|
||||
const [selectedRecipients, setSelectedRecipients] = useState<
|
||||
SelectedRecipient[]
|
||||
>([]);
|
||||
const [commonVariableValues, setCommonVariableValues] = useState<
|
||||
Record<string, string>
|
||||
>({});
|
||||
const [commonVariableMapping, setCommonVariableMapping] = useState<
|
||||
Record<
|
||||
string,
|
||||
| "userNm"
|
||||
| "sido"
|
||||
| "gugun"
|
||||
| "gubunNm"
|
||||
| "deptNm"
|
||||
| "jbgdNm"
|
||||
| "telNo"
|
||||
| "custom"
|
||||
| ""
|
||||
>
|
||||
>({});
|
||||
|
||||
const [previewRecipient, setPreviewRecipient] =
|
||||
useState<SelectedRecipient | null>(null);
|
||||
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
||||
const [isSending, setIsSending] = useState(false);
|
||||
const [userListRowSelection, setUserListRowSelection] =
|
||||
useState<RowSelectionState>({});
|
||||
|
||||
const { data: templatePageData } = useQuery({
|
||||
queryKey: [
|
||||
ENDPOINT.NTFTALK_SERVICE.TEMP,
|
||||
"ntitlk-sndng",
|
||||
DEFAULT_TEMPLATE_PARAMS,
|
||||
],
|
||||
queryFn: async () => {
|
||||
const response = await client.get<PageableList<NtftalkTemplate>>(
|
||||
ENDPOINT.NTFTALK_SERVICE.TEMP,
|
||||
{ params: DEFAULT_TEMPLATE_PARAMS },
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
});
|
||||
|
||||
const templates = templatePageData?.content ?? [];
|
||||
|
||||
const { data: templateVariablesData } = useQuery({
|
||||
queryKey: [
|
||||
ENDPOINT.NTFTALK_SERVICE.ATA_SEND,
|
||||
"template-variables",
|
||||
selectedTemplateCode,
|
||||
],
|
||||
queryFn: async () => {
|
||||
const response = await client.get<TemplateVariablesResponse>(
|
||||
`${ENDPOINT.NTFTALK_SERVICE.ATA_SEND}/template-variables/${selectedTemplateCode}`,
|
||||
);
|
||||
return response.data;
|
||||
},
|
||||
enabled: Boolean(selectedTemplateCode),
|
||||
});
|
||||
|
||||
const variableNames = templateVariablesData?.variables ?? [];
|
||||
|
||||
const { data: sidoData } = useStAnlsSidoCombo();
|
||||
const { data: sigunguData } = useStAnlsSigunguCombo(searchSido);
|
||||
const sidoOptions = sidoData ?? EMPTY_ADST_LIST;
|
||||
const sigunguOptions = sigunguData ?? EMPTY_ADST_LIST;
|
||||
|
||||
const { data: userListResponse, isLoading: isUserListLoading } =
|
||||
useSewerStUserList(appliedParams);
|
||||
const userList = (userListResponse as unknown as SewerStUserItem[]) ?? [];
|
||||
const userListColumns = useMemo<ColumnDef<SewerStUserItem>[]>(
|
||||
() => [
|
||||
{
|
||||
id: "select",
|
||||
header: ({ table }) => (
|
||||
<div
|
||||
className="flex justify-center"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onKeyDown={(e) => e.stopPropagation()}
|
||||
role="presentation"
|
||||
>
|
||||
<Checkbox
|
||||
checked={
|
||||
table.getIsAllPageRowsSelected() ||
|
||||
(table.getIsSomePageRowsSelected() &&
|
||||
"indeterminate")
|
||||
}
|
||||
onCheckedChange={(value) =>
|
||||
table.toggleAllPageRowsSelected(!!value)
|
||||
}
|
||||
aria-label="전체 선택"
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
cell: ({ row }) => (
|
||||
<div
|
||||
className="flex justify-center"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onKeyDown={(e) => e.stopPropagation()}
|
||||
role="presentation"
|
||||
>
|
||||
<Checkbox
|
||||
checked={row.getIsSelected()}
|
||||
onCheckedChange={(value) =>
|
||||
row.toggleSelected(!!value)
|
||||
}
|
||||
aria-label="행 선택"
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
enableSorting: false,
|
||||
enableHiding: false,
|
||||
},
|
||||
{
|
||||
accessorKey: "userNm",
|
||||
header: "이름",
|
||||
},
|
||||
{
|
||||
accessorKey: "sido",
|
||||
header: "시도",
|
||||
},
|
||||
{
|
||||
accessorKey: "gugun",
|
||||
header: "시군구",
|
||||
},
|
||||
{
|
||||
accessorKey: "gubunNm",
|
||||
header: "구분",
|
||||
},
|
||||
{
|
||||
accessorKey: "deptNm",
|
||||
header: "소속",
|
||||
},
|
||||
{
|
||||
accessorKey: "jbgdNm",
|
||||
header: "직급",
|
||||
},
|
||||
{
|
||||
accessorKey: "telNo",
|
||||
header: "전화번호",
|
||||
},
|
||||
],
|
||||
[],
|
||||
);
|
||||
const userListTable = useReactTable({
|
||||
data: userList,
|
||||
columns: userListColumns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
enableRowSelection: true,
|
||||
enableMultiRowSelection: true,
|
||||
state: {
|
||||
rowSelection: userListRowSelection,
|
||||
},
|
||||
onRowSelectionChange: setUserListRowSelection,
|
||||
getRowId: (row) => `${row.userNm}-${row.telNo}`,
|
||||
});
|
||||
|
||||
const selectedTemplate = useMemo(
|
||||
() =>
|
||||
templates.find(
|
||||
(template) => template.templateCode === selectedTemplateCode,
|
||||
),
|
||||
[templates, selectedTemplateCode],
|
||||
);
|
||||
|
||||
const previewMessage = useMemo(() => {
|
||||
if (!previewRecipient || !selectedTemplate?.templateContent) return "";
|
||||
return buildTemplateMessage(
|
||||
selectedTemplate.templateContent,
|
||||
getMergedVariables(previewRecipient, commonVariableValues),
|
||||
);
|
||||
}, [previewRecipient, selectedTemplate, commonVariableValues]);
|
||||
|
||||
const handleTemplateChange = (templateCode: string) => {
|
||||
setSelectedTemplateCode(templateCode);
|
||||
setCommonVariableValues({});
|
||||
setCommonVariableMapping({});
|
||||
setSelectedRecipients((prev) =>
|
||||
prev.map((recipient) => ({ ...recipient, variableOverrides: {} })),
|
||||
);
|
||||
};
|
||||
|
||||
const handleSearch = () => {
|
||||
const sewerBzmnCd =
|
||||
searchSido !== ""
|
||||
? searchSigungu !== ""
|
||||
? searchSigungu
|
||||
: searchSido
|
||||
: "";
|
||||
|
||||
setAppliedParams({
|
||||
statsYr: searchStatsYr,
|
||||
sewerBzmnCd,
|
||||
gubun: searchGubun,
|
||||
});
|
||||
setUserListRowSelection({});
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
const defaultYear = getDefaultStatsYear();
|
||||
setSearchStatsYr(defaultYear);
|
||||
setSearchSido("");
|
||||
setSearchSigungu("");
|
||||
setSearchGubun("");
|
||||
setAppliedParams({
|
||||
statsYr: defaultYear,
|
||||
sewerBzmnCd: "",
|
||||
gubun: "",
|
||||
});
|
||||
setUserListRowSelection({});
|
||||
};
|
||||
|
||||
const handleRemoveRecipient = (telNo: string) => {
|
||||
setSelectedRecipients((prev) =>
|
||||
prev.filter((recipient) => recipient.telNo !== telNo),
|
||||
);
|
||||
};
|
||||
|
||||
const handleAddSelectedToRecipients = () => {
|
||||
const rows = userListTable.getSelectedRowModel().rows;
|
||||
if (rows.length === 0) {
|
||||
alert("추가할 담당자를 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
setSelectedRecipients((prev) => {
|
||||
const existingTelNos = new Set(prev.map((r) => r.telNo));
|
||||
const newRecipients = rows
|
||||
.map((row) => row.original)
|
||||
.filter((recipient) => !existingTelNos.has(recipient.telNo))
|
||||
.map((recipient) => ({
|
||||
...recipient,
|
||||
variableOverrides: {},
|
||||
}));
|
||||
|
||||
return [...prev, ...newRecipients];
|
||||
});
|
||||
|
||||
setUserListRowSelection({});
|
||||
};
|
||||
|
||||
const handleApplyCommonValues = () => {
|
||||
setSelectedRecipients((prev) =>
|
||||
prev.map((recipient) => {
|
||||
const newOverrides: Record<string, string> = {};
|
||||
|
||||
variableNames.forEach((variableName) => {
|
||||
const mappingType = commonVariableMapping[variableName];
|
||||
|
||||
if (!mappingType) return;
|
||||
|
||||
if (mappingType === "custom") {
|
||||
newOverrides[variableName] =
|
||||
commonVariableValues[variableName] ?? "";
|
||||
} else {
|
||||
newOverrides[variableName] =
|
||||
(recipient[
|
||||
mappingType as keyof SewerStUserItem
|
||||
] as string) ?? "";
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
...recipient,
|
||||
variableOverrides: {
|
||||
...recipient.variableOverrides,
|
||||
...newOverrides,
|
||||
},
|
||||
};
|
||||
}),
|
||||
);
|
||||
setCommonVariableMapping({});
|
||||
};
|
||||
|
||||
const handleResetCommonValues = () => {
|
||||
setCommonVariableMapping({});
|
||||
setCommonVariableValues({});
|
||||
};
|
||||
|
||||
const handleRecipientVariableChange = (
|
||||
telNo: string,
|
||||
variableName: string,
|
||||
value: string,
|
||||
) => {
|
||||
setSelectedRecipients((prev) =>
|
||||
prev.map((recipient) =>
|
||||
recipient.telNo === telNo
|
||||
? {
|
||||
...recipient,
|
||||
variableOverrides: {
|
||||
...recipient.variableOverrides,
|
||||
[variableName]: value,
|
||||
},
|
||||
}
|
||||
: recipient,
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const handlePreview = (recipient: SelectedRecipient) => {
|
||||
if (!selectedTemplate) {
|
||||
alert("알림톡 템플릿을 먼저 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
setPreviewRecipient(recipient);
|
||||
setIsPreviewOpen(true);
|
||||
};
|
||||
|
||||
const handleSend = async () => {
|
||||
if (!selectedTemplateCode) {
|
||||
alert("알림톡 템플릿을 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
if (selectedRecipients.length === 0) {
|
||||
alert("발송할 담당자를 1명 이상 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const missingVariable = selectedRecipients.some((recipient) =>
|
||||
variableNames.some((name) => {
|
||||
const mergedValue =
|
||||
recipient.variableOverrides[name] ??
|
||||
commonVariableValues[name] ??
|
||||
"";
|
||||
return mergedValue.trim() === "";
|
||||
}),
|
||||
);
|
||||
if (missingVariable) {
|
||||
alert("필수 변수값이 입력되지 않은 발송 대상이 있습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const payload: BusinessSendRequest = {
|
||||
templateCode: selectedTemplateCode,
|
||||
callback: "032-590-4000",
|
||||
recipients: selectedRecipients.map((recipient) =>
|
||||
getMergedVariables(recipient, commonVariableValues),
|
||||
),
|
||||
};
|
||||
|
||||
try {
|
||||
setIsSending(true);
|
||||
const response = await client.post<BusinessSendResponse>(
|
||||
`${ENDPOINT.NTFTALK_SERVICE.ATA_SEND}/business`,
|
||||
payload,
|
||||
);
|
||||
const data = response.data;
|
||||
if (!data.success) {
|
||||
alert(data.message || "알림톡 발송 요청에 실패했습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
alert(
|
||||
data.message ||
|
||||
`${data.sentCount}건의 알림톡 발송이 요청되었습니다.`,
|
||||
);
|
||||
setSelectedRecipients([]);
|
||||
setCommonVariableValues({});
|
||||
} catch {
|
||||
alert("알림톡 발송 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsSending(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-[32rem_minmax(0,1fr)]">
|
||||
<section className="card card-border space-y-6 p-4 pb-0">
|
||||
<div className="space-y-2">
|
||||
<h3 className="text-xl font-semibold">
|
||||
알림톡 템플릿 선택
|
||||
</h3>
|
||||
<div className="flex items-center gap-3">
|
||||
<Select
|
||||
value={selectedTemplateCode}
|
||||
onValueChange={handleTemplateChange}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="템플릿 선택" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{templates.map((template) => (
|
||||
<SelectItem
|
||||
key={template.templateCode}
|
||||
value={template.templateCode}
|
||||
>
|
||||
{template.templateName}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<p className="text-lg font-medium">미리보기</p>
|
||||
<div className="relative">
|
||||
<div className="h-[32rem] overflow-auto rounded-[20px] rounded-b-none bg-[rgb(176,192,207)] p-8 pb-0 before:absolute before:left-0 before:top-0 before:block before:h-full before:w-full before:rounded-[20px] before:rounded-b-none before:border-[10px] before:border-b-0 before:border-black before:content-['']">
|
||||
<div className="w-[calc(100%-2rem)] pb-5">
|
||||
<span className="text-[1.1rem] text-black">
|
||||
하수도통계시스템
|
||||
</span>
|
||||
<div className="mt-2 rounded-t-[12px] bg-[rgb(247,228,54)] p-4 text-[1.2rem] font-medium text-black">
|
||||
알림톡 도착
|
||||
</div>
|
||||
<div className="whitespace-pre-wrap rounded-b-[12px] bg-white p-4 text-[1.2rem] leading-normal tracking-tight text-black">
|
||||
{selectedTemplate?.templateContent ??
|
||||
"알림톡 템플릿을 선택하면 미리보기 메시지가 표시됩니다."}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="card card-border p-4">
|
||||
<h3 className="text-xl font-semibold">통계 담당자 목록</h3>
|
||||
<div className="card card-border mx-0 flex items-center p-4">
|
||||
<div className="flex items-center gap-6">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="whitespace-nowrap">
|
||||
시도
|
||||
</Label>
|
||||
<Select
|
||||
value={searchSido}
|
||||
onValueChange={(value) => {
|
||||
setSearchSido(value);
|
||||
setSearchSigungu("");
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-[16rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{sidoOptions.map((option) => (
|
||||
<SelectItem
|
||||
key={option.adstCd}
|
||||
value={option.adstCd}
|
||||
>
|
||||
{option.adstNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="whitespace-nowrap">
|
||||
시군구
|
||||
</Label>
|
||||
<Select
|
||||
value={searchSigungu}
|
||||
onValueChange={setSearchSigungu}
|
||||
disabled={!searchSido}
|
||||
>
|
||||
<SelectTrigger className="w-[16rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{sigunguOptions.map((option) => (
|
||||
<SelectItem
|
||||
key={option.adstCd}
|
||||
value={option.adstCd}
|
||||
>
|
||||
{option.adstNm}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="whitespace-nowrap">
|
||||
구분
|
||||
</Label>
|
||||
<Select
|
||||
value={searchGubun}
|
||||
onValueChange={setSearchGubun}
|
||||
>
|
||||
<SelectTrigger className="w-[16rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{GUBUN_OPTIONS.map((option) => (
|
||||
<SelectItem
|
||||
key={option.value || "ALL"}
|
||||
value={option.value}
|
||||
>
|
||||
{option.label}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex w-full justify-end gap-2">
|
||||
<Button
|
||||
color="white"
|
||||
type="button"
|
||||
onClick={handleReset}
|
||||
>
|
||||
초기화
|
||||
</Button>
|
||||
<Button type="button" onClick={handleSearch}>
|
||||
검색
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="h-[32rem] overflow-x-auto rounded-md border">
|
||||
{isUserListLoading ? (
|
||||
<div className="flex items-center justify-center p-6">
|
||||
<div className="relative flex size-[6rem] justify-center">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
) : userList.length === 0 ? (
|
||||
<div className="p-6 text-center text-muted-foreground">
|
||||
조회된 담당자가 없습니다.
|
||||
</div>
|
||||
) : (
|
||||
<DataTable
|
||||
table={userListTable}
|
||||
className="min-w-[72rem] text-sm"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{!isUserListLoading && userList.length > 0 && (
|
||||
<div className="mt-3 flex items-center justify-end gap-4">
|
||||
<p className="text-xl text-muted-foreground">
|
||||
선택{" "}
|
||||
<span className="font-semibold text-foreground">
|
||||
{
|
||||
userListTable.getSelectedRowModel().rows
|
||||
.length
|
||||
}
|
||||
명
|
||||
</span>{" "}
|
||||
/ 전체{" "}
|
||||
<span className="font-semibold text-foreground">
|
||||
{userList.length}명
|
||||
</span>
|
||||
</p>
|
||||
<Button
|
||||
type="button"
|
||||
onClick={handleAddSelectedToRecipients}
|
||||
>
|
||||
+ 발송 목록 추가
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section className="card card-border p-4">
|
||||
<div className="mb-3 flex items-center justify-between">
|
||||
<h3 className="text-xl font-semibold">발송 목록</h3>
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-xl font-semibold text-foreground">
|
||||
{selectedRecipients.length}명
|
||||
</span>
|
||||
<Button
|
||||
type="button"
|
||||
color="green"
|
||||
onClick={handleSend}
|
||||
disabled={isSending}
|
||||
>
|
||||
발송
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{variableNames.length > 0 && (
|
||||
<div className="mb-4 rounded-md border p-3">
|
||||
<div className="flex items-center justify-between">
|
||||
<p className="text-lg font-medium">
|
||||
변수 일괄 적용
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color="white"
|
||||
onClick={handleResetCommonValues}
|
||||
>
|
||||
초기화
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
onClick={handleApplyCommonValues}
|
||||
>
|
||||
적용하기
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-6 md:grid-cols-4 lg:grid-cols-6">
|
||||
{variableNames.map((variableName) => (
|
||||
<div key={variableName} className="space-y-2">
|
||||
<Label className="whitespace-nowrap">{`#{${variableName}}`}</Label>
|
||||
<Select
|
||||
value={
|
||||
commonVariableMapping[
|
||||
variableName
|
||||
] ?? ""
|
||||
}
|
||||
onValueChange={(value) =>
|
||||
setCommonVariableMapping(
|
||||
(prev) => ({
|
||||
...prev,
|
||||
[variableName]: value as
|
||||
| "userNm"
|
||||
| "sido"
|
||||
| "gugun"
|
||||
| "gubunNm"
|
||||
| "deptNm"
|
||||
| "jbgdNm"
|
||||
| "telNo"
|
||||
| "custom"
|
||||
| "",
|
||||
}),
|
||||
)
|
||||
}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="선택하세요" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="userNm">
|
||||
이름
|
||||
</SelectItem>
|
||||
<SelectItem value="sido">
|
||||
시도
|
||||
</SelectItem>
|
||||
<SelectItem value="gugun">
|
||||
시군구
|
||||
</SelectItem>
|
||||
<SelectItem value="gubunNm">
|
||||
구분
|
||||
</SelectItem>
|
||||
<SelectItem value="deptNm">
|
||||
소속
|
||||
</SelectItem>
|
||||
<SelectItem value="jbgdNm">
|
||||
직급
|
||||
</SelectItem>
|
||||
<SelectItem value="telNo">
|
||||
전화번호
|
||||
</SelectItem>
|
||||
<SelectItem value="custom">
|
||||
직접입력
|
||||
</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
{commonVariableMapping[variableName] ===
|
||||
"custom" && (
|
||||
<Input
|
||||
placeholder="값을 입력하세요"
|
||||
value={
|
||||
commonVariableValues[
|
||||
variableName
|
||||
] ?? ""
|
||||
}
|
||||
onChange={(event) =>
|
||||
setCommonVariableValues(
|
||||
(prev) => ({
|
||||
...prev,
|
||||
[variableName]:
|
||||
event.target.value,
|
||||
}),
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="space-y-4">
|
||||
{selectedRecipients.length === 0 ? (
|
||||
<p className="rounded-md border p-6 text-center text-muted-foreground">
|
||||
선택된 발송 대상이 없습니다.
|
||||
</p>
|
||||
) : (
|
||||
<div className="overflow-x-auto rounded-md border">
|
||||
<Table variant="line" className="text-sm">
|
||||
<TableHeader>
|
||||
<TableRow>
|
||||
<TableHead className="min-w-[100px]">
|
||||
이름
|
||||
</TableHead>
|
||||
<TableHead className="min-w-[120px]">
|
||||
전화번호
|
||||
</TableHead>
|
||||
{/* <TableHead className="min-w-[80px]">
|
||||
시도
|
||||
</TableHead>
|
||||
<TableHead className="min-w-[100px]">
|
||||
시군구
|
||||
</TableHead>
|
||||
<TableHead className="min-w-[120px]">
|
||||
소속
|
||||
</TableHead> */}
|
||||
{variableNames.map((variableName) => (
|
||||
<TableHead
|
||||
key={variableName}
|
||||
className="min-w-[180px]"
|
||||
>
|
||||
#{variableName}
|
||||
</TableHead>
|
||||
))}
|
||||
<TableHead className="min-w-[160px] text-center">
|
||||
액션
|
||||
</TableHead>
|
||||
</TableRow>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
{selectedRecipients.map((recipient) => (
|
||||
<TableRow key={recipient.telNo}>
|
||||
<TableCell align="center">
|
||||
{recipient.userNm}
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
{recipient.telNo}
|
||||
</TableCell>
|
||||
{/* <TableCell align="center">
|
||||
{recipient.sido}
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
{recipient.gugun}
|
||||
</TableCell>
|
||||
<TableCell align="center">
|
||||
{recipient.deptNm}
|
||||
</TableCell> */}
|
||||
{variableNames.map(
|
||||
(variableName) => (
|
||||
<TableCell
|
||||
key={`${recipient.telNo}-${variableName}`}
|
||||
>
|
||||
<Input
|
||||
value={
|
||||
recipient
|
||||
.variableOverrides[
|
||||
variableName
|
||||
] ?? ""
|
||||
}
|
||||
onChange={(event) =>
|
||||
handleRecipientVariableChange(
|
||||
recipient.telNo,
|
||||
variableName,
|
||||
event.target
|
||||
.value,
|
||||
)
|
||||
}
|
||||
className="w-full min-w-[150px]"
|
||||
/>
|
||||
</TableCell>
|
||||
),
|
||||
)}
|
||||
<TableCell align="center">
|
||||
<div className="flex justify-center gap-1">
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color="gray"
|
||||
onClick={() =>
|
||||
handlePreview(
|
||||
recipient,
|
||||
)
|
||||
}
|
||||
>
|
||||
미리보기
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
size="sm"
|
||||
color="red"
|
||||
onClick={() =>
|
||||
handleRemoveRecipient(
|
||||
recipient.telNo,
|
||||
)
|
||||
}
|
||||
>
|
||||
제거
|
||||
</Button>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
))}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<Dialog open={isPreviewOpen} onOpenChange={setIsPreviewOpen}>
|
||||
<DialogContent
|
||||
className="max-w-[36rem]"
|
||||
aria-describedby={undefined}
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle>알림톡 미리보기</DialogTitle>
|
||||
<DialogDescription className="text-[1.1rem] tracking-tight">
|
||||
수신자: {previewRecipient?.userNm ?? "-"} /{" "}
|
||||
{previewRecipient?.telNo ?? "-"}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="relative">
|
||||
<div className="h-[32rem] overflow-auto rounded-[20px] rounded-b-none bg-[rgb(176,192,207)] p-8 pb-0 before:absolute before:left-0 before:top-0 before:block before:h-full before:w-full before:rounded-[20px] before:rounded-b-none before:border-[10px] before:border-b-0 before:border-black before:content-['']">
|
||||
<div className="w-[calc(100%-2rem)] pb-5">
|
||||
<span className="text-[1.1rem] text-black">
|
||||
하수도통계시스템
|
||||
</span>
|
||||
<div className="mt-2 rounded-t-[12px] bg-[rgb(247,228,54)] p-4 text-[1.2rem] font-medium text-black">
|
||||
알림톡 도착
|
||||
</div>
|
||||
<div className="whitespace-pre-wrap rounded-b-[12px] bg-white p-4 text-[1.2rem] leading-normal tracking-tight text-black">
|
||||
{previewMessage ||
|
||||
"메시지를 생성할 수 없습니다."}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button type="button" color="white">
|
||||
닫기
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default NtitlkSndng;
|
||||
@@ -0,0 +1,22 @@
|
||||
const CellColorInfo = () => {
|
||||
return (
|
||||
<div className="m-[0.6rem] flex justify-end">
|
||||
<div className="flex justify-end items-center gap-[1.2rem] !text-xl bg-white w-fit py-3 px-5 border border-slate-200/80 rounded-md">
|
||||
<div className="flex justify-center items-center gap-x-2">
|
||||
<div className="w-8 h-6 bg-[#feee85]"></div>
|
||||
<span>요약표</span>
|
||||
</div>
|
||||
<div className="flex justify-center items-center gap-x-2">
|
||||
<div className="w-8 h-6 bg-[#fff7bf]"></div>
|
||||
<span>합계</span>
|
||||
</div>
|
||||
<div className="flex justify-center items-center gap-x-2">
|
||||
<div className="w-8 h-6 bg-[#ffe9cf]"></div>
|
||||
<span>소계</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CellColorInfo;
|
||||
@@ -1,10 +1,202 @@
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsTotalStatusApi } from "@/entities/statistics/api/statistics-total-service";
|
||||
import { LoadingWithAnimation, Tabs, TabsContent, TabsList, TabsTrigger } from "@common/components";
|
||||
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import type { ColumnInfo } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { SewagePipeMaintainColumnListTot } from "@/components/util/column/total/sewagePipeMaintain/sewagePipeMaintainColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { SewagePipeMaintainTotalRequest } from "@/entities/statistics/model/statistics-total/statistics-sewage-pipe-maintain-total-interface";
|
||||
|
||||
const firstTabKey = SewagePipeMaintainColumnListTot[0]?.tabKey ?? "ST00030001";
|
||||
|
||||
function buildSewagePipeMaintainTotSearchParam(values: SearchFormValues): SewagePipeMaintainTotalRequest {
|
||||
return {
|
||||
ctpvNm: values.sido === "ALL" ? "" : values.sido,
|
||||
sggNm: values.gugun === "ALL" ? "" : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
rowDataYn: values.isDetail,
|
||||
};
|
||||
}
|
||||
|
||||
const SewagePipeMaintainTot = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [rowDataMap, setRowDataMap] = useState<Map<string, Record<string, string | number>[]>>(new Map());
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState(firstTabKey);
|
||||
const lastSearchedValuesRef = useRef<SearchFormValues | null>(null);
|
||||
|
||||
const columnInfo = SewagePipeMaintainColumnListTot;
|
||||
|
||||
const handleReset = () => {
|
||||
setRowDataMap(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
lastSearchedValuesRef.current = null;
|
||||
};
|
||||
|
||||
const loadSewagePipeMaintainTotTabData = async (
|
||||
tabKey: string,
|
||||
values: SearchFormValues,
|
||||
mergeIntoExistingMap: boolean,
|
||||
): Promise<boolean> => {
|
||||
const param = buildSewagePipeMaintainTotSearchParam(values);
|
||||
|
||||
const applyRows = (rows: Record<string, string | number>[]) => {
|
||||
if (mergeIntoExistingMap) {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set(tabKey, rows);
|
||||
return next;
|
||||
});
|
||||
} else {
|
||||
const next = new Map<string, Record<string, string | number>[]>();
|
||||
next.set(tabKey, rows);
|
||||
setRowDataMap(next);
|
||||
}
|
||||
};
|
||||
|
||||
if (tabKey === "ST00030001") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipeMaintainRepairTotal(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tabKey === "ST00030002") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipeMaintainDredgingTotal(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
let ok = false;
|
||||
if (activeTab === "ST00030001" || activeTab === "ST00030002") {
|
||||
ok = await loadSewagePipeMaintainTotTabData(activeTab, values, true);
|
||||
}
|
||||
if (ok) {
|
||||
lastSearchedValuesRef.current = values;
|
||||
} else {
|
||||
lastSearchedValuesRef.current = null;
|
||||
}
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
lastSearchedValuesRef.current = null;
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleActiveTabChange = async (tabKey: string) => {
|
||||
setActiveTab(tabKey);
|
||||
|
||||
const values = lastSearchedValuesRef.current;
|
||||
if (!values) return;
|
||||
|
||||
const existing = rowDataMap.get(tabKey);
|
||||
const hasData = Array.isArray(existing) && existing.length > 0;
|
||||
if (hasData) return;
|
||||
|
||||
if (tabKey === "ST00030001" || tabKey === "ST00030002") {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
await loadSewagePipeMaintainTotTabData(tabKey, values, true);
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm />
|
||||
</>
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="flex flex-col gap-[0.6rem] mx-[0.6rem]">
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={(v) => void handleActiveTabChange(v)}
|
||||
className="w-full"
|
||||
variant="default"
|
||||
>
|
||||
<TabsList>
|
||||
{columnInfo.map((info) => (
|
||||
<TabsTrigger key={info.tabKey} value={info.tabKey}>
|
||||
{info.tabLabel || info.tabKey}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
{columnInfo.map((info) => {
|
||||
const tabKey = info.tabKey;
|
||||
if (!info.columns || !info.columnLayout) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const gridColumnInfo: ColumnInfo = {
|
||||
columns: info.columns,
|
||||
columnLayout: info.columnLayout,
|
||||
};
|
||||
|
||||
return (
|
||||
<TabsContent key={tabKey} value={tabKey}>
|
||||
<DataGrid
|
||||
columnInfo={gridColumnInfo}
|
||||
rowStartNum={info.rowStartNum}
|
||||
excelExportFileSuffix={info.tabLabel || tabKey}
|
||||
rowData={rowData}
|
||||
setRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
const cur = next.get(tabKey) ?? [];
|
||||
const n =
|
||||
typeof updater === "function" ? updater(cur) : updater;
|
||||
next.set(tabKey, n);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
cellStyleCallback={({ row }) => {
|
||||
const rowType = String(row.rowType ?? "");
|
||||
if (rowType === "DETAIL") return undefined;
|
||||
if (rowType === "BIZ_SUM") return "rg-cell-rowtype-biz-sum";
|
||||
return "rg-cell-rowtype-other";
|
||||
}}
|
||||
/>
|
||||
</TabsContent>
|
||||
);
|
||||
})}
|
||||
</Tabs>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsTotalStatusApi } from "@/entities/statistics/api/statistics-total-service";
|
||||
@@ -6,71 +6,165 @@ import { LoadingWithAnimation, Tabs, TabsContent, TabsList, TabsTrigger } from "
|
||||
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import type { ColumnConfig, ColumnInfo, ColumnInfoList } from "@/components/type/DataGrid.type";
|
||||
import type { ColumnInfo } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { SewagePipeColumnInfoListTot } from "@/components/util/column/total/SewagePipeTotColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { SewagePipeTotalRequest } from "@/entities/statistics/model/statistics-total/statistics-sewage-pipe-total-interface";
|
||||
|
||||
const firstTabKey = SewagePipeColumnInfoListTot[0]?.tabKey ?? "ST00020001";
|
||||
|
||||
function buildSewagePipeTotSearchParam(values: SearchFormValues): SewagePipeTotalRequest {
|
||||
return {
|
||||
ctpvNm: values.sido === "ALL" ? "" : values.sido,
|
||||
sggNm: values.gugun === "ALL" ? "" : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
rowDataYn: values.isDetail,
|
||||
};
|
||||
}
|
||||
|
||||
const SewagePipeTot = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [rowDataMap, setRowDataMap] = useState<Map<string, Record<string, string | number>[]>>(new Map());
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [activeTab, setActiveTab] = useState(firstTabKey);
|
||||
/** 조회 성공 후 탭 전환 시 동일 조건으로 지연 조회 */
|
||||
const lastSearchedValuesRef = useRef<SearchFormValues | null>(null);
|
||||
|
||||
const columnInfo = useMemo(
|
||||
() =>
|
||||
SewagePipeColumnInfoListTot.map((tab: ColumnInfoList) => ({
|
||||
...tab,
|
||||
columns: (tab.columns ?? []).map((col: ColumnConfig) => ({
|
||||
...col,
|
||||
editable: false as const,
|
||||
styleName: col.styleName ?? ("rg-cell-readonly" as const),
|
||||
})),
|
||||
})),
|
||||
[],
|
||||
);
|
||||
const columnInfo = SewagePipeColumnInfoListTot;
|
||||
|
||||
const handleReset = () => {
|
||||
setRowDataMap(new Map());
|
||||
setActiveTab(firstTabKey);
|
||||
lastSearchedValuesRef.current = null;
|
||||
};
|
||||
|
||||
/** SewagePipeInp의 `loadSewagePipeActiveTabData`와 동일 역할: 탭키별 API 호출 후 `rowDataMap` 반영 */
|
||||
const loadSewagePipeTotTabData = async (
|
||||
tabKey: string,
|
||||
values: SearchFormValues,
|
||||
mergeIntoExistingMap: boolean,
|
||||
): Promise<boolean> => {
|
||||
const param = buildSewagePipeTotSearchParam(values);
|
||||
|
||||
const applyRows = (rows: Record<string, string | number>[]) => {
|
||||
if (mergeIntoExistingMap) {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set(tabKey, rows);
|
||||
return next;
|
||||
});
|
||||
} else {
|
||||
const next = new Map<string, Record<string, string | number>[]>();
|
||||
next.set(tabKey, rows);
|
||||
setRowDataMap(next);
|
||||
}
|
||||
};
|
||||
|
||||
if (tabKey === "ST00020001") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipeRegionalStatusList(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tabKey === "ST00020002") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipeFactInstallStatus(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tabKey === "ST00020003") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipePipeTypeFacilityStatus(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tabKey === "ST00020004") {
|
||||
const response = await statisticsTotalStatusApi.getSewagePipePipeDiamStatus(param);
|
||||
if (response.status === "success" && response.data) {
|
||||
applyRows(toGridRows(response.data as object[]));
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
setActiveTab(firstTabKey);
|
||||
setRowDataMap(new Map());
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const param = {
|
||||
ctpvNm: values.sido === "ALL" ? "" : values.sido,
|
||||
sggNm: values.gugun === "ALL" ? "" : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
rowDataYn: values.isDetail,
|
||||
};
|
||||
|
||||
const response = await statisticsTotalStatusApi.getSewagePipeRegionalStatusList(param);
|
||||
|
||||
if (response.status === "success" && response.data) {
|
||||
const next = new Map<string, Record<string, string | number>[]>();
|
||||
next.set("ST00020001", toGridRows(response.data as object[]));
|
||||
setRowDataMap(next);
|
||||
// SewagePipeInp과 동일: 검색 시 활성 탭 데이터만 조회·맵 병합
|
||||
let ok = false;
|
||||
if (
|
||||
activeTab === "ST00020001" ||
|
||||
activeTab === "ST00020002" ||
|
||||
activeTab === "ST00020003" ||
|
||||
activeTab === "ST00020004"
|
||||
) {
|
||||
ok = await loadSewagePipeTotTabData(activeTab, values, true);
|
||||
}
|
||||
if (ok) {
|
||||
lastSearchedValuesRef.current = values;
|
||||
} else {
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
lastSearchedValuesRef.current = null;
|
||||
}
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
lastSearchedValuesRef.current = null;
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleActiveTabChange = async (tabKey: string) => {
|
||||
setActiveTab(tabKey);
|
||||
|
||||
const values = lastSearchedValuesRef.current;
|
||||
if (!values) return;
|
||||
|
||||
const existing = rowDataMap.get(tabKey);
|
||||
const hasData = Array.isArray(existing) && existing.length > 0;
|
||||
if (hasData) return;
|
||||
|
||||
if (
|
||||
tabKey === "ST00020001" ||
|
||||
tabKey === "ST00020002" ||
|
||||
tabKey === "ST00020003" ||
|
||||
tabKey === "ST00020004"
|
||||
) {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
await loadSewagePipeTotTabData(tabKey, values, true);
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("[SewagePipeTot] tabKey (API 미연결):", tabKey);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<SearchForm isDetail={true} onSubmit={handleSearch} onReset={handleReset} />
|
||||
<SearchForm isDetail={true} onSubmit={handleSearch} onReset={handleReset} sidoSelectText="전체" />
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
@@ -81,7 +175,7 @@ const SewagePipeTot = () => {
|
||||
<div className="flex flex-col gap-[0.6rem] mx-[0.6rem]">
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={setActiveTab}
|
||||
onValueChange={(v) => void handleActiveTabChange(v)}
|
||||
className="w-full"
|
||||
variant="default"
|
||||
>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useAlertStore } from "@/shared/lib";
|
||||
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import CellColorInfo from "./CellColorInfo";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
|
||||
const SeweragePenetrationRateTot = () => {
|
||||
@@ -19,12 +20,17 @@ const SeweragePenetrationRateTot = () => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
|
||||
const isSummaryEnabled = values.isSummary !== 'ALL';
|
||||
const summaryYearCnt = isSummaryEnabled ? Number(values.isSummary) : undefined;
|
||||
|
||||
const param = {
|
||||
ctpvNm: values.sido === 'ALL' ? '' : values.sido,
|
||||
sggNm: values.gugun === 'ALL' ? '' : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
rowDataYn: values.isDetail
|
||||
rowDataYn: values.isDetail,
|
||||
summaryYn: isSummaryEnabled,
|
||||
...(isSummaryEnabled ? { summaryYearCnt } : {}),
|
||||
};
|
||||
|
||||
const response = await statisticsTotalStatusApi.getSewerageSupplyRateList(param);
|
||||
@@ -35,7 +41,8 @@ const SeweragePenetrationRateTot = () => {
|
||||
} else {
|
||||
alert(response.message || '데이터 조회 중 오류가 발생했습니다.');
|
||||
}
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
alert('데이터 조회 중 오류가 발생했습니다.');
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
@@ -44,12 +51,13 @@ const SeweragePenetrationRateTot = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<SearchForm isDetail={true} onSubmit={handleSearch} sidoSelectText="전체" />
|
||||
<SearchForm isDetail={true} isSummary={true} onSubmit={handleSearch} sidoSelectText="전체" />
|
||||
{isLoading && <div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>}
|
||||
<CellColorInfo />
|
||||
<DataGrid
|
||||
columnInfo={SeweragePentrationRateTotColumn}
|
||||
rowStartNum={2}
|
||||
@@ -61,6 +69,7 @@ const SeweragePenetrationRateTot = () => {
|
||||
const rowType = String(row.rowType ?? '');
|
||||
if (rowType === 'DETAIL') return undefined;
|
||||
if (rowType === 'BIZ_SUM') return 'rg-cell-rowtype-biz-sum';
|
||||
if (rowType === 'SUMMARY') return 'rg-cell-rowtype-summary';
|
||||
return 'rg-cell-rowtype-other';
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { useRef, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsTotalStatusApi } from "@/entities/statistics/api/statistics-total-service";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import TabDataGrid from "@/components/module/TabDataGrid";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import { LoadingWithAnimation, Tabs, TabsContent, TabsList, TabsTrigger } from "@common/components";
|
||||
|
||||
import type { ColumnConfig, ColumnInfoList } from "@/components/type/DataGrid.type";
|
||||
import type { ColumnInfo } from "@/components/type/DataGrid.type";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { ComplaintInpColumn } from "@/components/util/column/total/sewerageServiceLevel/ComplaintTotColumn";
|
||||
import { ResidentFriendlyFactTotColumn } from "@/components/util/column/total/sewerageServiceLevel/ResidentFriendlyFactTotColumn";
|
||||
@@ -17,81 +17,111 @@ const SewerageServiceLevelInpTabList = [
|
||||
ComplaintInpColumn,
|
||||
ResidentFriendlyFactTotColumn,
|
||||
];
|
||||
const SUPPORTED_TAB_KEYS = [ComplaintInpColumn.tabKey, ResidentFriendlyFactTotColumn.tabKey] as const;
|
||||
|
||||
const SewerageServiceLevelTot = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const [rowDataMap, setRowDataMap] = useState<Map<string, Record<string, string | number>[]>>(new Map());
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [activeTab, setActiveTab] = useState(ComplaintInpColumn.tabKey);
|
||||
const [lastSearchValues, setLastSearchValues] = useState<SearchFormValues | null>(null);
|
||||
const lastSearchValuesRef = useRef<SearchFormValues | null>(null);
|
||||
|
||||
const columnInfo = useMemo(
|
||||
() =>
|
||||
SewerageServiceLevelInpTabList.map((tab: ColumnInfoList) => ({
|
||||
...tab,
|
||||
columns: (tab.columns ?? []).map((col: ColumnConfig) => ({
|
||||
...col,
|
||||
editable: false as const,
|
||||
styleName: col.styleName ?? ("rg-cell-readonly" as const),
|
||||
})),
|
||||
})),
|
||||
[],
|
||||
);
|
||||
const columnInfo = SewerageServiceLevelInpTabList;
|
||||
|
||||
const handleReset = () => {
|
||||
setRowDataMap(new Map());
|
||||
setActiveTab(ComplaintInpColumn.tabKey);
|
||||
setLastSearchValues(null);
|
||||
lastSearchValuesRef.current = null;
|
||||
};
|
||||
|
||||
const fetchByTab = async (tabKey: string, values: SearchFormValues) => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const loadSewerageServiceLevelTotTabData = async (
|
||||
tabKey: string,
|
||||
values: SearchFormValues,
|
||||
mergeIntoExistingMap: boolean,
|
||||
) => {
|
||||
const param = {
|
||||
ctpvNm: values.sido === "ALL" ? "" : values.sido,
|
||||
sggNm: values.gugun === "ALL" ? "" : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
rowDataYn: values.isDetail,
|
||||
};
|
||||
|
||||
const param = {
|
||||
ctpvNm: values.sido === "ALL" ? "" : values.sido,
|
||||
sggNm: values.gugun === "ALL" ? "" : values.gugun,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
statsYr: values.year,
|
||||
rowDataYn: values.isDetail,
|
||||
};
|
||||
const fetcherMap = {
|
||||
[ComplaintInpColumn.tabKey]: statisticsTotalStatusApi.getSewerageServiceLevelComplaint.bind(
|
||||
statisticsTotalStatusApi,
|
||||
),
|
||||
[ResidentFriendlyFactTotColumn.tabKey]:
|
||||
statisticsTotalStatusApi.getSewerageServiceLevelResidentFriendlyFact.bind(
|
||||
statisticsTotalStatusApi,
|
||||
),
|
||||
};
|
||||
const fetcher = fetcherMap[tabKey];
|
||||
if (!fetcher) {
|
||||
return false;
|
||||
}
|
||||
const response = await fetcher(param);
|
||||
|
||||
let response;
|
||||
if (tabKey === ResidentFriendlyFactTotColumn.tabKey) {
|
||||
response =
|
||||
await statisticsTotalStatusApi.getSewerageServiceLevelResidentFriendlyFact(param);
|
||||
} else {
|
||||
response =
|
||||
await statisticsTotalStatusApi.getSewerageServiceLevelComplaint(param);
|
||||
}
|
||||
|
||||
if (response.status === "success" && response.data) {
|
||||
if (response.status === "success" && response.data) {
|
||||
const rows = toGridRows(response.data as object[]);
|
||||
if (mergeIntoExistingMap) {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
next.set(tabKey, toGridRows(response.data as object[]));
|
||||
next.set(tabKey, rows);
|
||||
return next;
|
||||
});
|
||||
} else {
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
const next = new Map<string, Record<string, string | number>[]>();
|
||||
next.set(tabKey, rows);
|
||||
setRowDataMap(next);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
return false;
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
let ok = false;
|
||||
if (SUPPORTED_TAB_KEYS.includes(activeTab)) {
|
||||
ok = await loadSewerageServiceLevelTotTabData(activeTab, values, true);
|
||||
}
|
||||
if (ok) {
|
||||
lastSearchValuesRef.current = values;
|
||||
} else {
|
||||
lastSearchValuesRef.current = null;
|
||||
}
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
lastSearchValuesRef.current = null;
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearch = async (values: SearchFormValues) => {
|
||||
setLastSearchValues(values);
|
||||
setRowDataMap(new Map());
|
||||
await fetchByTab(activeTab, values);
|
||||
};
|
||||
const handleActiveTabChange = async (tabKey: string) => {
|
||||
setActiveTab(tabKey);
|
||||
|
||||
useEffect(() => {
|
||||
if (lastSearchValues == null) return;
|
||||
if (rowDataMap.has(activeTab)) return;
|
||||
void fetchByTab(activeTab, lastSearchValues);
|
||||
}, [activeTab]);
|
||||
const values = lastSearchValuesRef.current;
|
||||
if (!values) return;
|
||||
|
||||
const existing = rowDataMap.get(tabKey);
|
||||
const hasData = Array.isArray(existing) && existing.length > 0;
|
||||
if (hasData) return;
|
||||
|
||||
if (SUPPORTED_TAB_KEYS.includes(tabKey)) {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
await loadSewerageServiceLevelTotTabData(tabKey, values, true);
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
@@ -103,20 +133,60 @@ const SewerageServiceLevelTot = () => {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<TabDataGrid
|
||||
columnInfo={columnInfo}
|
||||
isExcelImport={false}
|
||||
rowDataMap={rowDataMap}
|
||||
setRowDataMap={setRowDataMap}
|
||||
activeTab={activeTab}
|
||||
onActiveTabChange={setActiveTab}
|
||||
cellStyleCallback={({ row }) => {
|
||||
const rowType = String(row.rowType ?? "");
|
||||
if (rowType === "DETAIL") return undefined;
|
||||
if (rowType === "BIZ_SUM") return "rg-cell-rowtype-biz-sum";
|
||||
return "rg-cell-rowtype-other";
|
||||
}}
|
||||
/>
|
||||
<div className="flex flex-col gap-[0.6rem] mx-[0.6rem]">
|
||||
<Tabs value={activeTab} onValueChange={(v) => void handleActiveTabChange(v)} className="w-full" variant="default">
|
||||
<TabsList>
|
||||
{columnInfo.map((info) => (
|
||||
<TabsTrigger key={info.tabKey} value={info.tabKey}>
|
||||
{info.tabLabel || info.tabKey}
|
||||
</TabsTrigger>
|
||||
))}
|
||||
</TabsList>
|
||||
{columnInfo.map((info) => {
|
||||
const tabKey = info.tabKey;
|
||||
if (!info.columns || !info.columnLayout) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const rowData = rowDataMap.get(tabKey) ?? [];
|
||||
const gridColumnInfo: ColumnInfo = {
|
||||
columns: info.columns,
|
||||
columnLayout: info.columnLayout,
|
||||
};
|
||||
|
||||
return (
|
||||
<TabsContent key={tabKey} value={tabKey}>
|
||||
<DataGrid
|
||||
columnInfo={gridColumnInfo}
|
||||
rowStartNum={info.rowStartNum}
|
||||
excelExportFileSuffix={info.tabLabel || tabKey}
|
||||
rowData={rowData}
|
||||
setRowData={(updater) => {
|
||||
setRowDataMap((prev) => {
|
||||
const next = new Map(prev);
|
||||
const cur = next.get(tabKey) ?? [];
|
||||
const n = typeof updater === "function" ? updater(cur) : updater;
|
||||
next.set(tabKey, n);
|
||||
return next;
|
||||
});
|
||||
}}
|
||||
isExcelImport={false}
|
||||
isExcelExport
|
||||
showHeaderCheckbox={false}
|
||||
fixedColumns={info.fixedColumns}
|
||||
enableSort={false}
|
||||
cellStyleCallback={({ row }) => {
|
||||
const rowType = String(row.rowType ?? "");
|
||||
if (rowType === "DETAIL") return undefined;
|
||||
if (rowType === "BIZ_SUM") return "rg-cell-rowtype-biz-sum";
|
||||
return "rg-cell-rowtype-other";
|
||||
}}
|
||||
/>
|
||||
</TabsContent>
|
||||
);
|
||||
})}
|
||||
</Tabs>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -129,6 +129,7 @@ const DEFAULT_FILTERS: StatisticsVerificationFilterState = {
|
||||
statsYr: String(dayjs().year() - 1),
|
||||
sewerBzmnCd: null,
|
||||
statsCd: null,
|
||||
laeSbmsnSttsCd: "2",
|
||||
};
|
||||
|
||||
const DEFAULT_SUB_FILTERS: StatisticsVerificationSubFilterState = {
|
||||
@@ -156,15 +157,6 @@ function StatisticsVerificationReport() {
|
||||
useState<StatisticsVerificationFilterState>(DEFAULT_FILTERS);
|
||||
const [subFilters, setSubFilters] =
|
||||
useState<StatisticsVerificationSubFilterState>(DEFAULT_SUB_FILTERS);
|
||||
const [submittedFilters, setSubmittedFilters] =
|
||||
useState<StatisticsVerificationFilterState>(DEFAULT_FILTERS);
|
||||
const [submittedParams, setSubmittedParams] = useState<{
|
||||
main: StatisticsVerificationFilterState;
|
||||
sub: StatisticsVerificationSubFilterState;
|
||||
}>({
|
||||
main: DEFAULT_FILTERS,
|
||||
sub: DEFAULT_SUB_FILTERS,
|
||||
});
|
||||
const [selectedReportRows, setSelectedReportRows] = useState<
|
||||
StatsInputStatusList[]
|
||||
>([]);
|
||||
@@ -182,11 +174,30 @@ function StatisticsVerificationReport() {
|
||||
const { data: sigunguData } = useStAnlsSigunguCombo(
|
||||
filters.sewerBzmnCd ?? "",
|
||||
);
|
||||
const detailParams = useMemo(
|
||||
() => ({
|
||||
statsYr: filters.statsYr,
|
||||
ctpvNm:
|
||||
subFilters.ctpvNm !== "" ? subFilters.ctpvNm : filters.ctpvNm,
|
||||
sggNm: subFilters.sggNm !== "" ? subFilters.sggNm : filters.sggNm,
|
||||
sewerBzmnCd:
|
||||
subFilters.sewerBzmnCd !== ""
|
||||
? subFilters.sewerBzmnCd
|
||||
: filters.sewerBzmnCd,
|
||||
statsCd:
|
||||
subFilters.statsCd !== ""
|
||||
? subFilters.statsCd
|
||||
: filters.statsCd,
|
||||
prcsYnList: subFilters.prcsYnList,
|
||||
pbcpAprvYn: subFilters.pbcpAprvYn,
|
||||
laeSbmsnSttsCd: subFilters.laeSbmsnSttsCd,
|
||||
}),
|
||||
[filters, subFilters],
|
||||
);
|
||||
|
||||
const statisticsVerificationReportQuery =
|
||||
useStatsVrfcRptData(submittedFilters);
|
||||
const statisticsVerificationReportQuery = useStatsVrfcRptData(filters);
|
||||
const statisticsVerificationResultQuery =
|
||||
useStatsVrfcRsltData(submittedParams);
|
||||
useStatsVrfcRsltData(detailParams);
|
||||
|
||||
const statisticsVerificationReportData =
|
||||
statisticsVerificationReportQuery.data ?? [];
|
||||
@@ -253,11 +264,17 @@ function StatisticsVerificationReport() {
|
||||
const nextRows = statisticsVerificationResultGridRows;
|
||||
const prevLength = prevLengthRef.current;
|
||||
|
||||
if (!dataProvider || nextRows.length === 0) {
|
||||
if (!dataProvider) {
|
||||
prevLengthRef.current = nextRows.length;
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextRows.length === 0) {
|
||||
dataProvider.setRows?.([]);
|
||||
prevLengthRef.current = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (nextRows.length > prevLength && prevLength > 0) {
|
||||
// 무한스크롤 시 데이터 처리
|
||||
const newRows = nextRows.slice(prevLength);
|
||||
@@ -327,17 +344,16 @@ function StatisticsVerificationReport() {
|
||||
statisticsVerificationReportQuery.isError,
|
||||
]);
|
||||
|
||||
function handleSearch(
|
||||
nextFilters: StatisticsVerificationFilterState,
|
||||
nextSubFilters: StatisticsVerificationSubFilterState,
|
||||
) {
|
||||
setSelectedReportRows([]);
|
||||
function resetResultState() {
|
||||
setSelectedResultRows([]);
|
||||
setSubmittedFilters({ ...nextFilters });
|
||||
setSubmittedParams({
|
||||
main: { ...nextFilters },
|
||||
sub: { ...nextSubFilters },
|
||||
});
|
||||
editedResultRowMapRef.current = new Map();
|
||||
prevLengthRef.current = 0;
|
||||
resultGridRef.current?.dataProvider?.setRows?.([]);
|
||||
}
|
||||
|
||||
function resetReportState() {
|
||||
setSelectedReportRows([]);
|
||||
resetResultState();
|
||||
}
|
||||
|
||||
async function handleLoadMoreDetail() {
|
||||
@@ -350,14 +366,6 @@ function StatisticsVerificationReport() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleResultSearch() {
|
||||
setSelectedResultRows([]);
|
||||
setSubmittedParams({
|
||||
main: { ...filters },
|
||||
sub: { ...subFilters },
|
||||
});
|
||||
}
|
||||
|
||||
function handleFilterChange<
|
||||
K extends keyof StatisticsVerificationFilterState,
|
||||
>(key: K) {
|
||||
@@ -365,6 +373,7 @@ function StatisticsVerificationReport() {
|
||||
value?: StatisticsVerificationFilterState[K],
|
||||
optionData?: { label: string; value: string },
|
||||
) => {
|
||||
resetReportState();
|
||||
if (key === "sewerBzmnCd") {
|
||||
setFilters((prev) => ({
|
||||
...prev,
|
||||
@@ -372,8 +381,17 @@ function StatisticsVerificationReport() {
|
||||
sewerBzmnCd: optionData?.value,
|
||||
sggNm: "",
|
||||
}));
|
||||
setSubFilters((prev) => ({
|
||||
...prev,
|
||||
ctpvNm: "",
|
||||
sggNm: "",
|
||||
sewerBzmnCd: "",
|
||||
}));
|
||||
return;
|
||||
}
|
||||
if (key === "statsCd") {
|
||||
setSubFilters((prev) => ({ ...prev, statsCd: "" }));
|
||||
}
|
||||
setFilters((prev) => ({ ...prev, [key]: value }));
|
||||
};
|
||||
}
|
||||
@@ -382,10 +400,16 @@ function StatisticsVerificationReport() {
|
||||
K extends keyof StatisticsVerificationSubFilterState,
|
||||
>(key: K) {
|
||||
return (value?: StatisticsVerificationSubFilterState[K]) => {
|
||||
resetResultState();
|
||||
setSubFilters((prev) => ({ ...prev, [key]: value }));
|
||||
};
|
||||
}
|
||||
|
||||
function handleSubFilterReset() {
|
||||
setSubFilters(DEFAULT_SUB_FILTERS);
|
||||
resetResultState();
|
||||
}
|
||||
|
||||
function handleCellEdited(params: CellEditedCallbackParams) {
|
||||
const { itemIndex, fieldName, newValue } = params;
|
||||
const dataProvider = resultGridRef.current?.dataProvider as
|
||||
@@ -403,11 +427,7 @@ function StatisticsVerificationReport() {
|
||||
function handleReset() {
|
||||
setFilters(DEFAULT_FILTERS);
|
||||
setSubFilters(DEFAULT_SUB_FILTERS);
|
||||
setSelectedReportRows([]);
|
||||
setSelectedResultRows([]);
|
||||
editedResultRowMapRef.current = new Map();
|
||||
prevLengthRef.current = 0;
|
||||
handleSearch(DEFAULT_FILTERS, DEFAULT_SUB_FILTERS);
|
||||
resetReportState();
|
||||
}
|
||||
|
||||
function handleApprove() {
|
||||
@@ -532,9 +552,6 @@ function StatisticsVerificationReport() {
|
||||
<Button color="white" onClick={handleReset}>
|
||||
초기화
|
||||
</Button>
|
||||
<Button onClick={() => handleSearch(filters, subFilters)}>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
onClick={handleApprove}
|
||||
@@ -557,6 +574,15 @@ function StatisticsVerificationReport() {
|
||||
setRowData={() => {}}
|
||||
showHeaderCheckbox={true}
|
||||
gridHeight={30}
|
||||
onRowClick={(row: StatsInputStatusList) => {
|
||||
setSubFilters((prev) => ({
|
||||
...prev,
|
||||
ctpvNm: row?.ctpvNm ?? "",
|
||||
sggNm: row?.sggNm ?? "",
|
||||
sewerBzmnCd: row?.sewerBzmnCd ?? "",
|
||||
statsCd: row?.statsCd ?? "",
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
|
||||
<h3 className="mt-10 px-2 text-[1.8rem] font-bold text-title">
|
||||
@@ -578,14 +604,15 @@ function StatisticsVerificationReport() {
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-end justify-end gap-2">
|
||||
<Button onClick={handleResultSearch}>조회</Button>
|
||||
<Button color="white" onClick={handleSubFilterReset}>
|
||||
초기화
|
||||
</Button>
|
||||
<Button
|
||||
color="red"
|
||||
onClick={handleReject}
|
||||
disabled={
|
||||
selectedResultRows.length === 0
|
||||
// ||
|
||||
// selectedResultRows.some((row) => row.prcsYn !== "2")
|
||||
selectedResultRows.length === 0 ||
|
||||
selectedResultRows.some((row) => row.prcsYn !== "2")
|
||||
}
|
||||
>
|
||||
반려
|
||||
|
||||
@@ -65,21 +65,15 @@ const Indicators: React.FC<IndicatorsProps> = ({ anlsSn, vrfcTrgtSn }) => {
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 grid min-h-[10rem] grid-cols-4 gap-2">
|
||||
<IndicatorItem label="r 중위수" value={dtl?.rtCnterVl} />
|
||||
<IndicatorItem label="R 중위수" value={dtl?.rtCnterVl} />
|
||||
<IndicatorItem label="E 중위수" value={dtl?.lastTrsfScrCnterVl} />
|
||||
<IndicatorItem label="하위 기준값" value={dtl?.lastTrsfScrLlmtVl} />
|
||||
<IndicatorItem
|
||||
label="(E_m)E 중위수"
|
||||
value={dtl?.lastTrsfScrCnterVl}
|
||||
/>
|
||||
<IndicatorItem
|
||||
label="(E_l)E 하한값"
|
||||
value={dtl?.lastTrsfScrLlmtVl}
|
||||
/>
|
||||
<IndicatorItem
|
||||
label="(E_u)E 상한값"
|
||||
label="상위 기준값"
|
||||
value={dtl?.lastTrsfScrUplmtVl}
|
||||
/>
|
||||
<IndicatorItem label="E_D_L" value={dtl?.llmtVl} />
|
||||
<IndicatorItem label="E_D_U" value={dtl?.uplmtVl} />
|
||||
<IndicatorItem label="이상치 하한값" value={dtl?.llmtVl} />
|
||||
<IndicatorItem label="이상치 상한값" value={dtl?.uplmtVl} />
|
||||
<IndicatorItem label="이상치 하한선" value={dtl?.otlrLlmtLine} />
|
||||
<IndicatorItem label="이상치 상한선" value={dtl?.otlrUplmtLine} />
|
||||
</div>
|
||||
|
||||
@@ -46,11 +46,6 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
selectedRowId,
|
||||
appliedFilter,
|
||||
}) => {
|
||||
const [selectedSido, setSelectedSido] = useState<string>("");
|
||||
const [selectedGugun, setSelectedGugun] = useState<string>("");
|
||||
const [selectedStatus, setSelectedStatus] = useState<string>("");
|
||||
const [showAllOnEmptyFilter, setShowAllOnEmptyFilter] =
|
||||
useState<boolean>(true);
|
||||
const [isDownloading, setIsDownloading] = useState<boolean>(false);
|
||||
|
||||
const [gridRowData, setGridRowData] = useState<
|
||||
@@ -58,7 +53,7 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
>([]);
|
||||
|
||||
const { data: sidoData } = useStAnlsSidoCombo();
|
||||
const { data: gugunData } = useStAnlsSigunguCombo(selectedSido);
|
||||
const { data: gugunData } = useStAnlsSigunguCombo(appliedFilter.sido ?? "");
|
||||
const sidoOptions = sidoData ?? EMPTY_ADST_LIST;
|
||||
const gugunOptions = gugunData ?? EMPTY_ADST_LIST;
|
||||
|
||||
@@ -69,14 +64,7 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
|
||||
const rowData = useMemo(() => {
|
||||
let data = (resultData?.content ?? []) as StAnlsRsltResponse[];
|
||||
|
||||
if (
|
||||
!appliedFilter.sido &&
|
||||
!appliedFilter.gugun &&
|
||||
!appliedFilter.status
|
||||
) {
|
||||
data = showAllOnEmptyFilter ? data : [];
|
||||
} else {
|
||||
{
|
||||
const sidoCd = appliedFilter.sido;
|
||||
if (sidoCd) {
|
||||
data = data.filter((item) =>
|
||||
@@ -116,32 +104,18 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
}));
|
||||
|
||||
return mappedData;
|
||||
}, [resultData, appliedFilter, showAllOnEmptyFilter]);
|
||||
}, [resultData, appliedFilter]);
|
||||
|
||||
const handleSidoChange = (val: string) => {
|
||||
setSelectedSido(val);
|
||||
setSelectedGugun("");
|
||||
};
|
||||
|
||||
const handleSearch = () => {
|
||||
onFilterChange({
|
||||
sido: selectedSido,
|
||||
gugun: selectedGugun,
|
||||
status: selectedStatus,
|
||||
});
|
||||
setShowAllOnEmptyFilter(false);
|
||||
onFilterChange({ ...appliedFilter, sido: val, gugun: "" });
|
||||
};
|
||||
|
||||
const handleReset = () => {
|
||||
setSelectedSido("");
|
||||
setSelectedGugun("");
|
||||
setSelectedStatus("");
|
||||
onFilterChange({
|
||||
sido: "",
|
||||
gugun: "",
|
||||
status: "",
|
||||
});
|
||||
setShowAllOnEmptyFilter(true);
|
||||
};
|
||||
|
||||
const handleDownload = async () => {
|
||||
@@ -182,7 +156,7 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
<div className="flex justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Select
|
||||
value={selectedSido || ""}
|
||||
value={appliedFilter.sido || ""}
|
||||
onValueChange={handleSidoChange}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem] bg-white">
|
||||
@@ -197,9 +171,11 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select
|
||||
value={selectedGugun}
|
||||
onValueChange={setSelectedGugun}
|
||||
disabled={!selectedSido}
|
||||
value={appliedFilter.gugun || ""}
|
||||
onValueChange={(val) =>
|
||||
onFilterChange({ ...appliedFilter, gugun: val })
|
||||
}
|
||||
disabled={!appliedFilter.sido}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem] bg-white">
|
||||
<SelectValue placeholder="시군구 선택" />
|
||||
@@ -213,8 +189,10 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select
|
||||
value={selectedStatus}
|
||||
onValueChange={setSelectedStatus}
|
||||
value={appliedFilter.status || ""}
|
||||
onValueChange={(val) =>
|
||||
onFilterChange({ ...appliedFilter, status: val })
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-[10rem] bg-white">
|
||||
<SelectValue placeholder="상태 선택" />
|
||||
@@ -231,7 +209,7 @@ const RegionalGrid: React.FC<RegionalGridProps> = ({
|
||||
<Button color="white" onClick={handleReset}>
|
||||
초기화
|
||||
</Button>
|
||||
<Button onClick={handleSearch}>조회</Button>
|
||||
{/* <Button onClick={handleSearch}>조회</Button> */}
|
||||
<Button
|
||||
color="green"
|
||||
onClick={handleDownload}
|
||||
|
||||
@@ -104,10 +104,12 @@ const ScatterChart: React.FC<ScatterChartProps> = ({
|
||||
anlsSn,
|
||||
vrfcTrgtSn,
|
||||
);
|
||||
console.log("resultData: ", resultData);
|
||||
const { data: chartData, isLoading: isLoadingChart } = useStAnlsChartData(
|
||||
anlsSn,
|
||||
vrfcTrgtSn,
|
||||
);
|
||||
console.log("chartData: ", chartData);
|
||||
|
||||
const isLoading = isLoadingGrid || isLoadingChart;
|
||||
|
||||
@@ -158,10 +160,12 @@ const ScatterChart: React.FC<ScatterChartProps> = ({
|
||||
item,
|
||||
};
|
||||
|
||||
if (item.otlrYnCd === "0") {
|
||||
normalPoints.push(pt);
|
||||
} else {
|
||||
if (item.otlrYnCd === "2") {
|
||||
return;
|
||||
} else if (item.otlrYnCd === "1") {
|
||||
outlierPoints.push(pt);
|
||||
} else {
|
||||
normalPoints.push(pt);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import { useEffect, useRef, useState } from 'react';
|
||||
import { NoData } from '@/shared/ui/no-data';
|
||||
import {
|
||||
Button,
|
||||
Input,
|
||||
Table,
|
||||
TableBody,
|
||||
TableCell,
|
||||
|
||||
@@ -3,9 +3,15 @@ import React from "react";
|
||||
import { ValueType } from "realgrid";
|
||||
import type { RealGridReact } from "realgrid-react";
|
||||
|
||||
import { type SewerageSupplyRateStatusInfo } from "@/entities/statistics/model/input/statistics-sewage-supply-rate-input-interface";
|
||||
|
||||
// RealGrid 타입 정의
|
||||
|
||||
/** DataGrid 상단 진행상황/제출일/담당자 표시에 사용 (보급률·하수관로 등 공통) */
|
||||
export type DataGridStatusBannerInfo = {
|
||||
laeSbmsnSttsCd: string | null;
|
||||
laeSbmsnYmd: string | null;
|
||||
laePicNm: string | null;
|
||||
laePicTelNo: string | null;
|
||||
};
|
||||
/** setColumns에 전달하는 컬럼 정보 (footer 배열/단일 객체 포함) */
|
||||
export type RealGridColumnInfo = {
|
||||
name: string;
|
||||
@@ -19,30 +25,30 @@ export type RealGridColumnInfo = {
|
||||
mergeRule?: { criteria: "value" | string };
|
||||
sortable?: boolean;
|
||||
footer?:
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>;
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>;
|
||||
};
|
||||
|
||||
/** setColumns 메서드가 있는 GridView */
|
||||
@@ -111,21 +117,21 @@ export type DataFieldValueCallback = (
|
||||
export type ComputedFieldConfig =
|
||||
| { fields: string[]; type: "sum" | "avg" }
|
||||
| {
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "pblswrgPopltnSuprtRate";
|
||||
}
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "pblswrgPopltnSuprtRate";
|
||||
}
|
||||
| {
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "adtrtPopltnSuprtRate";
|
||||
}
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "adtrtPopltnSuprtRate";
|
||||
}
|
||||
| {
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
thirdFields: string[];
|
||||
type: "swrgInstlrtRate";
|
||||
};
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
thirdFields: string[];
|
||||
type: "swrgInstlrtRate";
|
||||
};
|
||||
|
||||
export type ColumnConfig = {
|
||||
name: string;
|
||||
@@ -148,31 +154,31 @@ export type ColumnConfig = {
|
||||
valueType?: ValueType;
|
||||
dataFormat?: string;
|
||||
footer?:
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
multiRow?: boolean; // 여러 행 footer 사용 여부
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>; // RealGrid에서 footer를 배열로 설정할 수 있음
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
multiRow?: boolean; // 여러 행 footer 사용 여부
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>; // RealGrid에서 footer를 배열로 설정할 수 있음
|
||||
};
|
||||
|
||||
export type FooterUserSpan = {
|
||||
@@ -184,16 +190,16 @@ export type FooterUserSpan = {
|
||||
export type ColumnLayoutItem =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
hideChildHeaders?: boolean;
|
||||
header: { text: string };
|
||||
items: (string | ColumnLayoutItem)[];
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
}
|
||||
name: string;
|
||||
hideChildHeaders?: boolean;
|
||||
header: { text: string };
|
||||
items: (string | ColumnLayoutItem)[];
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
}
|
||||
| {
|
||||
column: string; // 컬럼 이름 (footerUserSpans 사용 시)
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
};
|
||||
column: string; // 컬럼 이름 (footerUserSpans 사용 시)
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
};
|
||||
|
||||
export type ColumnInfo = {
|
||||
columns: ColumnConfig[];
|
||||
@@ -285,7 +291,7 @@ export type DataGridProps = {
|
||||
/** CheckBar 헤더 전체 선택/해제 */
|
||||
onItemAllChecked?: (checked: boolean) => void;
|
||||
onScrollToBottom?: () => void;
|
||||
statusInfo?: SewerageSupplyRateStatusInfo | null;
|
||||
statusInfo?: DataGridStatusBannerInfo | null;
|
||||
/** 강조 및 스크롤할 행의 ID */
|
||||
highlightedRowId?: string | number | null;
|
||||
/** ID로 사용할 필드명 (기본값: 'id') */
|
||||
|
||||
@@ -6,6 +6,7 @@ export type SearchFormValues = {
|
||||
fctName?: string;
|
||||
bsnmCd?: string;
|
||||
isDetail?: boolean;
|
||||
isSummary?: string;
|
||||
};
|
||||
|
||||
export type SearchFormProps = {
|
||||
@@ -17,6 +18,7 @@ export type SearchFormProps = {
|
||||
fctName?: boolean;
|
||||
userMenual?: boolean;
|
||||
isDetail?: boolean;
|
||||
isSummary?: boolean;
|
||||
onSubmit?: (values: SearchFormValues) => void;
|
||||
onReset?: () => void;
|
||||
onValuesChange?: (values: SearchFormValues) => void;
|
||||
@@ -33,4 +35,5 @@ export const defaultSearchFormProps: Required<
|
||||
fctName: false,
|
||||
userMenual: false,
|
||||
isDetail: false,
|
||||
isSummary: false,
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* statistics/input 화면과 탭(·분할 그리드) 키 매칭용 상수.
|
||||
* 각 컴포넌트에 실제로 쓰이는 `tabKey`를 모두 포함합니다.
|
||||
*/
|
||||
|
||||
/** `SewagePipeInp.tsx` — 메인 탭 + `ConnectionStatusInpColumn` 좌·우 그리드 서브 키 */
|
||||
export const SEWAGE_PIPE_INP_TAB_KEYS = [
|
||||
"ST00020001",
|
||||
"ST00020002",
|
||||
"ST00020003",
|
||||
"ST00020004",
|
||||
"ST00020005",
|
||||
"ST00020006",
|
||||
"treatmentPlantConnectionInp",
|
||||
"adminAreaConnectionInp",
|
||||
] as const;
|
||||
|
||||
/** `SewagePipeMaintainInp.tsx` — 보수·준설 탭 */
|
||||
export const SEWAGE_PIPE_MAINTAIN_INP_TAB_KEYS = ["ST00030001", "ST00030002"] as const;
|
||||
|
||||
/** `SeweragePenetrationRateInp.tsx` — 단일 그리드(통계코드) */
|
||||
export const SEWERAGE_PENETRATION_RATE_INP_TAB_KEYS = ["ST00010001"] as const;
|
||||
|
||||
export type SewagePipeInpTabKey = (typeof SEWAGE_PIPE_INP_TAB_KEYS)[number];
|
||||
export type SewagePipeMaintainInpTabKey = (typeof SEWAGE_PIPE_MAINTAIN_INP_TAB_KEYS)[number];
|
||||
export type SeweragePenetrationRateInpTabKey = (typeof SEWERAGE_PENETRATION_RATE_INP_TAB_KEYS)[number];
|
||||
|
||||
/** 컴포넌트 파일명 기준 묶음 (메뉴·라우트 매칭 시 참고) */
|
||||
export const STATISTICS_INPUT_TAB_KEYS_BY_SCREEN = {
|
||||
SewagePipeInp: SEWAGE_PIPE_INP_TAB_KEYS,
|
||||
SewagePipeMaintainInp: SEWAGE_PIPE_MAINTAIN_INP_TAB_KEYS,
|
||||
SeweragePenetrationRateInp: SEWERAGE_PENETRATION_RATE_INP_TAB_KEYS,
|
||||
} as const;
|
||||
@@ -20,4 +20,15 @@ export const needBsnmFrgnrPoplSmSidoList = [
|
||||
"4700000000",
|
||||
"4800000000",
|
||||
"5000000000",
|
||||
];
|
||||
|
||||
export const doNameList = [
|
||||
"경기도",
|
||||
"강원특별자치도",
|
||||
"충청북도",
|
||||
"충청남도",
|
||||
"전북특별자치도",
|
||||
"전라남도",
|
||||
"경상북도",
|
||||
"경상남도",
|
||||
];
|
||||
@@ -1,211 +0,0 @@
|
||||
import { footerInt, footerDecimal1, footerDecimal3 } from "@/components/util/grid/footerSummary";
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
/**
|
||||
* 하수도 통계 관리 > 06. 공공하수처리시설
|
||||
* 단일 Tab
|
||||
*/
|
||||
export const PublicSewageFactInpColumn = {
|
||||
columns: [
|
||||
// 행정구역
|
||||
{ name: 'sidoCd', fieldName: '시도', header: { text: '시도' }, editable: false },
|
||||
{ name: 'gugun', fieldName: '시군구', header: { text: '시군구' }, editable: false, footer: { text: '합계' } },
|
||||
|
||||
// 시설명
|
||||
{ name: 'bscFctNm', fieldName: '시설명(500m³/일 이상/미만)', header: { text: '시설명(500m³/일 이상/미만)' }, editable: false },
|
||||
|
||||
// 소재지
|
||||
{ name: 'addr', fieldName: '소재지', header: { text: '소재지' }, editable: false },
|
||||
|
||||
// 시설용량
|
||||
{ name: 'fctCpc', fieldName: '시설용량(500m³/일 이상/미만)', header: { text: '시설용량(500m³/일 이상/미만)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// (m³/일)
|
||||
{ name: 'fctCpc1', fieldName: '물리적', header: { text: '물리적' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'fctCpc2', fieldName: '생물학적', header: { text: '생물학적' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'fctCpc3', fieldName: '고도', header: { text: '고도' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 유입하수량
|
||||
{ name: 'totInflAmntAve', fieldName: '유입하수량(500m³/일 이상/미만)', header: { text: '유입하수량(500m³/일 이상/미만)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// (m³/일)
|
||||
{ name: 'pInflAmntAve', fieldName: '물리적', header: { text: '물리적' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'oInflAmntAve', fieldName: '생물학적', header: { text: '생물학적' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'aInflAmntAve', fieldName: '고도', header: { text: '고도' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 방류량
|
||||
{ name: 'totTputAve', fieldName: '방류량(500m³/일 이상/미만)', header: { text: '방류량(500m³/일 이상/미만)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 방류량 - (m³/일)
|
||||
{ name: 'pTputAve', fieldName: '물리적', header: { text: '물리적' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'oTputAve', fieldName: '생물학적', header: { text: '생물학적' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'aTputAve', fieldName: '고도', header: { text: '고도' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 수질
|
||||
{ name: 'inflAssctBfrWqltBod', fieldName: '유입BOD', header: { text: '유입BOD' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'efflWqltBod', fieldName: '방류BOD', header: { text: '방류BOD' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'inflAssctBfrWqltToc', fieldName: '유입TOC', header: { text: '유입TOC' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'efflWqltToc', fieldName: '방류TOC', header: { text: '방류TOC' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'inflAssctBfrWqltSs', fieldName: '유입SS', header: { text: '유입SS' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'efflWqltSs', fieldName: '방류SS', header: { text: '방류SS' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'inflAssctBfrWqltTn', fieldName: '유입T-N', header: { text: '유입T-N' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' },
|
||||
{ name: 'efflWqltTn', fieldName: '방류T-N', header: { text: '방류T-N' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' },
|
||||
{ name: 'inflAssctBfrWqltTp', fieldName: '유입T-P', header: { text: '유입T-P' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' },
|
||||
{ name: 'efflWqltTp', fieldName: '방류T-P', header: { text: '방류T-P' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' },
|
||||
{ name: 'inflAssctBfrWqltClfgrpcnt', fieldName: '유입총대장균군수', header: { text: '유입총대장균군수' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'efflWqltClfgrpcnt', fieldName: '방류총대장균군수', header: { text: '방류총대장균군수' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 처리특성
|
||||
{ name: 'tmEfficiency', fieldName: '처리효율(%)', header: { text: '처리효율(%)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'pcLoad', fieldName: '처리부하량(kgBOD/D)', header: { text: '처리부하량(kgBOD/D)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'trtFrfHanNm', fieldName: '처리방법', header: { text: '처리방법' }, editable: false },
|
||||
|
||||
// 연계처리량
|
||||
{ name: 'excretionsTot', fieldName: '분뇨', header: { text: '분뇨' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'stkrsngWstwtrTot', fieldName: '축산', header: { text: '축산' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'lchtTot', fieldName: '침출수', header: { text: '침출수' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'etcTot', fieldName: '기타', header: { text: '기타' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 시설정보
|
||||
{ name: 'tel', fieldName: '전화번호', header: { text: '전화번호' }, editable: false },
|
||||
{ name: 'rnDt', fieldName: '준공일', header: { text: '준공일' }, editable: false },
|
||||
{ name: 'compDt', fieldName: '가동개시일', header: { text: '가동개시일' }, editable: false },
|
||||
{ name: 'tot', fieldName: '사업비', header: { text: '사업비' }, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 방류수 소독방법
|
||||
{ name: 'dsfctNm', fieldName: '방류수 소독방법', header: { text: '방류수 소독방법' }, editable: false },
|
||||
|
||||
// 방류수역
|
||||
{ name: 'wbsnNm', fieldName: '수계', header: { text: '수계' }, editable: false },
|
||||
{ name: 'rvNm', fieldName: '지류', header: { text: '지류' }, editable: false },
|
||||
{ name: 'mdmbsn', fieldName: '세부단위구역', header: { text: '세부단위구역' }, editable: false },
|
||||
{ name: 'efflWqltStndrdNm', fieldName: '지역구분', header: { text: '지역구분' }, editable: false },
|
||||
|
||||
// 방류수역 > 중권역
|
||||
{ name: 'lgbsn', fieldName: '명칭', header: { text: '명칭' }, editable: false },
|
||||
{ name: 'lgbsnBod', fieldName: '목표수질(BOD)', header: { text: '목표수질(BOD)' }, editable: false },
|
||||
|
||||
// 에너지 자립률
|
||||
{ name: 'toeRt', fieldName: '에너지자립률(%)', header: { text: '에너지자립률(%)' }, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 에너지 자체 생산량
|
||||
{ name: 'useQnty', fieldName: '에너지자체생산량(TOE)', header: { text: '에너지자체생산량(TOE)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 연간 총 에너지 사용량
|
||||
{ name: 'toeSum', fieldName: '계(TOE)', header: { text: '계(TOE)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'elcpwAmnt', fieldName: '총 전력사용량(kWh)', header: { text: '총 전력사용량(kWh)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'toeQnty', fieldName: '자체 에너지사용량(TOE)', header: { text: '자체 에너지사용량(TOE)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 하수처리량당 CO2배출량
|
||||
{ name: 'co2Emissions', fieldName: '하수처리량당 CO2배출량(kgCO2/m³)', header: { text: '하수처리량당 CO2배출량(kgCO2/m³)' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000' },
|
||||
|
||||
// 운영주체
|
||||
{ name: 'oprClsNm', fieldName: '운영주체(자체/공기업/민간대행)', header: { text: '운영주체(자체/공기업/민간대행)' }, editable: false },
|
||||
|
||||
// 위탁현황
|
||||
{ name: 'trstOprEtpNm', fieldName: '위탁업체명', header: { text: '위탁업체명' } },
|
||||
{ name: 'yrstpTrstCst', fieldName: '위탁비용(백만원/년)', header: { text: '위탁비용(백만원/년)' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'trstOprDt', fieldName: '위탁계약기간(yyyy-mm-dd~yyyy-mm-dd)', header: { text: '위탁계약기간(yyyy-mm-dd~yyyy-mm-dd)' } },
|
||||
|
||||
// 기타
|
||||
{ name: 'cntrTrtFctNm', fieldName: '중심처리시설', header: { text: '중심처리시설' } },
|
||||
{ name: 'totWtrQrm', fieldName: '직원총수(명)', header: { text: '직원총수(명)' }, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'safeAcdntCo', fieldName: '안전사고건수', header: { text: '안전사고건수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'rmk', fieldName: '비고', header: { text: '비고' } },
|
||||
],
|
||||
|
||||
columnLayout: [
|
||||
{
|
||||
name: 'administrative',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '행정구역' },
|
||||
items: ['sidoCd', 'gugun'],
|
||||
},
|
||||
'bscFctNm',
|
||||
'addr',
|
||||
'fctCpc',
|
||||
{
|
||||
name: 'facilityCapacityDetail',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '(m³/일)' },
|
||||
items: ['fctCpc1', 'fctCpc2', 'fctCpc3'],
|
||||
},
|
||||
'totInflAmntAve',
|
||||
{
|
||||
name: 'influentWaterDetail',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '(m³/일)' },
|
||||
items: ['pInflAmntAve', 'oInflAmntAve', 'aInflAmntAve'],
|
||||
},
|
||||
'totTputAve',
|
||||
{
|
||||
name: 'effluentWaterDetail',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '(m³/일)' },
|
||||
items: ['pTputAve', 'oTputAve', 'aTputAve'],
|
||||
},
|
||||
'inflAssctBfrWqltBod',
|
||||
'efflWqltBod',
|
||||
'inflAssctBfrWqltToc',
|
||||
'efflWqltToc',
|
||||
'inflAssctBfrWqltSs',
|
||||
'efflWqltSs',
|
||||
'inflAssctBfrWqltTn',
|
||||
'efflWqltTn',
|
||||
'inflAssctBfrWqltTp',
|
||||
'efflWqltTp',
|
||||
'inflAssctBfrWqltClfgrpcnt',
|
||||
'efflWqltClfgrpcnt',
|
||||
'tmEfficiency',
|
||||
'pcLoad',
|
||||
'trtFrfHanNm',
|
||||
{
|
||||
name: 'linkedTreatment',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '연계처리량(m³/일) (500m³/일 이상/미만)' },
|
||||
items: ['excretionsTot', 'stkrsngWstwtrTot', 'lchtTot', 'etcTot'],
|
||||
},
|
||||
'tel',
|
||||
'rnDt',
|
||||
'compDt',
|
||||
'tot',
|
||||
'dsfctNm',
|
||||
{
|
||||
name: 'dischargeArea',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '방류수역' },
|
||||
items: [
|
||||
'wbsnNm',
|
||||
'rvNm',
|
||||
'mdmbsn',
|
||||
'efflWqltStndrdNm',
|
||||
{
|
||||
name: 'mediumWatershed',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '중권역' },
|
||||
items: ['lgbsn', 'lgbsnBod'],
|
||||
},
|
||||
],
|
||||
},
|
||||
'toeRt',
|
||||
'useQnty',
|
||||
{
|
||||
name: 'energy',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '연간 총 에너지 사용량(TOE)' },
|
||||
items: ['toeSum', 'elcpwAmnt', 'toeQnty'],
|
||||
},
|
||||
'co2Emissions',
|
||||
'oprClsNm',
|
||||
{
|
||||
name: 'consignmentStatus',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '위탁현황' },
|
||||
items: ['trstOprEtpNm', 'yrstpTrstCst', 'trstOprDt'],
|
||||
},
|
||||
'cntrTrtFctNm',
|
||||
'totWtrQrm',
|
||||
'safeAcdntCo',
|
||||
'rmk',
|
||||
]
|
||||
};
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
export const MainFacilityColumn = {
|
||||
columns: [
|
||||
{ name: 'swtrmtFcltNm', fieldName: 'swtrmtFcltNm', header: { text: '시설명' }, editable: false },
|
||||
{ name: 'fcltPstnCn', fieldName: 'fcltPstnCn', header: { text: '소재지' }, editable: false },
|
||||
{ name: 'prxyBzentyNmCn', fieldName: 'prxyBzentyNmCn', header: { text: '위탁업체명' }, editable: false },
|
||||
{ name: 'cnsgnCstVl', fieldName: 'cnsgnCstVl', header: { text: '위탁비용(백만원/년)' }, editable: false },
|
||||
{ name: 'prxyCtrtCn', fieldName: 'prxyCtrtCn', header: { text: '위탁계약기간' }, editable: false },
|
||||
{ name: 'isMainYn', fieldName: 'isMainYn', header: { text: '중심처리시설여부' }, editable: false },
|
||||
|
||||
{ name: 'admdstCd', fieldName: 'admdstCd', header: { text: '행정구역코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'fcltSn', fieldName: 'fcltSn', header: { text: '처리시설일련번호' }, visible: false, editable: false, valueType: ValueType.TEXT, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'swtrmtFcltCd', fieldName: 'swtrmtFcltCd', header: { text: '하수처리시설코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
],
|
||||
columnLayout: [
|
||||
'swtrmtFcltNm',
|
||||
'fcltPstnCn',
|
||||
'prxyBzentyNmCn',
|
||||
'cnsgnCstVl',
|
||||
'prxyCtrtCn',
|
||||
'isMainYn',
|
||||
'admdstCd',
|
||||
'fcltSn',
|
||||
'swtrmtFcltCd',
|
||||
'sggNm',
|
||||
'admdstNm',
|
||||
],
|
||||
rowStartNum: 1,
|
||||
fixedColumns: 1,
|
||||
tabKey: 'MainFacility',
|
||||
tabLabel: '지자체별공공하수처리시설'
|
||||
};
|
||||
|
||||
// Tab 6-2: 하수처리장별 연결 현황 (왼쪽 그리드)
|
||||
export const MainFacilityTargetColumn = {
|
||||
columns: [
|
||||
// 하수처리장 정보
|
||||
{ name: 'swtrmtFcltNm', fieldName: 'swtrmtFcltNm', header: { text: '시설명' }, editable: false },
|
||||
{ name: 'fcltPstnCn', fieldName: 'fcltPstnCn', header: { text: '소재지' }, editable: false },
|
||||
{ name: 'mappedYn', fieldName: 'mappedYn', header: { text: '연결여부' }, editable: false },
|
||||
|
||||
{ name: 'fcltSn', fieldName: 'fcltSn', header: { text: '처리시설일련번호' }, visible: false, editable: false, valueType: ValueType.TEXT, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'swtrmtFcltCd', fieldName: 'swtrmtFcltCd', header: { text: '하수처리시설코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'mainFcltSn', fieldName: 'mainFcltSn', header: { text: '연결된중심시설일련번호' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'isMainYn', fieldName: 'isMainYn', header: { text: '중심처리시설여부' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
],
|
||||
columnLayout: [
|
||||
'swtrmtFcltNm',
|
||||
'fcltPstnCn',
|
||||
'mappedYn',
|
||||
'fcltSn',
|
||||
'swtrmtFcltCd',
|
||||
'admdstNm',
|
||||
'mainFcltSn',
|
||||
'isMainYn',
|
||||
],
|
||||
rowStartNum: 1,
|
||||
fixedColumns: 1,
|
||||
tabKey: 'MainFacilityTarget',
|
||||
tabLabel: '연결대상시설'
|
||||
};
|
||||
|
||||
export const MainFacilityInpColumn = {
|
||||
tabKey: 'ST00060002',
|
||||
tabLabel: '중심 처리 시설',
|
||||
isSplitGrid: true,
|
||||
left: MainFacilityColumn,
|
||||
right: MainFacilityTargetColumn,
|
||||
};
|
||||
+220
@@ -0,0 +1,220 @@
|
||||
import { footerInt, footerDecimal1, footerDecimal3 } from "@/components/util/grid/footerSummary";
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
/**
|
||||
* 하수도 통계 관리 > 06. 공공하수처리시설
|
||||
*/
|
||||
export const PublicSewageFactColumn = {
|
||||
columns: [
|
||||
// 행정구역
|
||||
{ name: 'ctpvNm', fieldName: 'ctpvNm', header: { text: '시도' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구' }, editable: false, footer: { text: '합계' }, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 시설명
|
||||
{ name: 'swtrmtFcltNm', fieldName: 'swtrmtFcltNm', header: { text: '시설명(500m³/일 이상/미만)' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 소재지
|
||||
{ name: 'impdFcltPstnCn', fieldName: 'impdFcltPstnCn', header: { text: '소재지' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 시설용량
|
||||
{ name: 'prcsFcltCpct', fieldName: 'prcsFcltCpct', header: { text: '시설용량(500m³/일 이상/미만)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-total' },
|
||||
|
||||
// (m³/일)
|
||||
{ name: 'prcsFcltPhysCpct', fieldName: 'prcsFcltPhysCpct', header: { text: '물리적' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'prcsFcltBoilCpct', fieldName: 'prcsFcltBoilCpct', header: { text: '생물학적' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'prcsFcltAltdCpct', fieldName: 'prcsFcltAltdCpct', header: { text: '고도' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 유입하수량
|
||||
{ name: 'inflwSwageQnt', fieldName: 'inflwSwageQnt', header: { text: '유입하수량(500m³/일 이상/미만)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// (m³/일)
|
||||
{ name: 'inflwSwagePhysQnt', fieldName: 'inflwSwagePhysQnt', header: { text: '물리적' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'inflwSwageBoilQnt', fieldName: 'inflwSwageBoilQnt', header: { text: '생물학적' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'inflwSwageAltdQnt', fieldName: 'inflwSwageAltdQnt', header: { text: '고도' }, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 방류량
|
||||
{ name: 'prcsQnt', fieldName: 'prcsQnt', header: { text: '방류량(500m³/일 이상/미만)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 방류량 - (m³/일)
|
||||
{ name: 'prcsPhysCpct', fieldName: 'prcsPhysCpct', header: { text: '물리적' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'prcsBoilCpct', fieldName: 'prcsBoilCpct', header: { text: '생물학적' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'prcsAltdCpct', fieldName: 'prcsAltdCpct', header: { text: '고도' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 수질
|
||||
{ name: 'inflwBodVl', fieldName: 'inflwBodVl', header: { text: '유입BOD' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dschgBodVl', fieldName: 'dschgBodVl', header: { text: '방류BOD' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'inflwTocQnt', fieldName: 'inflwTocQnt', header: { text: '유입TOC' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dschgTocQnt', fieldName: 'dschgTocQnt', header: { text: '방류TOC' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'inflwSsQnt', fieldName: 'inflwSsQnt', header: { text: '유입SS' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dschgSsQnt', fieldName: 'dschgSsQnt', header: { text: '방류SS' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'inflwTnVl', fieldName: 'inflwTnVl', header: { text: '유입T-N' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dschgTnVl', fieldName: 'dschgTnVl', header: { text: '방류T-N' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'inflwTpVl', fieldName: 'inflwTpVl', header: { text: '유입T-P' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dschgTpVl', fieldName: 'dschgTpVl', header: { text: '방류T-P' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'inflwGrssClfgVl', fieldName: 'inflwGrssClfgVl', header: { text: '유입총대장균군수' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dschgGrssClfgVl', fieldName: 'dschgGrssClfgVl', header: { text: '방류총대장균군수' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 처리특성
|
||||
{ name: 'prcsRt', fieldName: 'prcsRt', header: { text: '처리효율(%)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-total' },
|
||||
{ name: 'prcsLodQnt', fieldName: 'prcsLodQnt', header: { text: '처리부하량(kgBOD/D)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-total' },
|
||||
{ name: 'prcsMthdExpln', fieldName: 'prcsMthdExpln', header: { text: '처리방법' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 연계처리량
|
||||
{ name: 'wholHmnQnt', fieldName: 'wholHmnQnt', header: { text: '분뇨' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'wholLvstQnt', fieldName: 'wholLvstQnt', header: { text: '축산' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'wholEfntQnt', fieldName: 'wholEfntQnt', header: { text: '침출수' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'wholEtcQnt', fieldName: 'wholEtcQnt', header: { text: '기타' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 시설정보
|
||||
{ name: 'telNo', fieldName: 'telNo', header: { text: '전화번호' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'cmptnStrtYmd', fieldName: 'cmptnStrtYmd', header: { text: '준공일' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'oprtngStrtYmd', fieldName: 'oprtngStrtYmd', header: { text: '가동개시일' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'wholBizVl', fieldName: 'wholBizVl', header: { text: '사업비' }, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 방류수 소독방법
|
||||
{ name: 'eflntDsnfMthdExpln', fieldName: 'eflntDsnfMthdExpln', header: { text: '방류수 소독방법' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 방류수역
|
||||
{ name: 'wtsysNm', fieldName: 'wtsysNm', header: { text: '수계' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'trbtrNm', fieldName: 'trbtrNm', header: { text: '지류' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'dtlUnitZoneCn', fieldName: 'dtlUnitZoneCn', header: { text: '세부단위구역' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'rgnSeNm', fieldName: 'rgnSeNm', header: { text: '지역구분' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 방류수역 > 중권역
|
||||
{ name: 'msirbCn', fieldName: 'msirbCn', header: { text: '명칭' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'goalWqNo', fieldName: 'goalWqNo', header: { text: '목표수질(BOD)' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 에너지 자립률
|
||||
{ name: 'engySrlneRt', fieldName: 'engySrlneRt', header: { text: '에너지자립률(%)' }, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 에너지 자체 생산량
|
||||
{ name: 'engyItslfPrdctnQnt', fieldName: 'engyItslfPrdctnQnt', header: { text: '에너지자체생산량(TOE)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 연간 총 에너지 사용량
|
||||
{ name: 'anlEngyWholUseQnt', fieldName: 'anlEngyWholUseQnt', header: { text: '계(TOE)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'anlElpwrUseQnt', fieldName: 'anlElpwrUseQnt', header: { text: '총 전력사용량(kWh)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'itslfEngyUseQnt', fieldName: 'itslfEngyUseQnt', header: { text: '자체 에너지사용량(TOE)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 하수처리량당 CO2배출량
|
||||
{ name: 'swtrmtEmsnQnt', fieldName: 'swtrmtEmsnQnt', header: { text: '하수처리량당 CO2배출량(kgCO2/m³)' }, editable: false, footer: footerDecimal3, valueType: ValueType.NUMBER, dataFormat: '#,##0.000', styleName: 'rg-cell-total' },
|
||||
|
||||
// 운영주체
|
||||
{ name: 'operMnbdCn', fieldName: 'operMnbdCn', header: { text: '운영주체(자체/공기업/민간대행)' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
|
||||
// 위탁현황
|
||||
{ name: 'prxyBzentyNmCn', fieldName: 'prxyBzentyNmCn', header: { text: '위탁업체명' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'cnsgnCstVl', fieldName: 'cnsgnCstVl', header: { text: '위탁비용(백만원/년)' }, editable: false, footer: footerDecimal1, valueType: ValueType.NUMBER, dataFormat: '#,##0.0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'prxyCtrtCn', fieldName: 'prxyCtrtCn', header: { text: '위탁계약기간' } },
|
||||
|
||||
// 기타
|
||||
{ name: 'intgPrcsFcltCn', fieldName: 'intgPrcsFcltCn', header: { text: '중심처리시설' }, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'wholNope', fieldName: 'wholNope', header: { text: '직원총수(명)' }, editable: false, footer: footerInt, valueType: ValueType.NUMBER, dataFormat: '#,##0', styleName: 'rg-cell-readonly' },
|
||||
{ name: 'sftyAcdntEvntcsCnt', fieldName: 'sftyAcdntEvntcsCnt', header: { text: '안전사고건수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'rmk', fieldName: '비고', header: { text: '비고' } },
|
||||
{ name: 'admdstCd', fieldName: 'admdstCd', header: { text: '행정구역코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'fcltSn', fieldName: 'fcltSn', header: { text: '처리시설일련번호' }, visible: false, editable: false, valueType: ValueType.TEXT, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'swtrmtFcltCd', fieldName: 'swtrmtFcltCd', header: { text: '하수처리시설코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
],
|
||||
|
||||
columnLayout: [
|
||||
{
|
||||
name: 'administrative',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '행정구역' },
|
||||
items: ['ctpvNm', 'sggNm'],
|
||||
},
|
||||
'swtrmtFcltNm',
|
||||
'impdFcltPstnCn',
|
||||
'prcsFcltCpct',
|
||||
{
|
||||
name: 'facilityCapacityDetail',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '(m³/일)' },
|
||||
items: ['prcsFcltPhysCpct', 'prcsFcltBoilCpct', 'prcsFcltAltdCpct'],
|
||||
},
|
||||
'inflwSwageQnt',
|
||||
{
|
||||
name: 'influentWaterDetail',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '(m³/일)' },
|
||||
items: ['inflwSwagePhysQnt', 'inflwSwageBoilQnt', 'inflwSwageAltdQnt'],
|
||||
},
|
||||
'prcsQnt',
|
||||
{
|
||||
name: 'effluentWaterDetail',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '(m³/일)' },
|
||||
items: ['prcsPhysCpct', 'prcsBoilCpct', 'prcsAltdCpct'],
|
||||
},
|
||||
'inflwBodVl',
|
||||
'dschgBodVl',
|
||||
'inflwTocQnt',
|
||||
'dschgTocQnt',
|
||||
'inflwSsQnt',
|
||||
'dschgSsQnt',
|
||||
'inflwTnVl',
|
||||
'dschgTnVl',
|
||||
'inflwTpVl',
|
||||
'dschgTpVl',
|
||||
'inflwGrssClfgVl',
|
||||
'dschgGrssClfgVl',
|
||||
'prcsRt',
|
||||
'prcsLodQnt',
|
||||
'prcsMthdExpln',
|
||||
{
|
||||
name: 'linkedTreatment',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '연계처리량(m³/일) (500m³/일 이상/미만)' },
|
||||
items: ['wholHmnQnt', 'wholLvstQnt', 'wholEfntQnt', 'wholEtcQnt'],
|
||||
},
|
||||
'telNo',
|
||||
'cmptnStrtYmd',
|
||||
'oprtngStrtYmd',
|
||||
'wholBizVl',
|
||||
'eflntDsnfMthdExpln',
|
||||
{
|
||||
name: 'dischargeArea',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '방류수역' },
|
||||
items: [
|
||||
'wtsysNm',
|
||||
'trbtrNm',
|
||||
'dtlUnitZoneCn',
|
||||
'rgnSeNm',
|
||||
{
|
||||
name: 'mediumWatershed',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '중권역' },
|
||||
items: ['msirbCn', 'goalWqNo'],
|
||||
},
|
||||
],
|
||||
},
|
||||
'engySrlneRt',
|
||||
'engyItslfPrdctnQnt',
|
||||
{
|
||||
name: 'energy',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '연간 총 에너지 사용량(TOE)' },
|
||||
items: ['anlEngyWholUseQnt', 'anlElpwrUseQnt', 'itslfEngyUseQnt'],
|
||||
},
|
||||
'swtrmtEmsnQnt',
|
||||
'operMnbdCn',
|
||||
{
|
||||
name: 'consignmentStatus',
|
||||
hideChildHeaders: false,
|
||||
header: { text: '위탁현황' },
|
||||
items: ['prxyBzentyNmCn', 'cnsgnCstVl', 'prxyCtrtCn'],
|
||||
},
|
||||
'intgPrcsFcltCn',
|
||||
'wholNope',
|
||||
'sftyAcdntEvntcsCnt',
|
||||
'rmk',
|
||||
'admdstCd',
|
||||
'fcltSn',
|
||||
'swtrmtFcltCd',
|
||||
],
|
||||
rowStartNum: 3,
|
||||
fixedColumns: 2,
|
||||
tabKey: 'ST00060001',
|
||||
tabLabel: '공공 하수처리 시설'
|
||||
};
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
import type { ColumnInfoList } from "@/components/type/DataGrid.type";
|
||||
import { MainFacilityInpColumn } from "./MainFacilityInpColumn";
|
||||
import { PublicSewageFactColumn } from "./PublicSewageFactColumn";
|
||||
|
||||
export const PublicSewageFactInpColumnList: ColumnInfoList[] = [
|
||||
PublicSewageFactColumn,
|
||||
MainFacilityInpColumn,
|
||||
];
|
||||
@@ -49,18 +49,18 @@ export const AdminAreaConnectionInpColumn = {
|
||||
export const TreatPlantConnectionInpColumn = {
|
||||
columns: [
|
||||
// 하수처리장 정보
|
||||
{ name: 'bscFctNm', fieldName: 'bscFctNm', header: { text: '하수처리장명' }, editable: false },
|
||||
{ name: 'fctCpc', fieldName: 'fctCpc', header: { text: '용량' }, valueType: ValueType.NUMBER, dataFormat: '#,##0', editable: false },
|
||||
{ name: 'bscFctCd', fieldName: 'bscFctCd', header: { text: '하수처리장코드' }, editable: false },
|
||||
{ name: 'fcltNm', fieldName: 'fcltNm', header: { text: '하수처리장명' }, editable: false },
|
||||
{ name: 'fcltCpct', fieldName: 'fcltCpct', header: { text: '용량' }, valueType: ValueType.NUMBER, dataFormat: '#,##0', editable: false },
|
||||
{ name: 'fcltSn', fieldName: 'fcltSn', header: { text: '하수처리장코드' }, editable: false },
|
||||
// 연결여부
|
||||
{ name: 'isConnection', fieldName: 'isConnection', header: { text: '연결여부' }, editable: false },
|
||||
// 연결지역
|
||||
{ name: 'connectionAreaList', fieldName: 'connectionAreaList', header: { text: '연결지역' }, editable: false },
|
||||
],
|
||||
columnLayout: [
|
||||
'bscFctNm',
|
||||
'fctCpc',
|
||||
'bscFctCd',
|
||||
'fcltNm',
|
||||
'fcltCpct',
|
||||
'fcltSn',
|
||||
'isConnection',
|
||||
'connectionAreaList',
|
||||
],
|
||||
|
||||
@@ -58,7 +58,7 @@ export const FactInstallStatusInpColumn = {
|
||||
|
||||
// 식별·키 필드 (API SeweragePipeInputFactInstallStatusItem, 그리드 비표시 — fixedColumns와 겹치지 않도록 맨 뒤)
|
||||
{ name: 'admdstCd', fieldName: 'admdstCd', header: { text: '행정구역코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
{ name: 'prcsFcltSn', fieldName: 'prcsFcltSn', header: { text: '처리시설일련번호' }, visible: false, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'fcltSn', fieldName: 'fcltSn', header: { text: '처리시설일련번호' }, visible: false, editable: false, valueType: ValueType.TEXT },
|
||||
{ name: 'swtrmtFcltCd', fieldName: 'swtrmtFcltCd', header: { text: '하수처리시설코드' }, visible: false, editable: false, styleName: 'rg-cell-readonly' },
|
||||
],
|
||||
columnLayout: [
|
||||
@@ -146,7 +146,7 @@ export const FactInstallStatusInpColumn = {
|
||||
},
|
||||
'rmrk',
|
||||
'admdstCd',
|
||||
'prcsFcltSn',
|
||||
'fcltSn',
|
||||
'swtrmtFcltCd',
|
||||
],
|
||||
rowStartNum: 4,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import dayjs from "dayjs";
|
||||
import { headers } from "next/headers";
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
/**
|
||||
@@ -7,9 +5,9 @@ import { ValueType } from "realgrid";
|
||||
* 항목은 검토(SewagePipeRvwColumn)와 동일하나 footer·mergeCells·구분(displayYear)·비고(rmrk) 제외.
|
||||
* 표시 형식은 SeweragePentrationRateTotColumn과 같이 dataFormat + editable: false.
|
||||
*/
|
||||
const currentYear = dayjs().year() - 1;
|
||||
const startYear = 1996;
|
||||
const totalCount = currentYear - startYear + 1 + 1;
|
||||
|
||||
/** ST00020003 관종별: 입력 `SeweragePipeInputPipeTypeStatusItem`·합계 `SewagePipePipeTypeFacilityStatusItem`과 동일 (yy1=1996년 이전 … yy30) */
|
||||
const YY_PIPE_TYPE_FACILITY_MAX = 30;
|
||||
|
||||
const rawSewagePipeTotList = [
|
||||
{
|
||||
@@ -642,11 +640,11 @@ const rawSewagePipeTotList = [
|
||||
dataFormat: "#,##0.0",
|
||||
editable: false,
|
||||
},
|
||||
...Array.from({ length: totalCount }, (_, i) => {
|
||||
const dtoNum = totalCount - i;
|
||||
const wholField = `yy${dtoNum}PrlgWhol`;
|
||||
const lyngField = `yy${dtoNum}LyngPrlg`;
|
||||
const dmltnField = `yy${dtoNum}DmltnPrlg`;
|
||||
...Array.from({ length: YY_PIPE_TYPE_FACILITY_MAX }, (_, i) => {
|
||||
const yyIdx = i + 1;
|
||||
const wholField = `yy${yyIdx}PrlgWhol`;
|
||||
const lyngField = `yy${yyIdx}LyngPrlg`;
|
||||
const dmltnField = `yy${yyIdx}DmltnPrlg`;
|
||||
return [
|
||||
{
|
||||
name: wholField,
|
||||
@@ -687,13 +685,18 @@ const rawSewagePipeTotList = [
|
||||
header: { text: "총계" },
|
||||
items: ["pipeByPrstWholSum", "lyngPrlgSum", "dmltnPrlgSum"],
|
||||
},
|
||||
...Array.from({ length: totalCount }, (_, i) => {
|
||||
const dtoNum = totalCount - i;
|
||||
const yearLabel = i === 0 ? "1996년이전" : `${startYear + (i - 1)}년`;
|
||||
{
|
||||
name: "year1996Before",
|
||||
header: { text: "1996년이전" },
|
||||
items: ["yy1PrlgWhol", "yy1LyngPrlg", "yy1DmltnPrlg"],
|
||||
},
|
||||
...Array.from({ length: YY_PIPE_TYPE_FACILITY_MAX - 1 }, (_, i) => {
|
||||
const yyIdx = i + 2;
|
||||
const year = 1994 + yyIdx;
|
||||
return {
|
||||
name: `group_${yearLabel}`,
|
||||
header: { text: yearLabel },
|
||||
items: [`yy${dtoNum}PrlgWhol`, `yy${dtoNum}LyngPrlg`, `yy${dtoNum}DmltnPrlg`],
|
||||
name: `group_yy${yyIdx}`,
|
||||
header: { text: `${year}년` },
|
||||
items: [`yy${yyIdx}PrlgWhol`, `yy${yyIdx}LyngPrlg`, `yy${yyIdx}DmltnPrlg`],
|
||||
};
|
||||
}),
|
||||
],
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
// 하수도 통계 관리 > 03.하수관로 유지관리 > tab 2. 관로준설
|
||||
export const PipeDredgingStatusTotColumn = {
|
||||
columns: [
|
||||
// 행정구역
|
||||
{ name: 'ctpvNm', fieldName: 'ctpvNm', header: { text: '시도' } },
|
||||
{ name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구명' } },
|
||||
{ name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' } },
|
||||
|
||||
// 하수관로 총 시설연장
|
||||
{ name: 'wholFcltPrlg', fieldName: 'wholFcltPrlg', header: { text: '하수관로총시설연장(m)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.00' },
|
||||
|
||||
// 준설연장 및 개소수 > 관로(m)
|
||||
{ name: 'wholSwagePpl', fieldName: 'wholSwagePpl', header: { text: '합계' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'cbsysPplPrlg', fieldName: 'cbsysPplPrlg', header: { text: '합류식' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 준설연장 및 개소수 > 관로(m) > 분류식
|
||||
{ name: 'sprsysExlnPrlg', fieldName: 'sprsysExlnPrlg', header: { text: '우수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'sprsysDrtwPrlg', fieldName: 'sprsysDrtwPrlg', header: { text: '오수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 준설연장 및 개소수 > 맨홀, 오·우수받이, 토실·토구
|
||||
{ name: 'mnhlCnt', fieldName: 'mnhlCnt', header: { text: '맨홀(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'exlnDrtwRcvprpCnt', fieldName: 'exlnDrtwRcvprpCnt', header: { text: '오·우수받이(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'stofcbrOtflCnt', fieldName: 'stofcbrOtflCnt', header: { text: '토실·토구(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 계획 & 비율
|
||||
{ name: 'drdgnPlanPrlg', fieldName: 'drdgnPlanPrlg', header: { text: '준설 계획 연장(m)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'drdgnTrgtCtrsDrdgnRt', fieldName: 'drdgnTrgtCtrsDrdgnRt', header: { text: '계획대비 준설율(%)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'wholPrlgCtrsDrdgnRt', fieldName: 'wholPrlgCtrsDrdgnRt', header: { text: '총시설연장대비 준설율(%)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 준설실적
|
||||
{ name: 'drdgnAmt', fieldName: 'drdgnAmt', header: { text: '금액(백만원)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'drdgnQnt', fieldName: 'drdgnQnt', header: { text: '준설량(m³)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 준설토사처리
|
||||
{ name: 'drdgnUntprcAmt', fieldName: 'drdgnUntprcAmt', header: { text: '준설토처리비(백만원)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'wholDrdgnPrcsQnt', fieldName: 'wholDrdgnPrcsQnt', header: { text: '처리량 계(톤)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'rclmQnt', fieldName: 'rclmQnt', header: { text: '매립' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'oceanEmsnQnt', fieldName: 'oceanEmsnQnt', header: { text: '해양투기' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'rcycQnt', fieldName: 'rcycQnt', header: { text: '재활용' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'etcQnt', fieldName: 'etcQnt', header: { text: '기타(소각, 고형화, 시멘트원료 등)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
].map((col) => ({ ...col, editable: false })),
|
||||
columnLayout: [
|
||||
{ name: 'group_admin', header: { text: '행정구역' }, items: ['ctpvNm', 'sggNm', 'admdstNm'] },
|
||||
'wholFcltPrlg',
|
||||
{
|
||||
name: 'group_dredge_info',
|
||||
header: { text: '준설연장 및 개소수' },
|
||||
items: [
|
||||
{
|
||||
name: 'group_pipe',
|
||||
header: { text: '관로(m)' },
|
||||
items: [
|
||||
'wholSwagePpl', 'cbsysPplPrlg',
|
||||
{ name: 'group_sep', header: { text: '분류식' }, items: ['sprsysExlnPrlg', 'sprsysDrtwPrlg'] }
|
||||
]
|
||||
},
|
||||
'mnhlCnt', 'exlnDrtwRcvprpCnt', 'stofcbrOtflCnt'
|
||||
]
|
||||
},
|
||||
'drdgnPlanPrlg', 'drdgnTrgtCtrsDrdgnRt', 'wholPrlgCtrsDrdgnRt',
|
||||
{
|
||||
name: 'group_perf',
|
||||
header: { text: '준설실적' },
|
||||
items: ['drdgnAmt', 'drdgnQnt']
|
||||
},
|
||||
{
|
||||
name: 'group_soil_treat',
|
||||
header: { text: '준설토사처리' },
|
||||
items: ['drdgnUntprcAmt', 'wholDrdgnPrcsQnt', 'rclmQnt', 'oceanEmsnQnt', 'rcycQnt', 'etcQnt']
|
||||
},
|
||||
],
|
||||
rowStartNum: 4,
|
||||
fixedColumns: 1,
|
||||
tabKey: 'ST00030002',
|
||||
tabLabel: '관로준설'
|
||||
};
|
||||
@@ -0,0 +1,112 @@
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
// 하수도 통계 관리 > 03.하수관로 유지관리 > tab 1. 개보수
|
||||
export const RepairStatusTotColumn = {
|
||||
columns: [
|
||||
// 행정구역
|
||||
{ name: 'ctpvNm', fieldName: 'ctpvNm', header: { text: '시도' }, editable: false },
|
||||
{ name: 'sggNm', fieldName: 'sggNm', header: { text: '시군구명' }, editable: false },
|
||||
{ name: 'admdstNm', fieldName: 'admdstNm', header: { text: '행정구역명' }, editable: false },
|
||||
|
||||
// 개·보수관로 > 전체보수(m)
|
||||
{ name: 'mendngWhol', fieldName: 'mendngWhol', header: { text: '계' }, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'cbsysMendngPrlg', fieldName: 'cbsysMendngPrlg', header: { text: '합류식' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 개·보수관로 > 전체보수(m) > 분류식
|
||||
{ name: 'sprsysExlnPrlg', fieldName: 'sprsysExlnPrlg', header: { text: '우수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
{ name: 'sprsysDrtwPrlg', fieldName: 'sprsysDrtwPrlg', header: { text: '오수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
// 개·보수관로 > 부분보수(개소)
|
||||
{ name: 'partMendngWhol', fieldName: 'partMendngWhol', header: { text: '계' }, editable: false, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'cbsysPartMendngPrlg', fieldName: 'cbsysPartMendngPrlg', header: { text: '합류식' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 개·보수관로 > 부분보수(개소) > 분류식
|
||||
{ name: 'sprsysExlnMendngPrlg', fieldName: 'sprsysExlnMendngPrlg', header: { text: '우수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'sprsysDrtwMendngPrlg', fieldName: 'sprsysDrtwMendngPrlg', header: { text: '오수' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 맨홀(개소)
|
||||
{ name: 'cbsysMnhlCnt', fieldName: 'cbsysMnhlCnt', header: { text: '합류식맨홀' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 맨홀(개소) > 분류식
|
||||
{ name: 'sprsysDrtwMnhlCnt', fieldName: 'sprsysDrtwMnhlCnt', header: { text: '오수맨홀' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'sprsysExlnMnhlCnt', fieldName: 'sprsysExlnMnhlCnt', header: { text: '우수맨홀' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 받이
|
||||
{ name: 'drtwRcvprpCnt', fieldName: 'drtwRcvprpCnt', header: { text: '오수받이(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'exlnRcvprpCnt', fieldName: 'exlnRcvprpCnt', header: { text: '빗물받이(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 토실, 토구
|
||||
{ name: 'stofcbrCnt', fieldName: 'stofcbrCnt', header: { text: '토실(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
{ name: 'otflCnt', fieldName: 'otflCnt', header: { text: '토구(개소)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0' },
|
||||
|
||||
// 수밀검사CCTV조사량(m)
|
||||
{ name: 'cctvExmnPrlg', fieldName: 'cctvExmnPrlg', header: { text: '수밀검사·CCTV조사량(m)' }, valueType: ValueType.NUMBER, dataFormat: '#,##0.0' },
|
||||
|
||||
].map((col) => ({ ...col, editable: false })),
|
||||
columnLayout: [
|
||||
{
|
||||
name: 'group_admin',
|
||||
header: { text: '행정구역' },
|
||||
items: ['ctpvNm', 'sggNm', 'admdstNm']
|
||||
},
|
||||
{
|
||||
name: 'group_repair_main',
|
||||
header: { text: '개·보수관로' },
|
||||
items: [
|
||||
{
|
||||
name: 'group_full_repair',
|
||||
header: { text: '전체보수(m)' },
|
||||
items: [
|
||||
'mendngWhol',
|
||||
'cbsysMendngPrlg',
|
||||
{
|
||||
name: 'group_full_sep',
|
||||
header: { text: '분류식' },
|
||||
items: ['sprsysExlnPrlg', 'sprsysDrtwPrlg']
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'group_part_repair',
|
||||
header: { text: '부분보수(개소)' },
|
||||
items: [
|
||||
'partMendngWhol',
|
||||
'cbsysPartMendngPrlg',
|
||||
{
|
||||
name: 'group_part_sep',
|
||||
header: { text: '분류식' },
|
||||
items: ['sprsysExlnMendngPrlg', 'sprsysDrtwMendngPrlg']
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'group_manhole',
|
||||
header: { text: '맨홀(개소)' },
|
||||
items: [
|
||||
'cbsysMnhlCnt',
|
||||
{
|
||||
name: 'group_mh_sep',
|
||||
header: { text: '분류식' },
|
||||
items: ['sprsysDrtwMnhlCnt', 'sprsysExlnMnhlCnt']
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'group_inlet',
|
||||
header: { text: '받이' },
|
||||
items: ['drtwRcvprpCnt', 'exlnRcvprpCnt']
|
||||
},
|
||||
{
|
||||
name: 'group_chamber',
|
||||
header: { text: '토실,토구' },
|
||||
items: ['stofcbrCnt', 'otflCnt']
|
||||
},
|
||||
'cctvExmnPrlg',
|
||||
],
|
||||
rowStartNum: 4,
|
||||
fixedColumns: 1,
|
||||
tabKey: 'ST00030001',
|
||||
tabLabel: '개보수'
|
||||
};
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { PipeDredgingStatusTotColumn } from "./PipeDredgingStatusTotColumn"
|
||||
import { RepairStatusTotColumn } from "./RepairStatusTotColumn"
|
||||
|
||||
const sewagePipeMaintainColumn = [
|
||||
RepairStatusTotColumn,
|
||||
PipeDredgingStatusTotColumn
|
||||
];
|
||||
|
||||
export const SewagePipeMaintainColumnListTot = sewagePipeMaintainColumn.map((tab) => ({
|
||||
...tab,
|
||||
columns: tab.columns.map((col) => ({ ...col, editable: false as const })),
|
||||
}));
|
||||
@@ -0,0 +1,31 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { RecentPostSearchParams } from "../model/post-interface";
|
||||
|
||||
import { postApi } from "./post-service";
|
||||
|
||||
export function useRecentPostList(params?: RecentPostSearchParams) {
|
||||
return useQuery({
|
||||
queryKey: createRecentPostListQueryKey(params),
|
||||
queryFn: () => postApi.getRecentPostList(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
function createRecentPostListQueryKey(params?: RecentPostSearchParams) {
|
||||
return [
|
||||
ENDPOINT.BOARD_SERVICE.POSTS,
|
||||
"recentPosts",
|
||||
params?.page ?? "",
|
||||
params?.size ?? "",
|
||||
params?.sort ?? "",
|
||||
params?.keywordType ?? "",
|
||||
params?.keyword ?? "",
|
||||
params?.bbsId ?? "",
|
||||
params?.delYn ?? "",
|
||||
params?.frDateYmd ?? "",
|
||||
params?.toDateYmd ?? "",
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
PostService,
|
||||
RecentPostListResponse,
|
||||
RecentPostSearchParams,
|
||||
} from "../model/post-interface";
|
||||
|
||||
async function getRecentPostList(
|
||||
params?: RecentPostSearchParams,
|
||||
): Promise<RecentPostListResponse> {
|
||||
const response = await client.get<RecentPostListResponse>(
|
||||
`${ENDPOINT.BOARD_SERVICE.POSTS}/recentPosts`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const postApi: PostService = {
|
||||
getRecentPostList,
|
||||
};
|
||||
@@ -0,0 +1,8 @@
|
||||
export { useRecentPostList } from "./api/post-queries";
|
||||
export { postApi } from "./api/post-service";
|
||||
export {
|
||||
type PostService,
|
||||
type PstRecentListResponse,
|
||||
type RecentPostListResponse,
|
||||
type RecentPostSearchParams,
|
||||
} from "./model/post-interface";
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
export interface RecentPostSearchParams extends PageableParams {
|
||||
keywordType?: string;
|
||||
keyword?: string;
|
||||
bbsId?: number;
|
||||
delYn?: string;
|
||||
frDateYmd?: string;
|
||||
toDateYmd?: string;
|
||||
}
|
||||
|
||||
export interface PstRecentListResponse {
|
||||
rowNo: number;
|
||||
bbsId: number;
|
||||
pstNo: number;
|
||||
pstTtl: string;
|
||||
pstCn: string;
|
||||
inqNocs: number;
|
||||
rfrncUrl: string;
|
||||
popupYn: string;
|
||||
upndFixYn: string;
|
||||
prdPstgYn: string;
|
||||
rootPath: string;
|
||||
pstPath: string;
|
||||
ansPstn: number;
|
||||
wrtrNm: string;
|
||||
wrtrCplc: string;
|
||||
atflCd: string;
|
||||
regDt: string;
|
||||
rgtrNm: string;
|
||||
cmntCnt: number;
|
||||
bbsTypeCd: string;
|
||||
bbsNm: string;
|
||||
}
|
||||
|
||||
export type RecentPostListResponse = PageableList<PstRecentListResponse>;
|
||||
|
||||
export interface PostService {
|
||||
getRecentPostList(
|
||||
params?: RecentPostSearchParams,
|
||||
): Promise<RecentPostListResponse>;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { ScheduleSearchParams } from "../model/schedule-interface";
|
||||
|
||||
import { scheduleApi } from "./schedule-service";
|
||||
|
||||
export function useSchedules(params?: ScheduleSearchParams) {
|
||||
return useQuery({
|
||||
queryKey: createSchedulesQueryKey(params),
|
||||
queryFn: () => scheduleApi.getSchedules(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
function createSchedulesQueryKey(params?: ScheduleSearchParams) {
|
||||
return [
|
||||
ENDPOINT.CMS_SERVICE.SCHEDULES,
|
||||
"list",
|
||||
params?.siteId ?? "",
|
||||
params?.schdlTtl ?? "",
|
||||
params?.schdlSeCd ?? "",
|
||||
params?.schdlBgngYmd ?? "",
|
||||
params?.schdlEndYmd ?? "",
|
||||
params?.reptYn ?? "",
|
||||
params?.commSchdlYn ?? "",
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
Schedule,
|
||||
ScheduleSearchParams,
|
||||
ScheduleService,
|
||||
} from "../model/schedule-interface";
|
||||
|
||||
async function getSchedules(
|
||||
params?: ScheduleSearchParams,
|
||||
): Promise<Schedule[]> {
|
||||
const response = await client.get<Schedule[]>(
|
||||
ENDPOINT.CMS_SERVICE.SCHEDULES,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const scheduleApi: ScheduleService = {
|
||||
getSchedules,
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
export { useSchedules } from "./api/schedule-queries";
|
||||
export { scheduleApi } from "./api/schedule-service";
|
||||
export {
|
||||
type Schedule,
|
||||
type ScheduleSearchParams,
|
||||
type ScheduleService,
|
||||
} from "./model/schedule-interface";
|
||||
@@ -0,0 +1,27 @@
|
||||
export interface ScheduleSearchParams {
|
||||
siteId?: string;
|
||||
schdlTtl?: string;
|
||||
schdlSeCd?: string;
|
||||
schdlBgngYmd?: string;
|
||||
schdlEndYmd?: string;
|
||||
reptYn?: string;
|
||||
commSchdlYn?: string;
|
||||
}
|
||||
|
||||
export interface Schedule {
|
||||
schdlBgngDt: string;
|
||||
schdlEndDt: string;
|
||||
actualDate: string;
|
||||
schdlSn: number;
|
||||
siteId: string;
|
||||
schdlTtl: string;
|
||||
schdlSeCd: string;
|
||||
schdlCn: string;
|
||||
reptYn: string;
|
||||
commSchdlYn: string;
|
||||
atflCd: string;
|
||||
}
|
||||
|
||||
export interface ScheduleService {
|
||||
getSchedules(params?: ScheduleSearchParams): Promise<Schedule[]>;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { DashboardSearchParams } from "../../model/dashboard/dashboard-interface";
|
||||
|
||||
import { dashboardApi } from "./dashboard-service";
|
||||
|
||||
// 이상치 선별보고서 조회
|
||||
export function useDashboardVrfcReport(params: DashboardSearchParams | null) {
|
||||
return useQuery({
|
||||
queryKey: createDashboardQueryKey("vrfc-report", params),
|
||||
queryFn: async () => {
|
||||
if (!params)
|
||||
throw new Error("Dashboard search params are required.");
|
||||
const response = await dashboardApi.getVrfcReport(params);
|
||||
return response.data;
|
||||
},
|
||||
enabled: hasRequiredDashboardParams(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 검증오류 수 조회
|
||||
export function useDashboardVrfcErrCount(params: DashboardSearchParams | null) {
|
||||
return useQuery({
|
||||
queryKey: createDashboardQueryKey("vrfc-err-count", params),
|
||||
queryFn: async () => {
|
||||
if (!params)
|
||||
throw new Error("Dashboard search params are required.");
|
||||
const response = await dashboardApi.getVrfcErrCount(params);
|
||||
return response.data;
|
||||
},
|
||||
enabled: hasRequiredDashboardParams(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 미제출 수 & 목록 조회
|
||||
export function useDashboardUnSubmitCount(
|
||||
params: DashboardSearchParams | null,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: createDashboardQueryKey("submission-status", params),
|
||||
queryFn: async () => {
|
||||
if (!params)
|
||||
throw new Error("Dashboard search params are required.");
|
||||
const response = await dashboardApi.getUnSubmitCount({
|
||||
...params,
|
||||
unSubmitOnly: true,
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
enabled: hasRequiredDashboardParams(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 통계입력현황 조회
|
||||
export function useDashboardStatsSubmissionRate(
|
||||
params: DashboardSearchParams | null,
|
||||
) {
|
||||
return useQuery({
|
||||
queryKey: createDashboardQueryKey("stats-submission-rate", params),
|
||||
queryFn: async () => {
|
||||
if (!params)
|
||||
throw new Error("Dashboard search params are required.");
|
||||
const response = await dashboardApi.getStatsSubmissionRate(params);
|
||||
return response.data;
|
||||
},
|
||||
enabled: hasRequiredDashboardParams(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
// 예외신청 수 조회
|
||||
export function useDashboardEcptReqCount(params: DashboardSearchParams | null) {
|
||||
return useQuery({
|
||||
queryKey: createDashboardQueryKey("ecpt-req-count", params),
|
||||
queryFn: async () => {
|
||||
if (!params)
|
||||
throw new Error("Dashboard search params are required.");
|
||||
const response = await dashboardApi.getEcptReqCount(params);
|
||||
return response.data;
|
||||
},
|
||||
enabled: hasRequiredDashboardParams(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
function createDashboardQueryKey(
|
||||
name: string,
|
||||
params: DashboardSearchParams | null,
|
||||
) {
|
||||
return [
|
||||
ENDPOINT.ST_SERVICE.DASHBOARD,
|
||||
name,
|
||||
params?.statsYr ?? "",
|
||||
params?.dtlInstCd ?? "",
|
||||
params?.enoCd ?? "",
|
||||
params?.laeSeCd ?? "",
|
||||
];
|
||||
}
|
||||
|
||||
function hasRequiredDashboardParams(
|
||||
params: DashboardSearchParams | null,
|
||||
): params is DashboardSearchParams {
|
||||
return Boolean(params?.statsYr && params.dtlInstCd);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { stClient } from "@/shared/api/client";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
DashboardApiResponse,
|
||||
DashboardSearchParams,
|
||||
DashboardService,
|
||||
EcptReqCountResponse,
|
||||
StatsSubmissionResponse,
|
||||
UnSubmitCountResponse,
|
||||
VrfcErrCountResponse,
|
||||
VrfcReportResponse,
|
||||
} from "../../model/dashboard/dashboard-interface";
|
||||
|
||||
async function getVrfcReport(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<VrfcReportResponse>> {
|
||||
const response = await stClient.get<
|
||||
DashboardApiResponse<VrfcReportResponse>
|
||||
>(`${ENDPOINT.ST_SERVICE.DASHBOARD}/vrfc-report`, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getVrfcErrCount(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<VrfcErrCountResponse>> {
|
||||
const response = await stClient.get<
|
||||
DashboardApiResponse<VrfcErrCountResponse>
|
||||
>(`${ENDPOINT.ST_SERVICE.DASHBOARD}/vrfc-err-count`, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getUnSubmitCount(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<UnSubmitCountResponse>> {
|
||||
const response = await stClient.get<
|
||||
DashboardApiResponse<UnSubmitCountResponse>
|
||||
>(`${ENDPOINT.ST_SERVICE.DASHBOARD}/submission-status`, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getStatsSubmissionRate(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<StatsSubmissionResponse>> {
|
||||
const response = await stClient.get<
|
||||
DashboardApiResponse<StatsSubmissionResponse>
|
||||
>(`${ENDPOINT.ST_SERVICE.DASHBOARD}/stats-submission-rate`, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async function getEcptReqCount(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<EcptReqCountResponse>> {
|
||||
const response = await stClient.get<
|
||||
DashboardApiResponse<EcptReqCountResponse>
|
||||
>(`${ENDPOINT.ST_SERVICE.DASHBOARD}/ecpt-req-count`, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const dashboardApi: DashboardService = {
|
||||
getVrfcReport,
|
||||
getVrfcErrCount,
|
||||
getUnSubmitCount,
|
||||
getStatsSubmissionRate,
|
||||
getEcptReqCount,
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type { ScheduleInfoSearchParams } from "../../model/dashboard/schedule-info-interface";
|
||||
|
||||
import { scheduleInfoApi } from "./schedule-info-service";
|
||||
|
||||
export function useScheduleInfo(params: ScheduleInfoSearchParams | null) {
|
||||
return useQuery({
|
||||
queryKey: createScheduleInfoQueryKey(params),
|
||||
queryFn: async () => {
|
||||
if (!params)
|
||||
throw new Error("Schedule info search params are required.");
|
||||
const response = await scheduleInfoApi.getScheduleInfo(params);
|
||||
return response.data;
|
||||
},
|
||||
enabled: hasRequiredScheduleInfoParams(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
}
|
||||
|
||||
function createScheduleInfoQueryKey(params: ScheduleInfoSearchParams | null) {
|
||||
return [
|
||||
ENDPOINT.ST_SERVICE.DASHBOARD,
|
||||
"schedule-info",
|
||||
params?.statsYr ?? "",
|
||||
];
|
||||
}
|
||||
|
||||
function hasRequiredScheduleInfoParams(
|
||||
params: ScheduleInfoSearchParams | null,
|
||||
): params is ScheduleInfoSearchParams {
|
||||
return Boolean(params?.statsYr);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
import { stClient } from "@/shared/api/client";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
ScheduleInfoApiResponse,
|
||||
ScheduleInfoResponse,
|
||||
ScheduleInfoSearchParams,
|
||||
ScheduleInfoService,
|
||||
} from "../../model/dashboard/schedule-info-interface";
|
||||
|
||||
async function getScheduleInfo(
|
||||
params: ScheduleInfoSearchParams,
|
||||
): Promise<ScheduleInfoApiResponse<ScheduleInfoResponse>> {
|
||||
const response = await stClient.get<
|
||||
ScheduleInfoApiResponse<ScheduleInfoResponse>
|
||||
>(`${ENDPOINT.ST_SERVICE.DASHBOARD}/schedule-info`, { params });
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const scheduleInfoApi: ScheduleInfoService = {
|
||||
getScheduleInfo,
|
||||
};
|
||||
@@ -3,6 +3,8 @@ import { stClient } from "@/shared/api/client";
|
||||
import type {
|
||||
SeweragePipeFacilityAdminAreaListRequest,
|
||||
SeweragePipeFacilityAdminAreaListResponse,
|
||||
SeweragePipeFactConnectionSaveRequest,
|
||||
SeweragePipeFactConnectionSaveResponse,
|
||||
SeweragePipeFacilitiesListRequest,
|
||||
SeweragePipeFacilitiesListResponse,
|
||||
SeweragePipeInputConnectionStatusResponse,
|
||||
@@ -12,9 +14,13 @@ import type {
|
||||
SeweragePipeInputPipeTypeResponse,
|
||||
SeweragePipeInputRegionalFactStatusSaveRequest,
|
||||
SeweragePipeInputRegionalFactStatusSaveResponse,
|
||||
SeweragePipeInputRegionalFactStatusSubmitRequest,
|
||||
SeweragePipeInputRegionalFactStatusSubmitResponse,
|
||||
SeweragePipeInputRegionalResponse,
|
||||
SeweragePipeRequestParams,
|
||||
StatisticsInputSewPipeService,
|
||||
SeweragePipeInputFactInstallStatusSaveRequest,
|
||||
SeweragePipeInputFactInstallStatusSaveResponse,
|
||||
} from "../../model/input/statistics-sewage-pipe-input-interface";
|
||||
|
||||
export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeService {
|
||||
@@ -82,6 +88,14 @@ export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeS
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async saveFactConnection(param: SeweragePipeFactConnectionSaveRequest): Promise<SeweragePipeFactConnectionSaveResponse> {
|
||||
const response = await stClient.post<SeweragePipeFactConnectionSaveResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-connection-status/popup/save`,
|
||||
param,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async saveRegionalFactStatus(param: SeweragePipeInputRegionalFactStatusSaveRequest): Promise<SeweragePipeInputRegionalFactStatusSaveResponse> {
|
||||
const response = await stClient.post<SeweragePipeInputRegionalFactStatusSaveResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status/save`,
|
||||
@@ -89,6 +103,22 @@ export class StatisticsInputSewPipeApiService implements StatisticsInputSewPipeS
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async submitRegionalFactStatus(param: SeweragePipeInputRegionalFactStatusSubmitRequest): Promise<SeweragePipeInputRegionalFactStatusSubmitResponse> {
|
||||
const response = await stClient.post<SeweragePipeInputRegionalFactStatusSubmitResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/regional-facility-status/submit`,
|
||||
param,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async saveFactInstallStatus(param: SeweragePipeInputFactInstallStatusSaveRequest): Promise<SeweragePipeInputFactInstallStatusSaveResponse> {
|
||||
const response = await stClient.post<SeweragePipeInputFactInstallStatusSaveResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.INPUT}/sewage-pipe/facility-install-status/save`,
|
||||
param,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
};
|
||||
|
||||
export const statisticsInputSewPipeApiService = new StatisticsInputSewPipeApiService();
|
||||
@@ -9,16 +9,14 @@ import type {
|
||||
StatisticsVerificationSubFilterState,
|
||||
} from "@/entities/statistics/model/statistics-verification-report/statistics-verification-report-types";
|
||||
|
||||
import type { SewerStUserSearchParams } from "../model/sewer-st-user-interface";
|
||||
|
||||
import { sewerStUserApi } from "./sewer-st-user-service";
|
||||
import { stAnlsMstApi } from "./statistics-analysis-master-api";
|
||||
import { stAnlsRsltApi } from "./statistics-analysis-result-api";
|
||||
|
||||
const DETAIL_PAGE_SIZE = 100;
|
||||
|
||||
interface StatisticsVerificationDetailSubmittedParams {
|
||||
main: StatisticsVerificationFilterState;
|
||||
sub: StatisticsVerificationSubFilterState;
|
||||
}
|
||||
|
||||
export const useStAnlsSidoCombo = () => {
|
||||
return useQuery({
|
||||
queryKey: [ENDPOINT.STATVERIFY_SERVICE.ST_ANLS_MST, "sido"],
|
||||
@@ -102,23 +100,24 @@ export const useStatsVrfcRptData = (
|
||||
};
|
||||
|
||||
export const useStatsVrfcRsltData = (
|
||||
submittedDetailParams: StatisticsVerificationDetailSubmittedParams | null,
|
||||
params: StatisticsVerificationSubFilterState | null,
|
||||
) => {
|
||||
return useInfiniteQuery({
|
||||
queryKey: [
|
||||
ENDPOINT.ST_SERVICE.INPUTVERIFY,
|
||||
"verify-results",
|
||||
submittedDetailParams?.main.statsYr ?? "",
|
||||
submittedDetailParams?.main.ctpvNm ?? "",
|
||||
submittedDetailParams?.main.sggNm ?? "",
|
||||
submittedDetailParams?.main.sewerBzmnCd ?? "",
|
||||
submittedDetailParams?.main.statsCd ?? "",
|
||||
submittedDetailParams?.sub.prcsYnList ?? "",
|
||||
submittedDetailParams?.sub.pbcpAprvYn ?? "",
|
||||
params?.statsYr ?? "",
|
||||
params?.ctpvNm ?? "",
|
||||
params?.sggNm ?? "",
|
||||
params?.sewerBzmnCd ?? "",
|
||||
params?.statsCd ?? "",
|
||||
params?.prcsYnList ?? "",
|
||||
params?.pbcpAprvYn ?? "",
|
||||
params?.laeSbmsnSttsCd ?? "",
|
||||
],
|
||||
initialPageParam: 1,
|
||||
queryFn: async ({ pageParam }) => {
|
||||
if (!submittedDetailParams)
|
||||
if (!params)
|
||||
return {
|
||||
verifyResultList: [],
|
||||
pageInfo: {
|
||||
@@ -134,13 +133,14 @@ export const useStatsVrfcRsltData = (
|
||||
page: pageParam,
|
||||
size: DETAIL_PAGE_SIZE,
|
||||
searchDto: {
|
||||
statsYr: submittedDetailParams.main.statsYr,
|
||||
ctpvNm: submittedDetailParams.main.ctpvNm,
|
||||
sggNm: submittedDetailParams.main.sggNm,
|
||||
sewerBzmnCd: submittedDetailParams.main.sewerBzmnCd,
|
||||
statsCd: submittedDetailParams.main.statsCd,
|
||||
prcsYnList: submittedDetailParams.sub.prcsYnList,
|
||||
pbcpAprvYn: submittedDetailParams.sub.pbcpAprvYn,
|
||||
statsYr: params.statsYr,
|
||||
ctpvNm: params.ctpvNm,
|
||||
sggNm: params.sggNm,
|
||||
sewerBzmnCd: params.sewerBzmnCd,
|
||||
statsCd: params.statsCd,
|
||||
prcsYnList: params.prcsYnList,
|
||||
pbcpAprvYn: params.pbcpAprvYn,
|
||||
laeSbmsnSttsCd: params.laeSbmsnSttsCd,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -153,7 +153,19 @@ export const useStatsVrfcRsltData = (
|
||||
if (currentPage + 1 <= totalPages) return currentPage + 1;
|
||||
return undefined;
|
||||
},
|
||||
enabled: Boolean(submittedDetailParams),
|
||||
enabled: Boolean(params),
|
||||
refetchOnWindowFocus: false,
|
||||
});
|
||||
};
|
||||
|
||||
export const useSewerStUserList = (params: SewerStUserSearchParams) => {
|
||||
return useQuery({
|
||||
queryKey: [
|
||||
ENDPOINT.STATVERIFY_SERVICE.SEWERST_USER,
|
||||
"user-list",
|
||||
params,
|
||||
],
|
||||
queryFn: () => sewerStUserApi.getUserList(params),
|
||||
enabled: Boolean(params.statsYr),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { stClient } from "@/shared/api/client";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
|
||||
import type {
|
||||
SewerStUserListResponse,
|
||||
SewerStUserSearchParams,
|
||||
} from "../model/sewer-st-user-interface";
|
||||
|
||||
/**
|
||||
* 하수도 통계 사용자 목록 API 서비스
|
||||
*/
|
||||
export class SewerStUserApiService {
|
||||
/**
|
||||
* 하수도 통계 제출현황 사용자 목록 조회
|
||||
* @param params 검색 조건 (statsYr, sewerBzmnCd, gubun)
|
||||
* @returns 사용자 목록 (입력자·승인자·검토자)
|
||||
*/
|
||||
public async getUserList(
|
||||
params: SewerStUserSearchParams,
|
||||
): Promise<SewerStUserListResponse> {
|
||||
const response = await stClient.get<SewerStUserListResponse>(
|
||||
`${ENDPOINT.STATVERIFY_SERVICE.SEWERST_USER}/user-list`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const sewerStUserApi = new SewerStUserApiService();
|
||||
@@ -26,6 +26,8 @@ import {
|
||||
type SubmitExceptionResponse,
|
||||
type ImrResponse,
|
||||
type ImrStatusResponse,
|
||||
type SubmitVerifyExceptionRequest,
|
||||
type SubmitVerifyExceptionResponse,
|
||||
} from "../model/statistics-interface";
|
||||
|
||||
export class StatisticsApiService implements StatisticsService {
|
||||
@@ -164,6 +166,14 @@ export class StatisticsApiService implements StatisticsService {
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async SubmitVerifyException(param: SubmitVerifyExceptionRequest): Promise<SubmitVerifyExceptionResponse> {
|
||||
const response = await stClient.put<SubmitVerifyExceptionResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.INPUTVERIFY}/results/exception`,
|
||||
param,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const statisticsApi = new StatisticsApiService();
|
||||
|
||||
@@ -2,7 +2,18 @@ import { ENDPOINT } from "@/shared/config";
|
||||
import { stClient } from "@/shared/api/client";
|
||||
|
||||
import type { SewerageSupplyRateRequest, SewerageSupplyRateResponse } from "../model/statistics-total/statistics-sewage-supply-rate-total-interface";
|
||||
import type { SewagePipeTotalRequest, SewagePipeTotalResponse } from "../model/statistics-total/statistics-sewage-pipe-total-interface";
|
||||
import type {
|
||||
SewagePipeMaintainDredgingTotalResponse,
|
||||
SewagePipeMaintainTotalRequest,
|
||||
SewagePipeMaintainRepairTotalResponse,
|
||||
} from "../model/statistics-total/statistics-sewage-pipe-maintain-total-interface";
|
||||
import type {
|
||||
SewagePipeFactInstallStatusResponse,
|
||||
SewagePipePipeDiamStatusResponse,
|
||||
SewagePipePipeTypeFacilityStatusResponse,
|
||||
SewagePipeTotalRequest,
|
||||
SewagePipeTotalResponse,
|
||||
} from "../model/statistics-total/statistics-sewage-pipe-total-interface";
|
||||
import type {
|
||||
SewerageServiceLevelComplaintResponse,
|
||||
SewerageServiceLevelRequest,
|
||||
@@ -41,6 +52,60 @@ export class StatisticsTotalApiService {
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async getSewagePipeFactInstallStatus(
|
||||
params: SewagePipeTotalRequest,
|
||||
): Promise<SewagePipeFactInstallStatusResponse> {
|
||||
const response = await stClient.get<SewagePipeFactInstallStatusResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/facility-installation-status`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/** ST00020003 — 관종·관경별 시설현황(합계) */
|
||||
public async getSewagePipePipeTypeFacilityStatus(
|
||||
params: SewagePipeTotalRequest,
|
||||
): Promise<SewagePipePipeTypeFacilityStatusResponse> {
|
||||
const response = await stClient.get<SewagePipePipeTypeFacilityStatusResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/pipe-type-facility-status`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/** ST00020004 — 관경별 시설현황(합계) */
|
||||
public async getSewagePipePipeDiamStatus(
|
||||
params: SewagePipeTotalRequest,
|
||||
): Promise<SewagePipePipeDiamStatusResponse> {
|
||||
const response = await stClient.get<SewagePipePipeDiamStatusResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe/pipe-diam-status`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/** ST00030001 — 하수관로 유지관리 > 개보수(합계) */
|
||||
public async getSewagePipeMaintainRepairTotal(
|
||||
params: SewagePipeMaintainTotalRequest,
|
||||
): Promise<SewagePipeMaintainRepairTotalResponse> {
|
||||
const response = await stClient.get<SewagePipeMaintainRepairTotalResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe-mtc/repair`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
/** ST00030002 — 하수관로 유지관리 > 관로준설(합계) */
|
||||
public async getSewagePipeMaintainDredgingTotal(
|
||||
params: SewagePipeMaintainTotalRequest,
|
||||
): Promise<SewagePipeMaintainDredgingTotalResponse> {
|
||||
const response = await stClient.get<SewagePipeMaintainDredgingTotalResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.TOTAL}/sewer-pipe-mtc/dredging`,
|
||||
{ params },
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const statisticsTotalStatusApi = new StatisticsTotalApiService();
|
||||
@@ -1,9 +1,21 @@
|
||||
export {
|
||||
useDashboardEcptReqCount,
|
||||
useDashboardStatsSubmissionRate,
|
||||
useDashboardUnSubmitCount,
|
||||
useDashboardVrfcErrCount,
|
||||
useDashboardVrfcReport,
|
||||
} from "./api/dashboard/dashboard-queries";
|
||||
export { dashboardApi } from "./api/dashboard/dashboard-service";
|
||||
export { useScheduleInfo } from "./api/dashboard/schedule-info-queries";
|
||||
export { scheduleInfoApi } from "./api/dashboard/schedule-info-service";
|
||||
export {
|
||||
useSewerStUserList,
|
||||
useStAnlsSidoCombo,
|
||||
useStAnlsSigunguCombo,
|
||||
useStatsVrfcRptData,
|
||||
useStatsVrfcRsltData,
|
||||
} from "./api/queries";
|
||||
export { sewerStUserApi } from "./api/sewer-st-user-service";
|
||||
export { statisticsApprovalApi } from "./api/statistics-approval-service";
|
||||
export {
|
||||
type AnalysisHistoryListApiResponse,
|
||||
@@ -14,6 +26,24 @@ export {
|
||||
type JobStatusDto,
|
||||
type OutlierRecordDto,
|
||||
} from "./model/analysis/analysis-interface";
|
||||
export {
|
||||
type DashboardApiResponse,
|
||||
type DashboardSearchParams,
|
||||
type DashboardService,
|
||||
type EcptReqCountResponse,
|
||||
type StatsSubmissionResponse,
|
||||
type UnSubmitCountResponse,
|
||||
type UnSubmitStatsResponse,
|
||||
type VrfcErrCountResponse,
|
||||
type VrfcReportResponse,
|
||||
type VrfcReportSelect,
|
||||
} from "./model/dashboard/dashboard-interface";
|
||||
export {
|
||||
type ScheduleInfoApiResponse,
|
||||
type ScheduleInfoResponse,
|
||||
type ScheduleInfoSearchParams,
|
||||
type ScheduleInfoService,
|
||||
} from "./model/dashboard/schedule-info-interface";
|
||||
export { type VerifyResultItem } from "./model/general-verification-interface";
|
||||
export {
|
||||
IMR_DETAIL_VISIBLE_COLUMNS_BY_STATS_CD,
|
||||
@@ -34,6 +64,11 @@ export {
|
||||
} from "./model/imr/imr-interface";
|
||||
export { imrVerificationHistoryColumns } from "./model/imr/imr-verification-history-columns";
|
||||
export { type StatsInputStatusList } from "./model/input/statistics-input-status-interface";
|
||||
export {
|
||||
type SewerStUserItem,
|
||||
type SewerStUserListResponse,
|
||||
type SewerStUserSearchParams,
|
||||
} from "./model/sewer-st-user-interface";
|
||||
export {
|
||||
type StAnlsDtlListApiResponse,
|
||||
type StAnlsDtlResponse,
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
export interface DashboardSearchParams {
|
||||
statsYr: string;
|
||||
dtlInstCd: string;
|
||||
enoCd?: string;
|
||||
laeSeCd?: string;
|
||||
sewerBzmnCd?: string;
|
||||
sido?: string;
|
||||
sggNm?: string;
|
||||
unSubmitOnly?: boolean;
|
||||
}
|
||||
|
||||
export interface DashboardApiResponse<T> {
|
||||
status: string;
|
||||
message: string;
|
||||
data: T;
|
||||
code: string;
|
||||
httpStatus: number;
|
||||
}
|
||||
|
||||
export interface VrfcReportResponse {
|
||||
typeCounts: Record<string, number>;
|
||||
list: VrfcReportSelect[];
|
||||
}
|
||||
|
||||
export interface VrfcReportSelect {
|
||||
vrfcCd: string;
|
||||
statsNm: string;
|
||||
rsnExpln: string;
|
||||
admdstNm: string;
|
||||
nowVlCn: string;
|
||||
compVlCn: string;
|
||||
}
|
||||
|
||||
export interface VrfcErrCountResponse {
|
||||
statsYr: string;
|
||||
vrfcErrCount: number;
|
||||
}
|
||||
|
||||
export interface UnSubmitCountResponse {
|
||||
statsYr: string;
|
||||
statusList: UnSubmitStatsResponse[];
|
||||
submittedCount: number;
|
||||
totalCount: number;
|
||||
unSubmittedCount: number;
|
||||
}
|
||||
|
||||
export interface UnSubmitStatsResponse {
|
||||
sbmsnYn: string;
|
||||
sidoSggNm: string;
|
||||
statsCd: string;
|
||||
statsNm: string;
|
||||
statusCd: string;
|
||||
statusNm: string;
|
||||
}
|
||||
|
||||
export interface StatsSubmissionResponse {
|
||||
totalCount: number;
|
||||
submittedCount: number;
|
||||
submissionRate: number;
|
||||
statusLevel: string;
|
||||
}
|
||||
|
||||
export interface EcptReqCountResponse {
|
||||
statsYr: string;
|
||||
ecptReqCount: number;
|
||||
}
|
||||
|
||||
export interface DashboardService {
|
||||
getVrfcReport(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<VrfcReportResponse>>;
|
||||
getVrfcErrCount(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<VrfcErrCountResponse>>;
|
||||
getUnSubmitCount(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<UnSubmitCountResponse>>;
|
||||
getStatsSubmissionRate(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<StatsSubmissionResponse>>;
|
||||
getEcptReqCount(
|
||||
params: DashboardSearchParams,
|
||||
): Promise<DashboardApiResponse<EcptReqCountResponse>>;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
export interface ScheduleInfoSearchParams {
|
||||
statsYr: string;
|
||||
}
|
||||
|
||||
export interface ScheduleInfoApiResponse<T> {
|
||||
status: string;
|
||||
message: string;
|
||||
data: T;
|
||||
code: string;
|
||||
httpStatus: number;
|
||||
}
|
||||
|
||||
export interface ScheduleInfoResponse {
|
||||
statsYr: string;
|
||||
inptSeCd: number;
|
||||
inptBgngYmd: string;
|
||||
inptEndYmd: string;
|
||||
vrfcSeCd: number;
|
||||
vrfcBgngYmd: string;
|
||||
vrfcEndYmd: string;
|
||||
currentSe: string;
|
||||
dday: string;
|
||||
ddayLabel: string;
|
||||
}
|
||||
|
||||
export interface ScheduleInfoService {
|
||||
getScheduleInfo(
|
||||
params: ScheduleInfoSearchParams,
|
||||
): Promise<ScheduleInfoApiResponse<ScheduleInfoResponse>>;
|
||||
}
|
||||
@@ -196,11 +196,12 @@ export interface CopyVerifyDataRequest {
|
||||
}
|
||||
|
||||
export interface VerifyResultSearchRequest {
|
||||
sewerBzmnCd?: string | null;
|
||||
ctpvNm?: string | null;
|
||||
sggNm?: string | null;
|
||||
sewerBzmnCd?: string | null;
|
||||
statsYr: string;
|
||||
statsCd?: string | null;
|
||||
laeSbmsnSttsCd?: string | null;
|
||||
vrfcMthdCd?: string;
|
||||
prcsYnList?: string; // 검증 상태 리스트 (0: 미검증, 1: 수정완료, 2:예외통과, 3: 반려)
|
||||
pbcpAprvYn?: string; // 공단 승인 여부 (Y/N)
|
||||
|
||||
@@ -6,6 +6,7 @@ export interface StatsInputStatusListRequestParams {
|
||||
sewerBzmnCd?: string | null;
|
||||
statsYr: string;
|
||||
statsCd?: string | null;
|
||||
laeSbmsnSttsCd?: string | null;
|
||||
}
|
||||
|
||||
export interface StatsInputStatusList {
|
||||
|
||||
+95
-12
@@ -22,6 +22,10 @@ export interface SeweragePipeInputStatusInfo {
|
||||
export interface VerifyResultItem {
|
||||
vrfcCd: string;
|
||||
rsnExpln: string;
|
||||
/** 현재값(문자열로 내려오는 경우가 많음) */
|
||||
nowVlCn?: string;
|
||||
/** 비교값 */
|
||||
compVlCn?: string;
|
||||
}
|
||||
|
||||
/** 필드명 -> 검증 결과 배열 */
|
||||
@@ -106,6 +110,12 @@ export type SeweragePipeInputRegionalFactStatusSaveItem = Omit<
|
||||
"verificationResult"
|
||||
>;
|
||||
|
||||
/** Tab2 저장 — saveList */
|
||||
export type SeweragePipeInputFactInstallStatusSaveItem = Omit<
|
||||
SeweragePipeInputFactInstallStatusItem,
|
||||
"verificationResult"
|
||||
>;
|
||||
|
||||
/** 지역별 시설현황 저장 API 요청 */
|
||||
export interface SeweragePipeInputRegionalFactStatusSaveRequest {
|
||||
statsYr: string;
|
||||
@@ -118,7 +128,50 @@ export interface SeweragePipeInputRegionalFactStatusSaveRequest {
|
||||
}
|
||||
|
||||
export interface SeweragePipeInputRegionalFactStatusSaveResponse {
|
||||
data: string;
|
||||
data?: string;
|
||||
message?: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
/** 지역별 시설현황 제출 API 요청 (save item 구조 재사용) */
|
||||
export interface SeweragePipeInputRegionalFactStatusSubmitRequest {
|
||||
statsYr: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
sewerBzmnCd: string;
|
||||
userId: string;
|
||||
laePicNm: string;
|
||||
laePicTelNo: string;
|
||||
laeKbrdrDeptNm: string;
|
||||
laeKbrdrJbgdNm: string;
|
||||
laeIdfrNm: string;
|
||||
laeIdfrTelNo: string;
|
||||
laeIdfrDeptNm: string;
|
||||
laeIdfrJbgdNm: string;
|
||||
submitList: SeweragePipeInputRegionalFactStatusSaveItem[];
|
||||
}
|
||||
|
||||
export interface SeweragePipeInputRegionalFactStatusSubmitResponse {
|
||||
data: {
|
||||
finalStatus: string;
|
||||
nvpassed: boolean;
|
||||
}
|
||||
message?: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
export interface SeweragePipeInputFactInstallStatusSaveRequest {
|
||||
statsYr: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
sewerBzmnCd: string;
|
||||
userId: string;
|
||||
superAdmin: string;
|
||||
saveList: SeweragePipeInputFactInstallStatusSaveItem[];
|
||||
}
|
||||
|
||||
export interface SeweragePipeInputFactInstallStatusSaveResponse {
|
||||
data?: string;
|
||||
message?: string;
|
||||
status: string;
|
||||
}
|
||||
@@ -128,7 +181,7 @@ export interface SeweragePipeInputFactInstallStatusItem {
|
||||
admdstCd: string;
|
||||
sggNm: string;
|
||||
admdstNm: string;
|
||||
prcsFcltSn: number;
|
||||
fcltSn: string;
|
||||
swtrmtFcltCd: string;
|
||||
swtrmtFcltNm: string;
|
||||
prcsFcltCpct: number;
|
||||
@@ -425,9 +478,9 @@ export interface SeweragePipeInputManholeResponse {
|
||||
|
||||
/** 시설별 현황 관리 - 하수처리장별 연결 현황 목록 항목 */
|
||||
export interface SeweragePipeInputFacilityConnectionItem {
|
||||
bscFctNm: string;
|
||||
fctCpc: number;
|
||||
bscFctCd: string;
|
||||
fcltNm: string;
|
||||
fcltCpct: number;
|
||||
fcltSn: string;
|
||||
isConnection: string;
|
||||
connectionAreaList: string;
|
||||
}
|
||||
@@ -472,9 +525,10 @@ export interface SeweragePipeFacilitiesListItem {
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
admdstCd: string;
|
||||
bscFctNm: string;
|
||||
fctCpc: number;
|
||||
bscFctCd: string;
|
||||
fcltNm: string;
|
||||
fcltCpct: number;
|
||||
fcltCd: string;
|
||||
fcltSn: string;
|
||||
}
|
||||
|
||||
/** facilitiesList API 응답 */
|
||||
@@ -490,7 +544,7 @@ export interface SeweragePipeFacilityAdminAreaListRequest {
|
||||
swtrmtFcltCd: string;
|
||||
sewerBzmnCd: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
sggNm?: string;
|
||||
}
|
||||
|
||||
/** 처리시설별 행정구역 목록 항목 */
|
||||
@@ -509,6 +563,34 @@ export interface SeweragePipeFacilityAdminAreaListResponse {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
/** 시설별 연결관계 저장 — saveList 항목 */
|
||||
export interface SeweragePipeFactConnectionSaveItem {
|
||||
admdstCd: string;
|
||||
admdstNm: string;
|
||||
}
|
||||
|
||||
/** 시설별 연결관계 저장 요청 */
|
||||
export interface SeweragePipeFactConnectionSaveRequest {
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
fcltSn: string;
|
||||
statsYr: string;
|
||||
swtrmtFcltCd: string;
|
||||
swtrmtFcltNm: string;
|
||||
prcsFcltCpct: number;
|
||||
sewerBzmnCd: string;
|
||||
userId: string;
|
||||
saveList: SeweragePipeFactConnectionSaveItem[];
|
||||
deleteList: string[];
|
||||
}
|
||||
|
||||
/** 시설별 연결관계 저장 응답 */
|
||||
export interface SeweragePipeFactConnectionSaveResponse {
|
||||
status: string;
|
||||
data?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface StatisticsInputSewPipeService {
|
||||
getRegionalFactStatus(param: SeweragePipeRequestParams): Promise<SeweragePipeInputRegionalResponse>;
|
||||
getFactInstallStatus(param: SeweragePipeRequestParams): Promise<SeweragePipeInputFactInstallResponse>;
|
||||
@@ -518,7 +600,8 @@ export interface StatisticsInputSewPipeService {
|
||||
getConnectionStatus(param: SeweragePipeRequestParams): Promise<SeweragePipeInputConnectionStatusResponse>;
|
||||
getFacilitiesList(param: SeweragePipeFacilitiesListRequest): Promise<SeweragePipeFacilitiesListResponse>;
|
||||
getFacilityAdminAreaList(param: SeweragePipeFacilityAdminAreaListRequest): Promise<SeweragePipeFacilityAdminAreaListResponse>;
|
||||
saveRegionalFactStatus(
|
||||
param: SeweragePipeInputRegionalFactStatusSaveRequest,
|
||||
): Promise<SeweragePipeInputRegionalFactStatusSaveResponse>;
|
||||
saveFactConnection(param: SeweragePipeFactConnectionSaveRequest): Promise<SeweragePipeFactConnectionSaveResponse>;
|
||||
saveRegionalFactStatus(param: SeweragePipeInputRegionalFactStatusSaveRequest): Promise<SeweragePipeInputRegionalFactStatusSaveResponse>;
|
||||
submitRegionalFactStatus(param: SeweragePipeInputRegionalFactStatusSubmitRequest): Promise<SeweragePipeInputRegionalFactStatusSubmitResponse>;
|
||||
saveFactInstallStatus(param: SeweragePipeInputFactInstallStatusSaveRequest): Promise<SeweragePipeInputFactInstallStatusSaveResponse>;
|
||||
}
|
||||
+52
-2
@@ -167,11 +167,61 @@ export interface SewerageSupplyRateSubmitResponse {
|
||||
status: string;
|
||||
}
|
||||
|
||||
// 하수도 통계 입력 기간 조회
|
||||
// 하수도 통계 입력 기간 조회 (입력 INPT / 검증 VRFC 구간)
|
||||
export interface CheckInputPeriodItem {
|
||||
statsYr: string;
|
||||
seCd: number;
|
||||
seType: string;
|
||||
bgngYmd: string;
|
||||
endYmd: string;
|
||||
current: boolean;
|
||||
}
|
||||
|
||||
export interface CheckInputPeriodResponse {
|
||||
status: string;
|
||||
message: string;
|
||||
data: boolean;
|
||||
data: CheckInputPeriodItem[];
|
||||
}
|
||||
|
||||
/** 입력기간(INPT) 중 현재 구간이면 true */
|
||||
export function isInputPeriodCurrent(periods: CheckInputPeriodItem[] | null | undefined): boolean {
|
||||
return (periods ?? []).some((p) => p.seType === "INPT" && p.current === true);
|
||||
}
|
||||
|
||||
/** `YYYYMMDD` → `yyyy-mm-dd` (그 외 형식은 그대로 반환) */
|
||||
export function formatCheckInputYmdAsDash(ymd: string | null | undefined): string {
|
||||
if (ymd == null || ymd === "") return "";
|
||||
if (ymd.length === 8 && /^\d{8}$/.test(ymd)) {
|
||||
return `${ymd.slice(0, 4)}-${ymd.slice(4, 6)}-${ymd.slice(6, 8)}`;
|
||||
}
|
||||
return ymd;
|
||||
}
|
||||
|
||||
/** 검증기간(VRFC) 중 `current`인 항목 (없으면 null) */
|
||||
export function getCurrentVerificationPeriod(
|
||||
periods: CheckInputPeriodItem[] | null | undefined,
|
||||
): CheckInputPeriodItem | null {
|
||||
return (periods ?? []).find((p) => p.seType === "VRFC" && p.current === true) ?? null;
|
||||
}
|
||||
|
||||
/** 검증기간(VRFC) 중 현재 구간이면 true — 저장·제출·제출 취소 불가 */
|
||||
export function isVerificationPeriodCurrent(periods: CheckInputPeriodItem[] | null | undefined): boolean {
|
||||
return getCurrentVerificationPeriod(periods) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 검증기간이면 차단 안내 문구(줄바꿈 + yyyy-mm-dd ~ yyyy-mm-dd), 아니면 null
|
||||
*/
|
||||
export function getVerificationPeriodActionBlockedMessage(
|
||||
periods: CheckInputPeriodItem[] | null | undefined,
|
||||
): string | null {
|
||||
const v = getCurrentVerificationPeriod(periods);
|
||||
if (!v) return null;
|
||||
const from = formatCheckInputYmdAsDash(v.bgngYmd);
|
||||
const to = formatCheckInputYmdAsDash(v.endYmd);
|
||||
const range =
|
||||
from && to ? `${from} ~ ${to}` : [from, to].filter(Boolean).join(" ~ ");
|
||||
return `검증기간에는 저장, 제출, 제출 취소를\n 할 수 없습니다.\n(검증기간: ${range})`;
|
||||
}
|
||||
|
||||
export interface StatisticsInputSewSupplyRateService {
|
||||
|
||||
@@ -47,7 +47,7 @@ export const regionalGridColumnInfo: ColumnInfo = {
|
||||
{
|
||||
name: "chgRt",
|
||||
fieldName: "chgRt",
|
||||
header: { text: "R" },
|
||||
header: { text: "전년대비 비율" },
|
||||
width: 60,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
@@ -55,7 +55,7 @@ export const regionalGridColumnInfo: ColumnInfo = {
|
||||
{
|
||||
name: "trsfRt",
|
||||
fieldName: "trsfRt",
|
||||
header: { text: "S" },
|
||||
header: { text: "S_i" },
|
||||
width: 60,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
@@ -63,7 +63,7 @@ export const regionalGridColumnInfo: ColumnInfo = {
|
||||
{
|
||||
name: "otlrTrsfRt",
|
||||
fieldName: "otlrTrsfRt",
|
||||
header: { text: "E" },
|
||||
header: { text: "기준값" },
|
||||
width: 60,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 하수도 통계 제출현황 사용자 목록 조회 인터페이스
|
||||
*/
|
||||
|
||||
/**
|
||||
* 하수도 통계 사용자 목록 검색 조건
|
||||
*/
|
||||
export interface SewerStUserSearchParams {
|
||||
/** 통계연도 (예: "2024") */
|
||||
statsYr?: string;
|
||||
/** 하수도 사업자코드 (예: "4145000000") */
|
||||
sewerBzmnCd?: string;
|
||||
/** 구분 코드 (PIC: 입력자, IDFR: 승인자, MCTPV: 검토자, null: 전체) */
|
||||
gubun?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하수도 통계 사용자 목록 한 행
|
||||
*/
|
||||
export interface SewerStUserItem {
|
||||
/** 시도 */
|
||||
sido: string;
|
||||
/** 시군구 */
|
||||
gugun: string;
|
||||
/** 이름 */
|
||||
userNm: string;
|
||||
/** 전화번호 */
|
||||
telNo: string;
|
||||
/** 소속 */
|
||||
deptNm: string;
|
||||
/** 직급 */
|
||||
jbgdNm: string;
|
||||
/** 구분 코드 (PIC: 입력자, IDFR: 승인자, MCTPV: 검토자) */
|
||||
gubun: string;
|
||||
/** 구분명 (입력자 / 승인자 / 검토자) */
|
||||
gubunNm: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하수도 통계 사용자 목록 조회 API 응답
|
||||
*/
|
||||
export interface SewerStUserListResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data?: SewerStUserItem[];
|
||||
}
|
||||
@@ -268,6 +268,24 @@ export interface ReviewSubmitResponse {
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface SubmitVerifyExceptionRequest {
|
||||
sewerBzmnCd: string;
|
||||
statsYr: string;
|
||||
statsCd: string;
|
||||
userId: string;
|
||||
exceptionList: [
|
||||
{
|
||||
vrfcSn: number;
|
||||
prcsOpnnExpln: string;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
export interface SubmitVerifyExceptionResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface StatisticsService {
|
||||
getSidoList(params?: { instSeCd?: string }): Promise<ApiResponse<SearchCondition>>;
|
||||
getSggList(sidoName: string, params?: { instSeCd?: string; gugunSkipYn?: "Y" | "N" }): Promise<ApiResponse<Sgg[]>>;
|
||||
@@ -280,7 +298,8 @@ export interface StatisticsService {
|
||||
saveReviewOpinion(param: ReviewOpinionSaveRequest): Promise<ReviewOpinionSaveResponse>;
|
||||
getReviewOpinionDetail(param: getReviewOpinionDetailRequest): Promise<getReviewOpinionDetailResponse>;
|
||||
saveReviewReturn(param: ReviewReturnSaveRequest): Promise<ReviewReturnSaveResponse>;
|
||||
submitReview(param :ReviewSubmitRequest): Promise<ReviewSubmitResponse>;
|
||||
submitReview(param: ReviewSubmitRequest): Promise<ReviewSubmitResponse>;
|
||||
getVerificationResultList(param: VerificationResultListRequest): Promise<VerificationResultListResponse>;
|
||||
getImrStatus(param: string): Promise<ImrStatusResponse>;
|
||||
SubmitVerifyException(param: SubmitVerifyExceptionRequest): Promise<SubmitVerifyExceptionResponse>;
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
export interface SewagePipeMaintainTotalRequest {
|
||||
ctpvNm?: string;
|
||||
sggNm?: string;
|
||||
statsYr?: string;
|
||||
sewerBzmnCd?: string;
|
||||
rowDataYn?: boolean;
|
||||
}
|
||||
|
||||
export interface SewagePipeMaintainRepairTotalItem {
|
||||
ctpvNm: string;
|
||||
sggNm: string | null;
|
||||
statsYr: string;
|
||||
rowType: string;
|
||||
sewerBzmnCd: string | null;
|
||||
admdstNm: string;
|
||||
mendngWhol: number;
|
||||
cbsysMendngPrlg: number;
|
||||
sprsysDrtwPrlg: number;
|
||||
sprsysExlnPrlg: number;
|
||||
partMendngWhol: number;
|
||||
cbsysPartMendngPrlg: number;
|
||||
sprsysDrtwMendngPrlg: number;
|
||||
sprsysExlnMendngPrlg: number;
|
||||
cbsysMnhlCnt: number;
|
||||
sprsysDrtwMnhlCnt: number;
|
||||
sprsysExlnMnhlCnt: number;
|
||||
drtwRcvprpCnt: number;
|
||||
exlnRcvprpCnt: number;
|
||||
stofcbrCnt: number;
|
||||
otflCnt: number;
|
||||
cctvExmnPrlg: number;
|
||||
rmrk: string | null;
|
||||
}
|
||||
|
||||
export interface SewagePipeMaintainRepairTotalResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: SewagePipeMaintainRepairTotalItem[];
|
||||
}
|
||||
|
||||
/** `GET .../sewer-pipe-mtc/dredging` 목록 항목 */
|
||||
export interface SewagePipeMaintainDredgingTotalItem {
|
||||
ctpvNm: string;
|
||||
sggNm: string | null;
|
||||
admdstNm: string;
|
||||
admdstCd: string;
|
||||
statsYr: string;
|
||||
rowType: string;
|
||||
sewerBzmnCd: string | null;
|
||||
wholFcltPrlg: number;
|
||||
wholSwagePpl: number;
|
||||
cbsysPplPrlg: number;
|
||||
sprsysDrtwPrlg: number;
|
||||
sprsysExlnPrlg: number;
|
||||
mnhlCnt: number;
|
||||
exlnDrtwRcvprpCnt: number;
|
||||
stofcbrOtflCnt: number;
|
||||
drdgnPlanPrlg: number;
|
||||
drdgnTrgtCtrsDrdgnRt: number;
|
||||
wholPrlgCtrsDrdgnRt: number;
|
||||
drdgnAmt: number;
|
||||
drdgnQnt: number;
|
||||
drdgnUntprcAmt: number;
|
||||
wholDrdgnPrcsQnt: number;
|
||||
rclmQnt: number;
|
||||
oceanEmsnQnt: number;
|
||||
rcycQnt: number;
|
||||
etcQnt: number;
|
||||
rmrk: string | null;
|
||||
}
|
||||
|
||||
/** `GET .../sewer-pipe-mtc/dredging` 응답 */
|
||||
export interface SewagePipeMaintainDredgingTotalResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: SewagePipeMaintainDredgingTotalItem[];
|
||||
}
|
||||
+177
@@ -57,3 +57,180 @@ export interface SewagePipeTotalResponse {
|
||||
message: string;
|
||||
data: SewagePipeTotalItem[];
|
||||
}
|
||||
|
||||
export interface SewagePipeFactInstallStatusItem {
|
||||
statsYr: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string | null;
|
||||
admdstCd: string;
|
||||
admdstNm: string;
|
||||
swtrmtFcltNm: string;
|
||||
prcsFcltCpct: number | null;
|
||||
rowType: string;
|
||||
prcsZoneArea: number;
|
||||
cbsysPrcsZoneArea: number;
|
||||
sprsysPrcsZoneArea: number;
|
||||
sprsysVartnRt: number;
|
||||
mltvEqpmCnt: number;
|
||||
cbsysMltvEqpmCnt: number;
|
||||
sprsysMltvEqpmCnt: number;
|
||||
sprsysMltvLnkgCnt: number;
|
||||
sprsysMltvYetLnkgCnt: number;
|
||||
planPrcsZoneArea: number;
|
||||
cbsysPlanPrcsZoneArea: number;
|
||||
sprsysPlanPrcsZoneArea: number;
|
||||
wholFcltPrlg: number;
|
||||
wholIcptgAtlfcPrlg: number | null;
|
||||
icptgPrlg: number;
|
||||
atlfcsPrlg: number;
|
||||
cbsysStofcbrCnt: number;
|
||||
sprsysStofcbrCnt: number;
|
||||
sprsysExlnOtflCnt: number;
|
||||
wholBrchlnPrlg: number;
|
||||
cbsysBrchlnPrlg: number;
|
||||
exlnBrchlnPrlg: number;
|
||||
drtwBrchlnPrlg: number;
|
||||
}
|
||||
|
||||
export interface SewagePipeFactInstallStatusResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: SewagePipeFactInstallStatusItem[];
|
||||
}
|
||||
|
||||
/** ST00020003 합계 — `GET .../sewer-pipe/pipe-type-facility-status` */
|
||||
export interface SewagePipePipeTypeFacilityStatusItem {
|
||||
pipeByPrstWhol: number;
|
||||
lyngPrlg: number;
|
||||
dmltnPrlg: number;
|
||||
yy1PrlgWhol: number;
|
||||
yy1LyngPrlg: number;
|
||||
yy1DmltnPrlg: number;
|
||||
yy2PrlgWhol: number;
|
||||
yy2LyngPrlg: number;
|
||||
yy2DmltnPrlg: number;
|
||||
yy3PrlgWhol: number;
|
||||
yy3LyngPrlg: number;
|
||||
yy3DmltnPrlg: number;
|
||||
yy4PrlgWhol: number;
|
||||
yy4LyngPrlg: number;
|
||||
yy4DmltnPrlg: number;
|
||||
yy5PrlgWhol: number;
|
||||
yy5LyngPrlg: number;
|
||||
yy5DmltnPrlg: number;
|
||||
yy6PrlgWhol: number;
|
||||
yy6LyngPrlg: number;
|
||||
yy6DmltnPrlg: number;
|
||||
yy7PrlgWhol: number;
|
||||
yy7LyngPrlg: number;
|
||||
yy7DmltnPrlg: number;
|
||||
yy8PrlgWhol: number;
|
||||
yy8LyngPrlg: number;
|
||||
yy8DmltnPrlg: number;
|
||||
yy9PrlgWhol: number;
|
||||
yy9LyngPrlg: number;
|
||||
yy9DmltnPrlg: number;
|
||||
yy10PrlgWhol: number;
|
||||
yy10LyngPrlg: number;
|
||||
yy10DmltnPrlg: number;
|
||||
yy11PrlgWhol: number;
|
||||
yy11LyngPrlg: number;
|
||||
yy11DmltnPrlg: number;
|
||||
yy12PrlgWhol: number;
|
||||
yy12LyngPrlg: number;
|
||||
yy12DmltnPrlg: number;
|
||||
yy13PrlgWhol: number;
|
||||
yy13LyngPrlg: number;
|
||||
yy13DmltnPrlg: number;
|
||||
yy14PrlgWhol: number;
|
||||
yy14LyngPrlg: number;
|
||||
yy14DmltnPrlg: number;
|
||||
yy15PrlgWhol: number;
|
||||
yy15LyngPrlg: number;
|
||||
yy15DmltnPrlg: number;
|
||||
yy16PrlgWhol: number;
|
||||
yy16LyngPrlg: number;
|
||||
yy16DmltnPrlg: number;
|
||||
yy17PrlgWhol: number;
|
||||
yy17LyngPrlg: number;
|
||||
yy17DmltnPrlg: number;
|
||||
yy18PrlgWhol: number;
|
||||
yy18LyngPrlg: number;
|
||||
yy18DmltnPrlg: number;
|
||||
yy19PrlgWhol: number;
|
||||
yy19LyngPrlg: number;
|
||||
yy19DmltnPrlg: number;
|
||||
yy20PrlgWhol: number;
|
||||
yy20LyngPrlg: number;
|
||||
yy20DmltnPrlg: number;
|
||||
yy21PrlgWhol: number;
|
||||
yy21LyngPrlg: number;
|
||||
yy21DmltnPrlg: number;
|
||||
yy22PrlgWhol: number;
|
||||
yy22LyngPrlg: number;
|
||||
yy22DmltnPrlg: number;
|
||||
yy23PrlgWhol: number;
|
||||
yy23LyngPrlg: number;
|
||||
yy23DmltnPrlg: number;
|
||||
yy24PrlgWhol: number;
|
||||
yy24LyngPrlg: number;
|
||||
yy24DmltnPrlg: number;
|
||||
yy25PrlgWhol: number;
|
||||
yy25LyngPrlg: number;
|
||||
yy25DmltnPrlg: number;
|
||||
yy26PrlgWhol: number;
|
||||
yy26LyngPrlg: number;
|
||||
yy26DmltnPrlg: number;
|
||||
yy27PrlgWhol: number;
|
||||
yy27LyngPrlg: number;
|
||||
yy27DmltnPrlg: number;
|
||||
yy28PrlgWhol: number;
|
||||
yy28LyngPrlg: number;
|
||||
yy28DmltnPrlg: number;
|
||||
yy29PrlgWhol: number;
|
||||
yy29LyngPrlg: number;
|
||||
yy29DmltnPrlg: number;
|
||||
yy30PrlgWhol: number;
|
||||
yy30LyngPrlg: number;
|
||||
yy30DmltnPrlg: number;
|
||||
ctpvNm: string;
|
||||
sggNm: string | null;
|
||||
admdstCd: string;
|
||||
admdstNm: string;
|
||||
swrgPipeNm: string;
|
||||
statsYr: string;
|
||||
rowType: string;
|
||||
rmrk: string | null;
|
||||
}
|
||||
|
||||
export interface SewagePipePipeTypeFacilityStatusResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: SewagePipePipeTypeFacilityStatusItem[];
|
||||
}
|
||||
|
||||
/** ST00020004 합계 — `GET .../sewer-pipe/pipe-diam-status` */
|
||||
export interface SewagePipePipeDiamStatusItem {
|
||||
ctpvNm: string;
|
||||
sggNm: string | null;
|
||||
admdstCd: string;
|
||||
admdstNm: string;
|
||||
statsYr: string;
|
||||
swrgPipeNm: string;
|
||||
rowType: string;
|
||||
pdmtByTsmWhol: number;
|
||||
step1PdmtPrlg: number;
|
||||
step2PdmtPrlg: number;
|
||||
step3PdmtPrlg: number;
|
||||
step4PdmtPrlg: number;
|
||||
step5PdmtPrlg: number;
|
||||
sqrePdmtPrlg: number;
|
||||
etcPdmtPrlg: number;
|
||||
rmrk: string | null;
|
||||
}
|
||||
|
||||
export interface SewagePipePipeDiamStatusResponse {
|
||||
status: string;
|
||||
message?: string;
|
||||
data: SewagePipePipeDiamStatusItem[];
|
||||
}
|
||||
|
||||
+2
@@ -4,6 +4,8 @@ export interface SewerageSupplyRateRequest {
|
||||
statsYr?: string;
|
||||
sewerBzmnCd?: string;
|
||||
rowDataYn?: boolean;
|
||||
summaryYn?: boolean;
|
||||
summaryYearCnt?: number;
|
||||
}
|
||||
|
||||
export interface SewerageSupplyRateTotalItem {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import {
|
||||
KeyboardSensor,
|
||||
PointerSensor,
|
||||
useSensor,
|
||||
useSensors,
|
||||
} from "@dnd-kit/core";
|
||||
import { sortableKeyboardCoordinates } from "@dnd-kit/sortable";
|
||||
|
||||
export function useDndSensors() {
|
||||
return useSensors(
|
||||
useSensor(PointerSensor),
|
||||
useSensor(KeyboardSensor, {
|
||||
coordinateGetter: sortableKeyboardCoordinates,
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import type { DragEndEvent } from "@dnd-kit/core";
|
||||
import { arrayMove } from "@dnd-kit/sortable";
|
||||
|
||||
import type { PanelItem } from "../../model/types";
|
||||
|
||||
interface UsePanelOrderProps {
|
||||
initialPanels: PanelItem[];
|
||||
storageKey: string;
|
||||
}
|
||||
|
||||
export function usePanelOrder({
|
||||
initialPanels,
|
||||
storageKey,
|
||||
}: UsePanelOrderProps) {
|
||||
const [panels, setPanels] = useState<PanelItem[]>(initialPanels);
|
||||
const [isInitialized, setIsInitialized] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (initialPanels.length === 0 || isInitialized) return;
|
||||
|
||||
const saved = localStorage.getItem(storageKey);
|
||||
if (saved) {
|
||||
try {
|
||||
const savedIds = JSON.parse(saved);
|
||||
const restoredPanels = savedIds
|
||||
.map((id: string) => initialPanels.find((p) => p.id === id))
|
||||
.filter(Boolean);
|
||||
if (restoredPanels.length === initialPanels.length) {
|
||||
setPanels(restoredPanels);
|
||||
}
|
||||
} catch {
|
||||
setPanels(initialPanels);
|
||||
}
|
||||
} else {
|
||||
setPanels(initialPanels);
|
||||
}
|
||||
setIsInitialized(true);
|
||||
}, [storageKey, initialPanels, isInitialized]);
|
||||
|
||||
const handleDragEnd = (event: DragEndEvent) => {
|
||||
const { active, over } = event;
|
||||
|
||||
if (over && active.id !== over.id) {
|
||||
setPanels((items) => {
|
||||
const oldIndex = items.findIndex(
|
||||
(item) => item.id === active.id,
|
||||
);
|
||||
const newIndex = items.findIndex((item) => item.id === over.id);
|
||||
const newItems = arrayMove(items, oldIndex, newIndex);
|
||||
|
||||
localStorage.setItem(
|
||||
storageKey,
|
||||
JSON.stringify(newItems.map((item) => item.id)),
|
||||
);
|
||||
|
||||
return newItems;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return { panels, handleDragEnd };
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import type { DashboardSearchParams } from "@/entities/statistics/model/dashboard/dashboard-interface";
|
||||
import type { ScheduleInfoSearchParams } from "@/entities/statistics/model/dashboard/schedule-info-interface";
|
||||
|
||||
import { NoticePanel } from "../ui/panels/notice-panel";
|
||||
import { ScheduleCalendarPanel } from "../ui/panels/schedule-calendar-panel";
|
||||
import { ScheduleInfoPanel } from "../ui/panels/schedule-info-panel";
|
||||
import { StatsSubmissionPanel } from "../ui/panels/stats-submission-panel";
|
||||
import { UnSubmitPanel } from "../ui/panels/unsubmit-panel";
|
||||
// import { VrfcErrPanel } from "../ui/panels/vrfc-err-panel";
|
||||
import { VrfcReportPanel } from "../ui/panels/vrfc-report-panel";
|
||||
|
||||
import type { PanelItem } from "./types";
|
||||
|
||||
interface GetInitialPanelsParams {
|
||||
dashboardParams: DashboardSearchParams | null;
|
||||
scheduleInfoParams: ScheduleInfoSearchParams | null;
|
||||
}
|
||||
|
||||
export function getInitialPanels({
|
||||
dashboardParams,
|
||||
scheduleInfoParams,
|
||||
}: GetInitialPanelsParams): PanelItem[] {
|
||||
return [
|
||||
{
|
||||
id: "panel-a",
|
||||
component: <StatsSubmissionPanel params={dashboardParams} />,
|
||||
className: "",
|
||||
},
|
||||
{
|
||||
id: "panel-b",
|
||||
component: <ScheduleInfoPanel params={scheduleInfoParams} />,
|
||||
className: "",
|
||||
},
|
||||
{
|
||||
id: "panel-c",
|
||||
component: <NoticePanel />,
|
||||
className: "",
|
||||
},
|
||||
// {
|
||||
// id: "panel-d",
|
||||
// component: <VrfcErrPanel params={dashboardParams} />,
|
||||
// className: "",
|
||||
// },
|
||||
{
|
||||
id: "panel-d",
|
||||
component: <UnSubmitPanel params={dashboardParams} />,
|
||||
className: "",
|
||||
},
|
||||
{
|
||||
id: "panel-e",
|
||||
component: <VrfcReportPanel params={dashboardParams} />,
|
||||
className: "",
|
||||
},
|
||||
{
|
||||
id: "panel-f",
|
||||
component: <ScheduleCalendarPanel />,
|
||||
className: "",
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
export interface PanelItem {
|
||||
id: string;
|
||||
component: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
import { createColumnHelper, getCoreRowModel } from "@tanstack/react-table";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { useDataTable } from "@/shared/lib";
|
||||
import { type PstRecentListResponse, useRecentPostList } from "@/entities/post";
|
||||
import { Button } from "@common/components";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
export function NoticePanel() {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
const router = useRouter();
|
||||
|
||||
const recentPostListQuery = useRecentPostList({
|
||||
page: 0,
|
||||
size: 4,
|
||||
keywordType: "bbsTypeCd",
|
||||
keyword: "BBSNOTICE",
|
||||
});
|
||||
|
||||
const handleRowClick = (post: PstRecentListResponse) => {
|
||||
router.push(
|
||||
`/cms/${post.bbsTypeCd.toLowerCase()}/${post.bbsId}/${post.pstNo}`,
|
||||
);
|
||||
};
|
||||
|
||||
const handleMoreClick = () => {
|
||||
router.push("/cms/bbsnotice/7");
|
||||
};
|
||||
|
||||
const { tableComponent } = useDataTable({
|
||||
query: recentPostListQuery,
|
||||
tableOptions: {
|
||||
columns: noticeColumns,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
},
|
||||
dataTableOptions: {
|
||||
variant: "line",
|
||||
onRowClick: handleRowClick,
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
<div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">공지사항</h3>
|
||||
<Button
|
||||
size="sm"
|
||||
className="!text-xl"
|
||||
onClick={handleMoreClick}
|
||||
>
|
||||
더보기
|
||||
</Button>
|
||||
</div>
|
||||
{tableComponent}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const columnHelper = createColumnHelper<PstRecentListResponse>();
|
||||
|
||||
const noticeColumns = [
|
||||
columnHelper.accessor("pstTtl", {
|
||||
header: () => <div className="text-left">제목</div>,
|
||||
cell: ({ row }) => (
|
||||
<div className="min-w-[20rem] truncate px-2 text-left">
|
||||
{row.original.pstTtl}
|
||||
</div>
|
||||
),
|
||||
}),
|
||||
columnHelper.accessor("wrtrNm", {
|
||||
header: "작성자",
|
||||
}),
|
||||
columnHelper.accessor("regDt", {
|
||||
header: "등록일",
|
||||
cell: ({ row }) => formatDate(row.original.regDt),
|
||||
}),
|
||||
];
|
||||
|
||||
function formatDate(value: string) {
|
||||
return dayjs(value).format("YYYY-MM-DD");
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
"use client";
|
||||
|
||||
import dynamic from "next/dynamic";
|
||||
|
||||
import dayGridPlugin from "@fullcalendar/daygrid";
|
||||
import timeGridPlugin from "@fullcalendar/timegrid";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { SITE_ID } from "@/shared/config";
|
||||
import { useSchedules } from "@/entities/schedule";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
// FullCalendar는 클라이언트 전용이므로 dynamic import
|
||||
const FullCalendar = dynamic(() => import("@fullcalendar/react"), {
|
||||
ssr: false,
|
||||
});
|
||||
|
||||
export function ScheduleCalendarPanel() {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
|
||||
// TBD: 초기 날짜 범위 설정 로직
|
||||
const today = dayjs();
|
||||
const startOfMonth = today.startOf("month").format("YYYY-MM-DD");
|
||||
const endOfMonth = today.endOf("month").format("YYYY-MM-DD");
|
||||
|
||||
const { data, isLoading } = useSchedules({
|
||||
siteId: SITE_ID,
|
||||
schdlBgngYmd: startOfMonth,
|
||||
schdlEndYmd: endOfMonth,
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
<div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">일정관리</h3>
|
||||
</div>
|
||||
<div className="card-body max-h-[calc(100%-3.25rem)] py-2.5">
|
||||
{isLoading && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{data && (
|
||||
<div className="h-[48rem]">
|
||||
<FullCalendar
|
||||
plugins={[dayGridPlugin, timeGridPlugin]}
|
||||
initialView="dayGridMonth"
|
||||
locale="ko"
|
||||
headerToolbar={{
|
||||
left: "prev,next",
|
||||
center: "title",
|
||||
right: "dayGridMonth,timeGridWeek",
|
||||
}}
|
||||
buttonText={{
|
||||
month: "월",
|
||||
week: "주",
|
||||
}}
|
||||
events={data.map((schedule) => ({
|
||||
id: schedule.schdlSn.toString(),
|
||||
title: schedule.schdlTtl,
|
||||
start: schedule.schdlBgngDt,
|
||||
end: schedule.schdlEndDt,
|
||||
// TBD: allDay 판단 기준 (1439분 이상?)
|
||||
allDay: true,
|
||||
}))}
|
||||
height="100%"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
"use client";
|
||||
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import type { ScheduleInfoSearchParams } from "@/entities/statistics";
|
||||
import { useScheduleInfo } from "@/entities/statistics";
|
||||
import {
|
||||
Badge,
|
||||
type BadgeProps,
|
||||
LoadingWithAnimation,
|
||||
} from "@common/components";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
interface ScheduleInfoPanelProps {
|
||||
params: ScheduleInfoSearchParams | null;
|
||||
}
|
||||
|
||||
const CURRENT_STATUS_LABEL_MAP = {
|
||||
INPT: "입력중",
|
||||
VRFC: "검증중",
|
||||
NONE: "기간외",
|
||||
};
|
||||
|
||||
const CURRENT_STATUS_COLOR_MAP = {
|
||||
INPT: "",
|
||||
VRFC: "gray",
|
||||
NONE: "lightGray",
|
||||
};
|
||||
|
||||
export function ScheduleInfoPanel({ params }: ScheduleInfoPanelProps) {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
const { data, isLoading, error } = useScheduleInfo(params);
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
<div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">일정안내</h3>
|
||||
</div>
|
||||
<div className="card-body max-h-[calc(100%-3.25rem)] py-2.5">
|
||||
{isLoading && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{data && (
|
||||
<>
|
||||
<div className="space-y-4">
|
||||
<div className="mt-2 flex items-center justify-between">
|
||||
<h4 className="px-2 text-2xl font-semibold tracking-tight text-label">
|
||||
이번 주 주요 일정
|
||||
</h4>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="tracking-tight text-label">
|
||||
현재 진행 상태
|
||||
</span>
|
||||
<Badge
|
||||
color={
|
||||
CURRENT_STATUS_COLOR_MAP[
|
||||
data.currentSe as keyof typeof CURRENT_STATUS_COLOR_MAP
|
||||
] as BadgeProps["color"]
|
||||
}
|
||||
className="rounded-full !px-3"
|
||||
>
|
||||
{
|
||||
CURRENT_STATUS_LABEL_MAP[
|
||||
data.currentSe as keyof typeof CURRENT_STATUS_LABEL_MAP
|
||||
]
|
||||
}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between rounded-sm border border-border p-3">
|
||||
<Badge size="lg" className="font-semibold">
|
||||
{data.inptSeCd}차 입력기간
|
||||
</Badge>
|
||||
<p className="text-2xl">
|
||||
{dayjs(data.inptBgngYmd).format(
|
||||
"YYYY.MM.DD",
|
||||
)}{" "}
|
||||
~{" "}
|
||||
{dayjs(data.inptEndYmd).format(
|
||||
"YYYY.MM.DD",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center justify-between rounded-sm border border-border p-3">
|
||||
<Badge
|
||||
size="lg"
|
||||
color="gray"
|
||||
className="font-semibold"
|
||||
>
|
||||
{data.vrfcSeCd}차 검증기간
|
||||
</Badge>
|
||||
<p className="text-2xl">
|
||||
{dayjs(data.vrfcBgngYmd).format(
|
||||
"YYYY.MM.DD",
|
||||
)}{" "}
|
||||
~{" "}
|
||||
{dayjs(data.vrfcEndYmd).format(
|
||||
"YYYY.MM.DD",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center justify-center gap-4 py-4 tracking-tight">
|
||||
<span className="text-3xl font-semibold">
|
||||
{data.ddayLabel}
|
||||
</span>
|
||||
<Badge
|
||||
size="lg"
|
||||
className="rounded-sm !py-4 !text-5xl font-bold"
|
||||
>
|
||||
{data.dday}
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
"use client";
|
||||
|
||||
import { Frown, Laugh, Meh, OctagonAlert, OctagonX, Smile } from "lucide-react";
|
||||
|
||||
import {
|
||||
useDashboardEcptReqCount,
|
||||
useDashboardStatsSubmissionRate,
|
||||
useDashboardVrfcErrCount,
|
||||
} from "@/entities/statistics";
|
||||
import type { DashboardSearchParams } from "@/entities/statistics/model/dashboard/dashboard-interface";
|
||||
import { LoadingWithAnimation, Progress } from "@common/components";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
interface StatsSubmissionPanelProps {
|
||||
params: DashboardSearchParams | null;
|
||||
}
|
||||
|
||||
const STATUS_LEVEL_TEXT_COLOR = {
|
||||
GREAT: "text-blue-500",
|
||||
GOOD: "text-green-500",
|
||||
WARNING: "text-yellow-500",
|
||||
BAD: "text-red-500",
|
||||
};
|
||||
|
||||
const STATUS_LEVEL_EMOJI = {
|
||||
GREAT: <Laugh size={160} className={STATUS_LEVEL_TEXT_COLOR.GREAT} />,
|
||||
GOOD: <Smile size={160} className={STATUS_LEVEL_TEXT_COLOR.GOOD} />,
|
||||
WARNING: <Meh size={160} className={STATUS_LEVEL_TEXT_COLOR.WARNING} />,
|
||||
BAD: <Frown size={160} className={STATUS_LEVEL_TEXT_COLOR.BAD} />,
|
||||
};
|
||||
|
||||
export function StatsSubmissionPanel({ params }: StatsSubmissionPanelProps) {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
const { data, isLoading, error } = useDashboardStatsSubmissionRate(params);
|
||||
const vrfcErrQuery = useDashboardVrfcErrCount(params);
|
||||
const ecptReqQuery = useDashboardEcptReqCount(params);
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
{/* <div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">통계입력현황</h3>
|
||||
</div> */}
|
||||
<div
|
||||
className={`card-body cursor-grab py-2 active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
>
|
||||
<div className="flex h-full gap-6 px-2">
|
||||
<div className="h-full flex-1 flex-col">
|
||||
<h3 className="text-2xl font-semibold">통계입력현황</h3>
|
||||
{isLoading && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<div className="flex h-full items-center justify-center py-8 text-center">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
<div className="h-full">
|
||||
{data && (
|
||||
<div className="flex h-full flex-col items-center gap-2">
|
||||
{/* 통계제출률 상태 이모지 */}
|
||||
<div className="flex justify-center">
|
||||
{
|
||||
STATUS_LEVEL_EMOJI[
|
||||
data.statusLevel as keyof typeof STATUS_LEVEL_EMOJI
|
||||
]
|
||||
}
|
||||
</div>
|
||||
|
||||
{/* 통계제출률 프로그레스바 */}
|
||||
<div className="w-full space-y-3">
|
||||
<div className="flex w-full justify-between">
|
||||
<span className="text-2xl">
|
||||
통계제출률
|
||||
</span>
|
||||
<span className="text-2xl font-semibold">
|
||||
{data.submissionRate?.toFixed(
|
||||
1,
|
||||
)}
|
||||
%
|
||||
<span className="ml-1">
|
||||
({data.submittedCount}/
|
||||
{data.totalCount})
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<Progress
|
||||
value={data.submissionRate}
|
||||
className="h-10 bg-muted"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="h-full flex-[0.5]">
|
||||
<h3 className="text-2xl font-semibold">
|
||||
검증오류 및 예외
|
||||
</h3>
|
||||
<div className="mt-4 space-y-4">
|
||||
{/* 검증오류 수 카드 */}
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-red-200 bg-red-100 p-4 text-center">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<OctagonX
|
||||
className="text-red-600"
|
||||
size={20}
|
||||
/>
|
||||
<span className="text-lg">검증오류 수</span>
|
||||
</div>
|
||||
{vrfcErrQuery.isLoading && (
|
||||
<div className="text-2xl font-bold">-</div>
|
||||
)}
|
||||
{vrfcErrQuery.error && (
|
||||
<div className="text-sm">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{vrfcErrQuery.data && (
|
||||
<div className="text-5xl font-bold text-red-600">
|
||||
{vrfcErrQuery.data.vrfcErrCount.toLocaleString()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 예외신청 수 카드 */}
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-orange-200 bg-orange-100 p-4 text-center">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<OctagonAlert
|
||||
className="text-orange-600"
|
||||
size={20}
|
||||
/>
|
||||
<span className="text-lg">예외신청 수</span>
|
||||
</div>
|
||||
{ecptReqQuery.isLoading && (
|
||||
<div className="text-2xl font-bold">-</div>
|
||||
)}
|
||||
{ecptReqQuery.error && (
|
||||
<div className="text-sm">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{ecptReqQuery.data && (
|
||||
<div className="text-5xl font-bold text-orange-600">
|
||||
{ecptReqQuery.data.ecptReqCount.toLocaleString()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
"use client";
|
||||
|
||||
import { useDashboardUnSubmitCount } from "@/entities/statistics";
|
||||
import type { DashboardSearchParams } from "@/entities/statistics/model/dashboard/dashboard-interface";
|
||||
import { Badge, LoadingWithAnimation } from "@common/components";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
interface UnSubmitPanelProps {
|
||||
params: DashboardSearchParams | null;
|
||||
}
|
||||
|
||||
export function UnSubmitPanel({ params }: UnSubmitPanelProps) {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
const { data, isLoading, error } = useDashboardUnSubmitCount(params);
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
<div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">미제출 지표</h3>
|
||||
{data && (
|
||||
<Badge size="lg" className="rounded-full !px-3">
|
||||
{data.unSubmittedCount ?? 0}건
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
<div className="card-body max-h-[calc(100%-3.25rem)] py-2.5">
|
||||
{isLoading && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{data && (
|
||||
<div className="h-full">
|
||||
{data.statusList.length === 0 ? (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
미제출 지표가 없습니다.
|
||||
</div>
|
||||
) : (
|
||||
<div className="max-h-[48rem] space-y-2 overflow-y-auto">
|
||||
{data.statusList.map((item, i) => (
|
||||
<div
|
||||
key={`${i}-${item.statsCd}`}
|
||||
className="flex items-center justify-between gap-4 rounded-sm border border-border p-3"
|
||||
>
|
||||
<p className="font-medium">
|
||||
{item.statsNm}
|
||||
</p>
|
||||
{params?.dtlInstCd !==
|
||||
"ROLE_USER05" && (
|
||||
<span className="whitespace-nowrap text-lg text-muted-foreground">
|
||||
{item.sidoSggNm}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
"use client";
|
||||
|
||||
import { OctagonAlert, OctagonX } from "lucide-react";
|
||||
|
||||
import {
|
||||
useDashboardEcptReqCount,
|
||||
useDashboardVrfcErrCount,
|
||||
} from "@/entities/statistics";
|
||||
import type { DashboardSearchParams } from "@/entities/statistics/model/dashboard/dashboard-interface";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
interface VrfcErrPanelProps {
|
||||
params: DashboardSearchParams | null;
|
||||
}
|
||||
|
||||
export function VrfcErrPanel({ params }: VrfcErrPanelProps) {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
const vrfcErrQuery = useDashboardVrfcErrCount(params);
|
||||
const ecptReqQuery = useDashboardEcptReqCount(params);
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
<div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">검증오류 및 예외</h3>
|
||||
</div>
|
||||
<div className="card-body max-h-[calc(100%-3.25rem)] py-2.5">
|
||||
<div className="grid h-full grid-cols-2 gap-4">
|
||||
{/* 검증오류 수 카드 */}
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-red-200 bg-red-100 p-4 text-center">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<OctagonX className="text-red-600" size={20} />
|
||||
<span className="text-lg">검증오류 수</span>
|
||||
</div>
|
||||
{vrfcErrQuery.isLoading && (
|
||||
<div className="text-2xl font-bold">-</div>
|
||||
)}
|
||||
{vrfcErrQuery.error && (
|
||||
<div className="text-sm">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{vrfcErrQuery.data && (
|
||||
<div className="text-5xl font-bold text-red-600">
|
||||
{vrfcErrQuery.data.vrfcErrCount.toLocaleString()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 예외신청 수 카드 */}
|
||||
<div className="flex flex-col items-center justify-center gap-2 rounded-lg border border-orange-200 bg-orange-100 p-4 text-center">
|
||||
<div className="flex flex-col items-center gap-2">
|
||||
<OctagonAlert
|
||||
className="text-orange-600"
|
||||
size={20}
|
||||
/>
|
||||
<span className="text-lg">예외신청 수</span>
|
||||
</div>
|
||||
{ecptReqQuery.isLoading && (
|
||||
<div className="text-2xl font-bold">-</div>
|
||||
)}
|
||||
{ecptReqQuery.error && (
|
||||
<div className="text-sm">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{ecptReqQuery.data && (
|
||||
<div className="text-5xl font-bold text-orange-600">
|
||||
{ecptReqQuery.data.ecptReqCount.toLocaleString()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
"use client";
|
||||
|
||||
import { useDashboardVrfcReport } from "@/entities/statistics";
|
||||
import type { DashboardSearchParams } from "@/entities/statistics/model/dashboard/dashboard-interface";
|
||||
import {
|
||||
Badge,
|
||||
type BadgeProps,
|
||||
LoadingWithAnimation,
|
||||
} from "@common/components";
|
||||
|
||||
import { useDragHandle } from "../sortable-panel";
|
||||
|
||||
interface VrfcReportPanelProps {
|
||||
params: DashboardSearchParams | null;
|
||||
}
|
||||
|
||||
const TYPE_CODE_NAME_MAP: Record<string, string> = {
|
||||
NV: "일반",
|
||||
IMR: "I-MR",
|
||||
};
|
||||
|
||||
const TYPE_CODE_COLOR_MAP: Record<string, BadgeProps["color"]> = {
|
||||
NV: "gray",
|
||||
IMR: "red",
|
||||
};
|
||||
|
||||
export function VrfcReportPanel({ params }: VrfcReportPanelProps) {
|
||||
const { dragHandleProps, isDragging } = useDragHandle();
|
||||
const { data, isLoading, error } = useDashboardVrfcReport(params);
|
||||
|
||||
return (
|
||||
<div className="card card-border !m-0 h-full border-border bg-background text-foreground">
|
||||
<div
|
||||
className={`card-header cursor-grab border-border active:cursor-grabbing ${isDragging ? "opacity-50" : ""}`}
|
||||
{...dragHandleProps}
|
||||
title="헤더를 드래그하여 패널 순서 변경"
|
||||
>
|
||||
<h3 className="text-2xl font-semibold">이상치 선별보고서</h3>
|
||||
</div>
|
||||
<div className="card-body max-h-[calc(100%-3.25rem)] py-2.5">
|
||||
{isLoading && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{error && (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
데이터를 불러올 수 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{data && (
|
||||
<div className="space-y-2">
|
||||
{/* TBD: typeCounts 표시 방법 (탭? 필터?) */}
|
||||
{data.typeCounts &&
|
||||
Object.keys(data.typeCounts).length > 0 && (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{Object.entries(data.typeCounts).map(
|
||||
([type, count]) => (
|
||||
<Badge
|
||||
key={type}
|
||||
color={
|
||||
TYPE_CODE_COLOR_MAP[type]
|
||||
}
|
||||
className="rounded-full px-2 py-1 text-lg"
|
||||
>
|
||||
{TYPE_CODE_NAME_MAP[type]}:{" "}
|
||||
{count}
|
||||
</Badge>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* TBD: 테이블 컬럼 정의, 증감 표시 방법 */}
|
||||
<div className="max-h-[44rem] overflow-y-auto">
|
||||
{data.list.length === 0 ? (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
이상치 항목이 없습니다.
|
||||
</div>
|
||||
) : (
|
||||
<div className="space-y-2 tracking-tight">
|
||||
{data.list.map((item, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="flex flex-col rounded-sm border border-border p-3"
|
||||
>
|
||||
<div className="mb-2 flex items-center justify-between">
|
||||
<span className="font-medium">
|
||||
{item.statsNm}
|
||||
</span>
|
||||
<Badge
|
||||
color={
|
||||
TYPE_CODE_COLOR_MAP[
|
||||
item.vrfcCd
|
||||
]
|
||||
}
|
||||
className="text-sm"
|
||||
>
|
||||
{
|
||||
TYPE_CODE_NAME_MAP[
|
||||
item.vrfcCd
|
||||
]
|
||||
}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="text-lg text-muted-foreground">
|
||||
{item.rsnExpln}
|
||||
</p>
|
||||
<div className="flex justify-between text-lg text-muted-foreground">
|
||||
<span>{item.admdstNm}</span>
|
||||
<span>
|
||||
{/* TBD: 증감 표시 방법 (nowVlCn - compVlCn 계산?) */}
|
||||
현재: {item.nowVlCn ?? "-"}{" "}
|
||||
/ 비교:{" "}
|
||||
{item.compVlCn ?? "-"}
|
||||
</span>
|
||||
</div>
|
||||
{/* TBD: 등급/점수/단계/업데이트 시각 필드 미제공 */}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
import { useSortable } from "@dnd-kit/sortable";
|
||||
import { CSS } from "@dnd-kit/utilities";
|
||||
|
||||
interface SortablePanelProps {
|
||||
id: string;
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
interface DragHandleContextValue {
|
||||
dragHandleProps: React.HTMLAttributes<HTMLElement>;
|
||||
isDragging: boolean;
|
||||
}
|
||||
|
||||
const DragHandleContext = createContext<DragHandleContextValue | null>(null);
|
||||
|
||||
export function SortablePanel({ id, children, className }: SortablePanelProps) {
|
||||
const {
|
||||
attributes,
|
||||
listeners,
|
||||
setNodeRef,
|
||||
transform,
|
||||
transition,
|
||||
isDragging,
|
||||
} = useSortable({ id });
|
||||
|
||||
const style = {
|
||||
transform: CSS.Transform.toString(transform),
|
||||
transition,
|
||||
opacity: isDragging ? 0.5 : 1,
|
||||
};
|
||||
|
||||
const contextValue: DragHandleContextValue = {
|
||||
dragHandleProps: { ...attributes, ...listeners },
|
||||
isDragging,
|
||||
};
|
||||
|
||||
return (
|
||||
<DragHandleContext.Provider value={contextValue}>
|
||||
<div ref={setNodeRef} style={style} className={className}>
|
||||
{children}
|
||||
</div>
|
||||
</DragHandleContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useDragHandle() {
|
||||
const context = useContext(DragHandleContext);
|
||||
|
||||
if (!context) {
|
||||
return {
|
||||
dragHandleProps: {},
|
||||
isDragging: false,
|
||||
};
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
@@ -1,26 +1,37 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense, useRef, useEffect } from "react";
|
||||
import { Suspense, useEffect, useMemo, useRef } from "react";
|
||||
import dynamic from "next/dynamic";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import Dashboard from "@/components/Dashboard";
|
||||
|
||||
import { SkeletonPage } from "@/shared/ui/skeleton-page";
|
||||
|
||||
import "@rsone/components/index.css";
|
||||
|
||||
import Dashboard from "@/components/statistics/Dashboard";
|
||||
import { isVerificationSelectionReportMenu } from "@/shared/lib/verification-selection-report";
|
||||
import { useAdminStore } from "@/store/admin-store";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
|
||||
const StatisticsPage = () => {
|
||||
const { tabs, activeTabId } = useTabStore();
|
||||
|
||||
const tabsForBody = useMemo(
|
||||
() =>
|
||||
tabs.filter(
|
||||
(tab) => !isVerificationSelectionReportMenu(tab.menuItem),
|
||||
),
|
||||
[tabs],
|
||||
);
|
||||
const fetchAdminInfo = useAdminStore((state) => state.fetchAdminInfo);
|
||||
|
||||
|
||||
// 컴포넌트 캐시를 useRef로 유지 (재렌더링 시에도 유지됨)
|
||||
const componentCache = useRef(new Map<string, React.ComponentType>());
|
||||
|
||||
// 닫힌 탭의 컴포넌트는 캐시에서 제거 (메모리 정리)
|
||||
useEffect(() => {
|
||||
const currentTabIds = new Set(tabs.map(tab => tab.id));
|
||||
const currentTabIds = new Set(tabs.map((tab) => tab.id));
|
||||
const cachedTabIds = Array.from(componentCache.current.keys());
|
||||
|
||||
|
||||
cachedTabIds.forEach((cachedId) => {
|
||||
if (!currentTabIds.has(cachedId)) {
|
||||
componentCache.current.delete(cachedId);
|
||||
@@ -35,28 +46,28 @@ const StatisticsPage = () => {
|
||||
// 탭이 없으면 Dashboard 표시
|
||||
if (tabs.length === 0) {
|
||||
return (
|
||||
<div className="card card-border !mt-6">
|
||||
<div className="card card-border !mt-6 border-border bg-background">
|
||||
<Dashboard />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="card card-border !mt-6">
|
||||
{tabs.map((tab) => {
|
||||
<div className="card card-border !mt-6 border-border bg-background">
|
||||
{tabsForBody.map((tab) => {
|
||||
// 렌더링 시점에 컴포넌트가 없으면 바로 로드
|
||||
if (!componentCache.current.has(tab.id)) {
|
||||
const componentName = tab.urlPath;
|
||||
const parentComponentName = tab.parentEngNm;
|
||||
|
||||
|
||||
const DynamicComponent = dynamic(
|
||||
() => import(`@/components/statistics/${parentComponentName}/${componentName}`),
|
||||
{
|
||||
ssr: false,
|
||||
loading: () => <SkeletonPage />
|
||||
}
|
||||
() =>
|
||||
import(
|
||||
`@/components/statistics${parentComponentName ? `/${parentComponentName}` : ""}/${componentName}`
|
||||
),
|
||||
{ ssr: false, loading: () => <SkeletonPage /> },
|
||||
);
|
||||
|
||||
|
||||
componentCache.current.set(tab.id, DynamicComponent);
|
||||
}
|
||||
|
||||
@@ -68,7 +79,7 @@ const StatisticsPage = () => {
|
||||
return (
|
||||
<div
|
||||
key={tab.id}
|
||||
style={{ display: isActive ? 'block' : 'none' }}
|
||||
style={{ display: isActive ? "block" : "none" }}
|
||||
>
|
||||
<Suspense fallback={<SkeletonPage />}>
|
||||
<Component />
|
||||
@@ -80,4 +91,4 @@ const StatisticsPage = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default StatisticsPage;
|
||||
export default StatisticsPage;
|
||||
|
||||
@@ -74,6 +74,11 @@ export const ENDPOINT = {
|
||||
INPUTVERIFY: "/st-input-service/api/v1/verify",
|
||||
TOTAL: "/st-management-service/api/v1/stats",
|
||||
APPROVAL: "/st-management-service/api/stats",
|
||||
DASHBOARD: "/st-management-service/api/v1/dashboard",
|
||||
},
|
||||
NTFTALK_SERVICE: {
|
||||
TEMP: "/ntftalk-service/api/v1/ntftalk-temp",
|
||||
ATA_SEND: "/ntftalk-service/api/v1/ata/send",
|
||||
},
|
||||
STATVERIFY_SERVICE: {
|
||||
VRFCTGT_MNG: "/statverify-service/api/v1/vrfc-trgt-mng",
|
||||
@@ -82,6 +87,7 @@ export const ENDPOINT = {
|
||||
ST_ANLS_DTL: "/statverify-service/api/v1/st-anls-dtl",
|
||||
ST_ANLS_RSLT: "/statverify-service/api/v1/st-anls-rslt",
|
||||
IMR: "/statverify-service/api/v1/imr/outlier/detect",
|
||||
SEWERST_USER: "/statverify-service/api/v1/sewerst",
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
import type { MenuItem } from "@/entities/menu";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { doNameList } from "@/components/util/column/input/DoList";
|
||||
import {
|
||||
SEWAGE_PIPE_INP_TAB_KEYS,
|
||||
SEWAGE_PIPE_MAINTAIN_INP_TAB_KEYS,
|
||||
SEWERAGE_PENETRATION_RATE_INP_TAB_KEYS,
|
||||
} from "@/components/util/MenuMatchList";
|
||||
|
||||
/** 검증 결과에서 입력 화면 자동 조회에 사용하는 조건 */
|
||||
export type StatisticsInputPendingSearch = {
|
||||
statsYr: string;
|
||||
sewerBzmnCd: string;
|
||||
ctpvNm: string;
|
||||
sggNm: string;
|
||||
};
|
||||
|
||||
export function verificationSearchToFormValues(
|
||||
s: StatisticsInputPendingSearch,
|
||||
): SearchFormValues {
|
||||
const ctpvNmTrimmed = s.ctpvNm?.trim() ?? "";
|
||||
const sggNmTrimmed = s.sggNm?.trim() ?? "";
|
||||
/** 시군구 필수 도(`DoList.ts`의 `doNameList`)일 때만 API `sggNm`을 검색폼에 반영 */
|
||||
const useSggNm =
|
||||
sggNmTrimmed.length > 0 && doNameList.includes(ctpvNmTrimmed);
|
||||
|
||||
return {
|
||||
year: s.statsYr,
|
||||
bsnmCd: s.sewerBzmnCd,
|
||||
sido: s.ctpvNm,
|
||||
gugun: useSggNm ? sggNmTrimmed : "ALL",
|
||||
};
|
||||
}
|
||||
|
||||
/** `statistics-page` 동적 import 경로의 파일명(확장자 제외)과 일치해야 함 */
|
||||
export const STATISTICS_INPUT_URL_PATH = {
|
||||
SEWAGE_PIPE: "SewagePipeInp",
|
||||
SEWAGE_PIPE_MAINTAIN: "SewagePipeMaintainInp",
|
||||
SEWERAGE_PENETRATION_RATE: "SeweragePenetrationRateInp",
|
||||
} as const;
|
||||
|
||||
function normalizeSewagePipeTabKey(tabKey: string): string {
|
||||
if (
|
||||
tabKey === "adminAreaConnectionInp" ||
|
||||
tabKey === "treatmentPlantConnectionInp"
|
||||
) {
|
||||
return "ST00020006";
|
||||
}
|
||||
return tabKey;
|
||||
}
|
||||
|
||||
const NAV_ROWS: { urlPath: string; tabKeys: readonly string[] }[] = [
|
||||
{ urlPath: STATISTICS_INPUT_URL_PATH.SEWAGE_PIPE, tabKeys: SEWAGE_PIPE_INP_TAB_KEYS },
|
||||
{
|
||||
urlPath: STATISTICS_INPUT_URL_PATH.SEWAGE_PIPE_MAINTAIN,
|
||||
tabKeys: SEWAGE_PIPE_MAINTAIN_INP_TAB_KEYS,
|
||||
},
|
||||
{
|
||||
urlPath: STATISTICS_INPUT_URL_PATH.SEWERAGE_PENETRATION_RATE,
|
||||
tabKeys: SEWERAGE_PENETRATION_RATE_INP_TAB_KEYS,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 검증 결과 등의 `statsCd`(또는 입력 화면 탭 키와 동일한 코드)로
|
||||
* 열 입력 화면 `urlPath`와 활성 탭 키를 반환합니다.
|
||||
*/
|
||||
export function resolveInputPageNavigationFromStatsCd(statsCd: string): {
|
||||
urlPath: string;
|
||||
tabKey: string;
|
||||
} | null {
|
||||
const trimmed = statsCd.trim();
|
||||
if (!trimmed) return null;
|
||||
|
||||
for (const row of NAV_ROWS) {
|
||||
if (row.tabKeys.includes(trimmed)) {
|
||||
const tabKey =
|
||||
row.urlPath === STATISTICS_INPUT_URL_PATH.SEWAGE_PIPE
|
||||
? normalizeSewagePipeTabKey(trimmed)
|
||||
: trimmed;
|
||||
return { urlPath: row.urlPath, tabKey };
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function findMenuItemByUrlPath(
|
||||
menus: MenuItem[],
|
||||
urlPath: string,
|
||||
): MenuItem | null {
|
||||
for (const item of menus) {
|
||||
if (item.urlPath === urlPath) return item;
|
||||
if (item.children?.length) {
|
||||
const found = findMenuItemByUrlPath(item.children, urlPath);
|
||||
if (found) return found;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -1,42 +1,46 @@
|
||||
import type { HTMLAttributes } from "react";
|
||||
|
||||
import type { UseQueryResult } from "@tanstack/react-query";
|
||||
import { useReactTable, type TableOptions } from "@tanstack/react-table";
|
||||
import { type TableOptions, useReactTable } from "@tanstack/react-table";
|
||||
|
||||
import { DataTable } from "@common/components";
|
||||
import { NoData } from "../ui/no-data";
|
||||
|
||||
import type { PageableList } from "../model";
|
||||
import { NoData } from "../ui/no-data";
|
||||
|
||||
import { matchQueryStatus } from "./match-query-status";
|
||||
|
||||
type UseDataTableOptions<T> = {
|
||||
query: UseQueryResult<PageableList<T>>;
|
||||
tableOptions: Omit<TableOptions<T>, "data" | "rowCount">;
|
||||
dataTableOptions?: DataTableOptions<T>;
|
||||
query: UseQueryResult<PageableList<T>>;
|
||||
tableOptions: Omit<TableOptions<T>, "data" | "rowCount">;
|
||||
dataTableOptions?: DataTableOptions<T>;
|
||||
};
|
||||
|
||||
type DataTableOptions<T> = {
|
||||
variant?: "default" | "secondary" | "line";
|
||||
className?: HTMLAttributes<HTMLTableElement>["className"];
|
||||
viewPagination?: boolean;
|
||||
onRowClick?: (row: T) => void;
|
||||
variant?: "default" | "secondary" | "line";
|
||||
className?: HTMLAttributes<HTMLTableElement>["className"];
|
||||
viewPagination?: boolean;
|
||||
onRowClick?: (row: T) => void;
|
||||
};
|
||||
|
||||
export const useDataTable = <T,>({
|
||||
query,
|
||||
tableOptions,
|
||||
dataTableOptions,
|
||||
query,
|
||||
tableOptions,
|
||||
dataTableOptions,
|
||||
}: UseDataTableOptions<T>) => {
|
||||
const table = useReactTable({
|
||||
...tableOptions,
|
||||
data: query.data?.content ?? [],
|
||||
rowCount: query.data?.totalElements ?? 0,
|
||||
});
|
||||
const table = useReactTable({
|
||||
...tableOptions,
|
||||
data: query.data?.content ?? [],
|
||||
rowCount: query.data?.totalElements ?? 0,
|
||||
});
|
||||
|
||||
return {
|
||||
tableComponent: matchQueryStatus(query, {
|
||||
Empty: <NoData />,
|
||||
Success: () => {
|
||||
return <DataTable table={table} {...dataTableOptions} />;
|
||||
},
|
||||
}),
|
||||
tableInstance: table,
|
||||
};
|
||||
return {
|
||||
tableComponent: matchQueryStatus(query, {
|
||||
Empty: <NoData />,
|
||||
Success: () => {
|
||||
return <DataTable table={table} {...dataTableOptions} />;
|
||||
},
|
||||
}),
|
||||
tableInstance: table,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { useStore } from "zustand";
|
||||
import { useContext } from "react";
|
||||
import type { UserStore } from "../store/user-store";
|
||||
|
||||
import { useStore } from "zustand";
|
||||
|
||||
import { StoreContext } from "../providers/store-provider";
|
||||
import type { UserStore } from "../store/user-store";
|
||||
|
||||
export const useUserStore = <T>(selector: (store: UserStore) => T): T => {
|
||||
const storeContext = useContext(StoreContext);
|
||||
const storeContext = useContext(StoreContext);
|
||||
|
||||
if (!storeContext) {
|
||||
throw new Error("useUserStore must be used within StoreProvider");
|
||||
}
|
||||
if (!storeContext) {
|
||||
throw new Error("useUserStore must be used within StoreProvider");
|
||||
}
|
||||
|
||||
return useStore(storeContext.userStore, selector);
|
||||
return useStore(storeContext.userStore, selector);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { MenuItem } from "@/entities/menu";
|
||||
|
||||
export const VERIFICATION_SELECTION_REPORT_MARKER =
|
||||
"VerificationSelectionReport";
|
||||
|
||||
export function isVerificationSelectionReportMenu(item: MenuItem): boolean {
|
||||
return (
|
||||
item.menuEngNm === VERIFICATION_SELECTION_REPORT_MARKER ||
|
||||
!!item.urlPath?.includes(VERIFICATION_SELECTION_REPORT_MARKER)
|
||||
);
|
||||
}
|
||||
@@ -1,59 +1,61 @@
|
||||
import { createStore } from "zustand/vanilla";
|
||||
|
||||
export interface IUserInfo {
|
||||
regDt: string;
|
||||
mdfcnDt: string;
|
||||
rgtr: string;
|
||||
mdfr: string;
|
||||
adminRoleYn: string;
|
||||
userUnqId: string;
|
||||
userId: string;
|
||||
userName: string;
|
||||
email: string;
|
||||
encryptedPassword: string;
|
||||
refreshToken: string;
|
||||
userStateCode: string;
|
||||
lastLoginDate: string;
|
||||
loginFailCount: number;
|
||||
pswdHnt: string;
|
||||
pswdAns: string;
|
||||
mphn: string;
|
||||
telno: string;
|
||||
zip: string;
|
||||
addr: string;
|
||||
daddr: string;
|
||||
laeSeCd: string;
|
||||
/** 기관 구분 코드 — 통계 공통 조회 등 query `instSeCd`로 전달 */
|
||||
instSeCd?: string;
|
||||
ogdpSeCd: string;
|
||||
aprvYn: string;
|
||||
autzrId: string;
|
||||
expryYmd: string;
|
||||
lastPswdChgDt: string;
|
||||
googleId: string;
|
||||
kakaoId: string;
|
||||
naverId: string;
|
||||
isSocialUser: boolean;
|
||||
hasPassword: boolean;
|
||||
regDt: string;
|
||||
mdfcnDt: string;
|
||||
rgtr: string;
|
||||
mdfr: string;
|
||||
adminRoleYn: string;
|
||||
userUnqId: string;
|
||||
userId: string;
|
||||
userName: string;
|
||||
email: string;
|
||||
encryptedPassword: string;
|
||||
enoCd: string;
|
||||
refreshToken: string;
|
||||
userStateCode: string;
|
||||
lastLoginDate: string;
|
||||
loginFailCount: number;
|
||||
pswdHnt: string;
|
||||
pswdAns: string;
|
||||
mphn: string;
|
||||
telno: string;
|
||||
zip: string;
|
||||
addr: string;
|
||||
daddr: string;
|
||||
dtlInstCd: string;
|
||||
laeSeCd: string;
|
||||
/** 기관 구분 코드 — 통계 공통 조회 등 query `instSeCd`로 전달 */
|
||||
instSeCd?: string;
|
||||
ogdpSeCd: string;
|
||||
aprvYn: string;
|
||||
autzrId: string;
|
||||
expryYmd: string;
|
||||
lastPswdChgDt: string;
|
||||
googleId: string;
|
||||
kakaoId: string;
|
||||
naverId: string;
|
||||
isSocialUser: boolean;
|
||||
hasPassword: boolean;
|
||||
}
|
||||
|
||||
export type UserState = {
|
||||
userInfo: IUserInfo | null;
|
||||
userInfo: IUserInfo | null;
|
||||
};
|
||||
|
||||
export type UserActions = {
|
||||
setUserInfo: (userInfo: IUserInfo | null) => void;
|
||||
setUserInfo: (userInfo: IUserInfo | null) => void;
|
||||
};
|
||||
|
||||
export type UserStore = UserState & UserActions;
|
||||
|
||||
export const defaultInitState: UserState = {
|
||||
userInfo: null,
|
||||
userInfo: null,
|
||||
};
|
||||
|
||||
export const createUserStore = (initState: UserState = defaultInitState) => {
|
||||
return createStore<UserStore>()((set) => ({
|
||||
...initState,
|
||||
setUserInfo: (userInfo: IUserInfo | null) => set(() => ({ userInfo })),
|
||||
}));
|
||||
return createStore<UserStore>()((set) => ({
|
||||
...initState,
|
||||
setUserInfo: (userInfo: IUserInfo | null) => set(() => ({ userInfo })),
|
||||
}));
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user