This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
import { PORT, PROXY_HOST, SERVER_API_URL, SITE_ID } from "@/shared/config";
|
||||
|
||||
const serverApiUrl = process.env.SERVER_API_URL ?? "http://localhost:3000";
|
||||
@@ -9,7 +10,7 @@ function addSecurityHeaders(response: NextResponse): NextResponse {
|
||||
return response;
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
@@ -45,6 +46,11 @@ export function middleware(req: NextRequest) {
|
||||
return addSecurityHeaders(response);
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/server/:path*", "/"],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
|
||||
import {
|
||||
AUTH_USER_ID,
|
||||
@@ -18,7 +19,7 @@ function addSecurityHeaders(response: NextResponse): NextResponse {
|
||||
return response;
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
@@ -83,6 +84,11 @@ export function middleware(req: NextRequest) {
|
||||
return addSecurityHeaders(response);
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/server/:path*", "/attach-service/:path*", "/"],
|
||||
};
|
||||
|
||||
@@ -99,6 +99,7 @@ const ROLE_USER01_ATRZ_STATUS_ACTIONS: Record<
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.fileVrfc,
|
||||
FNRS_CNSLTN_VIEW_BUTTON_ACTION.dsgntRvwr,
|
||||
],
|
||||
ATRZ02: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
},
|
||||
SL: {
|
||||
ATRZ01: [FNRS_CNSLTN_VIEW_BUTTON_ACTION.pwrkCnsltnDocMng],
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
import {
|
||||
CLAIM_NAME,
|
||||
AUTH_USER_ID,
|
||||
@@ -19,7 +20,7 @@ const serverApiUrl3 = process.env.NEXT_PUBLIC_SERVER_API_URL3 ?? serverApiUrl;
|
||||
|
||||
const serverApiUrl5 = process.env.NEXT_PUBLIC_SERVER_API_URL5 ?? serverApiUrl;
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
@@ -177,6 +178,11 @@ export function middleware(req: NextRequest) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/server/:path*",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
|
||||
import {
|
||||
AUTH_USER_ID,
|
||||
@@ -23,7 +24,7 @@ function addSecurityHeaders(response: NextResponse): NextResponse {
|
||||
return response;
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
@@ -103,6 +104,11 @@ export function middleware(req: NextRequest) {
|
||||
return addSecurityHeaders(response);
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/server/:path*",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
import {
|
||||
CLAIM_NAME,
|
||||
AUTH_USER_ID,
|
||||
@@ -26,7 +27,7 @@ function addSecurityHeaders(response: NextResponse): NextResponse {
|
||||
return response;
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
@@ -170,6 +171,11 @@ export function middleware(req: NextRequest) {
|
||||
return addSecurityHeaders(response);
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/server/:path*", "/attach-service/:path*", "/api/link/:path*", "/"],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# 공단 운영
|
||||
NEXT_PUBLIC_SITE_ID = DM
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
#NEXT_PUBLIC_PROXY_HOST = https://devreuse.hasuon.or.kr
|
||||
#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login
|
||||
SERVER_API_URL = https://apigateway.hasuon.or.kr
|
||||
CS_SERVER_API_URL = https://apigateway.hasuon.or.kr
|
||||
FO_SERVER_API_URL = https://apigateway.hasuon.or.kr/operation-service
|
||||
WR_SERVER_API_URL = https://apigateway.hasuon.or.kr/reuse-service
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://apigateway.hasuon.or.kr/reuse-service/api/v1/geoserver-proxy/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://apigateway.hasuon.or.kr/reuse-service/api/v1/geoserver-proxy/geoserver_swl
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr
|
||||
NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y}
|
||||
SEWERAGE_API_URL = http://apigateway.hasuon.or.kr/sewerage-service
|
||||
GATEWAY_URL = http://apigateway.hasuon.or.kr
|
||||
CONTENTS_INTRO = 24
|
||||
CONTENTS_EXAMPLE = 25
|
||||
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA=
|
||||
NEXT_PUBLIC_NGII_CLIENT_URL = https://map.ngii.go.kr
|
||||
@@ -504,8 +504,9 @@ const postSdmData = async (data: DemandCompType) => {
|
||||
// 수요정보 등록
|
||||
const postSdmInfoData = async (data: SdmInfoFormData): Promise<boolean> => {
|
||||
try {
|
||||
// 첫 수요정보 등록도 가능하도록 수요정보 유무와 상관없이 수요처 사용 여부만 확인
|
||||
const activeDemand = data.dmdInfoId
|
||||
? await getSdmInfoStatusList(data.dmdInfoId)
|
||||
? await getSdmInfoStatusList(data.dmdInfoId, false)
|
||||
: null;
|
||||
if (!activeDemand?.dmdInfoId) {
|
||||
sessionStorage.removeItem("user");
|
||||
@@ -525,8 +526,9 @@ const postSdmInfoData = async (data: SdmInfoFormData): Promise<boolean> => {
|
||||
// 수요정보 수정
|
||||
const fetchUpdateSdmInfoData = async (data: SdmInfoFormData): Promise<boolean> => {
|
||||
try {
|
||||
// 수요처 사용 여부만 확인
|
||||
const activeDemand = data.dmdInfoId
|
||||
? await getSdmInfoStatusList(data.dmdInfoId)
|
||||
? await getSdmInfoStatusList(data.dmdInfoId, false)
|
||||
: null;
|
||||
if (!activeDemand?.dmdInfoId) {
|
||||
sessionStorage.removeItem("user");
|
||||
@@ -606,9 +608,11 @@ type DemandStatusResponse = DemandCompType & {
|
||||
demandMatchings?: DemandMatchings[];
|
||||
};
|
||||
|
||||
const getSdmInfoStatusList = async (dmdInfoId: string): Promise<DemandStatusResponse | null> => {
|
||||
// withInfoList=true : 수요정보가 1건 이상 있는 수요처만 조회됨(백엔드 INNER JOIN)
|
||||
// withInfoList=false: 수요정보가 없어도 사용 중(use_yn='Y')인 수요처면 조회됨(백엔드 LEFT JOIN)
|
||||
const getSdmInfoStatusList = async (dmdInfoId: string, withInfoList = true): Promise<DemandStatusResponse | null> => {
|
||||
try {
|
||||
const url = '/reuseFc/request/' + dmdInfoId + '?infoListYn=Y';
|
||||
const url = '/reuseFc/request/' + dmdInfoId + (withInfoList ? '?infoListYn=Y' : '');
|
||||
const res = await getFetch(fetchType.WR, url);
|
||||
return res?.data ?? null;
|
||||
} catch (error) {
|
||||
@@ -708,7 +712,8 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
},
|
||||
|
||||
insertSdmData: async (data: DemandCompType) => {
|
||||
const preRes = await getSdmInfoStatusList(data.dmdInfoId);
|
||||
// 수요정보가 없는 기존 수요처도 중복으로 판단하도록 수요처만 조회
|
||||
const preRes = await getSdmInfoStatusList(data.dmdInfoId, false);
|
||||
if (preRes?.dmdInfoId) {
|
||||
toast.error('이미 등록된 수요처입니다.');
|
||||
return;
|
||||
@@ -759,6 +764,18 @@ export const SdmReducer = (set: any): SdmActions => {
|
||||
const res = await getSdmInfoStatusList(dmdInfoId);
|
||||
|
||||
if (!res?.dmdInfoId) {
|
||||
// 수요정보가 0건이면 위 조회는 비어 있으므로, 수요처 사용 여부를 다시 확인해 빈 목록으로 처리
|
||||
const activeDemand = await getSdmInfoStatusList(dmdInfoId, false);
|
||||
if (activeDemand?.dmdInfoId) {
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
...state.Sdm,
|
||||
sdmInfoStatusList: [],
|
||||
}
|
||||
}))
|
||||
return true;
|
||||
}
|
||||
|
||||
sessionStorage.removeItem("user");
|
||||
set((state: SdmType) => ({
|
||||
Sdm: {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config";
|
||||
import { SERVER_API_FO_URL, SERVER_API_WR_URL } from "./src/shared/config/env";
|
||||
|
||||
@@ -24,7 +25,7 @@ function toDecodedQueryString(params: URLSearchParams): string {
|
||||
return new URLSearchParams(entries).toString();
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
console.log(`[Middleware] Request URL: ${req.url}`);
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
@@ -158,6 +159,11 @@ export function middleware(req: NextRequest) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/server/:path*",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
import { SERVER_API_CS_URL, SERVER_API_FO_URL, SERVER_API_WR_URL } from "./src/shared/config/env";
|
||||
|
||||
const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
||||
@@ -49,7 +50,7 @@ function rewriteWith(url: string, req: NextRequest, withAuth = false): NextRespo
|
||||
return NextResponse.rewrite(new URL(url), { headers });
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
console.log("Middleware 진입:", req.nextUrl.pathname);
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
@@ -170,6 +171,11 @@ export function middleware(req: NextRequest) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/",
|
||||
|
||||
@@ -56,7 +56,11 @@ const FALLBACK_PIPE_MIN_ZOOM = 13;
|
||||
const MIN_ZOOM_VISIBILITY_OFFSET = 0.01;
|
||||
const NETWORK_LAYER_GROUP = "SN_NETWORK";
|
||||
const PIPE_LAYER_TYPE = "tb_ms_swage_ppl";
|
||||
const NGII_WMTS_URL = `/ngii-server/openapi/Gettile.do?apikey=${process.env.NEXT_PUBLIC_NGII_PARAM ?? ""}`;
|
||||
// NGII 타일 호출 기준 주소. 값이 없으면 기존처럼 Next 서버(middleware)를 경유한다.
|
||||
const NGII_WMTS_BASE =
|
||||
process.env.NEXT_PUBLIC_NGII_CLIENT_URL || "/ngii-server";
|
||||
// NGII 배경지도 타일 URL 틀. {z}, {x}, {y}는 타일 요청 시 치환한다.
|
||||
const NGII_WMTS_URL = `${NGII_WMTS_BASE}/openapi/Gettile.do?apikey=${process.env.NEXT_PUBLIC_NGII_PARAM ?? ""}`;
|
||||
const NGII_RESOLUTIONS = [
|
||||
1044.48, 522.24, 261.12, 130.56, 65.28, 32.64, 16.32, 8.16, 4.08, 2.04, 1.02,
|
||||
0.51, 0.255,
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
|
||||
const AUTH_USER_ID = process.env.NEXT_PUBLIC_AUTH_USER_ID || "token-id";
|
||||
const CLAIM_NAME = process.env.NEXT_PUBLIC_CLAIM_NAME || "Authorization";
|
||||
@@ -37,7 +38,7 @@ function rewriteWith(url: string, req: NextRequest, withAuth = false): NextRespo
|
||||
: NextResponse.rewrite(new URL(url));
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
console.log("Middleware 진입:", req.nextUrl.pathname);
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
@@ -150,6 +151,11 @@ export function middleware(req: NextRequest) {
|
||||
}
|
||||
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/server/:path*",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
|
||||
import {
|
||||
AUTH_USER_ID,
|
||||
@@ -26,7 +27,7 @@ function addSecurityHeaders(response: NextResponse): NextResponse {
|
||||
return response;
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
|
||||
@@ -149,6 +150,11 @@ export function middleware(req: NextRequest) {
|
||||
return addSecurityHeaders(response);
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/server/:path*",
|
||||
|
||||
@@ -4,11 +4,16 @@ interface SubmitButtonProps {
|
||||
submitFunc: () => void;
|
||||
/** 버튼 문구 (기본: 제출) */
|
||||
text?: string;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
||||
const SubmitButton = ({ submitFunc, text = "제출" }: SubmitButtonProps) => {
|
||||
const SubmitButton = ({ submitFunc, text = "제출", disabled = false }: SubmitButtonProps) => {
|
||||
return (
|
||||
<Button className="h-[3.2rem] min-w-[96px] px-4" onClick={submitFunc}>
|
||||
<Button
|
||||
className="h-[3.2rem] min-w-[96px] px-4"
|
||||
onClick={submitFunc}
|
||||
disabled={disabled}
|
||||
>
|
||||
<i className="diveicon di-upload" />
|
||||
<span>{text}</span>
|
||||
</Button>
|
||||
|
||||
@@ -253,7 +253,12 @@ declare module "realgrid" {
|
||||
setOptions(options: {
|
||||
footer?: { visible?: boolean };
|
||||
summaryMode?: "aggregate" | "statistical" | "none";
|
||||
checkBar?: { visible?: boolean; exclusive?: boolean; syncHeadCheck?: boolean };
|
||||
checkBar?: {
|
||||
visible?: boolean;
|
||||
exclusive?: boolean;
|
||||
syncHeadCheck?: boolean;
|
||||
checkableOnly?: boolean;
|
||||
};
|
||||
}): void;
|
||||
}
|
||||
}
|
||||
@@ -432,6 +437,7 @@ type GridViewWithCheckApi = {
|
||||
checkEvent?: boolean,
|
||||
) => void;
|
||||
setAllCheck?: (checked: boolean) => void;
|
||||
setCheckable?: (itemIndex: number, checkable: boolean) => void;
|
||||
};
|
||||
|
||||
function isRowCheckedFlag(value: unknown): boolean {
|
||||
@@ -847,6 +853,7 @@ const DataGrid = ({
|
||||
isExcelExport = true,
|
||||
fixedColumns,
|
||||
showHeaderCheckbox = false,
|
||||
checkableCallback,
|
||||
rowData,
|
||||
setRowData,
|
||||
getGridDataRef,
|
||||
@@ -902,6 +909,7 @@ const DataGrid = ({
|
||||
const onItemCheckedRef = useRef<typeof onItemChecked>(onItemChecked);
|
||||
const onItemAllCheckedRef =
|
||||
useRef<typeof onItemAllChecked>(onItemAllChecked);
|
||||
const checkableCallbackRef = useRef<typeof checkableCallback>(checkableCallback);
|
||||
const isSyncingChecksFromRowDataRef = useRef(false);
|
||||
const columnsFieldsSigRef = useRef("");
|
||||
const emptyCellHoverKeyRef = useRef("");
|
||||
@@ -923,6 +931,7 @@ const DataGrid = ({
|
||||
onScrollToBottomRef.current = onScrollToBottom;
|
||||
onItemCheckedRef.current = onItemChecked;
|
||||
onItemAllCheckedRef.current = onItemAllChecked;
|
||||
checkableCallbackRef.current = checkableCallback;
|
||||
onCellEditedRef.current = onCellEdited;
|
||||
onDataCellClickRef.current = onDataCellClick;
|
||||
|
||||
@@ -1608,7 +1617,12 @@ useEffect(() => {
|
||||
|
||||
// 헤더 체크박스 표시 여부 설정
|
||||
gridView.setOptions({
|
||||
checkBar: { visible: showHeaderCheckbox, exclusive: false, syncHeadCheck: true },
|
||||
checkBar: {
|
||||
visible: showHeaderCheckbox,
|
||||
exclusive: false,
|
||||
syncHeadCheck: true,
|
||||
checkableOnly: true,
|
||||
},
|
||||
rowIndicator: { visible: false },
|
||||
});
|
||||
|
||||
@@ -2272,6 +2286,17 @@ useEffect(() => {
|
||||
if (onItemChecked) {
|
||||
gridView.onItemChecked = (_grid, itemIndex, checked) => {
|
||||
if (isSyncingChecksFromRowDataRef.current) return;
|
||||
const row = rowDataRef.current[itemIndex];
|
||||
if (
|
||||
row &&
|
||||
checkableCallbackRef.current &&
|
||||
!checkableCallbackRef.current(row, itemIndex)
|
||||
) {
|
||||
if (checked) {
|
||||
(_grid as GridViewWithCheckApi).checkItem?.(itemIndex, false, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
onItemCheckedRef.current?.(itemIndex, checked);
|
||||
};
|
||||
} else {
|
||||
@@ -2307,7 +2332,15 @@ useEffect(() => {
|
||||
gridView.checkAll?.(false, false, false, false);
|
||||
gridView.setAllCheck?.(false);
|
||||
rowData.forEach((row, itemIndex) => {
|
||||
if (!isRowCheckedFlag((row as Record<string, unknown>).__checked)) return;
|
||||
const checkable =
|
||||
checkableCallbackRef.current?.(row, itemIndex) ?? true;
|
||||
gridView.setCheckable?.(itemIndex, checkable);
|
||||
if (
|
||||
!checkable ||
|
||||
!isRowCheckedFlag((row as Record<string, unknown>).__checked)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
if (gridView.checkItem) {
|
||||
gridView.checkItem(itemIndex, true, false);
|
||||
return;
|
||||
|
||||
@@ -136,7 +136,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const mergedProps = { ...defaultSearchFormProps, ...props };
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd ?? "";
|
||||
const sidoSelectText =
|
||||
props.sidoSelectText && props.sidoSelectText.trim() !== ""
|
||||
? props.sidoSelectText
|
||||
|
||||
@@ -14,6 +14,10 @@ import {
|
||||
import type { RealGridReact } from "realgrid-react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import {
|
||||
isJeonnamGwangjuHeadquartersOperableRow,
|
||||
shouldRestrictFinanceVerificationToHeadquarters,
|
||||
} from "@/entities/statistics";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { VerificationResultListRequest, VerificationResultReportItem } from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
@@ -91,6 +95,14 @@ function verificationMthdCellStyle({
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isResultRowOperable(
|
||||
restrictHeadquarters: boolean,
|
||||
row: { sewerBzmnCd?: string | number | null; admdstNm?: string | number | null },
|
||||
): boolean {
|
||||
if (!restrictHeadquarters) return true;
|
||||
return isJeonnamGwangjuHeadquartersOperableRow(row);
|
||||
}
|
||||
|
||||
/** History와 동일 + 구분(검증유형) + 편집 가능한 처리의견(예외사유) */
|
||||
const verificationSubmitResultColumnInfo: ColumnInfo = {
|
||||
columns: [
|
||||
@@ -171,6 +183,12 @@ export function VerificationResultDialog({
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
||||
|
||||
const restrictHeadquarters = shouldRestrictFinanceVerificationToHeadquarters(
|
||||
stableQueryContext?.statsCd,
|
||||
stableQueryContext?.sewerBzmnCd,
|
||||
stableQueryContext?.sggNm,
|
||||
);
|
||||
|
||||
const [rows, setRows] = useState<VerificationResultGridRow[]>([]);
|
||||
const [checkedIndices, setCheckedIndices] = useState<Set<number>>(() => new Set());
|
||||
|
||||
@@ -180,6 +198,11 @@ export function VerificationResultDialog({
|
||||
|
||||
const onPrcsOpnnExplnEdited = useCallback((params: CellEditedCallbackParams) => {
|
||||
if (params.fieldName !== "prcsOpnnExpln") return;
|
||||
const row = rows[params.itemIndex];
|
||||
if (row && !isResultRowOperable(restrictHeadquarters, row)) {
|
||||
setRowCheckByItemIndex(gridRef, params.itemIndex, false);
|
||||
return;
|
||||
}
|
||||
const text = String(params.newValue ?? "");
|
||||
const hasValue = text.trim().length > 0;
|
||||
setRowCheckByItemIndex(gridRef, params.itemIndex, hasValue);
|
||||
@@ -189,7 +212,7 @@ export function VerificationResultDialog({
|
||||
else next.delete(params.itemIndex);
|
||||
return next;
|
||||
});
|
||||
}, []);
|
||||
}, [restrictHeadquarters, rows]);
|
||||
|
||||
const resetState = useCallback(() => {
|
||||
setPageIndex(0);
|
||||
@@ -206,6 +229,7 @@ export function VerificationResultDialog({
|
||||
vrfcSn: item.vrfcSn,
|
||||
vrfcMthdCd,
|
||||
vrfcMthdNm: VRFC_MTHD_NAME_MAP[vrfcMthdCd] ?? item.vrfcMthdNm,
|
||||
sewerBzmnCd: item.sewerBzmnCd ?? "",
|
||||
ctpvNm: item.ctpvNm,
|
||||
admdstNm: item.admdstNm ?? item.sggNm ?? "-",
|
||||
fcltNm: item.fcltNm ?? "-",
|
||||
@@ -307,6 +331,11 @@ export function VerificationResultDialog({
|
||||
setCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
rows.forEach((row, itemIndex) => {
|
||||
if (!isResultRowOperable(restrictHeadquarters, row)) {
|
||||
setRowCheckByItemIndex(gridRef, itemIndex, false);
|
||||
next.delete(itemIndex);
|
||||
return;
|
||||
}
|
||||
const has = String(row.prcsOpnnExpln ?? "").trim().length > 0;
|
||||
setRowCheckByItemIndex(gridRef, itemIndex, has);
|
||||
if (has) next.add(itemIndex);
|
||||
@@ -315,7 +344,7 @@ export function VerificationResultDialog({
|
||||
});
|
||||
});
|
||||
return () => cancelAnimationFrame(id);
|
||||
}, [rows, loading]);
|
||||
}, [rows, loading, restrictHeadquarters]);
|
||||
|
||||
const handleExceptionSubmitClick = useCallback(async () => {
|
||||
if (checkedIndices.size === 0) {
|
||||
@@ -326,6 +355,11 @@ export function VerificationResultDialog({
|
||||
const gridRows = getGridDataRef.current?.() ?? [];
|
||||
const payload: VerificationExceptionSubmitItem[] = [];
|
||||
for (const idx of checkedIndices) {
|
||||
const row = rows[idx] ?? gridRows[idx];
|
||||
if (row && !isResultRowOperable(restrictHeadquarters, row)) {
|
||||
alert("전남광주통합특별시는 본청 데이터만 조작할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
const prcsOpnnExpln = String(gridRows[idx]?.prcsOpnnExpln ?? "").trim();
|
||||
if (!prcsOpnnExpln) {
|
||||
alert("예외 제출 사유를 작성해주세요.");
|
||||
@@ -373,6 +407,7 @@ export function VerificationResultDialog({
|
||||
rows,
|
||||
onExceptionSubmitted,
|
||||
onOpenChange,
|
||||
restrictHeadquarters,
|
||||
stableQueryContext,
|
||||
]);
|
||||
|
||||
@@ -419,9 +454,30 @@ export function VerificationResultDialog({
|
||||
getGridRef={gridRef}
|
||||
getGridDataRef={getGridDataRef}
|
||||
onCellEdited={onPrcsOpnnExplnEdited}
|
||||
cellStyleCallback={verificationMthdCellStyle}
|
||||
cellStyleCallback={(params) => {
|
||||
const mthdStyle = verificationMthdCellStyle(params);
|
||||
if (!isResultRowOperable(restrictHeadquarters, params.row)) {
|
||||
const mthdName =
|
||||
typeof mthdStyle === "string" ? mthdStyle : undefined;
|
||||
return {
|
||||
styleName: ["rg-cell-readonly", mthdName]
|
||||
.filter(Boolean)
|
||||
.join(" "),
|
||||
editable: false,
|
||||
readOnly: true,
|
||||
};
|
||||
}
|
||||
return mthdStyle;
|
||||
}}
|
||||
checkableCallback={(row) =>
|
||||
isResultRowOperable(restrictHeadquarters, row)
|
||||
}
|
||||
cellTooltipCallback={cellContentTooltip}
|
||||
onItemChecked={(itemIndex, checked) => {
|
||||
const row = rows[itemIndex];
|
||||
if (checked && row && !isResultRowOperable(restrictHeadquarters, row)) {
|
||||
return;
|
||||
}
|
||||
setCheckedIndices((prev) => {
|
||||
const next = new Set(prev);
|
||||
if (checked) next.add(itemIndex);
|
||||
@@ -431,7 +487,15 @@ export function VerificationResultDialog({
|
||||
}}
|
||||
onItemAllChecked={(checked) => {
|
||||
setCheckedIndices(
|
||||
checked ? new Set(rows.map((_, i) => i)) : new Set(),
|
||||
checked
|
||||
? new Set(
|
||||
rows.flatMap((row, i) =>
|
||||
isResultRowOperable(restrictHeadquarters, row)
|
||||
? [i]
|
||||
: [],
|
||||
),
|
||||
)
|
||||
: new Set(),
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -14,6 +14,10 @@ import {
|
||||
import type { RealGridReact } from "realgrid-react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import {
|
||||
isJeonnamGwangjuHeadquartersOperableRow,
|
||||
shouldRestrictFinanceVerificationToHeadquarters,
|
||||
} from "@/entities/statistics";
|
||||
import { statisticsApi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { VerificationResultListRequest, VerificationResultReportItem } from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
@@ -137,6 +141,14 @@ function verificationPrcsYnNmCellStyle({ fieldName, row }: CellStyleCallbackPara
|
||||
return "rg-cell-vrf-prcs-ok";
|
||||
}
|
||||
|
||||
function isHistoryRowOperable(
|
||||
restrictHeadquarters: boolean,
|
||||
row: { sewerBzmnCd?: string | number | null; admdstNm?: string | number | null },
|
||||
): boolean {
|
||||
if (!restrictHeadquarters) return true;
|
||||
return isJeonnamGwangjuHeadquartersOperableRow(row);
|
||||
}
|
||||
|
||||
const verificationResultColumnInfo: ColumnInfo = {
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
@@ -227,6 +239,12 @@ export function VerificationResultHistoryDialog({
|
||||
const [resetSubmitting, setResetSubmitting] = useState(false);
|
||||
const [checkedVrfcByTab, setCheckedVrfcByTab] = useState(createEmptyCheckedVrfcByTab);
|
||||
|
||||
const restrictHeadquarters = shouldRestrictFinanceVerificationToHeadquarters(
|
||||
stableQueryContext?.statsCd,
|
||||
stableQueryContext?.sewerBzmnCd,
|
||||
stableQueryContext?.sggNm,
|
||||
);
|
||||
|
||||
const nvGridRef = useRef<RealGridReact | null>(null);
|
||||
const imrGridRef = useRef<RealGridReact | null>(null);
|
||||
const hbGridRef = useRef<RealGridReact | null>(null);
|
||||
@@ -375,10 +393,12 @@ export function VerificationResultHistoryDialog({
|
||||
(entries: VerificationResultReportItem[], checkedMap: Map<number, string>): VerificationResultGridRow[] =>
|
||||
entries.map((item) => {
|
||||
const vrfcSn = Number(item.vrfcSn);
|
||||
const isChecked = Number.isFinite(vrfcSn) && checkedMap.has(vrfcSn);
|
||||
const operable = isHistoryRowOperable(restrictHeadquarters, item);
|
||||
const isChecked = operable && Number.isFinite(vrfcSn) && checkedMap.has(vrfcSn);
|
||||
return {
|
||||
vrfcSn: item.vrfcSn,
|
||||
__checked: isChecked ? 1 : 0,
|
||||
sewerBzmnCd: item.sewerBzmnCd ?? "",
|
||||
ctpvNm: item.ctpvNm ?? "-",
|
||||
admdstNm: item.admdstNm ?? item.sggNm ?? "-",
|
||||
fcltNm: item.fcltNm ?? "-",
|
||||
@@ -395,7 +415,7 @@ export function VerificationResultHistoryDialog({
|
||||
mdfcnDt: (item.mdfcnDt ?? "").slice(0, 16),
|
||||
};
|
||||
}),
|
||||
[],
|
||||
[restrictHeadquarters],
|
||||
);
|
||||
|
||||
/** 페이지(entries) 변경 시에만 __checked 반영 — 클릭마다 rowData를 바꾸지 않아 체크 UI가 안정적 */
|
||||
@@ -432,6 +452,13 @@ export function VerificationResultHistoryDialog({
|
||||
return;
|
||||
}
|
||||
setCheckedVrfcByTab((prev) => ({ ...prev, [tab]: syncedMap }));
|
||||
for (const vrfcSn of syncedMap.keys()) {
|
||||
const onPage = currentEntries.find((e) => Number(e.vrfcSn) === vrfcSn);
|
||||
if (onPage && !isHistoryRowOperable(restrictHeadquarters, onPage)) {
|
||||
alert("전남광주통합특별시는 본청 데이터만 조작할 수 있습니다.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
const vrfcSnList = Array.from(syncedMap.keys());
|
||||
let mdfrUuid: string;
|
||||
try {
|
||||
@@ -477,6 +504,7 @@ export function VerificationResultHistoryDialog({
|
||||
entriesByTab,
|
||||
loadTabPage,
|
||||
onExceptionResetSubmitted,
|
||||
restrictHeadquarters,
|
||||
stableQueryContext,
|
||||
tabPages,
|
||||
]);
|
||||
@@ -487,6 +515,18 @@ export function VerificationResultHistoryDialog({
|
||||
const { pageIndex, pageCount } = tabPages[tab];
|
||||
const loading = loadingByTab[tab];
|
||||
const gridRef = gridRefByTab[tab];
|
||||
const historyCellStyle = (params: CellStyleCallbackParams) => {
|
||||
const statusStyle = verificationPrcsYnNmCellStyle(params);
|
||||
if (!isHistoryRowOperable(restrictHeadquarters, params.row)) {
|
||||
const statusName = typeof statusStyle === "string" ? statusStyle : undefined;
|
||||
return {
|
||||
styleName: ["rg-cell-readonly", statusName].filter(Boolean).join(" "),
|
||||
editable: false,
|
||||
readOnly: true,
|
||||
};
|
||||
}
|
||||
return statusStyle;
|
||||
};
|
||||
|
||||
if (!loading && rows.length === 0) {
|
||||
return <p className="p-6 text-center text-[1.3rem] text-muted-foreground h-[65vh] flex justify-center items-center">{emptyMessage}</p>;
|
||||
@@ -504,13 +544,18 @@ export function VerificationResultHistoryDialog({
|
||||
showHeaderCheckbox
|
||||
enableSort={false}
|
||||
getGridRef={gridRef}
|
||||
cellStyleCallback={verificationPrcsYnNmCellStyle}
|
||||
cellStyleCallback={historyCellStyle}
|
||||
checkableCallback={(row) => isHistoryRowOperable(restrictHeadquarters, row)}
|
||||
cellTooltipCallback={cellContentTooltip}
|
||||
onItemChecked={(itemIndex, checked) => {
|
||||
const entry = entries[itemIndex];
|
||||
if (!entry) return;
|
||||
const vrfcSn = Number(entry.vrfcSn);
|
||||
if (!Number.isFinite(vrfcSn)) return;
|
||||
if (checked && !isHistoryRowOperable(restrictHeadquarters, entry)) {
|
||||
uncheckGridRow(gridRef, itemIndex);
|
||||
return;
|
||||
}
|
||||
if (checked && !canExceptionReset(entry.vrfcSttsCd)) {
|
||||
alert(EXCEPTION_RESET_ONLY_PRCS_YN_2_MESSAGE);
|
||||
uncheckGridRow(gridRef, itemIndex);
|
||||
@@ -530,6 +575,10 @@ export function VerificationResultHistoryDialog({
|
||||
map.delete(vrfcSn);
|
||||
return;
|
||||
}
|
||||
if (!isHistoryRowOperable(restrictHeadquarters, entry)) {
|
||||
uncheckGridRow(gridRef, itemIndex);
|
||||
return;
|
||||
}
|
||||
if (canExceptionReset(entry.vrfcSttsCd)) {
|
||||
map.set(vrfcSn, String(entry.vrfcSttsCd ?? ""));
|
||||
} else {
|
||||
|
||||
@@ -310,7 +310,6 @@ const PublicSewageFacilityInp = () => {
|
||||
swtrmtFcltCd: nullableTrimmedString(d.swtrmtFcltCd),
|
||||
swtrmtFcltNm: nullableTrimmedString(d.swtrmtFcltNm),
|
||||
fcltSn: nullableTrimmedString(d.fcltSn),
|
||||
fcltPstnCn: nullableTrimmedString(d.fcltPstnCn),
|
||||
inflwSwagePhysQnt: toNumber(d.inflwSwagePhysQnt),
|
||||
inflwSwageBoilQnt: toNumber(d.inflwSwageBoilQnt),
|
||||
inflwSwageAltdQnt: toNumber(d.inflwSwageAltdQnt),
|
||||
|
||||
@@ -42,9 +42,11 @@ import type {
|
||||
import {
|
||||
filterBySelectedAdmdstCd,
|
||||
isGugunOkForToolbar,
|
||||
isJeonnamGwangjuSggNotApplicableSearch,
|
||||
isJeonnamGwangjuSidoAllSearch,
|
||||
isJeonnamGwangjuSidoAllToolbarException,
|
||||
isSubmitOkForToolbar,
|
||||
JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM,
|
||||
JEONNAM_GWANGJU_SIDO_ALL_SAVE_SUBMIT_MESSAGE,
|
||||
resolveNoApplicableForRequest,
|
||||
toInputSearchRegion,
|
||||
@@ -183,6 +185,47 @@ function isJeonnamGwangjuSidoAllToolbarTab(tabKey: string | null | undefined): b
|
||||
return Boolean(tabKey && ARTICLE_EDIT_TAB_KEYS.has(tabKey));
|
||||
}
|
||||
|
||||
function isJeonnamGwangjuHeadquartersGridRow(
|
||||
row: Record<string, string | number>,
|
||||
): boolean {
|
||||
return (
|
||||
String(row.admdstNm ?? "").trim() === JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM ||
|
||||
String(row.sggNm ?? "").trim() === JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM
|
||||
);
|
||||
}
|
||||
|
||||
function hasJeonnamGwangjuHeadquartersGridRows(
|
||||
rows: readonly Record<string, string | number>[],
|
||||
): boolean {
|
||||
return rows.some(isJeonnamGwangjuHeadquartersGridRow);
|
||||
}
|
||||
|
||||
function isOnlyJeonnamGwangjuHeadquartersGridRows(
|
||||
rows: readonly Record<string, string | number>[],
|
||||
): boolean {
|
||||
return rows.length > 0 && rows.every(isJeonnamGwangjuHeadquartersGridRow);
|
||||
}
|
||||
|
||||
function isJeonnamGwangjuSggHeadquartersOnlyNotApplicable(
|
||||
searchContext: SearchFormValues | null,
|
||||
rows: readonly Record<string, string | number>[],
|
||||
): boolean {
|
||||
return (
|
||||
isJeonnamGwangjuSggNotApplicableSearch(searchContext) &&
|
||||
isOnlyJeonnamGwangjuHeadquartersGridRows(rows)
|
||||
);
|
||||
}
|
||||
|
||||
function isEmptyForNotApplicable(
|
||||
searchContext: SearchFormValues | null,
|
||||
rows: readonly Record<string, string | number>[],
|
||||
): boolean {
|
||||
return (
|
||||
rows.length === 0 ||
|
||||
isJeonnamGwangjuSggHeadquartersOnlyNotApplicable(searchContext, rows)
|
||||
);
|
||||
}
|
||||
|
||||
function buildGugunOkForToolbar(
|
||||
values: SearchFormValues | null,
|
||||
tabKey?: string | null,
|
||||
@@ -221,7 +264,9 @@ function buildNoApplicableForRequest(
|
||||
values: SearchFormValues | null,
|
||||
checked: boolean,
|
||||
isSaveListEmpty: boolean,
|
||||
tabKey?: string | null,
|
||||
): boolean {
|
||||
if (buildSubmitOkForToolbar(values, tabKey)) return checked;
|
||||
return resolveNoApplicableForRequest(sidoListRef.current, values, checked, isSaveListEmpty);
|
||||
}
|
||||
|
||||
@@ -748,11 +793,29 @@ const SewageExcretaRelatedInp = () => {
|
||||
tabKey: string,
|
||||
hasRows: boolean,
|
||||
statusInfo: SewerageStatusInfo | null | undefined,
|
||||
): boolean =>
|
||||
NOT_APPLICABLE_TAB_KEYS.has(tabKey) &&
|
||||
hasSearched &&
|
||||
!hasRows &&
|
||||
computeTabEnterable(statusInfo, inputPeriodEnterable);
|
||||
rows: readonly Record<string, string | number>[] = [],
|
||||
searchContext: SearchFormValues | null = null,
|
||||
): boolean => {
|
||||
if (
|
||||
!NOT_APPLICABLE_TAB_KEYS.has(tabKey) ||
|
||||
!hasSearched ||
|
||||
!computeTabEnterable(statusInfo, inputPeriodEnterable)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (!hasRows) return true;
|
||||
if (
|
||||
ARTICLE_EDIT_TAB_KEYS.has(tabKey) &&
|
||||
isJeonnamGwangjuSggHeadquartersOnlyNotApplicable(searchContext, rows)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return (
|
||||
ARTICLE_EDIT_TAB_KEYS.has(tabKey) &&
|
||||
isJeonnamGwangjuSidoAllSearch(sidoListRef.current, searchContext) &&
|
||||
!hasJeonnamGwangjuHeadquartersGridRows(rows)
|
||||
);
|
||||
};
|
||||
|
||||
const setIsNotApplicableForTab = useCallback((tabKey: string, nextValue: boolean) => {
|
||||
setIsNotApplicableByTab((prev) => {
|
||||
@@ -1330,10 +1393,17 @@ const SewageExcretaRelatedInp = () => {
|
||||
}
|
||||
|
||||
commitActiveGrid();
|
||||
const noApplicable = buildNoApplicableForRequest(searchContextByTab.get(tabKey) ?? lastSearchedValues, isNotApplicableByTab.get(tabKey) ?? false, getTabGridRows(tabKey).length === 0);
|
||||
const noApplicable = buildNoApplicableForRequest(searchContextByTab.get(tabKey) ?? lastSearchedValues, isNotApplicableByTab.get(tabKey) ?? false, getTabGridRows(tabKey).length === 0, tabKey);
|
||||
const currentData = getTabGridRows(tabKey);
|
||||
if (NOT_APPLICABLE_TAB_KEYS.has(tabKey)) {
|
||||
if (!noApplicable && currentData.length === 0 && buildSubmitOkForToolbar(searchContextByTab.get(tabKey) ?? lastSearchedValues, tabKey)) {
|
||||
if (
|
||||
!noApplicable &&
|
||||
isEmptyForNotApplicable(
|
||||
searchContextByTab.get(tabKey) ?? lastSearchedValues,
|
||||
currentData,
|
||||
) &&
|
||||
buildSubmitOkForToolbar(searchContextByTab.get(tabKey) ?? lastSearchedValues, tabKey)
|
||||
) {
|
||||
alert("해당사항 없음을 체크해주세요.");
|
||||
return;
|
||||
}
|
||||
@@ -1372,7 +1442,7 @@ const SewageExcretaRelatedInp = () => {
|
||||
|
||||
const isDistrictRowTab = DISTRICT_ROW_TAB_KEYS.has(tabKey);
|
||||
const isPublicInstitutionTab = ARTICLE_EDIT_TAB_KEYS.has(tabKey);
|
||||
const noApplicable = buildNoApplicableForRequest(searchContextByTab.get(tabKey) ?? lastSearchedValues, isNotApplicableByTab.get(tabKey) ?? false, getTabGridRows(tabKey).length === 0);
|
||||
const noApplicable = buildNoApplicableForRequest(searchContextByTab.get(tabKey) ?? lastSearchedValues, isNotApplicableByTab.get(tabKey) ?? false, getTabGridRows(tabKey).length === 0, tabKey);
|
||||
const currentData = getTabGridRows(tabKey);
|
||||
const mapRows = rowDataMap.get(tabKey) ?? [];
|
||||
|
||||
@@ -1443,7 +1513,15 @@ const SewageExcretaRelatedInp = () => {
|
||||
)
|
||||
.map((row) => buildPublicInstitutionIndustrySaveItem(row, list));
|
||||
|
||||
if (!noApplicable && submitList.length === 0 && buildSubmitOkForToolbar(searchContextByTab.get(tabKey) ?? lastSearchedValues, tabKey)) {
|
||||
if (
|
||||
!noApplicable &&
|
||||
(submitList.length === 0 ||
|
||||
isJeonnamGwangjuSggHeadquartersOnlyNotApplicable(
|
||||
searchContextByTab.get(tabKey) ?? lastSearchedValues,
|
||||
currentData,
|
||||
)) &&
|
||||
buildSubmitOkForToolbar(searchContextByTab.get(tabKey) ?? lastSearchedValues, tabKey)
|
||||
) {
|
||||
alert("해당사항 없음을 체크해주세요.");
|
||||
return;
|
||||
}
|
||||
@@ -1640,7 +1718,8 @@ const SewageExcretaRelatedInp = () => {
|
||||
|
||||
const isDistrictRowTab = DISTRICT_ROW_TAB_KEYS.has(tabKey);
|
||||
const isPublicInstitutionTab = ARTICLE_EDIT_TAB_KEYS.has(tabKey);
|
||||
const noApplicable = buildNoApplicableForRequest(searchContextByTab.get(tabKey) ?? lastSearchedValues, isNotApplicableByTab.get(tabKey) ?? false, getTabGridRows(tabKey).length === 0);
|
||||
const notApplicableChecked = isNotApplicableByTab.get(tabKey) ?? false;
|
||||
const noApplicable = buildNoApplicableForRequest(searchContextByTab.get(tabKey) ?? lastSearchedValues, notApplicableChecked, getTabGridRows(tabKey).length === 0, tabKey);
|
||||
const currentData = getTabGridRows(tabKey);
|
||||
const mapRows = rowDataMap.get(tabKey) ?? [];
|
||||
|
||||
@@ -1730,7 +1809,30 @@ const SewageExcretaRelatedInp = () => {
|
||||
)
|
||||
.map((row) => buildPublicInstitutionIndustrySaveItem(row, list));
|
||||
|
||||
if (!noApplicable && saveList.length === 0 && buildSubmitOkForToolbar(searchContextByTab.get(tabKey) ?? lastSearchedValues, tabKey)) {
|
||||
if (
|
||||
isJeonnamGwangjuSidoAllSearch(
|
||||
sidoListRef.current,
|
||||
lastSearchedValues,
|
||||
) &&
|
||||
!notApplicableChecked &&
|
||||
!hasJeonnamGwangjuHeadquartersGridRows(currentData)
|
||||
) {
|
||||
alert("본청 데이터 제거 시 해당사항 없음을 체크해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!noApplicable &&
|
||||
(saveList.length === 0 ||
|
||||
isJeonnamGwangjuSggHeadquartersOnlyNotApplicable(
|
||||
searchContextByTab.get(tabKey) ?? lastSearchedValues,
|
||||
currentData,
|
||||
)) &&
|
||||
buildSubmitOkForToolbar(
|
||||
searchContextByTab.get(tabKey) ?? lastSearchedValues,
|
||||
tabKey,
|
||||
)
|
||||
) {
|
||||
alert("해당사항 없음을 체크해주세요.");
|
||||
return;
|
||||
}
|
||||
@@ -2021,10 +2123,23 @@ const SewageExcretaRelatedInp = () => {
|
||||
ARTICLE_EDIT_TAB_KEYS.has(activeTab) && showEnterableToolbarButtons;
|
||||
const gugunOk = buildGugunOkForToolbar(searchContextForToolbar, activeTab);
|
||||
const submitOk = buildSubmitOkForToolbar(searchContextForToolbar, activeTab);
|
||||
const disableSubmit =
|
||||
isJeonnamGwangjuSidoAllToolbarTab(activeTab) &&
|
||||
isJeonnamGwangjuSidoAllToolbarException(
|
||||
sidoListRef.current,
|
||||
searchContextForToolbar,
|
||||
relatedToolbarUserIdRef.current,
|
||||
);
|
||||
const showNotApplicableForActiveTab =
|
||||
NOT_APPLICABLE_TAB_KEYS.has(activeTab) &&
|
||||
loadedTabKeys.has(activeTab) &&
|
||||
shouldShowNotApplicable(activeTab, activeTabHasRowData, activeTabStatus) &&
|
||||
shouldShowNotApplicable(
|
||||
activeTab,
|
||||
activeTabHasRowData,
|
||||
activeTabStatus,
|
||||
rowDataMap.get(activeTab) ?? [],
|
||||
searchContextForToolbar,
|
||||
) &&
|
||||
submitOk;
|
||||
const showSecondaryToolbarCard =
|
||||
hasSearched &&
|
||||
@@ -2092,7 +2207,9 @@ const SewageExcretaRelatedInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void lastYearDataFunc()}
|
||||
/>
|
||||
{submitOk && <SubmitButton submitFunc={submitFunc} />}
|
||||
{submitOk && (
|
||||
<SubmitButton submitFunc={submitFunc} disabled={disableSubmit} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.lclgvSbmsnSttsCd === "2" && submitOk && inputPeriodEnterable && (
|
||||
|
||||
@@ -71,7 +71,10 @@ import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { FactInstallStatusInpColumn } from "@/components/util/column/input/sewagePipe/FactInstallStatusInpColumn";
|
||||
import { ManholeStatusInpColumn } from "@/components/util/column/input/sewagePipe/ManholeStatusInpColumn";
|
||||
import { PipeDiameterStatusInpColumn } from "@/components/util/column/input/sewagePipe/PipeDiameterStatusInpColumn";
|
||||
import { PipeTypeStatusInpColumn } from "@/components/util/column/input/sewagePipe/PipeTypeStatusInpColumn";
|
||||
import {
|
||||
getPipeTypeStatusInpColumn,
|
||||
resolvePipeTypeColumnEndYear,
|
||||
} from "@/components/util/column/input/sewagePipe/PipeTypeStatusInpColumn";
|
||||
import { RegionalFactStatusInpColumn } from "@/components/util/column/input/sewagePipe/RegionalFactStatusInpColumn";
|
||||
import { SewagePipeInpColumnInfoList } from "@/components/util/column/input/sewagePipe/SewagePipeInpColumn";
|
||||
import { fetchColumnGuidesRecord } from "@/components/util/grid/columnGuides";
|
||||
@@ -119,11 +122,6 @@ function buildSewagePipeSearchParam(
|
||||
};
|
||||
}
|
||||
|
||||
const getPipeTypeLastDataYear = () => {
|
||||
const lastDataYear = new Date().getFullYear() - 1;
|
||||
return Math.max(1995, lastDataYear);
|
||||
};
|
||||
|
||||
const PIPE_TYPE_STATUS_TAB_KEY = "ST00020003";
|
||||
|
||||
/** 조회 연도(statsYr)에 해당하는 연도 (y{year}* 필드용) */
|
||||
@@ -131,7 +129,7 @@ const resolvePipeTypeEditableYear = (statsYr: string | null | undefined): number
|
||||
if (!statsYr) return null;
|
||||
const year = Number(statsYr);
|
||||
if (!Number.isFinite(year)) return null;
|
||||
return Math.min(getPipeTypeLastDataYear(), Math.max(1995, year));
|
||||
return Math.min(resolvePipeTypeColumnEndYear(statsYr), Math.max(1995, year));
|
||||
};
|
||||
|
||||
/** 조회 연도(statsYr)에 해당하는 연도별 매설연장 필드명 (y{year}LyngPrlg) */
|
||||
@@ -257,8 +255,9 @@ function getSewagePipeRowVerificationErrors(
|
||||
function normalizePipeTypeStatusRow(
|
||||
row: SeweragePipeInputPipeTypeStatusItem,
|
||||
ctpvNm: string,
|
||||
statsYr?: string | number | null,
|
||||
): Record<string, string | number | SeweragePipeInputVerificationResult | undefined> {
|
||||
const lastDataYear = getPipeTypeLastDataYear();
|
||||
const lastDataYear = resolvePipeTypeColumnEndYear(statsYr);
|
||||
const {
|
||||
yearlyStatList,
|
||||
lyngPrlgWhol,
|
||||
@@ -276,8 +275,8 @@ function normalizePipeTypeStatusRow(
|
||||
|
||||
for (const y of yearlyStatList ?? []) {
|
||||
const year = Number(y.lyngYr);
|
||||
if (!Number.isFinite(year)) continue;
|
||||
const targetYear = Math.min(lastDataYear, Math.max(1995, year));
|
||||
if (!Number.isFinite(year) || year > lastDataYear) continue;
|
||||
const targetYear = Math.max(1995, year);
|
||||
yearFields[`y${targetYear}PrlgWhol`] =
|
||||
(yearFields[`y${targetYear}PrlgWhol`] ?? 0) + Number(y.pipeWholPrlg ?? 0);
|
||||
yearFields[`y${targetYear}LyngPrlg`] =
|
||||
@@ -614,10 +613,14 @@ const SewagePipeInp = () => {
|
||||
};
|
||||
});
|
||||
return SewagePipeInpColumnInfoList.map((tab: ColumnInfoList) => {
|
||||
const canEdit =
|
||||
(computeTabEnterable(tabStatusInfoMap.get(tab.tabKey) ?? null, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const applyEditable = (cols: ColumnConfig[] | undefined) =>
|
||||
const sourceTab =
|
||||
tab.tabKey === PIPE_TYPE_STATUS_TAB_KEY
|
||||
? getPipeTypeStatusInpColumn(lastSearchedYear)
|
||||
: tab;
|
||||
const canEdit =
|
||||
(computeTabEnterable(tabStatusInfoMap.get(sourceTab.tabKey) ?? null, inputPeriodEnterable) || isAdminInfo) && inputPeriodEnterable;
|
||||
const applyEditable = (cols: ColumnConfig[] | undefined) =>
|
||||
sourceTab.tabKey === PIPE_TYPE_STATUS_TAB_KEY
|
||||
? applyPipeTypeStatusEditableColumns(
|
||||
cols,
|
||||
canEdit,
|
||||
@@ -635,20 +638,20 @@ const SewagePipeInp = () => {
|
||||
},
|
||||
);
|
||||
|
||||
if (tab.left && tab.right) {
|
||||
if (sourceTab.left && sourceTab.right) {
|
||||
return {
|
||||
...tab,
|
||||
left: { ...tab.left, columns: applyColumnGuides(applyEditable(tab.left.columns), tab.tabKey) },
|
||||
right: { ...tab.right, columns: applyColumnGuides(applyEditable(tab.right.columns), tab.tabKey) },
|
||||
...sourceTab,
|
||||
left: { ...sourceTab.left, columns: applyColumnGuides(applyEditable(sourceTab.left.columns), sourceTab.tabKey) },
|
||||
right: { ...sourceTab.right, columns: applyColumnGuides(applyEditable(sourceTab.right.columns), sourceTab.tabKey) },
|
||||
};
|
||||
}
|
||||
return {
|
||||
...tab,
|
||||
columns: applyColumnGuides(applyEditable(tab.columns), tab.tabKey),
|
||||
...(tab.tabKey === PIPE_TYPE_STATUS_TAB_KEY && tab.columnLayout
|
||||
...sourceTab,
|
||||
columns: applyColumnGuides(applyEditable(sourceTab.columns), sourceTab.tabKey),
|
||||
...(sourceTab.tabKey === PIPE_TYPE_STATUS_TAB_KEY && sourceTab.columnLayout
|
||||
? {
|
||||
columnLayout: applyPipeTypeStatusColumnLayout(
|
||||
tab.columnLayout,
|
||||
sourceTab.columnLayout,
|
||||
shouldHidePipeTypeEditableYearDmltn(
|
||||
canEdit,
|
||||
inputPeriodEnterable,
|
||||
@@ -807,7 +810,11 @@ const SewagePipeInp = () => {
|
||||
if (response.status === 'success') {
|
||||
const commonInfo = response.data.commonInfo;
|
||||
const convertedData = filterFetched(response.data.pipeTypeStatusList).map((d) =>
|
||||
normalizePipeTypeStatusRow(d, commonInfo.ctpvNm),
|
||||
normalizePipeTypeStatusRow(
|
||||
d,
|
||||
commonInfo.ctpvNm,
|
||||
searchParam.statsYr ?? values.year,
|
||||
),
|
||||
);
|
||||
applyRowMap((m) => m.set('ST00020003', toGridRows(convertedData)));
|
||||
setTabStatusInfoMap((prev) => new Map(prev).set(tabKey, response.data.statusInfo));
|
||||
@@ -1320,7 +1327,7 @@ const SewagePipeInp = () => {
|
||||
return;
|
||||
}
|
||||
const columnFormatMap = new Map<string, string>();
|
||||
PipeTypeStatusInpColumn.columns.forEach((col) => {
|
||||
getPipeTypeStatusInpColumn(values.year).columns.forEach((col) => {
|
||||
if (col.fieldName && col.dataFormat) columnFormatMap.set(col.fieldName, col.dataFormat);
|
||||
});
|
||||
const formatNumber = (value: string | number | null | undefined, fieldName: string): number => {
|
||||
@@ -1332,7 +1339,7 @@ const SewagePipeInp = () => {
|
||||
const decimalPlaces = format.match(/\.(\d+)/)?.[1]?.length ?? 0;
|
||||
return decimalPlaces > 0 ? parseFloat(num.toFixed(decimalPlaces)) : Math.round(num);
|
||||
};
|
||||
const lastDataYear = getPipeTypeLastDataYear();
|
||||
const lastDataYear = resolvePipeTypeColumnEndYear(values.year);
|
||||
const submitList = currentData.map((d) => {
|
||||
const yearlyStatList = [];
|
||||
for (let year = 1995; year <= lastDataYear; year++) {
|
||||
@@ -1803,7 +1810,7 @@ const SewagePipeInp = () => {
|
||||
}
|
||||
|
||||
const columnFormatMap = new Map<string, string>();
|
||||
PipeTypeStatusInpColumn.columns.forEach((col) => {
|
||||
getPipeTypeStatusInpColumn(values.year).columns.forEach((col) => {
|
||||
if (col.fieldName && col.dataFormat) {
|
||||
columnFormatMap.set(col.fieldName, col.dataFormat);
|
||||
}
|
||||
@@ -1819,7 +1826,7 @@ const SewagePipeInp = () => {
|
||||
return decimalPlaces > 0 ? parseFloat(num.toFixed(decimalPlaces)) : Math.round(num);
|
||||
};
|
||||
|
||||
const lastDataYear = getPipeTypeLastDataYear();
|
||||
const lastDataYear = resolvePipeTypeColumnEndYear(values.year);
|
||||
|
||||
const saveList = currentData.map((d) => {
|
||||
const yearlyStatList = [];
|
||||
@@ -2193,7 +2200,11 @@ const SewagePipeInp = () => {
|
||||
return (
|
||||
<TabsContent key={tabKey} value={tabKey}>
|
||||
<DataGrid
|
||||
key={tabKey}
|
||||
key={
|
||||
tabKey === PIPE_TYPE_STATUS_TAB_KEY
|
||||
? `${tabKey}-${lastSearchedYear ?? ""}`
|
||||
: tabKey
|
||||
}
|
||||
columnInfo={gridColumnInfo}
|
||||
rowStartNum={info.rowStartNum}
|
||||
excelExportFileSuffix={info.tabLabel || tabKey}
|
||||
|
||||
@@ -1235,6 +1235,11 @@ const SewerageFinanceInp = () => {
|
||||
const { showSaveInToolbar, showEnterableToolbarButtons, showActionToolbarCard } =
|
||||
activeTabToolbar;
|
||||
const submitOk = buildSubmitOkForToolbar(searchContextForToolbar);
|
||||
const disableSubmit = isJeonnamGwangjuSidoAllToolbarException(
|
||||
sidoListRef.current,
|
||||
searchContextForToolbar,
|
||||
financeToolbarUserIdRef.current,
|
||||
);
|
||||
|
||||
const verificationCellStyle = ({
|
||||
fieldName,
|
||||
@@ -1303,7 +1308,9 @@ const SewerageFinanceInp = () => {
|
||||
<LastYearDataButton
|
||||
getLastYearDataFunc={() => void lastYearDataFunc()}
|
||||
/>
|
||||
{submitOk && <SubmitButton submitFunc={submitFunc} />}
|
||||
{submitOk && (
|
||||
<SubmitButton submitFunc={submitFunc} disabled={disableSubmit} />
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{activeTabStatus?.lclgvSbmsnSttsCd === "2" && submitOk && inputPeriodEnterable && (
|
||||
|
||||
@@ -97,7 +97,7 @@ const ExcretaTreatmentFacilityRvw = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
if (!instSeCd) {
|
||||
return null;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ const ExcretaTreatmentFacilityRvw = () => {
|
||||
statsCd: reviewOpinionContext.statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [reviewOpinionContext, userInfo?.instSeCd]);
|
||||
}, [reviewOpinionContext, userInfo?.laeSeCd]);
|
||||
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
|
||||
@@ -109,7 +109,7 @@ const PrivateSewageFacilityRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -121,7 +121,7 @@ const PrivateSewageFacilityRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -81,7 +81,7 @@ const PublicSewageFacilityRvw = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
if (!instSeCd) {
|
||||
return null;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ const PublicSewageFacilityRvw = () => {
|
||||
statsCd: reviewOpinionContext.statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [reviewOpinionContext, userInfo?.instSeCd]);
|
||||
}, [reviewOpinionContext, userInfo?.laeSeCd]);
|
||||
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
|
||||
@@ -92,7 +92,7 @@ const PumpingStationRvw = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
if (!instSeCd) {
|
||||
return null;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ const PumpingStationRvw = () => {
|
||||
statsCd: reviewOpinionContext.statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [reviewOpinionContext, userInfo?.instSeCd]);
|
||||
}, [reviewOpinionContext, userInfo?.laeSeCd]);
|
||||
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
|
||||
@@ -112,7 +112,7 @@ const SewageExcretaRelatedRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -124,7 +124,7 @@ const SewageExcretaRelatedRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -112,7 +112,7 @@ const SewageExcretaSlurgeRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -124,7 +124,7 @@ const SewageExcretaSlurgeRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -127,7 +127,7 @@ const SewagePipeMaintainRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -139,7 +139,7 @@ const SewagePipeMaintainRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -187,7 +187,7 @@ const SewagePipeRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -199,7 +199,7 @@ const SewagePipeRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -133,7 +133,7 @@ const SewageReservoirPumpRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsCd;
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -145,7 +145,7 @@ const SewageReservoirPumpRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -112,7 +112,7 @@ const SewerageFinanceRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -124,7 +124,7 @@ const SewerageFinanceRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -81,7 +81,7 @@ const SeweragePenetrationRateRvw = () => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
if (!instSeCd) {
|
||||
return null;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ const SeweragePenetrationRateRvw = () => {
|
||||
statsCd: reviewOpinionContext.statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [reviewOpinionContext, userInfo?.instSeCd]);
|
||||
}, [reviewOpinionContext, userInfo?.laeSeCd]);
|
||||
|
||||
const handleReset = () => {
|
||||
setRowData([]);
|
||||
|
||||
@@ -110,7 +110,7 @@ const SewerageServiceLevelRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -122,7 +122,7 @@ const SewerageServiceLevelRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -271,7 +271,7 @@ const StatsInputStatusRvw = () => {
|
||||
|
||||
const statsYr = lastSearchedValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchedValues.bsnmCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -282,7 +282,7 @@ const StatsInputStatusRvw = () => {
|
||||
sewerBzmnCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [lastSearchedValues, userInfo?.instSeCd]);
|
||||
}, [lastSearchedValues, userInfo?.laeSeCd]);
|
||||
|
||||
const submitFunc = () => {
|
||||
if (submitDialogContext == null) {
|
||||
|
||||
@@ -115,7 +115,7 @@ const WaterReuseRvw = () => {
|
||||
const statsYr = lastSearchValues.year ?? "";
|
||||
const sewerBzmnCd = lastSearchValues.bsnmCd ?? "";
|
||||
const statsCd = activeStatsStatusInfo.statsCd ?? "";
|
||||
const instSeCd = userInfo?.instSeCd ?? "";
|
||||
const instSeCd = userInfo?.laeSeCd?? "";
|
||||
|
||||
if (!statsYr || !sewerBzmnCd || !statsCd || !instSeCd) {
|
||||
return null;
|
||||
@@ -127,7 +127,7 @@ const WaterReuseRvw = () => {
|
||||
statsCd,
|
||||
instSeCd,
|
||||
};
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.instSeCd]);
|
||||
}, [activeStatsStatusInfo.statsCd, lastSearchValues, userInfo?.laeSeCd]);
|
||||
|
||||
const { showReviewOpinionButton, showReturnButton, showSubmitButton } = useMemo(() => {
|
||||
const statsStatusInfo = activeStatsStatusInfo;
|
||||
|
||||
@@ -158,7 +158,7 @@ const ImrVerificationHistory = () => {
|
||||
});
|
||||
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const userInstSeCd = userInfo?.instSeCd;
|
||||
const userInstSeCd = userInfo?.laeSeCd;
|
||||
const { data: sidoData } = useSidoList({ instSeCd: userInstSeCd });
|
||||
const sidoOptions = sidoData?.sidoList ?? [];
|
||||
const selectedSidoBsnmCd =
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
DialogClose,
|
||||
DialogContent,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
Label,
|
||||
Textarea,
|
||||
} from "@common/components";
|
||||
|
||||
export interface RejectReasonInputDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onConfirm?: (reason: string) => void | Promise<void>;
|
||||
}
|
||||
|
||||
export function RejectReasonInputDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
onConfirm,
|
||||
}: RejectReasonInputDialogProps) {
|
||||
const [reason, setReason] = useState("");
|
||||
const [reasonError, setReasonError] = useState(false);
|
||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
||||
|
||||
const resetForm = () => {
|
||||
setReason("");
|
||||
setReasonError(false);
|
||||
};
|
||||
|
||||
const handleDialogOpenChange = (nextOpen: boolean) => {
|
||||
if (!nextOpen) resetForm();
|
||||
onOpenChange(nextOpen);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) resetForm();
|
||||
}, [open]);
|
||||
|
||||
const handleConfirm = async () => {
|
||||
const trimmed = reason.trim();
|
||||
if (!trimmed) {
|
||||
setReasonError(true);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
setIsSubmitting(true);
|
||||
await onConfirm?.(trimmed);
|
||||
} finally {
|
||||
setIsSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const canSubmit = reason.trim().length > 0 && !isSubmitting;
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={handleDialogOpenChange}>
|
||||
<DialogContent
|
||||
className="max-w-[56rem]"
|
||||
aria-describedby={undefined}
|
||||
>
|
||||
<DialogHeader>
|
||||
<DialogTitle>반려</DialogTitle>
|
||||
</DialogHeader>
|
||||
<div className="flex flex-col gap-4 py-2">
|
||||
<div className="flex flex-col gap-2">
|
||||
<Label className="text-label mb-2">반려 사유</Label>
|
||||
<Textarea
|
||||
value={reason}
|
||||
onChange={(e) => {
|
||||
setReason(e.target.value);
|
||||
if (reasonError) setReasonError(false);
|
||||
}}
|
||||
className="min-h-[12rem] resize-y !text-[1.3rem] !leading-6"
|
||||
placeholder="반려 사유를 입력하세요."
|
||||
disabled={isSubmitting}
|
||||
/>
|
||||
{reasonError && (
|
||||
<p className="text-[1.2rem] text-red-500">
|
||||
반려 사유를 작성해주세요.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<DialogFooter>
|
||||
<DialogClose asChild>
|
||||
<Button
|
||||
type="button"
|
||||
color="gray"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
취소
|
||||
</Button>
|
||||
</DialogClose>
|
||||
<Button
|
||||
type="button"
|
||||
color="red"
|
||||
disabled={!canSubmit}
|
||||
onClick={() => void handleConfirm()}
|
||||
>
|
||||
반려
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
type RejectRequest,
|
||||
type ReportStatusResponseDto,
|
||||
statisticsApprovalApi,
|
||||
type VrfcSttsRejectRequest,
|
||||
type StatisticsVerificationFilterState,
|
||||
statisticsVerificationReportColumnInfo,
|
||||
statisticsVerificationResultColumnInfo,
|
||||
@@ -52,6 +53,7 @@ import {
|
||||
type ApprovalFormData,
|
||||
ApprovalInputDialog,
|
||||
} from "@/components/statistics/verification/ApprovalInputDialog";
|
||||
import { RejectReasonInputDialog } from "@/components/statistics/verification/RejectReasonInputDialog";
|
||||
import type { CellEditedCallbackParams } from "@/components/type/DataGrid.type";
|
||||
import { doList } from "@/components/util/column/input/DoList";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
@@ -181,6 +183,7 @@ function StatisticsVerificationReport() {
|
||||
VerifyResultItem[]
|
||||
>([]);
|
||||
const [approvalDialogOpen, setApprovalDialogOpen] = useState(false);
|
||||
const [rejectDialogOpen, setRejectDialogOpen] = useState(false);
|
||||
const editedResultRowMapRef = useRef<Map<number, VerifyResultItem>>(
|
||||
new Map(),
|
||||
);
|
||||
@@ -188,7 +191,7 @@ function StatisticsVerificationReport() {
|
||||
const prevLengthRef = useRef(0);
|
||||
const rejectedVrfcSnRef = useRef<Set<number>>(new Set());
|
||||
|
||||
const userInstSeCd = userInfo?.instSeCd;
|
||||
const userInstSeCd = userInfo?.laeSeCd;
|
||||
const { data: sidoData } = useSidoList({ instSeCd: userInstSeCd });
|
||||
const sidoList = sidoData?.sidoList ?? [];
|
||||
const selectedSidoBsnmCd = filters.ctpvSewerBzmnCd ?? "";
|
||||
@@ -383,6 +386,11 @@ function StatisticsVerificationReport() {
|
||||
},
|
||||
});
|
||||
|
||||
const { mutateAsync: onVrfcSttsRejectStats } = useMutationWrapper({
|
||||
mutationFn: (rejectRequests: VrfcSttsRejectRequest[]) =>
|
||||
statisticsApprovalApi.VrfcSttsRejectStats(rejectRequests),
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!statisticsVerificationReportQuery.isError) return;
|
||||
alert("통계검증리포트 조회 중 오류가 발생했습니다.");
|
||||
@@ -593,6 +601,58 @@ function StatisticsVerificationReport() {
|
||||
}
|
||||
}
|
||||
|
||||
function handleVrfcSttsReject() {
|
||||
if (selectedReportRows.length === 0) return;
|
||||
setRejectDialogOpen(true);
|
||||
}
|
||||
|
||||
async function handleVrfcSttsRejectConfirm(reason: string) {
|
||||
const rjctOpnnCn = reason.trim();
|
||||
if (!rjctOpnnCn) {
|
||||
alert("반려 사유를 작성해주세요.");
|
||||
return;
|
||||
}
|
||||
|
||||
const rejectRequests: VrfcSttsRejectRequest[] = selectedReportRows.map(
|
||||
(row) => ({
|
||||
statsYr: filters.statsYr,
|
||||
sewerBzmnCd: row.sewerBzmnCd ?? "",
|
||||
statsCd: row.statsCd ?? "",
|
||||
rjctOpnnCn,
|
||||
mdfrUuid: userInfo?.userUnqId ?? "",
|
||||
}),
|
||||
);
|
||||
|
||||
try {
|
||||
const data = await onVrfcSttsRejectStats(rejectRequests);
|
||||
if (
|
||||
data.resultCode &&
|
||||
data.resultCode.toLowerCase() !== "success"
|
||||
) {
|
||||
alert(data.message || "반려 중 오류가 발생했습니다.");
|
||||
return;
|
||||
}
|
||||
alert(data.message ?? "반려가 완료되었습니다.");
|
||||
setRejectDialogOpen(false);
|
||||
setSelectedReportRows([]);
|
||||
resetResultState();
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.ST_SERVICE.INPUT, "validation-report"],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
ENDPOINT.ST_SERVICE.INPUTVERIFY,
|
||||
"verify-results",
|
||||
],
|
||||
}),
|
||||
]);
|
||||
} catch {
|
||||
alert("반려 중 오류가 발생했습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function handleReportRefresh() {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [ENDPOINT.ST_SERVICE.INPUT, "validation-report"],
|
||||
@@ -612,6 +672,11 @@ function StatisticsVerificationReport() {
|
||||
onOpenChange={setApprovalDialogOpen}
|
||||
onConfirm={handleApprovalConfirm}
|
||||
/>
|
||||
<RejectReasonInputDialog
|
||||
open={rejectDialogOpen}
|
||||
onOpenChange={setRejectDialogOpen}
|
||||
onConfirm={handleVrfcSttsRejectConfirm}
|
||||
/>
|
||||
<div className="flex justify-between p-2">
|
||||
<div className="flex items-center gap-6">
|
||||
<FilterSelect
|
||||
@@ -679,6 +744,18 @@ function StatisticsVerificationReport() {
|
||||
>
|
||||
승인
|
||||
</Button>
|
||||
<Button
|
||||
color="red"
|
||||
onClick={handleVrfcSttsReject}
|
||||
disabled={selectedReportRows.length === 0 ||
|
||||
!selectedReportRows.every(
|
||||
(row) =>
|
||||
row.mctpvPicSbmsnSttsCd === "3" && row.pbcpSbmsnSttsCd !== "3",
|
||||
)
|
||||
}
|
||||
>
|
||||
반려
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
import { ValueType } from "realgrid";
|
||||
|
||||
import type { ColumnConfig, ColumnLayoutItem } from "@/components/type/DataGrid.type";
|
||||
import type { ColumnConfig, ColumnInfoList, ColumnLayoutItem } from "@/components/type/DataGrid.type";
|
||||
import { footerDecimal2 } from "@/components/util/grid/footerSummary";
|
||||
|
||||
// 하수도 통계 관리 > 02.하수관로 > tab 3. 관종별 현황
|
||||
// SeweragePipeInputPipeTypeStatusItem + commonInfo.ctpvNm (그리드 행에 병합)
|
||||
//
|
||||
// 연도 그룹: y1995 = 1996년 이전, y1996 = 1996년 …
|
||||
// 표시 구간: 1996년 ~ (현재 연도 − 1) 까지.
|
||||
// 표시 구간: 1996년 ~ 조회 연도(statsYr) 까지.
|
||||
|
||||
/** 이 모듈이 로드될 때의 “데이터 기준 마지막 연도” (현재 연도 − 1) */
|
||||
const lastDataYear = new Date().getFullYear() - 1;
|
||||
const firstGroupedYear = 1995;
|
||||
const firstVisibleYear = 1996;
|
||||
|
||||
/** 조회 연도까지 연도 컬럼을 그림. 조회 전이면 현재 연도 − 1. */
|
||||
export function resolvePipeTypeColumnEndYear(statsYr?: string | number | null): number {
|
||||
const parsed = Number(statsYr);
|
||||
if (Number.isFinite(parsed) && parsed > 0) {
|
||||
return Math.max(firstGroupedYear, Math.floor(parsed));
|
||||
}
|
||||
return Math.max(firstGroupedYear, new Date().getFullYear() - 1);
|
||||
}
|
||||
|
||||
const yearField = (year: number, suffix: "PrlgWhol" | "LyngPrlg" | "DmltnPrlg") =>
|
||||
`y${year}${suffix}`;
|
||||
|
||||
@@ -61,17 +68,25 @@ const yearCols = (
|
||||
];
|
||||
};
|
||||
|
||||
const visibleYears =
|
||||
lastDataYear < firstVisibleYear
|
||||
? []
|
||||
: Array.from(
|
||||
{ length: lastDataYear - firstVisibleYear + 1 },
|
||||
(_, i) => firstVisibleYear + i,
|
||||
);
|
||||
function buildVisibleYears(lastDataYear: number): number[] {
|
||||
if (lastDataYear < firstVisibleYear) return [];
|
||||
return Array.from(
|
||||
{ length: lastDataYear - firstVisibleYear + 1 },
|
||||
(_, i) => firstVisibleYear + i,
|
||||
);
|
||||
}
|
||||
|
||||
const yearLayoutItems: ColumnLayoutItem[] = [];
|
||||
for (const y of visibleYears) {
|
||||
yearLayoutItems.push({
|
||||
export type PipeTypeStatusInpColumnConfig = ColumnInfoList & {
|
||||
columns: ColumnConfig[];
|
||||
columnLayout: ColumnLayoutItem[];
|
||||
};
|
||||
|
||||
export function getPipeTypeStatusInpColumn(
|
||||
statsYr?: string | number | null,
|
||||
): PipeTypeStatusInpColumnConfig {
|
||||
const lastDataYear = resolvePipeTypeColumnEndYear(statsYr);
|
||||
const visibleYears = buildVisibleYears(lastDataYear);
|
||||
const yearLayoutItems: ColumnLayoutItem[] = visibleYears.map((y) => ({
|
||||
name: `year${y}`,
|
||||
hideChildHeaders: false,
|
||||
header: { text: `${y}년` },
|
||||
@@ -80,145 +95,147 @@ for (const y of visibleYears) {
|
||||
yearField(y, "LyngPrlg"),
|
||||
yearField(y, "DmltnPrlg"),
|
||||
],
|
||||
});
|
||||
}));
|
||||
|
||||
return {
|
||||
columns: [
|
||||
{
|
||||
name: "ctpvNm",
|
||||
fieldName: "ctpvNm",
|
||||
header: { text: "시도" },
|
||||
footer: { text: "합계" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "sggNm",
|
||||
fieldName: "sggNm",
|
||||
header: { text: "시군구" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "pipeSeNm",
|
||||
fieldName: "pipeSeNm",
|
||||
header: { text: "관종" },
|
||||
footer: { text: "합계" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "admdstNm",
|
||||
fieldName: "admdstNm",
|
||||
header: { text: "행정구역명" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "pipeByPrstWhol",
|
||||
fieldName: "pipeByPrstWhol",
|
||||
header: { text: "계" },
|
||||
styleName: "rg-cell-total",
|
||||
footer: footerDecimal2,
|
||||
editable: false,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
computed: {
|
||||
minuendFields: [
|
||||
yearField(firstGroupedYear, "LyngPrlg"),
|
||||
...visibleYears.map((year) => yearField(year, "LyngPrlg")),
|
||||
],
|
||||
subtrahendFields: [
|
||||
yearField(firstGroupedYear, "DmltnPrlg"),
|
||||
...visibleYears.map((year) => yearField(year, "DmltnPrlg")),
|
||||
],
|
||||
type: "differenceOfSums" as const,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "lyngPrlg",
|
||||
fieldName: "lyngPrlg",
|
||||
header: { text: "매설연장(m)" },
|
||||
styleName: "rg-cell-total",
|
||||
footer: footerDecimal2,
|
||||
editable: false,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
},
|
||||
{
|
||||
name: "dmltnPrlg",
|
||||
fieldName: "dmltnPrlg",
|
||||
header: { text: "철거연장(m)" },
|
||||
styleName: "rg-cell-total",
|
||||
footer: footerDecimal2,
|
||||
editable: false,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
computed: {
|
||||
fields: [
|
||||
yearField(firstGroupedYear, "DmltnPrlg"),
|
||||
...visibleYears.map((year) => yearField(year, "DmltnPrlg")),
|
||||
],
|
||||
type: "sum" as const,
|
||||
},
|
||||
},
|
||||
...yearCols(firstGroupedYear, { footer: footerDecimal2 }),
|
||||
...visibleYears.map((year) =>
|
||||
yearCols(year, {
|
||||
footer: footerDecimal2,
|
||||
}),
|
||||
).flat(),
|
||||
{ name: "rmrk", fieldName: "rmrk", header: { text: "비고" } },
|
||||
{
|
||||
name: "admdstCd",
|
||||
fieldName: "admdstCd",
|
||||
header: { text: "행정구역코드" },
|
||||
visible: false,
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "pipeSeCd",
|
||||
fieldName: "pipeSeCd",
|
||||
header: { text: "관종코드" },
|
||||
visible: false,
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
] as ColumnConfig[],
|
||||
columnLayout: [
|
||||
{
|
||||
name: "adminArea",
|
||||
hideChildHeaders: false,
|
||||
header: { text: "행정구역" },
|
||||
items: [{ column: "ctpvNm", footerUserSpans: [{ colspan: 2 }] }, "sggNm"],
|
||||
},
|
||||
"pipeSeNm",
|
||||
"admdstNm",
|
||||
{
|
||||
name: "totalGroup",
|
||||
hideChildHeaders: false,
|
||||
header: { text: "총계" },
|
||||
items: ["pipeByPrstWhol", "lyngPrlg", "dmltnPrlg"],
|
||||
},
|
||||
{
|
||||
name: "year1996Before",
|
||||
hideChildHeaders: false,
|
||||
header: { text: "1996년 이전" },
|
||||
items: [
|
||||
yearField(firstGroupedYear, "PrlgWhol"),
|
||||
yearField(firstGroupedYear, "LyngPrlg"),
|
||||
yearField(firstGroupedYear, "DmltnPrlg"),
|
||||
],
|
||||
},
|
||||
...yearLayoutItems,
|
||||
"rmrk",
|
||||
"admdstCd",
|
||||
"pipeSeCd",
|
||||
] as ColumnLayoutItem[],
|
||||
rowStartNum: 2,
|
||||
fixedColumns: 2,
|
||||
tabKey: "ST00020003",
|
||||
tabLabel: "관종별 현황",
|
||||
};
|
||||
}
|
||||
|
||||
export const PipeTypeStatusInpColumn = {
|
||||
columns: [
|
||||
{
|
||||
name: "ctpvNm",
|
||||
fieldName: "ctpvNm",
|
||||
header: { text: "시도" },
|
||||
footer: { text: "합계" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "sggNm",
|
||||
fieldName: "sggNm",
|
||||
header: { text: "시군구" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "pipeSeNm",
|
||||
fieldName: "pipeSeNm",
|
||||
header: { text: "관종" },
|
||||
footer: { text: "합계" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "admdstNm",
|
||||
fieldName: "admdstNm",
|
||||
header: { text: "행정구역명" },
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "pipeByPrstWhol",
|
||||
fieldName: "pipeByPrstWhol",
|
||||
header: { text: "계" },
|
||||
styleName: "rg-cell-total",
|
||||
footer: footerDecimal2,
|
||||
editable: false,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
computed: {
|
||||
minuendFields: [
|
||||
yearField(firstGroupedYear, "LyngPrlg"),
|
||||
...visibleYears.map((year) => yearField(year, "LyngPrlg")),
|
||||
],
|
||||
subtrahendFields: [
|
||||
yearField(firstGroupedYear, "DmltnPrlg"),
|
||||
...visibleYears.map((year) => yearField(year, "DmltnPrlg")),
|
||||
],
|
||||
type: "differenceOfSums" as const,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "lyngPrlg",
|
||||
fieldName: "lyngPrlg",
|
||||
header: { text: "매설연장(m)" },
|
||||
styleName: "rg-cell-total",
|
||||
footer: footerDecimal2,
|
||||
editable: false,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
},
|
||||
{
|
||||
name: "dmltnPrlg",
|
||||
fieldName: "dmltnPrlg",
|
||||
header: { text: "철거연장(m)" },
|
||||
styleName: "rg-cell-total",
|
||||
footer: footerDecimal2,
|
||||
editable: false,
|
||||
valueType: ValueType.NUMBER,
|
||||
dataFormat: "#,##0.00",
|
||||
computed: {
|
||||
fields: [
|
||||
yearField(firstGroupedYear, "DmltnPrlg"),
|
||||
...visibleYears.map((year) => yearField(year, "DmltnPrlg")),
|
||||
],
|
||||
type: "sum" as const,
|
||||
},
|
||||
},
|
||||
...yearCols(firstGroupedYear, { footer: footerDecimal2 }),
|
||||
...visibleYears.map((year) =>
|
||||
yearCols(year, {
|
||||
footer: footerDecimal2,
|
||||
}),
|
||||
).flat(),
|
||||
{ name: "rmrk", fieldName: "rmrk", header: { text: "비고" } },
|
||||
{
|
||||
name: "admdstCd",
|
||||
fieldName: "admdstCd",
|
||||
header: { text: "행정구역코드" },
|
||||
visible: false,
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
{
|
||||
name: "pipeSeCd",
|
||||
fieldName: "pipeSeCd",
|
||||
header: { text: "관종코드" },
|
||||
visible: false,
|
||||
editable: false,
|
||||
styleName: "rg-cell-readonly",
|
||||
},
|
||||
] as ColumnConfig[],
|
||||
columnLayout: [
|
||||
{
|
||||
name: "adminArea",
|
||||
hideChildHeaders: false,
|
||||
header: { text: "행정구역" },
|
||||
items: [{ column: "ctpvNm", footerUserSpans: [{ colspan: 2 }] }, "sggNm"],
|
||||
},
|
||||
"pipeSeNm",
|
||||
"admdstNm",
|
||||
{
|
||||
name: "totalGroup",
|
||||
hideChildHeaders: false,
|
||||
header: { text: "총계" },
|
||||
items: ["pipeByPrstWhol", "lyngPrlg", "dmltnPrlg"],
|
||||
},
|
||||
{
|
||||
name: "year1996Before",
|
||||
hideChildHeaders: false,
|
||||
header: { text: "1996년 이전" },
|
||||
items: [
|
||||
yearField(firstGroupedYear, "PrlgWhol"),
|
||||
yearField(firstGroupedYear, "LyngPrlg"),
|
||||
yearField(firstGroupedYear, "DmltnPrlg"),
|
||||
],
|
||||
},
|
||||
...yearLayoutItems,
|
||||
'rmrk',
|
||||
'admdstCd',
|
||||
'pipeSeCd'
|
||||
] as ColumnLayoutItem[],
|
||||
rowStartNum: 2,
|
||||
fixedColumns: 2,
|
||||
tabKey: "ST00020003",
|
||||
tabLabel: "관종별 현황",
|
||||
};
|
||||
export const PipeTypeStatusInpColumn = getPipeTypeStatusInpColumn();
|
||||
|
||||
@@ -6,6 +6,8 @@ import type {
|
||||
ApproveRequest,
|
||||
RejectRequest,
|
||||
StatisticsApprovalService,
|
||||
VrfcSttsRejectRequest,
|
||||
VrfcSttsRejectResponse,
|
||||
} from "../model/statistics-approval-interface";
|
||||
|
||||
class StatisticsApprovalApiService implements StatisticsApprovalService {
|
||||
@@ -28,6 +30,14 @@ class StatisticsApprovalApiService implements StatisticsApprovalService {
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
public async VrfcSttsRejectStats(params: VrfcSttsRejectRequest[]): Promise<VrfcSttsRejectResponse> {
|
||||
const response = await client.post<VrfcSttsRejectResponse>(
|
||||
`${ENDPOINT.ST_SERVICE.APPROVAL}/reject?type=VRFC_STTS`,
|
||||
params,
|
||||
);
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
|
||||
export const statisticsApprovalApi = new StatisticsApprovalApiService();
|
||||
|
||||
@@ -11,9 +11,16 @@ export { useScheduleInfo } from "./api/dashboard/schedule-info-queries";
|
||||
export { scheduleInfoApi } from "./api/dashboard/schedule-info-service";
|
||||
export { imrApi } from "./api/imr-api";
|
||||
export {
|
||||
JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM,
|
||||
JEONNAM_GWANGJU_SIDO_ALL_SAVE_SUBMIT_MESSAGE,
|
||||
JEONNAM_GWANGJU_SGG_NOT_APPLICABLE_SEWER_BZMN_CD_SET,
|
||||
JEONNAM_GWANGJU_UNIFIED_SIDO_CD,
|
||||
isJeonnamGwangjuHeadquartersOperableRow,
|
||||
isJeonnamGwangjuSggNotApplicableSearch,
|
||||
isJeonnamGwangjuSidoAllSearch,
|
||||
isJeonnamGwangjuSidoAllToolbarException,
|
||||
isSewerageFinanceStatsCd,
|
||||
shouldRestrictFinanceVerificationToHeadquarters,
|
||||
} from "./lib/jeonnam-gwangju-sido-all-toolbar";
|
||||
export {
|
||||
filterBySelectedAdmdstCd,
|
||||
@@ -146,6 +153,7 @@ export {
|
||||
type ApprovalResponse,
|
||||
type ApproveRequest,
|
||||
type RejectRequest,
|
||||
type VrfcSttsRejectRequest,
|
||||
} from "./model/statistics-approval-interface";
|
||||
export {
|
||||
type SearchCondition,
|
||||
|
||||
@@ -5,6 +5,39 @@ import type { Sido } from "../model/statistics-interface";
|
||||
/** 전남광주통합특별시 — 도 목록에 있어 시군구 전체 조회 시 버튼이 숨겨짐 */
|
||||
export const JEONNAM_GWANGJU_UNIFIED_SIDO_CD = "1200000000";
|
||||
|
||||
export const JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM = "본청";
|
||||
|
||||
/** 12-1·12-2 — 본청만 남아도 해당사항 없음 조건을 적용하는 전남광주 시군구 */
|
||||
export const JEONNAM_GWANGJU_SGG_NOT_APPLICABLE_SEWER_BZMN_CD_SET = new Set([
|
||||
"1221000000",
|
||||
"1224000000",
|
||||
"1227000000",
|
||||
"1230000000",
|
||||
"1233000000",
|
||||
]);
|
||||
|
||||
export function isJeonnamGwangjuSggNotApplicableSearch(
|
||||
values: SidoGugunLookup | null | undefined,
|
||||
): boolean {
|
||||
return JEONNAM_GWANGJU_SGG_NOT_APPLICABLE_SEWER_BZMN_CD_SET.has(
|
||||
(values?.bsnmCd ?? "").trim(),
|
||||
);
|
||||
}
|
||||
|
||||
/** 입력 9-1 ~ 9-4 */
|
||||
export const SEWERAGE_FINANCE_STATS_CD_SET = new Set([
|
||||
"ST00090001",
|
||||
"ST00090002",
|
||||
"ST00090003",
|
||||
"ST00090004",
|
||||
]);
|
||||
|
||||
/** 입력 12-1, 12-2 */
|
||||
export const SEWAGE_EXCRETA_RELATED_PUBLIC_STATS_CD_SET = new Set([
|
||||
"ST00120001",
|
||||
"ST00120002",
|
||||
]);
|
||||
|
||||
export const SIDO_ALL_TOOLBAR_USER_IDS = new Set(["CLEANWATER", "S3291"]);
|
||||
|
||||
function isEmptyOrAllGugun(values: SidoGugunLookup | null | undefined): boolean {
|
||||
@@ -43,3 +76,39 @@ export function isJeonnamGwangjuSidoAllToolbarException(
|
||||
}
|
||||
return isJeonnamGwangjuSidoAllSearch(sidoList, values);
|
||||
}
|
||||
|
||||
export function isSewerageFinanceStatsCd(statsCd: string | null | undefined): boolean {
|
||||
return SEWERAGE_FINANCE_STATS_CD_SET.has((statsCd ?? "").trim());
|
||||
}
|
||||
|
||||
export function isSewageExcretaRelatedPublicStatsCd(
|
||||
statsCd: string | null | undefined,
|
||||
): boolean {
|
||||
return SEWAGE_EXCRETA_RELATED_PUBLIC_STATS_CD_SET.has((statsCd ?? "").trim());
|
||||
}
|
||||
|
||||
/** 9-1~4·12-1·12-2 + 전남광주(1200000000) 시군구 전체 조회 시, 검증 결과에서 본청만 조작 */
|
||||
export function shouldRestrictFinanceVerificationToHeadquarters(
|
||||
statsCd: string | null | undefined,
|
||||
sewerBzmnCd: string | null | undefined,
|
||||
sggNm?: string | null,
|
||||
): boolean {
|
||||
const sgg = String(sggNm ?? "").trim();
|
||||
const isAllSgg = !sgg || sgg === "ALL";
|
||||
return (
|
||||
(isSewerageFinanceStatsCd(statsCd) ||
|
||||
isSewageExcretaRelatedPublicStatsCd(statsCd)) &&
|
||||
String(sewerBzmnCd ?? "").trim() === JEONNAM_GWANGJU_UNIFIED_SIDO_CD &&
|
||||
isAllSgg
|
||||
);
|
||||
}
|
||||
|
||||
export function isJeonnamGwangjuHeadquartersOperableRow(row: {
|
||||
sewerBzmnCd?: string | number | null;
|
||||
admdstNm?: string | number | null;
|
||||
}): boolean {
|
||||
return (
|
||||
String(row.sewerBzmnCd ?? "").trim() === JEONNAM_GWANGJU_UNIFIED_SIDO_CD &&
|
||||
String(row.admdstNm ?? "").trim() === JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM
|
||||
);
|
||||
}
|
||||
|
||||
-1
@@ -211,7 +211,6 @@ export interface PublicSewageFacilitySaveItem {
|
||||
swtrmtFcltCd: string | null;
|
||||
swtrmtFcltNm: string | null;
|
||||
fcltSn: string | null;
|
||||
fcltPstnCn: string | null;
|
||||
|
||||
inflwSwagePhysQnt: number;
|
||||
inflwSwageBoilQnt: number;
|
||||
|
||||
@@ -25,7 +25,23 @@ export interface ApprovalResponse {
|
||||
exceptionCnt: number;
|
||||
}
|
||||
|
||||
|
||||
export interface VrfcSttsRejectRequest {
|
||||
statsYr: string;
|
||||
sewerBzmnCd: string;
|
||||
statsCd: string;
|
||||
rjctOpnnCn: string;
|
||||
mdfrUuid: string;
|
||||
}
|
||||
|
||||
export interface VrfcSttsRejectResponse {
|
||||
message: string;
|
||||
resultCode: string;
|
||||
updatedStts: string;
|
||||
}
|
||||
|
||||
export interface StatisticsApprovalService {
|
||||
approveStats(params: ApproveRequest[]): Promise<ApprovalResponse>;
|
||||
rejectStats(params: RejectRequest[]): Promise<ApprovalResponse>;
|
||||
VrfcSttsRejectStats(params: VrfcSttsRejectRequest[]): Promise<VrfcSttsRejectResponse>;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export function useSearchConditionSidoList(options?: { isInput?: boolean }): {
|
||||
sidoList: Sido[];
|
||||
isReady: boolean;
|
||||
} {
|
||||
const instSeCd = useUserStore((state) => state.userInfo?.instSeCd ?? "");
|
||||
const instSeCd = useUserStore((state) => state.userInfo?.laeSeCd ?? "");
|
||||
const kind: SearchConditionKind = options?.isInput ? "input" : "default";
|
||||
const { data } = useSWR(
|
||||
SEARCH_CONDITION_SWR_KEY(instSeCd, kind),
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
# 공단 운영
|
||||
NEXT_PUBLIC_SITE_ID = WR
|
||||
NEXT_PUBLIC_PORT = 3000
|
||||
NEXT_PUBLIC_CLAIM_NAME = Authorization
|
||||
NEXT_PUBLIC_AUTH_USER_ID = token-id
|
||||
NEXT_PUBLIC_ACCESS_TOKEN = access-token
|
||||
NEXT_PUBLIC_REFRESH_TOKEN = refresh-token
|
||||
#NEXT_PUBLIC_PROXY_HOST = https://devtiger.hasuon.or.kr
|
||||
#NEXT_PUBLIC_CM_LOGIN_PAGE_URL = https://devqueen.hasuon.or.kr/auth/login
|
||||
SERVER_API_URL = https://apigateway.hasuon.or.kr
|
||||
FO_SERVER_API_URL = https://apigateway.hasuon.or.kr/operation-service/api/v1
|
||||
CS_SERVER_API_URL = https://apigateway.hasuon.or.kr
|
||||
NEXT_PUBLIC_CS_TUS_UPLOAD = /attach-service/api/v1/tus/upload
|
||||
NEXT_PUBLIC_GEOSERVER_URL = http://apigateway.hasuon.or.kr/reuse-service/api/v1/geoserver-proxy/geoserver
|
||||
NEXT_PUBLIC_LX_GEOSERVER_URL = http://apigateway.hasuon.or.kr/reuse-service/api/v1/geoserver-proxy/geoserver_swl
|
||||
WR_SERVER_API_URL = https://apigateway.hasuon.or.kr/reuse-service/api/v1
|
||||
SEWERAGE_API_URL = https://apigateway.hasuon.or.kr/sewerage-service
|
||||
NEXT_PUBLIC_NGII_URL = https://map.ngii.go.kr
|
||||
NEXT_PUBLIC_NGII_PARAM = 04trYP9_xwLAfALjwZ-B8g&service=WMTS&request=GetTile&version=1.0.0&format=image/png&layer=korean_map&style=korean&tilematrixset=korean&tilematrix={z}&tilecol={x}&tilerow={y}
|
||||
NEXT_PUBLIC_HASUDOINFO = https://www.hasudoinfo.or.kr
|
||||
NEXT_PUBLIC_HASUDOINFO_IN = http://10.101.163.102:8889
|
||||
NEXT_PUBLIC_FINDADRESS_URL=https://business.juso.go.kr/addrlink/addrLinkApi.do
|
||||
NEXT_PRIVATE_WR_ADDRESS_KEY = U01TXOFVVEgyMDI1MDgyODE0MTAxNzExNjEyMjA=
|
||||
NEXT_PUBLIC_COOKIE_DOMAIN=.hasuon.or.kr
|
||||
NEXT_PUBLIC_NGII_CLIENT_URL = https://map.ngii.go.kr
|
||||
@@ -0,0 +1,68 @@
|
||||
import type { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
/**
|
||||
* 브라우저 실제 IP를 백엔드로 전달하기 위한 헤더 이름.
|
||||
*
|
||||
* 구조: [브라우저] → [앱 Ingress] → [Next middleware] → [API Ingress] → [apigateway]
|
||||
* - 앱 Ingress(ingress-nginx 기본 설정)가 X-Forwarded-For를 실제 접속 IP(브라우저)로 채웁니다.
|
||||
* - API Ingress는 X-Forwarded-For / X-Real-IP를 middleware IP로 덮어쓰므로, 별도 헤더로 브라우저 IP를 넘깁니다.
|
||||
* - 백엔드 LogUtil.getUserIp()가 이 헤더를 가장 먼저 읽습니다.
|
||||
*
|
||||
* 브라우저가 같은 이름의 헤더를 보내도 middleware가 항상 덮어쓰거나 지웁니다(위조 방지).
|
||||
*/
|
||||
export const CLIENT_IP_HEADER = "x-client-ip";
|
||||
|
||||
const OVERRIDE_HEADERS = "x-middleware-override-headers";
|
||||
const REQUEST_HEADER_PREFIX = "x-middleware-request-";
|
||||
const REWRITE_HEADER = "x-middleware-rewrite";
|
||||
|
||||
/** 앱 Ingress가 채운 X-Forwarded-For 첫 번째 값(브라우저 IP)을 구합니다. */
|
||||
export function resolveClientIp(req: NextRequest): string {
|
||||
const forwardedFor = req.headers.get("x-forwarded-for") ?? "";
|
||||
let ip = forwardedFor.split(",")[0]?.trim() ?? "";
|
||||
if (!ip) {
|
||||
ip = req.headers.get("x-real-ip")?.trim() ?? "";
|
||||
}
|
||||
if (ip.toLowerCase().startsWith("::ffff:") && ip.includes(".")) {
|
||||
ip = ip.substring("::ffff:".length);
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* middleware가 만든 rewrite 응답에 X-Client-IP 요청 헤더를 붙입니다.
|
||||
* (NextResponse.rewrite(url, { request: { headers } }) 와 같은 방식으로 요청 헤더를 덮어씀)
|
||||
* rewrite가 아닌 응답(NextResponse.next 등)은 그대로 반환합니다.
|
||||
*/
|
||||
export function attachClientIp(req: NextRequest, res: NextResponse): NextResponse {
|
||||
if (!res || !res.headers.has(REWRITE_HEADER)) {
|
||||
return res;
|
||||
}
|
||||
|
||||
const ip = resolveClientIp(req);
|
||||
const existing = res.headers.get(OVERRIDE_HEADERS);
|
||||
|
||||
// 백엔드로 넘길 요청 헤더 이름 목록
|
||||
const names = new Set<string>();
|
||||
if (existing) {
|
||||
existing.split(",").map((name) => name.trim().toLowerCase()).filter(Boolean).forEach((name) => names.add(name));
|
||||
} else {
|
||||
req.headers.forEach((value, key) => {
|
||||
const name = key.toLowerCase();
|
||||
names.add(name);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + name, value);
|
||||
});
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
names.add(CLIENT_IP_HEADER);
|
||||
res.headers.set(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER, ip);
|
||||
} else {
|
||||
// IP를 못 구하면 브라우저가 보낸 X-Client-IP가 그대로 넘어가지 않도록 제거
|
||||
names.delete(CLIENT_IP_HEADER);
|
||||
res.headers.delete(REQUEST_HEADER_PREFIX + CLIENT_IP_HEADER);
|
||||
}
|
||||
|
||||
res.headers.set(OVERRIDE_HEADERS, Array.from(names).join(","));
|
||||
return res;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { attachClientIp } from "./client-ip";
|
||||
import { CS_URL } from "./components/lib/config";
|
||||
import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config";
|
||||
|
||||
@@ -45,7 +46,7 @@ function rewriteWith(url: string, req: NextRequest, withAuth = false): NextRespo
|
||||
: NextResponse.rewrite(new URL(url));
|
||||
}
|
||||
|
||||
export function middleware(req: NextRequest) {
|
||||
function baseMiddleware(req: NextRequest) {
|
||||
const pathname = req.nextUrl.pathname;
|
||||
console.log(`[Middleware] Request URL: ${req.url}`);
|
||||
const searchParams = req.nextUrl.searchParams;
|
||||
@@ -187,6 +188,11 @@ export function middleware(req: NextRequest) {
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
/** 백엔드로 브라우저 IP(X-Client-IP)를 전달하도록 rewrite 응답에 요청 헤더를 추가 */
|
||||
export function middleware(req: NextRequest) {
|
||||
return attachClientIp(req, baseMiddleware(req));
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
"/cms-service/:path*",
|
||||
|
||||
+55
-6
@@ -11,21 +11,70 @@ const common = {
|
||||
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
NODE_TLS_REJECT_UNAUTHORIZED: '0',
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
apps: [
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'cs-app',
|
||||
cwd: './apps/cs',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3000',
|
||||
|
||||
error_file: './logs/cs-error.log',
|
||||
out_file: './logs/cs-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'st-app',
|
||||
cwd: './apps/st',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3001',
|
||||
|
||||
error_file: './logs/st-error.log',
|
||||
out_file: './logs/st-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'as2-app',
|
||||
name: 'cm-app',
|
||||
cwd: './apps/cm',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3002',
|
||||
|
||||
error_file: './logs/cm-error.log',
|
||||
out_file: './logs/cm-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'as-app',
|
||||
cwd: './apps/as',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3004',
|
||||
error_file: './logs/as2-error.log',
|
||||
out_file: './logs/as2-out.log',
|
||||
}
|
||||
|
||||
error_file: './logs/cm-error.log',
|
||||
out_file: './logs/cm-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'features-app',
|
||||
cwd: './apps/common/features',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 13000',
|
||||
|
||||
error_file: './logs/feature-error.log',
|
||||
out_file: './logs/feature-out.log',
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
const common = {
|
||||
exec_mode: 'cluster',
|
||||
instances: 2,
|
||||
|
||||
autorestart: true,
|
||||
max_memory_restart: '1G',
|
||||
watch: false,
|
||||
|
||||
merge_logs: true,
|
||||
log_date_format: 'YYYY-MM-DD HH:mm:ss Z',
|
||||
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
},
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'cs-app',
|
||||
cwd: './apps/cs',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3000',
|
||||
|
||||
error_file: './logs/cs-error.log',
|
||||
out_file: './logs/cs-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'st-app',
|
||||
cwd: './apps/st',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3001',
|
||||
|
||||
error_file: './logs/st-error.log',
|
||||
out_file: './logs/st-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'cm-app',
|
||||
cwd: './apps/cm',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3002',
|
||||
|
||||
error_file: './logs/cm-error.log',
|
||||
out_file: './logs/cm-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'as-app',
|
||||
cwd: './apps/as',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 3004',
|
||||
|
||||
error_file: './logs/cm-error.log',
|
||||
out_file: './logs/cm-out.log',
|
||||
},
|
||||
{
|
||||
...common,
|
||||
|
||||
name: 'features-app',
|
||||
cwd: './apps/common/features',
|
||||
|
||||
script: 'node_modules/next/dist/bin/next',
|
||||
args: 'start -p 13000',
|
||||
|
||||
error_file: './logs/feature-error.log',
|
||||
out_file: './logs/feature-out.log',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -44,7 +44,7 @@ GisApp.GOOGLE_HYBRID_URL = `https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}&k
|
||||
GisApp.GOOGLE_3D_URL = `https://tile.googleapis.com/v1/3dtiles/root.json?key=${GisApp.GOOGLE_API_KEY}`;
|
||||
|
||||
// NGII 정보(배경지도)
|
||||
//GisApp.NGII_WMTS_URL = process.env.NEXT_PUBLIC_NGII_URL;
|
||||
GisApp.NGII_WMTS_BASE = process.env.NEXT_PUBLIC_NGII_CLIENT_URL || '/ngii-server'; // NGII 타일 호출 기준 주소. 값이 없으면 기존처럼 Next 서버(middleware)를 경유한다.
|
||||
GisApp.NGII_WMTS_PARAM = process.env.NEXT_PUBLIC_NGII_PARAM ?? '';
|
||||
|
||||
GisApp.EMAP_URL = '/emap/';
|
||||
@@ -83,8 +83,9 @@ GisApp.getNgiiWmtsUrl = function (layerName, matrix, x, y) {
|
||||
const layerAwareParams = /(^|&)layer=[^&]*/i.test(GisApp.NGII_WMTS_PARAM)
|
||||
? GisApp.NGII_WMTS_PARAM.replace(/(^|&)layer=[^&]*/i, `$1layer=${layerName}`)
|
||||
: `${GisApp.NGII_WMTS_PARAM}&layer=${layerName}`;
|
||||
|
||||
return `/ngii-server/openapi/Gettile.do?apikey=${layerAwareParams}`
|
||||
|
||||
return `${GisApp.NGII_WMTS_BASE}/openapi/Gettile.do?apikey=${layerAwareParams}`
|
||||
//return `/ngii-server/openapi/Gettile.do?apikey=${layerAwareParams}`
|
||||
.replace("{z}", matrix)
|
||||
.replace("{x}", x)
|
||||
.replace("{y}", y);
|
||||
|
||||
@@ -1,31 +1,41 @@
|
||||
import "./header.css";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
|
||||
import { useEffect, useCallback, useState, useRef } from "react";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { Minus, Plus } from "lucide-react";
|
||||
|
||||
import { images } from "@common/assets";
|
||||
import type { AuthService, TokenManager } from "@common/auth";
|
||||
import { getRemainingMs } from "@common/auth";
|
||||
import { getConfig } from "@common/config";
|
||||
import { getAuthLoginRedirectUrl, isAtLoginRedirectUrl } from "@common/network";
|
||||
import { ENDPOINT } from "../../config";
|
||||
import { setCookie, getCookie } from "../../lib";
|
||||
import { useSessionExtendConfirm } from "../../lib/use-session-extend-confirm";
|
||||
|
||||
import {
|
||||
getPopupInfo,
|
||||
getUserPopupList,
|
||||
getSiteInfo,
|
||||
getUserInfo,
|
||||
type Popup,
|
||||
getSiteList,
|
||||
getUserInfo,
|
||||
getUserPopupList,
|
||||
type Popup,
|
||||
type SiteListResponse,
|
||||
} from "../../api";
|
||||
import { ENDPOINT } from "../../config";
|
||||
import { getCookie, setCookie } from "../../lib";
|
||||
import { useSessionExtendConfirm } from "../../lib/use-session-extend-confirm";
|
||||
import { Button } from "../button";
|
||||
import { Skeleton } from "../skeleton";
|
||||
import { SidebarTrigger } from "../sidebar";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "../dropdown-menu";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
|
||||
import { SearchForm } from "./search-form";
|
||||
import { SidebarTrigger } from "../sidebar";
|
||||
import { Skeleton } from "../skeleton";
|
||||
|
||||
import { NoticePopover } from "./notice-popover";
|
||||
import { SearchForm } from "./search-form";
|
||||
|
||||
import "./header.css";
|
||||
|
||||
const appConfig = getConfig();
|
||||
const userId = getCookie(appConfig.AUTH_USER_ID ?? "");
|
||||
@@ -211,6 +221,8 @@ export function Header({
|
||||
queryFn: () => getSiteList(),
|
||||
enabled: isLoggedIn && !viewOnly,
|
||||
});
|
||||
const activeSites =
|
||||
userSiteList?.content.filter((site) => site.useYn === "Y") ?? [];
|
||||
const handleLogout = () => {
|
||||
if (authService) {
|
||||
void authService.logout();
|
||||
@@ -360,46 +372,70 @@ export function Header({
|
||||
{/* 모바일에서 네비게이션 (토글 시 표시) */}
|
||||
{isMobileMenuOpen && (
|
||||
<div className="w-full border-t border-border bg-background py-2 sm:hidden">
|
||||
{mounted &&
|
||||
userSiteList?.content &&
|
||||
userSiteList.content.length > 0 && (
|
||||
<nav className="flex flex-col items-center gap-2 px-4">
|
||||
{userSiteList.content.map((site) => (
|
||||
<a
|
||||
key={site.siteId}
|
||||
href={siteId === site.siteId ? "#" : site.dmnAddr}
|
||||
className="w-full py-2 text-center text-xl font-medium text-foreground transition-colors hover:text-primary"
|
||||
target={siteId === site.siteId ? "_self" : "_blank"}
|
||||
rel="noopener noreferrer"
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
>
|
||||
{site.siteNm}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* 데스크톱에서 중간 네비게이션 */}
|
||||
{/* Radix ScrollArea 는 body 안에 <style> 을 삽입해 마크업 오류가 발생하므로 기본 가로 스크롤(nav overflow-x-auto) 사용 */}
|
||||
<div className="hidden min-w-0 max-w-[calc(100vw-60rem)] flex-1 items-center justify-center px-2 py-[0.4rem] sm:flex">
|
||||
{mounted &&
|
||||
userSiteList?.content &&
|
||||
userSiteList.content.length > 0 && (
|
||||
<nav className="flex w-full min-w-0 flex-nowrap items-center justify-start gap-3 overflow-x-auto whitespace-nowrap p-[0.6rem] [scrollbar-width:thin] md:gap-6">
|
||||
{userSiteList.content.map((site) => (
|
||||
{mounted && activeSites.length > 0 && (
|
||||
<nav className="flex flex-col items-center gap-2 px-4">
|
||||
{activeSites.map((site) => (
|
||||
<a
|
||||
key={site.siteId}
|
||||
href={siteId === site.siteId ? "#" : site.dmnAddr}
|
||||
className="header-nav-link whitespace-nowrap text-sm font-medium text-foreground transition-colors hover:text-primary md:text-lg lg:text-2xl"
|
||||
className="w-full py-2 text-center text-xl font-medium text-foreground transition-colors hover:text-primary"
|
||||
target={siteId === site.siteId ? "_self" : "_blank"}
|
||||
rel="noopener noreferrer"
|
||||
onClick={() => setIsMobileMenuOpen(false)}
|
||||
>
|
||||
{site.siteNm}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{/* 공간이 부족한 데스크톱에서는 사이트 메뉴를 드롭다운으로 표시 */}
|
||||
{mounted && activeSites.length > 0 && (
|
||||
<div className="hidden items-center px-2 sm:flex 2xl:hidden">
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button className="group m-0 flex h-[3rem] items-center gap-2 !bg-background px-3 py-0 text-label">
|
||||
<span>{siteInfo?.siteNm ?? "사이트 이동"}</span>
|
||||
<i className="diveicon di-chevron-down static p-0 transition-transform group-data-[state=open]:rotate-180" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
className="max-h-[70vh] overflow-y-auto"
|
||||
>
|
||||
{activeSites.map((site) => (
|
||||
<DropdownMenuItem key={site.siteId} asChild>
|
||||
<a
|
||||
href={siteId === site.siteId ? "#" : site.dmnAddr}
|
||||
target={siteId === site.siteId ? "_self" : "_blank"}
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{site.siteNm}
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
))}
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</div>
|
||||
)}
|
||||
{/* 넓은 화면에서는 사이트 메뉴를 가로로 표시 */}
|
||||
<div className="hidden min-w-0 flex-1 items-center justify-center px-2 py-[0.4rem] 2xl:flex">
|
||||
{mounted && activeSites.length > 0 && (
|
||||
<nav className="flex w-full min-w-0 flex-nowrap items-center justify-center gap-3 whitespace-nowrap p-[0.6rem] md:gap-6">
|
||||
{activeSites.map((site) => (
|
||||
<a
|
||||
key={site.siteId}
|
||||
href={siteId === site.siteId ? "#" : site.dmnAddr}
|
||||
className="header-nav-link whitespace-nowrap text-sm font-medium text-foreground transition-colors hover:text-primary md:text-lg lg:text-2xl"
|
||||
target={siteId === site.siteId ? "_self" : "_blank"}
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{site.siteNm}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
{/* 데스크톱에서 오른쪽 요소들 */}
|
||||
<div className="hidden items-center gap-2 px-2 sm:flex md:px-4">
|
||||
@@ -443,7 +479,11 @@ function ScreenZoomControls() {
|
||||
};
|
||||
|
||||
return (
|
||||
<div role="group" className="flex items-center gap-1" aria-label="화면 크기 조절">
|
||||
<div
|
||||
role="group"
|
||||
className="flex items-center gap-1"
|
||||
aria-label="화면 크기 조절"
|
||||
>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
|
||||
Reference in New Issue
Block a user