Merge branch 'iipbs/st/dev' of https://www.onasys.co.kr:3000/ONAANDALL/frontend into iipbs/st/dev
This commit is contained in:
@@ -322,10 +322,14 @@ const DataGrid = ({
|
||||
cellStyleCallback,
|
||||
cellTooltipCallback,
|
||||
onRowClick,
|
||||
onItemChecked,
|
||||
onItemAllChecked,
|
||||
onScrollToBottom,
|
||||
statusInfo,
|
||||
highlightedRowId,
|
||||
idFieldName = "id",
|
||||
enableSort = false,
|
||||
gridHeight = 65, // vh 단위
|
||||
}: DataGridProps) => {
|
||||
const { columns, columnLayout } = columnInfo;
|
||||
const gridRef = useRef<RealGridReact>(null);
|
||||
@@ -341,9 +345,18 @@ const DataGrid = ({
|
||||
const cellTooltipCallbackRef = useRef<CellTooltipCallback | undefined>(
|
||||
cellTooltipCallback,
|
||||
);
|
||||
const onScrollToBottomRef = useRef<(() => void) | undefined>(
|
||||
onScrollToBottom,
|
||||
);
|
||||
const onItemCheckedRef = useRef<typeof onItemChecked>(onItemChecked);
|
||||
const onItemAllCheckedRef =
|
||||
useRef<typeof onItemAllChecked>(onItemAllChecked);
|
||||
rowDataRef.current = rowData;
|
||||
cellStyleCallbackRef.current = cellStyleCallback;
|
||||
cellTooltipCallbackRef.current = cellTooltipCallback;
|
||||
onScrollToBottomRef.current = onScrollToBottom;
|
||||
onItemCheckedRef.current = onItemChecked;
|
||||
onItemAllCheckedRef.current = onItemAllChecked;
|
||||
|
||||
// highlightedRowId가 변경될 때 해당 행으로 스크롤 및 선택
|
||||
useEffect(() => {
|
||||
@@ -563,10 +576,10 @@ const DataGrid = ({
|
||||
) {
|
||||
const cell =
|
||||
worksheet[
|
||||
XLSX.utils.encode_cell({
|
||||
r: rowIndex,
|
||||
c: col,
|
||||
})
|
||||
XLSX.utils.encode_cell({
|
||||
r: rowIndex,
|
||||
c: col,
|
||||
})
|
||||
];
|
||||
if (
|
||||
cell &&
|
||||
@@ -642,7 +655,7 @@ const DataGrid = ({
|
||||
const col = range.s.c + colIndex;
|
||||
const cell =
|
||||
worksheet[
|
||||
XLSX.utils.encode_cell({ r: row, c: col })
|
||||
XLSX.utils.encode_cell({ r: row, c: col })
|
||||
];
|
||||
const headerName =
|
||||
headers[colIndex] || `Column${colIndex + 1}`;
|
||||
@@ -766,13 +779,13 @@ const DataGrid = ({
|
||||
onSorting?: (g: unknown, f: unknown[], d: unknown[]) => boolean;
|
||||
}
|
||||
).onSorting = enableSort
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
|
||||
(gridView.displayOptions as DisplayOptions).fitStyle =
|
||||
GridFitStyle.EVEN;
|
||||
@@ -942,7 +955,7 @@ const DataGrid = ({
|
||||
) {
|
||||
(
|
||||
column.footer[
|
||||
index
|
||||
index
|
||||
] as FooterItemWithCallback
|
||||
).valueCallback =
|
||||
footerItem.valueCallback;
|
||||
@@ -995,11 +1008,11 @@ const DataGrid = ({
|
||||
getGridDataRef.current = () => {
|
||||
const gv = gridRef.current?.gridView as
|
||||
| {
|
||||
getDataSource?: () => {
|
||||
getRowCount(): number;
|
||||
getValue(r: number, f: string): unknown;
|
||||
};
|
||||
}
|
||||
getDataSource?: () => {
|
||||
getRowCount(): number;
|
||||
getValue(r: number, f: string): unknown;
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
if (!gv?.getDataSource) return [];
|
||||
const ds = gv.getDataSource();
|
||||
@@ -1095,6 +1108,47 @@ const DataGrid = ({
|
||||
};
|
||||
}, [onRowClick, cellTooltipCallback, columns]);
|
||||
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
if (!gridView || !onScrollToBottom) return;
|
||||
|
||||
gridView.onScrollToBottom = () => {
|
||||
onScrollToBottomRef.current?.();
|
||||
};
|
||||
|
||||
return () => {
|
||||
if (gridView.onScrollToBottom)
|
||||
gridView.onScrollToBottom = undefined;
|
||||
};
|
||||
}, [onScrollToBottom]);
|
||||
|
||||
useEffect(() => {
|
||||
const gridView = gridRef.current?.gridView;
|
||||
if (!gridView) return;
|
||||
|
||||
if (onItemChecked) {
|
||||
gridView.onItemChecked = (_grid, itemIndex, checked) => {
|
||||
onItemCheckedRef.current?.(itemIndex, checked);
|
||||
};
|
||||
} else {
|
||||
gridView.onItemChecked = undefined;
|
||||
}
|
||||
|
||||
if (onItemAllChecked) {
|
||||
gridView.onItemAllChecked = (_grid, checked) => {
|
||||
onItemAllCheckedRef.current?.(checked);
|
||||
};
|
||||
} else {
|
||||
gridView.onItemAllChecked = undefined;
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (gridView.onItemChecked) gridView.onItemChecked = undefined;
|
||||
if (gridView.onItemAllChecked)
|
||||
gridView.onItemAllChecked = undefined;
|
||||
};
|
||||
}, [onItemChecked, onItemAllChecked]);
|
||||
|
||||
return (
|
||||
<div className="mx-[0.6rem] flex flex-col gap-[0.6rem]">
|
||||
<input
|
||||
@@ -1110,23 +1164,23 @@ const DataGrid = ({
|
||||
<span>
|
||||
진행상황:{" "}
|
||||
{statusInfo.laeSbmsnSttsCd === null ||
|
||||
statusInfo.laeSbmsnSttsCd === "0"
|
||||
statusInfo.laeSbmsnSttsCd === "0"
|
||||
? "미작성"
|
||||
: statusInfo.laeSbmsnSttsCd === "1"
|
||||
? "작성중"
|
||||
: statusInfo.laeSbmsnSttsCd === "2"
|
||||
? "제출"
|
||||
: statusInfo.laeSbmsnSttsCd === "3"
|
||||
? "승인"
|
||||
: statusInfo.laeSbmsnSttsCd === "4"
|
||||
? "반려"
|
||||
: "검증중"}
|
||||
? "작성중"
|
||||
: statusInfo.laeSbmsnSttsCd === "2"
|
||||
? "제출"
|
||||
: statusInfo.laeSbmsnSttsCd === "3"
|
||||
? "승인"
|
||||
: statusInfo.laeSbmsnSttsCd === "4"
|
||||
? "반려"
|
||||
: "검증중"}
|
||||
</span>
|
||||
<span>
|
||||
제출일:{" "}
|
||||
{statusInfo.laeSbmsnYmd
|
||||
? statusInfo.laeSbmsnYmd.length === 8 &&
|
||||
/^\d{8}$/.test(statusInfo.laeSbmsnYmd)
|
||||
/^\d{8}$/.test(statusInfo.laeSbmsnYmd)
|
||||
? `${statusInfo.laeSbmsnYmd.slice(0, 4)}-${statusInfo.laeSbmsnYmd.slice(4, 6)}-${statusInfo.laeSbmsnYmd.slice(6, 8)}`
|
||||
: statusInfo.laeSbmsnYmd
|
||||
: "미제출"}
|
||||
@@ -1164,7 +1218,7 @@ const DataGrid = ({
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<div className="h-[65vh]">
|
||||
<div style={{ height: `${gridHeight}vh` }}>
|
||||
<RealGridReact
|
||||
ref={gridRef}
|
||||
autoGenerateField={true}
|
||||
@@ -1181,24 +1235,24 @@ const DataGrid = ({
|
||||
) => boolean;
|
||||
}
|
||||
).onSorting = enableSort
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
? createOnSortingHandler(
|
||||
columns,
|
||||
setRowData,
|
||||
sortDirRef,
|
||||
originalRowsRef,
|
||||
)
|
||||
: () => false;
|
||||
const dataProvider = gridRef.current
|
||||
?.dataProvider as unknown as
|
||||
| {
|
||||
setFields?(f: unknown[]): void;
|
||||
setRows?(
|
||||
r: Record<string, string | number>[],
|
||||
): void;
|
||||
getJsonRow?(
|
||||
r: number,
|
||||
): Record<string, unknown>;
|
||||
}
|
||||
setFields?(f: unknown[]): void;
|
||||
setRows?(
|
||||
r: Record<string, string | number>[],
|
||||
): void;
|
||||
getJsonRow?(
|
||||
r: number,
|
||||
): Record<string, unknown>;
|
||||
}
|
||||
| undefined;
|
||||
if (dataProvider?.setFields) {
|
||||
dataProvider.setFields(
|
||||
@@ -1351,14 +1405,14 @@ const DataGrid = ({
|
||||
})}
|
||||
footer={
|
||||
column.footer &&
|
||||
!Array.isArray(column.footer)
|
||||
!Array.isArray(column.footer)
|
||||
? {
|
||||
text: column.footer.text,
|
||||
expression:
|
||||
column.footer.expression,
|
||||
numberFormat:
|
||||
column.footer.numberFormat,
|
||||
}
|
||||
text: column.footer.text,
|
||||
expression:
|
||||
column.footer.expression,
|
||||
numberFormat:
|
||||
column.footer.numberFormat,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
mergeRule={
|
||||
|
||||
@@ -1,34 +1,49 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import useSWR from 'swr';
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { statisticsAPi } from "@/entities/statistics/api/statistics-service";
|
||||
import type {
|
||||
ApiResponse,
|
||||
SearchCondition,
|
||||
Sgg,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
Button,
|
||||
Checkbox,
|
||||
Input,
|
||||
Label,
|
||||
Select,
|
||||
SelectTrigger,
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
Checkbox
|
||||
}
|
||||
from "@common/components";
|
||||
} from "@common/components";
|
||||
|
||||
import { useAlertStore, useUserStore } from "@/shared/lib";
|
||||
import { type SearchFormProps, type SearchFormValues, defaultSearchFormProps } from "../type/SearchForm.type";
|
||||
import { statisticsAPi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { ApiResponse, SearchCondition, Sgg } from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
defaultSearchFormProps,
|
||||
type SearchFormProps,
|
||||
type SearchFormValues,
|
||||
} from "../type/SearchForm.type";
|
||||
import { doList } from "../util/column/input/DoList";
|
||||
|
||||
const getSidoListFetcher = async (key: [string, string]): Promise<ApiResponse<SearchCondition>> => {
|
||||
const getSidoListFetcher = async (
|
||||
key: [string, string],
|
||||
): Promise<ApiResponse<SearchCondition>> => {
|
||||
return statisticsAPi.getSidoList({ instSeCd: key[1] });
|
||||
};
|
||||
|
||||
const getSggListFetcher = async (key: [string, string, string, string]): Promise<ApiResponse<Sgg[]>> => {
|
||||
const getSggListFetcher = async (
|
||||
key: [string, string, string, string],
|
||||
): Promise<ApiResponse<Sgg[]>> => {
|
||||
const gugunSkipYn = doList.includes(key[3]) ? "N" : "Y";
|
||||
return statisticsAPi.getSggAllList(key[1], { instSeCd: key[2], gugunSkipYn });
|
||||
return statisticsAPi.getSggAllList(key[1], {
|
||||
instSeCd: key[2],
|
||||
gugunSkipYn,
|
||||
});
|
||||
};
|
||||
|
||||
const SearchForm = (props: SearchFormProps = {}) => {
|
||||
@@ -54,7 +69,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== 'success') {
|
||||
if (data.status !== "success") {
|
||||
alert(`시도 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
}
|
||||
@@ -63,16 +78,16 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
alert(`시도 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const [values, setValues] = useState<SearchFormValues>({
|
||||
sido: props.defaultValues?.sido || '',
|
||||
gugun: props.defaultValues?.gugun || '',
|
||||
sido: props.defaultValues?.sido || "",
|
||||
gugun: props.defaultValues?.gugun || "",
|
||||
year: props.defaultValues?.year || defaultYear.toString(),
|
||||
order: props.defaultValues?.order || '',
|
||||
fctName: props.defaultValues?.fctName || '',
|
||||
bsnmCd: props.defaultValues?.bsnmCd || '',
|
||||
order: props.defaultValues?.order || "",
|
||||
fctName: props.defaultValues?.fctName || "",
|
||||
bsnmCd: props.defaultValues?.bsnmCd || "",
|
||||
isDetail: false,
|
||||
});
|
||||
|
||||
@@ -90,7 +105,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== 'success') {
|
||||
if (data.status !== "success") {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
}
|
||||
@@ -99,7 +114,7 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
const sggOptions = sggList?.data ?? [];
|
||||
|
||||
@@ -110,12 +125,12 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
|
||||
const handleReset = () => {
|
||||
const resetValues: SearchFormValues = {
|
||||
sido: '',
|
||||
gugun: '',
|
||||
sido: "",
|
||||
gugun: "",
|
||||
year: String(defaultYear),
|
||||
order: '',
|
||||
fctName: '',
|
||||
bsnmCd: '',
|
||||
order: "",
|
||||
fctName: "",
|
||||
bsnmCd: "",
|
||||
isDetail: false,
|
||||
};
|
||||
setValues(resetValues);
|
||||
@@ -123,20 +138,23 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
};
|
||||
|
||||
const handleSidoChange = (value: string) => {
|
||||
const selectedBsnm = sidoList?.data.sidoList.find((v) => v.sido === value)?.bsnmCd || '';
|
||||
const selectedBsnm =
|
||||
sidoList?.data.sidoList.find((v) => v.sido === value)?.bsnmCd || "";
|
||||
setValues((prev) => ({
|
||||
...prev,
|
||||
sido: value,
|
||||
gugun: '',
|
||||
gugun: "",
|
||||
bsnmCd: selectedBsnm,
|
||||
}));
|
||||
};
|
||||
|
||||
const handleSggChange = (value: string) => {
|
||||
const listForBsnm = sggList?.data ?? [];
|
||||
const selectedBsnm = value === 'ALL'
|
||||
? (sidoList?.data.sidoList.find((v) => v.sido === values.sido)?.bsnmCd || '')
|
||||
: (listForBsnm.find((v) => v.gugun === value)?.bsnmCd || '');
|
||||
const selectedBsnm =
|
||||
value === "ALL"
|
||||
? sidoList?.data.sidoList.find((v) => v.sido === values.sido)
|
||||
?.bsnmCd || ""
|
||||
: listForBsnm.find((v) => v.gugun === value)?.bsnmCd || "";
|
||||
|
||||
setValues((prev) => ({
|
||||
...prev,
|
||||
@@ -153,66 +171,84 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
<div className="card card-border">
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="flex items-center gap-8 p-2">
|
||||
{mergedProps.sido &&
|
||||
{mergedProps.sido && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">
|
||||
시도
|
||||
</Label>
|
||||
<Select value={values.sido} onValueChange={handleSidoChange}>
|
||||
<Label className="text-label">시도</Label>
|
||||
<Select
|
||||
value={values.sido}
|
||||
onValueChange={handleSidoChange}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem]">
|
||||
<SelectValue placeholder={sidoSelectText}></SelectValue>
|
||||
<SelectValue
|
||||
placeholder={sidoSelectText}
|
||||
></SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ALL">{sidoSelectText}</SelectItem>
|
||||
<SelectItem value="ALL">
|
||||
{sidoSelectText}
|
||||
</SelectItem>
|
||||
{sidoList?.data?.sidoList?.map((sido) => (
|
||||
<SelectItem key={sido.adstDstrCd} value={sido.sido}>
|
||||
<SelectItem
|
||||
key={sido.adstDstrCd}
|
||||
value={sido.sido}
|
||||
>
|
||||
{sido.sido}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
}
|
||||
{mergedProps.gugun &&
|
||||
)}
|
||||
{mergedProps.gugun && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">
|
||||
시군구
|
||||
</Label>
|
||||
<Select value={values.gugun} onValueChange={handleSggChange}>
|
||||
<Label className="text-label">시군구</Label>
|
||||
<Select
|
||||
value={values.gugun}
|
||||
onValueChange={handleSggChange}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem]">
|
||||
<SelectValue placeholder="전체"></SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ALL">전체</SelectItem>
|
||||
{sggOptions?.map((sgg) => (
|
||||
<SelectItem key={sgg.adstDstrCd} value={sgg.gugun}>
|
||||
<SelectItem
|
||||
key={sgg.adstDstrCd}
|
||||
value={sgg.gugun}
|
||||
>
|
||||
{sgg.gugun}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
}
|
||||
{mergedProps.year &&
|
||||
)}
|
||||
{mergedProps.year && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">
|
||||
년도
|
||||
</Label>
|
||||
<Select value={values.year} onValueChange={(value) => setValues({ ...values, year: value })}>
|
||||
<Label className="text-label">년도</Label>
|
||||
<Select
|
||||
value={values.year}
|
||||
onValueChange={(value) =>
|
||||
setValues({ ...values, year: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-[10rem]">
|
||||
<SelectValue placeholder="선택"></SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{sidoList?.data?.yearList.map((year) => (
|
||||
<SelectItem key={year} value={String(year)}>
|
||||
<SelectItem
|
||||
key={year}
|
||||
value={String(year)}
|
||||
>
|
||||
{year}년
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
}
|
||||
{mergedProps.isDetail &&
|
||||
)}
|
||||
{mergedProps.isDetail && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">
|
||||
세부 데이터 포함
|
||||
@@ -220,17 +256,23 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
<Checkbox
|
||||
checked={values.isDetail}
|
||||
onCheckedChange={(value) =>
|
||||
setValues({ ...values, isDetail: value === true })
|
||||
setValues({
|
||||
...values,
|
||||
isDetail: value === true,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
{mergedProps.order &&
|
||||
)}
|
||||
{mergedProps.order && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">
|
||||
차수
|
||||
</Label>
|
||||
<Select value={values.order} onValueChange={(value) => setValues({ ...values, order: value })}>
|
||||
<Label className="text-label">차수</Label>
|
||||
<Select
|
||||
value={values.order}
|
||||
onValueChange={(value) =>
|
||||
setValues({ ...values, order: value })
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-[10rem]">
|
||||
<SelectValue placeholder="전체"></SelectValue>
|
||||
</SelectTrigger>
|
||||
@@ -239,9 +281,14 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
}
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<Button color="white" className="h-[3.2rem] w-[96px]" type="button" onClick={handleReset}>
|
||||
)}
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<Button
|
||||
color="white"
|
||||
className="h-[3.2rem] w-[96px]"
|
||||
type="button"
|
||||
onClick={handleReset}
|
||||
>
|
||||
초기화
|
||||
</Button>
|
||||
<Button className="h-[3.2rem] w-[96px]" type="submit">
|
||||
@@ -249,35 +296,46 @@ const SearchForm = (props: SearchFormProps = {}) => {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{(mergedProps.fctName || mergedProps.userMenual) &&
|
||||
{(mergedProps.fctName || mergedProps.userMenual) && (
|
||||
<div className="flex items-center p-2">
|
||||
{mergedProps.fctName &&
|
||||
{mergedProps.fctName && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="fctNmSearchInput" className="mr-2 text-label">
|
||||
<Label
|
||||
htmlFor="fctNmSearchInput"
|
||||
className="mr-2 text-label"
|
||||
>
|
||||
시설명
|
||||
</Label>
|
||||
<Input
|
||||
className="h-[3.2rem] w-[14rem] rounded-sm !text-[1.3rem] mr-4"
|
||||
className="mr-4 h-[3.2rem] w-[14rem] rounded-sm !text-[1.3rem]"
|
||||
id="fctNmSearchInput"
|
||||
value={values.fctName}
|
||||
onChange={(e) => setValues({ ...values, fctName: e.target.value })}
|
||||
onChange={(e) =>
|
||||
setValues({
|
||||
...values,
|
||||
fctName: e.target.value,
|
||||
})
|
||||
}
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
{mergedProps.userMenual &&
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<Button className="h-[3.2rem] w-[124px]" type="button">
|
||||
)}
|
||||
{mergedProps.userMenual && (
|
||||
<div className="ml-auto flex items-center gap-2">
|
||||
<Button
|
||||
className="h-[3.2rem] w-[124px]"
|
||||
type="button"
|
||||
>
|
||||
<i className="diveicon di-person-fill" />
|
||||
사용자 메뉴얼
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SearchForm;
|
||||
export default SearchForm;
|
||||
|
||||
@@ -13,14 +13,18 @@ import {
|
||||
SelectContent,
|
||||
SelectItem,
|
||||
SelectValue,
|
||||
LoadingWithAnimation
|
||||
LoadingWithAnimation,
|
||||
} from "@common/components";
|
||||
import CompactDataGrid from "./CompactDataGrid";
|
||||
import SaveButton from "../button/SaveButton";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { statisticsAPi } from "@/entities/statistics/api/statistics-service";
|
||||
import type { ApiResponse, SearchCondition, Sgg } from "@/entities/statistics/model/statistics-interface";
|
||||
import type {
|
||||
ApiResponse,
|
||||
SearchCondition,
|
||||
Sgg,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import type { ColumnInfo } from "../type/DataGrid.type";
|
||||
import type {
|
||||
SeweragePipeFacilitiesListRequest,
|
||||
@@ -31,9 +35,24 @@ import { statisticsInputSewPipeApiService } from "@/entities/statistics/api/inpu
|
||||
/** 다이얼로그 좌측: 처리시설 정보 (순번 없음) */
|
||||
const treatmentFacilityColumnInfo: ColumnInfo = {
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "fctNm", fieldName: "fctNm", header: { text: "시설명" }, editable: false },
|
||||
{
|
||||
name: "ctpvNm",
|
||||
fieldName: "ctpvNm",
|
||||
header: { text: "시도" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "sggNm",
|
||||
fieldName: "sggNm",
|
||||
header: { text: "시군구" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "fctNm",
|
||||
fieldName: "fctNm",
|
||||
header: { text: "시설명" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "fctCpc",
|
||||
fieldName: "fctCpc",
|
||||
@@ -49,9 +68,24 @@ const treatmentFacilityColumnInfo: ColumnInfo = {
|
||||
/** 다이얼로그 우측: 행정구역 정보 (순번 없음, 헤더 체크박스는 showHeaderCheckbox) */
|
||||
const adminRegionColumnInfo: ColumnInfo = {
|
||||
columns: [
|
||||
{ name: "ctpvNm", fieldName: "ctpvNm", header: { text: "시도" }, editable: false },
|
||||
{ name: "sggNm", fieldName: "sggNm", header: { text: "시군구" }, editable: false },
|
||||
{ name: "emdNm", fieldName: "emdNm", header: { text: "읍면동" }, editable: false },
|
||||
{
|
||||
name: "ctpvNm",
|
||||
fieldName: "ctpvNm",
|
||||
header: { text: "시도" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "sggNm",
|
||||
fieldName: "sggNm",
|
||||
header: { text: "시군구" },
|
||||
editable: false,
|
||||
},
|
||||
{
|
||||
name: "emdNm",
|
||||
fieldName: "emdNm",
|
||||
header: { text: "읍면동" },
|
||||
editable: false,
|
||||
},
|
||||
],
|
||||
columnLayout: ["ctpvNm", "sggNm", "emdNm"],
|
||||
};
|
||||
@@ -60,7 +94,9 @@ const getSidoListFetcher = async (): Promise<ApiResponse<SearchCondition>> => {
|
||||
return statisticsAPi.getSidoList();
|
||||
};
|
||||
|
||||
const getSggAllListFetcher = async (key: [string, string]): Promise<ApiResponse<Sgg[]>> => {
|
||||
const getSggAllListFetcher = async (
|
||||
key: [string, string],
|
||||
): Promise<ApiResponse<Sgg[]>> => {
|
||||
return statisticsAPi.getSggAllList(key[1]);
|
||||
};
|
||||
|
||||
@@ -69,49 +105,72 @@ type SidoSggFacilityNameSearchFormProps = {
|
||||
statsYr?: string;
|
||||
};
|
||||
|
||||
const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFormProps) => {
|
||||
const SidoSggFacilityNameSearchForm = ({
|
||||
statsYr,
|
||||
}: SidoSggFacilityNameSearchFormProps) => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
|
||||
const { data: sidoList } = useSWR<ApiResponse<SearchCondition>>("sido-list", getSidoListFetcher, {
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
revalidateIfStale: false,
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== "success") {
|
||||
alert(`시도 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`);
|
||||
}
|
||||
const { data: sidoList } = useSWR<ApiResponse<SearchCondition>>(
|
||||
"sido-list",
|
||||
getSidoListFetcher,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
revalidateIfStale: false,
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== "success") {
|
||||
alert(
|
||||
`시도 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`,
|
||||
);
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
alert(
|
||||
`시도 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`,
|
||||
);
|
||||
},
|
||||
},
|
||||
onError: () => {
|
||||
alert(`시도 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`);
|
||||
},
|
||||
});
|
||||
);
|
||||
|
||||
const [sido, setSido] = useState<string>("ALL");
|
||||
const [gugun, setGugun] = useState<string>("ALL");
|
||||
const [fctNm, setFctNm] = useState<string>("");
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
const [treatmentFacilityRows, setTreatmentFacilityRows] = useState<Record<string, string | number>[]>([]);
|
||||
const [adminRegionRows, setAdminRegionRows] = useState<Record<string, string | number>[]>([]);
|
||||
const [treatmentFacilityRows, setTreatmentFacilityRows] = useState<
|
||||
Record<string, string | number>[]
|
||||
>([]);
|
||||
const [adminRegionRows, setAdminRegionRows] = useState<
|
||||
Record<string, string | number>[]
|
||||
>([]);
|
||||
|
||||
const sggKey: [string, string] | null = sido && sido !== "ALL" ? ["sgg-all", sido] : null;
|
||||
const { data: sggList } = useSWR<ApiResponse<Sgg[]>>(sggKey, getSggAllListFetcher, {
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
revalidateIfStale: false,
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== "success") {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`);
|
||||
}
|
||||
const sggKey: [string, string] | null =
|
||||
sido && sido !== "ALL" ? ["sgg-all", sido] : null;
|
||||
const { data: sggList } = useSWR<ApiResponse<Sgg[]>>(
|
||||
sggKey,
|
||||
getSggAllListFetcher,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
revalidateIfStale: false,
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== "success") {
|
||||
alert(
|
||||
`시군구 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`,
|
||||
);
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
alert(
|
||||
`시군구 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`,
|
||||
);
|
||||
},
|
||||
},
|
||||
onError: () => {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.\n새로고침 후 다시 시도해주세요.`);
|
||||
},
|
||||
});
|
||||
);
|
||||
const sggOptions = sggList?.data ?? [];
|
||||
|
||||
/** 시설 목록·행정구역 API 공통 — 하수도 사업자코드(bsnmCd) */
|
||||
@@ -129,7 +188,7 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
setGugun("ALL");
|
||||
};
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
const handleSubmit = async (e: React.SubmitEvent<HTMLFormElement>) => {
|
||||
e.preventDefault();
|
||||
if (!statsYr?.trim()) {
|
||||
alert("상단에서 통계연도로 조회한 뒤 이용해 주세요.");
|
||||
@@ -153,7 +212,10 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await statisticsInputSewPipeApiService.getFacilitiesList(params);
|
||||
const response =
|
||||
await statisticsInputSewPipeApiService.getFacilitiesList(
|
||||
params,
|
||||
);
|
||||
if (response.status !== "success") {
|
||||
alert(response.message ?? "처리시설 목록 조회에 실패했습니다.");
|
||||
return;
|
||||
@@ -178,7 +240,9 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
}
|
||||
};
|
||||
|
||||
const handleTreatmentFacilityRowClick = async (row: Record<string, string | number>) => {
|
||||
const handleTreatmentFacilityRowClick = async (
|
||||
row: Record<string, string | number>,
|
||||
) => {
|
||||
if (!statsYr?.trim()) {
|
||||
alert("상단에서 통계연도로 조회한 뒤 이용해 주세요.");
|
||||
return;
|
||||
@@ -197,14 +261,17 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
const params: SeweragePipeFacilityAdminAreaListRequest = {
|
||||
statsYr: statsYr.trim(),
|
||||
swtrmtFcltCd,
|
||||
sewerBzmnCd: String(row.admdstCd ?? "").trim(),
|
||||
sewerBzmnCd: String(row.admdstCd ?? "").trim(),
|
||||
ctpvNm,
|
||||
sggNm,
|
||||
};
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await statisticsInputSewPipeApiService.getFacilityAdminAreaList(params);
|
||||
const response =
|
||||
await statisticsInputSewPipeApiService.getFacilityAdminAreaList(
|
||||
params,
|
||||
);
|
||||
if (response.status !== "success") {
|
||||
alert(response.message ?? "행정구역 목록 조회에 실패했습니다.");
|
||||
return;
|
||||
@@ -234,7 +301,7 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
|
||||
<div className="flex flex-wrap items-end gap-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label shrink-0">시도</Label>
|
||||
<Label className="shrink-0 text-label">시도</Label>
|
||||
<Select value={sido} onValueChange={handleSidoChange}>
|
||||
<SelectTrigger className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
@@ -242,7 +309,10 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
<SelectContent>
|
||||
<SelectItem value="ALL">전체</SelectItem>
|
||||
{sidoList?.data?.sidoList?.map((item) => (
|
||||
<SelectItem key={item.adstDstrCd} value={item.sido}>
|
||||
<SelectItem
|
||||
key={item.adstDstrCd}
|
||||
value={item.sido}
|
||||
>
|
||||
{item.sido}
|
||||
</SelectItem>
|
||||
))}
|
||||
@@ -250,31 +320,42 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label shrink-0">시군구</Label>
|
||||
<Select value={gugun} onValueChange={setGugun} disabled={!sido || sido === "ALL"}>
|
||||
<Label className="shrink-0 text-label">시군구</Label>
|
||||
<Select
|
||||
value={gugun}
|
||||
onValueChange={setGugun}
|
||||
disabled={!sido || sido === "ALL"}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="ALL">전체</SelectItem>
|
||||
{sggOptions?.map((sgg) => (
|
||||
<SelectItem key={sgg.adstDstrCd} value={sgg.gugun}>
|
||||
<SelectItem
|
||||
key={sgg.adstDstrCd}
|
||||
value={sgg.gugun}
|
||||
>
|
||||
{sgg.gugun}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 min-w-[20rem] flex-1">
|
||||
<Label className="text-label shrink-0">시설명</Label>
|
||||
<div className="flex min-w-[20rem] flex-1 items-center gap-2">
|
||||
<Label className="shrink-0 text-label">시설명</Label>
|
||||
<Input
|
||||
className="flex-1 min-w-[12rem]"
|
||||
className="min-w-[12rem] flex-1"
|
||||
value={fctNm}
|
||||
onChange={(e) => setFctNm(e.target.value)}
|
||||
placeholder="시설명 입력"
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" className="h-[3.2rem] w-[96px]" color="primary">
|
||||
<Button
|
||||
type="submit"
|
||||
className="h-[3.2rem] w-[96px]"
|
||||
color="primary"
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
@@ -282,14 +363,18 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
<SaveButton saveFunc={handleSaveAdminRegions} />
|
||||
</div>
|
||||
</form>
|
||||
{isLoading && <div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
{isLoading && (
|
||||
<div className="[data-theme='black']:bg-transparent absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>}
|
||||
<div className="flex gap-[1.2rem] items-stretch w-full min-w-0">
|
||||
<div className="flex-1 flex flex-col gap-2 min-w-0">
|
||||
<h3 className="text-[1.4rem] font-medium text-foreground">처리시설 정보</h3>
|
||||
)}
|
||||
<div className="flex w-full min-w-0 items-stretch gap-[1.2rem]">
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-2">
|
||||
<h3 className="text-[1.4rem] font-medium text-foreground">
|
||||
처리시설 정보
|
||||
</h3>
|
||||
<CompactDataGrid
|
||||
columnInfo={treatmentFacilityColumnInfo}
|
||||
rowData={treatmentFacilityRows}
|
||||
@@ -300,9 +385,11 @@ const SidoSggFacilityNameSearchForm = ({ statsYr }: SidoSggFacilityNameSearchFor
|
||||
// compactGridHeightClass="h-[min(40vh,28rem)] min-h-[16rem]"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1 flex flex-col gap-2 min-w-0">
|
||||
<div className="flex min-w-0 flex-1 flex-col gap-2">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
<h3 className="text-[1.4rem] font-medium text-foreground">행정구역 정보</h3>
|
||||
<h3 className="text-[1.4rem] font-medium text-foreground">
|
||||
행정구역 정보
|
||||
</h3>
|
||||
</div>
|
||||
<CompactDataGrid
|
||||
columnInfo={adminRegionColumnInfo}
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import useSWR, { useSWRConfig } from "swr";
|
||||
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import ApproveButton from "@/components/button/ApproveButton";
|
||||
import RejectButton from "@/components/button/RejectButton";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
|
||||
import { StatsInputStatusInpColumn } from "@/components/util/column/input/StatsInputStatusInpColumn";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { StatisticsInputStatusApi } from "@/entities/statistics/api/input/statistics-input-status-service";
|
||||
import type { StatsInputStatusListRequestParams } from "@/entities/statistics/model/input/statistics-input-status-interface";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import type { StatsInputStatusListApiResponse } from "@/entities/statistics/model/input/statistics-input-status-interface";
|
||||
import { LoadingWithAnimation } from "@common/components";
|
||||
|
||||
const getStatsInputStatusFetcher = async (key: [string, StatsInputStatusListRequestParams]): Promise<StatsInputStatusListApiResponse> => {
|
||||
import ApproveButton from "@/components/button/ApproveButton";
|
||||
import RejectButton from "@/components/button/RejectButton";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import SearchForm from "@/components/module/SearchForm";
|
||||
import type { SearchFormValues } from "@/components/type/SearchForm.type";
|
||||
import { StatsInputStatusInpColumn } from "@/components/util/column/input/StatsInputStatusInpColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { useTabStore } from "@/store/tab-store";
|
||||
|
||||
const getStatsInputStatusFetcher = async (
|
||||
key: [string, StatsInputStatusListRequestParams],
|
||||
): Promise<StatsInputStatusListApiResponse> => {
|
||||
return StatisticsInputStatusApi.getStatisticsInputStatusList(key[1]);
|
||||
};
|
||||
|
||||
@@ -24,10 +27,15 @@ const getStatsInputStatusFetcher = async (key: [string, StatsInputStatusListRequ
|
||||
const StatsInputStatusInp = () => {
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const activeTabId = useTabStore((state) => state.activeTabId);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [searchParams, setSearchParams] = useState<StatsInputStatusListRequestParams | null>(null);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>(
|
||||
[],
|
||||
);
|
||||
const [searchParams, setSearchParams] =
|
||||
useState<StatsInputStatusListRequestParams | null>(null);
|
||||
|
||||
const swrKey = searchParams ? (["stats-input-status", searchParams] as const) : null;
|
||||
const swrKey = searchParams
|
||||
? (["stats-input-status", searchParams] as const)
|
||||
: null;
|
||||
const { mutate } = useSWRConfig();
|
||||
const { isLoading } = useSWR<StatsInputStatusListApiResponse>(
|
||||
swrKey,
|
||||
@@ -49,7 +57,7 @@ const StatsInputStatusInp = () => {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTabId === 'StatsInputStatusInp' && swrKey) {
|
||||
if (activeTabId === "StatsInputStatusInp" && swrKey) {
|
||||
mutate(swrKey);
|
||||
}
|
||||
}, [activeTabId]);
|
||||
@@ -63,7 +71,7 @@ const StatsInputStatusInp = () => {
|
||||
ctpvNm: values.sido,
|
||||
sewerBzmnCd: values.bsnmCd,
|
||||
sggNm: values.gugun === "ALL" ? "" : values.gugun,
|
||||
statsYr: values.year,
|
||||
statsYr: values.year ?? "",
|
||||
};
|
||||
setSearchParams(params);
|
||||
mutate(["stats-input-status", params]);
|
||||
@@ -87,22 +95,24 @@ const StatsInputStatusInp = () => {
|
||||
<div className="relative">
|
||||
<SearchForm onSubmit={handleSearch} onReset={handleReset} />
|
||||
<div className="card !py-0">
|
||||
<div className="flex justify-end items-center gap-[0.6rem] m-[0.6rem]">
|
||||
<div className="m-[0.6rem] flex items-center justify-end gap-[0.6rem]">
|
||||
<RejectButton rejectFunc={rejectFunc} />
|
||||
<ApproveButton approveFunc={approveFunc} />
|
||||
</div>
|
||||
</div>
|
||||
{isLoading && <div className="absolute inset-0 z-50 [data-theme='black']:bg-transparent rounded-lg p-10 flex justify-center items-center">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
{isLoading && (
|
||||
<div className="[data-theme='black']:bg-transparent absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>}
|
||||
<DataGrid
|
||||
columnInfo={ StatsInputStatusInpColumn }
|
||||
rowStartNum={2}
|
||||
fixedColumns={3}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
)}
|
||||
<DataGrid
|
||||
columnInfo={StatsInputStatusInpColumn}
|
||||
rowStartNum={2}
|
||||
fixedColumns={3}
|
||||
rowData={rowData}
|
||||
setRowData={setRowData}
|
||||
isExcelImport={false}
|
||||
showHeaderCheckbox={true}
|
||||
/>
|
||||
@@ -111,4 +121,4 @@ const StatsInputStatusInp = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default StatsInputStatusInp;
|
||||
export default StatsInputStatusInp;
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { useCallback, useState, useEffect } from "react";
|
||||
import useSWR from "swr";
|
||||
import dayjs from "dayjs";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
|
||||
import dayjs from "dayjs";
|
||||
import useSWR from "swr";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { CodeSelectWithAll } from "@/entities/code";
|
||||
import { statisticsAPi } from "@/entities/statistics/api/statistics-service";
|
||||
import type {
|
||||
ApiResponse,
|
||||
SearchCondition,
|
||||
Sgg,
|
||||
StatisticsLog,
|
||||
StatisticsLogRequest,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import {
|
||||
Button,
|
||||
InputDatePicker,
|
||||
@@ -15,23 +26,12 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@common/components";
|
||||
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import { CodeSelectWithAll } from "@/entities/code";
|
||||
|
||||
import { statisticsAPi } from "@/entities/statistics/api/statistics-service";
|
||||
import type {
|
||||
ApiResponse,
|
||||
SearchCondition,
|
||||
Sgg,
|
||||
StatisticsLog,
|
||||
StatisticsLogRequest,
|
||||
} from "@/entities/statistics/model/statistics-interface";
|
||||
import { LogHistoryDetailDialog } from "@/components/statistics/management/LogHistoryDetailDialog";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
|
||||
import { LogHistoryColumn } from "@/components/util/column/management/LogHistoryColumn";
|
||||
import { LogHistoryTablePagination } from "@/components/statistics/management/LogHistoryTablePagination";
|
||||
import { LogHistoryColumn } from "@/components/util/column/management/LogHistoryColumn";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
|
||||
const PAGE_SIZE = 100;
|
||||
|
||||
@@ -53,7 +53,9 @@ const LogHistory = () => {
|
||||
const [bsnmCd, setBsnmCd] = useState<string>("");
|
||||
const [statsDataChgComCd, setStatsDataChgComCd] = useState<string>("ALL");
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>([]);
|
||||
const [rowData, setRowData] = useState<Record<string, string | number>[]>(
|
||||
[],
|
||||
);
|
||||
const [pageIndex, setPageIndex] = useState(0);
|
||||
const [totalPages, setTotalPages] = useState(0);
|
||||
const [detailDialogOpen, setDetailDialogOpen] = useState(false);
|
||||
@@ -92,23 +94,27 @@ const LogHistory = () => {
|
||||
|
||||
const sggKey: [string, string] | null =
|
||||
sido && sido !== "ALL" ? ["log-history-sgg-list", sido] : null;
|
||||
const { data: sggList } = useSWR<ApiResponse<Sgg[]>>(sggKey, getSggListFetcher, {
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
revalidateIfStale: false,
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== "success") {
|
||||
const { data: sggList } = useSWR<ApiResponse<Sgg[]>>(
|
||||
sggKey,
|
||||
getSggListFetcher,
|
||||
{
|
||||
revalidateOnFocus: false,
|
||||
revalidateOnReconnect: false,
|
||||
revalidateIfStale: false,
|
||||
dedupingInterval: 2000,
|
||||
shouldRetryOnError: false,
|
||||
onSuccess: (data) => {
|
||||
if (data.status !== "success") {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
}
|
||||
},
|
||||
onError: () => {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
}
|
||||
},
|
||||
},
|
||||
onError: () => {
|
||||
alert(`시군구 목록을 불러오는데 실패했습니다.
|
||||
새로고침 후 다시 시도해주세요.`);
|
||||
},
|
||||
});
|
||||
);
|
||||
const sggOptions = sggList?.data ?? [];
|
||||
|
||||
const handleSidoChange = (value: string) => {
|
||||
@@ -123,8 +129,8 @@ const LogHistory = () => {
|
||||
const listForBsnm = sggList?.data ?? [];
|
||||
const selectedBsnm =
|
||||
value === "ALL"
|
||||
? (sidoList?.data.sidoList.find((v) => v.sido === sido)?.bsnmCd ??
|
||||
"")
|
||||
? (sidoList?.data.sidoList.find((v) => v.sido === sido)
|
||||
?.bsnmCd ?? "")
|
||||
: (listForBsnm.find((v) => v.gugun === value)?.bsnmCd ?? "");
|
||||
setGugun(value);
|
||||
setBsnmCd(selectedBsnm);
|
||||
@@ -161,7 +167,10 @@ const LogHistory = () => {
|
||||
setTotalPages(response.data?.pageInfo?.totalPages ?? 0);
|
||||
setPageIndex(Math.max(0, page1Based - 1));
|
||||
} else {
|
||||
alert(response.message || "데이터 조회 중 오류가 발생했습니다.");
|
||||
alert(
|
||||
response.message ||
|
||||
"데이터 조회 중 오류가 발생했습니다.",
|
||||
);
|
||||
}
|
||||
} catch {
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
@@ -217,7 +226,10 @@ const LogHistory = () => {
|
||||
<div className="flex flex-wrap items-center gap-8 p-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">시도</Label>
|
||||
<Select value={sido} onValueChange={handleSidoChange}>
|
||||
<Select
|
||||
value={sido}
|
||||
onValueChange={handleSidoChange}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
@@ -236,7 +248,10 @@ const LogHistory = () => {
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-label">시군구</Label>
|
||||
<Select value={gugun} onValueChange={handleSggChange}>
|
||||
<Select
|
||||
value={gugun}
|
||||
onValueChange={handleSggChange}
|
||||
>
|
||||
<SelectTrigger className="w-[12rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
</SelectTrigger>
|
||||
@@ -296,7 +311,10 @@ const LogHistory = () => {
|
||||
>
|
||||
초기화
|
||||
</Button>
|
||||
<Button className="h-[3.2rem] w-[96px]" type="submit">
|
||||
<Button
|
||||
className="h-[3.2rem] w-[96px]"
|
||||
type="submit"
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
</div>
|
||||
@@ -304,7 +322,7 @@ const LogHistory = () => {
|
||||
</form>
|
||||
</div>
|
||||
{isLoading && (
|
||||
<div className="absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10 [data-theme='black']:bg-transparent">
|
||||
<div className="[data-theme='black']:bg-transparent absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
@@ -314,7 +332,7 @@ const LogHistory = () => {
|
||||
columnInfo={LogHistoryColumn}
|
||||
isExcelImport={false}
|
||||
rowData={rowData}
|
||||
setRowData={() => { }}
|
||||
setRowData={() => {}}
|
||||
onRowClick={handleRowClick}
|
||||
/>
|
||||
<LogHistoryDetailDialog
|
||||
|
||||
@@ -1,10 +1,38 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import type { Dispatch, SetStateAction } from "react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { useAlertStore } from "@/shared/lib";
|
||||
import { useConfirm } from "@frontend-opensource/use-react-hooks";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
import { useAlertStore, useMutationWrapper, useUserStore } from "@/shared/lib";
|
||||
import { CodeSelect } from "@/entities/code";
|
||||
import {
|
||||
type ApprovalRequest,
|
||||
statisticsApprovalApi,
|
||||
statisticsVerificationDetailColumnInfo,
|
||||
type StatisticsVerificationFilterState,
|
||||
type StatisticsVerificationSubFilterState,
|
||||
statisticsVerificationSummaryColumnInfo,
|
||||
type StatsInputStatusList,
|
||||
useStAnlsSidoCombo,
|
||||
useStAnlsSigunguCombo,
|
||||
useStatsVrfcRptData,
|
||||
useStatsVrfcRsltData,
|
||||
type VerifyResultItem,
|
||||
} from "@/entities/statistics";
|
||||
import {
|
||||
Button,
|
||||
Combobox,
|
||||
ComboboxChip,
|
||||
ComboboxChips,
|
||||
ComboboxChipsInput,
|
||||
ComboboxContent,
|
||||
ComboboxEmpty,
|
||||
ComboboxItem,
|
||||
ComboboxList,
|
||||
ComboboxValue,
|
||||
Label,
|
||||
LoadingWithAnimation,
|
||||
Select,
|
||||
@@ -12,259 +40,355 @@ import {
|
||||
SelectItem,
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
useComboboxAnchor,
|
||||
} from "@common/components";
|
||||
|
||||
import {
|
||||
statisticsVerificationDetailColumnInfo,
|
||||
statisticsVerificationSummaryColumnInfo,
|
||||
} from "../../../entities/statistics/model/statistics-verification-report/statistics-verification-report-columns";
|
||||
import {
|
||||
APPROVAL_STATUS_OPTIONS,
|
||||
DEFAULT_FILTERS,
|
||||
DEFAULT_SUB_FILTERS,
|
||||
fetchStatisticsVerificationDetailMock,
|
||||
fetchStatisticsVerificationSummaryMock,
|
||||
getSigunguOptions,
|
||||
getYearOptions,
|
||||
SIDO_OPTIONS,
|
||||
STATS_INDICATOR_OPTIONS,
|
||||
STATUS_OPTIONS,
|
||||
} from "../../../entities/statistics/model/statistics-verification-report/statistics-verification-report-mock";
|
||||
import type {
|
||||
StatisticsVerificationDetailRow,
|
||||
StatisticsVerificationFilterState,
|
||||
StatisticsVerificationSubFilterState,
|
||||
StatisticsVerificationSummaryRow,
|
||||
} from "../../../entities/statistics/model/statistics-verification-report/statistics-verification-report-types";
|
||||
|
||||
import ApproveButton from "@/components/button/ApproveButton";
|
||||
import ReturnButton from "@/components/button/ReturnButton";
|
||||
import DataGrid from "@/components/module/DataGrid";
|
||||
import { toGridRows } from "@/components/util/grid/gridFunction";
|
||||
|
||||
const getYearOptions = () => {
|
||||
const currentYear = dayjs().year();
|
||||
const yearOptionsRange = Array.from(
|
||||
{ length: currentYear - 2017 },
|
||||
(_, i) => {
|
||||
const year = 2017 + i;
|
||||
return { label: String(year), value: String(year) };
|
||||
},
|
||||
);
|
||||
return yearOptionsRange.map((year) => ({
|
||||
label: year.label,
|
||||
value: year.value,
|
||||
}));
|
||||
};
|
||||
|
||||
function isSameStatsInputStatusRow(
|
||||
a: StatsInputStatusList,
|
||||
b: StatsInputStatusList,
|
||||
): boolean {
|
||||
return (
|
||||
a.ctpvNm === b.ctpvNm && a.sggNm === b.sggNm && a.statsCd === b.statsCd
|
||||
);
|
||||
}
|
||||
|
||||
function isSameVerifyResultRow(
|
||||
a: VerifyResultItem,
|
||||
b: VerifyResultItem,
|
||||
): boolean {
|
||||
if (a.vrfcSn != null && b.vrfcSn != null) return a.vrfcSn === b.vrfcSn;
|
||||
return (
|
||||
a.statsYr === b.statsYr &&
|
||||
a.statsCd === b.statsCd &&
|
||||
a.ctpvNm === b.ctpvNm &&
|
||||
a.sggNm === b.sggNm &&
|
||||
a.vrfcTrgtNm === b.vrfcTrgtNm &&
|
||||
a.vrfcMthdCd === b.vrfcMthdCd
|
||||
);
|
||||
}
|
||||
|
||||
function useGridCheckboxSelection<T>(
|
||||
sourceRows: T[],
|
||||
isSameRow: (a: T, b: T) => boolean,
|
||||
setSelected: Dispatch<SetStateAction<T[]>>,
|
||||
) {
|
||||
const handleItemChecked = useCallback(
|
||||
(itemIndex: number, checked: boolean) => {
|
||||
const origin = sourceRows[itemIndex];
|
||||
if (origin === undefined) return;
|
||||
setSelected((prev) => {
|
||||
if (checked) {
|
||||
if (prev.some((r) => isSameRow(r, origin))) return prev;
|
||||
return [...prev, origin];
|
||||
}
|
||||
return prev.filter((r) => !isSameRow(r, origin));
|
||||
});
|
||||
},
|
||||
[sourceRows, isSameRow, setSelected],
|
||||
);
|
||||
|
||||
const handleAllChecked = useCallback(
|
||||
(checked: boolean) => {
|
||||
if (checked) setSelected([...sourceRows]);
|
||||
else setSelected([]);
|
||||
},
|
||||
[sourceRows, setSelected],
|
||||
);
|
||||
|
||||
return { handleItemChecked, handleAllChecked };
|
||||
}
|
||||
|
||||
const DEFAULT_FILTERS: StatisticsVerificationFilterState = {
|
||||
ctpvNm: null,
|
||||
sggNm: null,
|
||||
statsYr: String(dayjs().year() - 1),
|
||||
sewerBzmnCd: null,
|
||||
statsCd: null,
|
||||
};
|
||||
|
||||
const DEFAULT_SUB_FILTERS: StatisticsVerificationSubFilterState = {
|
||||
...DEFAULT_FILTERS,
|
||||
prcsYnList: "1,2,3",
|
||||
pbcpAprvYn: "N",
|
||||
};
|
||||
|
||||
const STATUS_OPTIONS = [
|
||||
{ label: "수정완료", value: "1" },
|
||||
{ label: "예외통과", value: "2" },
|
||||
{ label: "반려", value: "3" },
|
||||
];
|
||||
|
||||
const APPROVAL_STATUS_OPTIONS = [
|
||||
{ label: "승인", value: "Y" },
|
||||
{ label: "미승인", value: "N" },
|
||||
];
|
||||
|
||||
function StatisticsVerificationReport() {
|
||||
const userInfo = useUserStore((state) => state.userInfo);
|
||||
const { setMessage: alert } = useAlertStore((state) => state);
|
||||
const yearOptions = useMemo(() => getYearOptions(), []);
|
||||
const { confirm } = useConfirm();
|
||||
const [filters, setFilters] =
|
||||
useState<StatisticsVerificationFilterState>(DEFAULT_FILTERS);
|
||||
const [subFilters, setSubFilters] =
|
||||
useState<StatisticsVerificationSubFilterState>(DEFAULT_SUB_FILTERS);
|
||||
const [summaryRows, setSummaryRows] = useState<
|
||||
StatisticsVerificationSummaryRow[]
|
||||
const [submittedMainFilters, setSubmittedMainFilters] =
|
||||
useState<StatisticsVerificationFilterState>(DEFAULT_FILTERS);
|
||||
const [submittedDetailParams, setSubmittedDetailParams] = useState<{
|
||||
main: StatisticsVerificationFilterState;
|
||||
sub: StatisticsVerificationSubFilterState;
|
||||
}>({
|
||||
main: DEFAULT_FILTERS,
|
||||
sub: DEFAULT_SUB_FILTERS,
|
||||
});
|
||||
const [selectedSummaryRows, setSelectedSummaryRows] = useState<
|
||||
StatsInputStatusList[]
|
||||
>([]);
|
||||
const [detailRows, setDetailRows] = useState<
|
||||
StatisticsVerificationDetailRow[]
|
||||
const [selectedDetailRows, setSelectedDetailRows] = useState<
|
||||
VerifyResultItem[]
|
||||
>([]);
|
||||
const [summaryGridRows, setSummaryGridRows] = useState<
|
||||
Record<string, string | number>[]
|
||||
>([]);
|
||||
const [detailGridRows, setDetailGridRows] = useState<
|
||||
Record<string, string | number>[]
|
||||
>([]);
|
||||
const [selectedSummaryRow, setSelectedSummaryRow] =
|
||||
useState<StatisticsVerificationSummaryRow | null>(null);
|
||||
const [selectedDetailRow, setSelectedDetailRow] =
|
||||
useState<StatisticsVerificationDetailRow | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
const sigunguOptions = useMemo(
|
||||
() => getSigunguOptions(filters.sido),
|
||||
[filters.sido],
|
||||
const { data: sidoData } = useStAnlsSidoCombo();
|
||||
const { data: sigunguData } = useStAnlsSigunguCombo(
|
||||
filters.sewerBzmnCd ?? "",
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
void handleSearch(filters, subFilters);
|
||||
}, []);
|
||||
const statisticsVerificationReportQuery =
|
||||
useStatsVrfcRptData(submittedMainFilters);
|
||||
const statisticsVerificationResultQuery = useStatsVrfcRsltData(
|
||||
submittedDetailParams,
|
||||
);
|
||||
|
||||
async function handleSearch(
|
||||
const statisticsVerificationReportData =
|
||||
statisticsVerificationReportQuery.data ?? [];
|
||||
const statisticsVerificationReportGridRows = useMemo(
|
||||
() => toGridRows(statisticsVerificationReportData),
|
||||
[statisticsVerificationReportData],
|
||||
);
|
||||
const statisticsVerificationResultData = useMemo(
|
||||
() =>
|
||||
statisticsVerificationResultQuery.data?.pages.flatMap(
|
||||
(page) => page.verifyResultList ?? [],
|
||||
) ?? [],
|
||||
[statisticsVerificationResultQuery.data],
|
||||
);
|
||||
const statisticsVerificationResultGridRows = useMemo(
|
||||
() => toGridRows(statisticsVerificationResultData),
|
||||
[statisticsVerificationResultData],
|
||||
);
|
||||
|
||||
const isLoading =
|
||||
statisticsVerificationReportQuery.isFetching ||
|
||||
statisticsVerificationResultQuery.isFetching;
|
||||
const isAppendingDetail =
|
||||
statisticsVerificationResultQuery.isFetchingNextPage;
|
||||
const canLoadMoreDetail = Boolean(
|
||||
statisticsVerificationResultQuery.hasNextPage,
|
||||
);
|
||||
|
||||
const {
|
||||
handleItemChecked: handleReportItemChecked,
|
||||
handleAllChecked: handleReportAllChecked,
|
||||
} = useGridCheckboxSelection(
|
||||
statisticsVerificationReportData,
|
||||
isSameStatsInputStatusRow,
|
||||
setSelectedSummaryRows,
|
||||
);
|
||||
|
||||
const {
|
||||
handleItemChecked: handleResultItemChecked,
|
||||
handleAllChecked: handleResultAllChecked,
|
||||
} = useGridCheckboxSelection(
|
||||
statisticsVerificationResultData,
|
||||
isSameVerifyResultRow,
|
||||
setSelectedDetailRows,
|
||||
);
|
||||
|
||||
const { mutateAsync: onApproveStats } = useMutationWrapper({
|
||||
mutationFn: (approvalRequests: ApprovalRequest[]) =>
|
||||
statisticsApprovalApi.approveStats(approvalRequests),
|
||||
onSuccess: (data) => {
|
||||
alert(data.message ?? "승인이 완료되었습니다.");
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!statisticsVerificationReportQuery.isError) return;
|
||||
alert("통계검증리포트 조회 중 오류가 발생했습니다.");
|
||||
setSelectedSummaryRows([]);
|
||||
}, [
|
||||
alert,
|
||||
statisticsVerificationReportQuery.errorUpdatedAt,
|
||||
statisticsVerificationReportQuery.isError,
|
||||
]);
|
||||
|
||||
function handleSearch(
|
||||
nextFilters: StatisticsVerificationFilterState,
|
||||
nextSubFilters: StatisticsVerificationSubFilterState,
|
||||
summaryId?: number | null,
|
||||
) {
|
||||
setSelectedSummaryRows([]);
|
||||
setSelectedDetailRows([]);
|
||||
setSubmittedMainFilters({ ...nextFilters });
|
||||
setSubmittedDetailParams({
|
||||
main: { ...nextFilters },
|
||||
sub: { ...nextSubFilters },
|
||||
});
|
||||
}
|
||||
|
||||
async function handleLoadMoreDetail() {
|
||||
if (isLoading || isAppendingDetail || !canLoadMoreDetail) return;
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const [summaryData, detailData] = await Promise.all([
|
||||
fetchStatisticsVerificationSummaryMock(nextFilters),
|
||||
fetchStatisticsVerificationDetailMock(
|
||||
nextFilters,
|
||||
nextSubFilters,
|
||||
summaryId,
|
||||
),
|
||||
]);
|
||||
setSummaryRows(summaryData);
|
||||
setDetailRows(detailData);
|
||||
setSummaryGridRows(toGridRows(summaryData));
|
||||
setDetailGridRows(toGridRows(detailData));
|
||||
if (summaryData.length === 0)
|
||||
alert("조회된 상단 목록 데이터가 없습니다.");
|
||||
if (detailData.length === 0)
|
||||
alert("조회된 상세 목록 데이터가 없습니다.");
|
||||
await statisticsVerificationResultQuery.fetchNextPage();
|
||||
} catch {
|
||||
alert("통계검증리포트 조회 중 오류가 발생했습니다.");
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
alert("추가 데이터를 불러오는 중 오류가 발생했습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
function handleDetailSearchByAreaC() {
|
||||
setSelectedDetailRows([]);
|
||||
setSubmittedDetailParams({
|
||||
main: { ...filters },
|
||||
sub: { ...subFilters },
|
||||
});
|
||||
}
|
||||
|
||||
function handleFilterChange<
|
||||
K extends keyof StatisticsVerificationFilterState,
|
||||
>(key: K, value: StatisticsVerificationFilterState[K]) {
|
||||
if (key === "sido") {
|
||||
setFilters((prev) => ({ ...prev, sido: value, sigungu: "ALL" }));
|
||||
return;
|
||||
}
|
||||
setFilters((prev) => ({ ...prev, [key]: value }));
|
||||
>(key: K) {
|
||||
return (
|
||||
value?: StatisticsVerificationFilterState[K],
|
||||
optionData?: { label: string; value: string },
|
||||
) => {
|
||||
if (key === "sewerBzmnCd") {
|
||||
setFilters((prev) => ({
|
||||
...prev,
|
||||
ctpvNm: optionData?.label,
|
||||
sewerBzmnCd: optionData?.value,
|
||||
sggNm: "",
|
||||
}));
|
||||
return;
|
||||
}
|
||||
setFilters((prev) => ({ ...prev, [key]: value }));
|
||||
};
|
||||
}
|
||||
|
||||
function handleSubFilterChange<
|
||||
K extends keyof StatisticsVerificationSubFilterState,
|
||||
>(key: K, value: StatisticsVerificationSubFilterState[K]) {
|
||||
setSubFilters((prev) => ({ ...prev, [key]: value }));
|
||||
>(key: K) {
|
||||
return (value?: StatisticsVerificationSubFilterState[K]) => {
|
||||
setSubFilters((prev) => ({ ...prev, [key]: value }));
|
||||
};
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
setFilters(DEFAULT_FILTERS);
|
||||
setSubFilters(DEFAULT_SUB_FILTERS);
|
||||
setSelectedSummaryRow(null);
|
||||
setSelectedDetailRow(null);
|
||||
void handleSearch(DEFAULT_FILTERS, DEFAULT_SUB_FILTERS);
|
||||
setSelectedSummaryRows([]);
|
||||
setSelectedDetailRows([]);
|
||||
handleSearch(DEFAULT_FILTERS, DEFAULT_SUB_FILTERS);
|
||||
}
|
||||
|
||||
function handleApprove() {
|
||||
if (!selectedSummaryRow) {
|
||||
alert("승인할 상단 목록 행을 먼저 선택해주세요.");
|
||||
return;
|
||||
async function handleApprove() {
|
||||
const commonParam = {
|
||||
statsYr: filters.statsYr,
|
||||
sewerBzmnCd: filters.sewerBzmnCd ?? "",
|
||||
statsCd: filters.statsCd ?? "",
|
||||
mdfrId: userInfo?.userUnqId ?? "",
|
||||
};
|
||||
const approvalRequests = selectedSummaryRows.map((row) => ({
|
||||
...commonParam,
|
||||
rjctOpnnCn: row.rjctOpnnCn ?? "",
|
||||
lastCfmtnPicNm: row.laePicNm ?? "",
|
||||
lastCfmtnPicTelNo: row.laePicTelNo ?? "",
|
||||
lastCfmtnPicDeptNm: row.laeKbrdrDeptNm ?? "",
|
||||
lastCfmtnPicJbgdNm: row.laeKbrdrJbgdNm ?? "",
|
||||
}));
|
||||
try {
|
||||
if (await confirm("승인하시겠습니까?")) {
|
||||
await onApproveStats(approvalRequests);
|
||||
}
|
||||
} catch {
|
||||
alert("승인 중 오류가 발생했습니다.");
|
||||
}
|
||||
alert(
|
||||
`승인 API TBD: ${selectedSummaryRow.sido} ${selectedSummaryRow.sigungu} (${selectedSummaryRow.reportType})`,
|
||||
);
|
||||
}
|
||||
|
||||
function handleReject() {
|
||||
if (!selectedDetailRow) {
|
||||
alert("반려할 상세 항목 행을 먼저 선택해주세요.");
|
||||
return;
|
||||
}
|
||||
alert(
|
||||
`반려 API TBD: ${selectedDetailRow.sido} ${selectedDetailRow.sigungu} ${selectedDetailRow.detailItem}`,
|
||||
);
|
||||
}
|
||||
|
||||
function handleDownload() {
|
||||
if (detailRows.length === 0) {
|
||||
alert("다운로드할 상세 목록이 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
const headers = [
|
||||
"시도",
|
||||
"시군구",
|
||||
"지표",
|
||||
"세부항목",
|
||||
"검증날짜",
|
||||
"오류내역",
|
||||
"입력값",
|
||||
"비교값",
|
||||
"상태",
|
||||
"예외사유",
|
||||
"반려의견",
|
||||
"승인여부",
|
||||
];
|
||||
const rows = detailRows.map((row) =>
|
||||
[
|
||||
row.sido,
|
||||
row.sigungu,
|
||||
row.indicator,
|
||||
row.detailItem,
|
||||
row.verifyDate,
|
||||
row.errorDetail,
|
||||
String(row.inputValue),
|
||||
String(row.compareValue),
|
||||
row.status,
|
||||
row.exceptionReason,
|
||||
row.returnOpinion,
|
||||
row.approvalYn,
|
||||
].join(","),
|
||||
);
|
||||
const csv = [headers.join(","), ...rows].join("\n");
|
||||
const blob = new Blob([`\uFEFF${csv}`], {
|
||||
type: "text/csv;charset=utf-8;",
|
||||
});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = "statistics-verification-report-detail.csv";
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function handleSummaryRowClick(row: Record<string, string | number>) {
|
||||
const summaryId = Number(row.summaryId);
|
||||
const selected = summaryRows.find(
|
||||
(item) => item.summaryId === summaryId,
|
||||
);
|
||||
setSelectedSummaryRow(selected ?? null);
|
||||
if (!summaryId) return;
|
||||
void handleSearch(filters, subFilters, summaryId);
|
||||
}
|
||||
|
||||
function handleDetailRowClick(row: Record<string, string | number>) {
|
||||
const detailId = Number(row.detailId);
|
||||
const selected = detailRows.find((item) => item.detailId === detailId);
|
||||
setSelectedDetailRow(selected ?? null);
|
||||
}
|
||||
function handleReject() {}
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<div className="card !py-0">
|
||||
<div className="grid grid-cols-1 gap-[0.8rem] p-[1.2rem] md:grid-cols-[repeat(4,minmax(0,1fr))_auto]">
|
||||
<div className="flex justify-between p-2">
|
||||
<div className="flex items-center gap-6">
|
||||
<FilterSelect
|
||||
label="시도"
|
||||
value={filters.sido}
|
||||
onChange={(value) => handleFilterChange("sido", value)}
|
||||
options={SIDO_OPTIONS}
|
||||
value={filters.sewerBzmnCd ?? ""}
|
||||
onChange={handleFilterChange("sewerBzmnCd")}
|
||||
options={
|
||||
sidoData?.map((item) => ({
|
||||
label: item.adstNm,
|
||||
value: item.adstCd,
|
||||
})) ?? []
|
||||
}
|
||||
/>
|
||||
<FilterSelect
|
||||
label="시군구"
|
||||
value={filters.sigungu}
|
||||
onChange={(value) =>
|
||||
handleFilterChange("sigungu", value)
|
||||
value={filters.sggNm ?? ""}
|
||||
onChange={handleFilterChange("sggNm")}
|
||||
options={
|
||||
sigunguData?.map((item) => ({
|
||||
label: item.adstNm,
|
||||
value: item.adstCd,
|
||||
})) ?? []
|
||||
}
|
||||
options={sigunguOptions}
|
||||
/>
|
||||
<FilterSelect
|
||||
label="년도"
|
||||
value={filters.year}
|
||||
onChange={(value) => handleFilterChange("year", value)}
|
||||
options={yearOptions}
|
||||
value={filters.statsYr}
|
||||
onChange={handleFilterChange("statsYr")}
|
||||
options={getYearOptions()}
|
||||
/>
|
||||
<FilterSelect
|
||||
label="통계지표"
|
||||
value={filters.statsIndicator}
|
||||
onChange={(value) =>
|
||||
handleFilterChange("statsIndicator", value)
|
||||
}
|
||||
options={STATS_INDICATOR_OPTIONS}
|
||||
/>
|
||||
|
||||
<div className="flex items-end justify-end gap-[0.6rem]">
|
||||
<Button color="green" onClick={handleReset}>
|
||||
초기화
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() =>
|
||||
void handleSearch(filters, subFilters)
|
||||
}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<div className="flex items-center gap-2">
|
||||
<Label>통계지표</Label>
|
||||
<CodeSelect
|
||||
upCd="STITEM"
|
||||
value={filters.statsCd ?? ""}
|
||||
onValueChange={handleFilterChange("statsCd")}
|
||||
placeholder="선택"
|
||||
className="w-[32rem]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="card !py-0">
|
||||
<div className="m-[0.6rem] flex items-center justify-end">
|
||||
<ApproveButton approveFunc={handleApprove} />
|
||||
<div className="flex items-end justify-end gap-[0.6rem]">
|
||||
<Button color="white" onClick={handleReset}>
|
||||
초기화
|
||||
</Button>
|
||||
<Button onClick={() => handleSearch(filters, subFilters)}>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
color="green"
|
||||
onClick={handleApprove}
|
||||
disabled={selectedSummaryRows.length === 0}
|
||||
>
|
||||
승인
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -272,78 +396,161 @@ function StatisticsVerificationReport() {
|
||||
columnInfo={statisticsVerificationSummaryColumnInfo}
|
||||
fixedColumns={3}
|
||||
isExcelImport={false}
|
||||
onRowClick={handleSummaryRowClick}
|
||||
rowData={summaryGridRows}
|
||||
isExcelExport={false}
|
||||
onItemAllChecked={handleReportAllChecked}
|
||||
onItemChecked={handleReportItemChecked}
|
||||
rowData={statisticsVerificationReportGridRows}
|
||||
rowStartNum={2}
|
||||
setRowData={setSummaryGridRows}
|
||||
setRowData={() => {}}
|
||||
showHeaderCheckbox={true}
|
||||
gridHeight={30}
|
||||
/>
|
||||
|
||||
<div className="card !py-0">
|
||||
<div className="m-[0.6rem] flex flex-wrap items-end justify-between gap-[0.8rem]">
|
||||
<div className="grid w-full grid-cols-1 gap-[0.8rem] md:w-auto md:grid-cols-2">
|
||||
<FilterSelect
|
||||
label="상태"
|
||||
value={subFilters.status}
|
||||
onChange={(value) =>
|
||||
handleSubFilterChange("status", value)
|
||||
}
|
||||
options={STATUS_OPTIONS}
|
||||
/>
|
||||
<FilterSelect
|
||||
label="승인상태"
|
||||
value={subFilters.approvalStatus}
|
||||
onChange={(value) =>
|
||||
handleSubFilterChange("approvalStatus", value)
|
||||
}
|
||||
options={APPROVAL_STATUS_OPTIONS}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-end justify-end gap-[0.6rem]">
|
||||
<Button color="gray" onClick={handleDownload}>
|
||||
다운로드
|
||||
</Button>
|
||||
<ReturnButton returnFunc={handleReject} />
|
||||
</div>
|
||||
<h3 className="mt-10 px-2 text-[1.8rem] font-bold text-title">
|
||||
검증 결과
|
||||
</h3>
|
||||
<div className="mt-2 flex flex-wrap items-end justify-between p-2">
|
||||
<div className="flex items-center gap-6">
|
||||
<FilterCombobox
|
||||
label="상태"
|
||||
value={subFilters.prcsYnList}
|
||||
onChange={handleSubFilterChange("prcsYnList")}
|
||||
options={STATUS_OPTIONS}
|
||||
/>
|
||||
<FilterSelect
|
||||
label="승인상태"
|
||||
value={subFilters.pbcpAprvYn}
|
||||
onChange={handleSubFilterChange("pbcpAprvYn")}
|
||||
options={APPROVAL_STATUS_OPTIONS}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-end justify-end gap-[0.6rem]">
|
||||
<Button onClick={handleDetailSearchByAreaC}>조회</Button>
|
||||
<Button
|
||||
color="red"
|
||||
onClick={handleReject}
|
||||
disabled={selectedDetailRows.length === 0}
|
||||
>
|
||||
반려
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DataGrid
|
||||
columnInfo={statisticsVerificationDetailColumnInfo}
|
||||
fixedColumns={4}
|
||||
isExcelImport={false}
|
||||
onRowClick={handleDetailRowClick}
|
||||
rowData={detailGridRows}
|
||||
rowStartNum={2}
|
||||
setRowData={setDetailGridRows}
|
||||
showHeaderCheckbox={true}
|
||||
/>
|
||||
<div className="relative">
|
||||
<DataGrid
|
||||
columnInfo={statisticsVerificationDetailColumnInfo}
|
||||
fixedColumns={4}
|
||||
isExcelImport={false}
|
||||
onItemAllChecked={handleResultAllChecked}
|
||||
onItemChecked={handleResultItemChecked}
|
||||
onScrollToBottom={handleLoadMoreDetail}
|
||||
rowData={statisticsVerificationResultGridRows}
|
||||
rowStartNum={2}
|
||||
setRowData={() => {}}
|
||||
showHeaderCheckbox={true}
|
||||
/>
|
||||
|
||||
{isLoading && (
|
||||
<div className="[data-theme='black']:bg-transparent absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10">
|
||||
<div className="relative size-[5rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
{(isLoading || isAppendingDetail) && (
|
||||
<div className="[data-theme='black']:bg-transparent absolute inset-0 z-50 flex items-center justify-center rounded-lg p-10">
|
||||
<div className="relative size-[6rem]">
|
||||
<LoadingWithAnimation color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface FilterSelectProps {
|
||||
label: string;
|
||||
onChange: (value: string) => void;
|
||||
onChange: (
|
||||
value?: string,
|
||||
optionData?: { label: string; value: string },
|
||||
) => void;
|
||||
options: Array<{ label: string; value: string }>;
|
||||
value: string;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
function FilterCombobox({
|
||||
label,
|
||||
onChange,
|
||||
options,
|
||||
value,
|
||||
}: FilterSelectProps) {
|
||||
const anchor = useComboboxAnchor();
|
||||
const items = useMemo(
|
||||
() => options.map((option) => option.value),
|
||||
[options],
|
||||
);
|
||||
const selectedValues = useMemo(() => {
|
||||
if (!value) return [];
|
||||
return value.split(",").filter(Boolean);
|
||||
}, [value]);
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="whitespace-nowrap">{label}</Label>
|
||||
<Combobox
|
||||
multiple
|
||||
autoHighlight
|
||||
items={items}
|
||||
value={selectedValues}
|
||||
onValueChange={(next) => {
|
||||
if (next == null) {
|
||||
onChange(undefined);
|
||||
return;
|
||||
}
|
||||
const list = Array.isArray(next) ? next : [next];
|
||||
onChange(list.length > 0 ? list.join(",") : undefined);
|
||||
}}
|
||||
>
|
||||
<ComboboxChips ref={anchor} className="max-w-[26rem]">
|
||||
<ComboboxValue>
|
||||
{(values: string[]) => (
|
||||
<>
|
||||
{values.map((v) => (
|
||||
<ComboboxChip key={v}>
|
||||
{options.find((o) => o.value === v)
|
||||
?.label ?? v}
|
||||
</ComboboxChip>
|
||||
))}
|
||||
<ComboboxChipsInput placeholder="선택" />
|
||||
</>
|
||||
)}
|
||||
</ComboboxValue>
|
||||
</ComboboxChips>
|
||||
<ComboboxContent anchor={anchor}>
|
||||
<ComboboxEmpty>검색 결과가 없습니다.</ComboboxEmpty>
|
||||
<ComboboxList>
|
||||
{(item: string) => (
|
||||
<ComboboxItem key={item} value={item}>
|
||||
{options.find((o) => o.value === item)?.label ??
|
||||
item}
|
||||
</ComboboxItem>
|
||||
)}
|
||||
</ComboboxList>
|
||||
</ComboboxContent>
|
||||
</Combobox>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function FilterSelect({ label, onChange, options, value }: FilterSelectProps) {
|
||||
return (
|
||||
<div className="flex items-center gap-[0.8rem]">
|
||||
<Label className="min-w-[4rem] text-[1.3rem]">{label}</Label>
|
||||
<Select value={value} onValueChange={onChange}>
|
||||
<SelectTrigger className="h-[3.2rem] min-w-[14rem]">
|
||||
<SelectValue placeholder="전체" />
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="whitespace-nowrap">{label}</Label>
|
||||
<Select
|
||||
value={value}
|
||||
onValueChange={(value) =>
|
||||
onChange(
|
||||
value,
|
||||
options.find((option) => option.value === value),
|
||||
)
|
||||
}
|
||||
>
|
||||
<SelectTrigger className="w-[16rem]">
|
||||
<SelectValue placeholder="선택" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{options.map((option) => (
|
||||
@@ -357,5 +564,4 @@ function FilterSelect({ label, onChange, options, value }: FilterSelectProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export { StatisticsVerificationReport };
|
||||
export default StatisticsVerificationReport;
|
||||
|
||||
@@ -211,7 +211,7 @@ function VerificationArticleManagement() {
|
||||
setDialogOpen(true);
|
||||
}
|
||||
|
||||
function handleSubmit(e: React.FormEvent) {
|
||||
function handleSubmit(e: React.SubmitEvent) {
|
||||
e.preventDefault();
|
||||
handleSearch();
|
||||
}
|
||||
|
||||
@@ -18,30 +18,30 @@ export type RealGridColumnInfo = {
|
||||
mergeRule?: { criteria: "value" | string };
|
||||
sortable?: boolean;
|
||||
footer?:
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>;
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>;
|
||||
};
|
||||
|
||||
/** setColumns 메서드가 있는 GridView */
|
||||
@@ -110,21 +110,21 @@ export type DataFieldValueCallback = (
|
||||
export type ComputedFieldConfig =
|
||||
| { fields: string[]; type: "sum" | "avg" }
|
||||
| {
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "pblswrgPopltnSuprtRate";
|
||||
}
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "pblswrgPopltnSuprtRate";
|
||||
}
|
||||
| {
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "adtrtPopltnSuprtRate";
|
||||
}
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
type: "adtrtPopltnSuprtRate";
|
||||
}
|
||||
| {
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
thirdFields: string[];
|
||||
type: "swrgInstlrtRate";
|
||||
};
|
||||
numeratorFields: string[];
|
||||
denominatorFields: string[];
|
||||
thirdFields: string[];
|
||||
type: "swrgInstlrtRate";
|
||||
};
|
||||
|
||||
export type ColumnConfig = {
|
||||
name: string;
|
||||
@@ -147,31 +147,31 @@ export type ColumnConfig = {
|
||||
valueType?: ValueType;
|
||||
dataFormat?: string;
|
||||
footer?:
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
multiRow?: boolean; // 여러 행 footer 사용 여부
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>; // RealGrid에서 footer를 배열로 설정할 수 있음
|
||||
| {
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
multiRow?: boolean; // 여러 행 footer 사용 여부
|
||||
}
|
||||
| Array<{
|
||||
text?: string;
|
||||
expression?: "sum" | "avg" | "count" | "max" | "min";
|
||||
numberFormat?: string;
|
||||
valueCallback?: (
|
||||
grid: GridView,
|
||||
column: DataColumn,
|
||||
footerIndex: number,
|
||||
columnFooter: ColumnFooter,
|
||||
value: number | string | undefined,
|
||||
) => number | string;
|
||||
}>; // RealGrid에서 footer를 배열로 설정할 수 있음
|
||||
};
|
||||
|
||||
export type FooterUserSpan = {
|
||||
@@ -183,16 +183,16 @@ export type FooterUserSpan = {
|
||||
export type ColumnLayoutItem =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
hideChildHeaders?: boolean;
|
||||
header: { text: string };
|
||||
items: (string | ColumnLayoutItem)[];
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
}
|
||||
name: string;
|
||||
hideChildHeaders?: boolean;
|
||||
header: { text: string };
|
||||
items: (string | ColumnLayoutItem)[];
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
}
|
||||
| {
|
||||
column: string; // 컬럼 이름 (footerUserSpans 사용 시)
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
};
|
||||
column: string; // 컬럼 이름 (footerUserSpans 사용 시)
|
||||
footerUserSpans?: FooterUserSpan[]; // footer 병합 설정
|
||||
};
|
||||
|
||||
export type ColumnInfo = {
|
||||
columns: ColumnConfig[];
|
||||
@@ -202,7 +202,10 @@ export type ColumnInfo = {
|
||||
export type GridTopButtonConfig = {
|
||||
visible?: boolean;
|
||||
text: string;
|
||||
onClick?: (helpers: { openDialog: (title?: string) => void; closeDialog: () => void }) => void;
|
||||
onClick?: (helpers: {
|
||||
openDialog: (title?: string) => void;
|
||||
closeDialog: () => void;
|
||||
}) => void;
|
||||
};
|
||||
|
||||
export type ColumnInfoList = {
|
||||
@@ -225,11 +228,18 @@ export type CellStyleCallbackParams = {
|
||||
row: Record<string, string | number>;
|
||||
};
|
||||
|
||||
export type CellStyleCallback = (params: CellStyleCallbackParams) => string | undefined;
|
||||
export type CellStyleCallback = (
|
||||
params: CellStyleCallbackParams,
|
||||
) => string | undefined;
|
||||
|
||||
/** 셀 hover 시 툴팁 문구 (반환 시 해당 문구 표시, 검증 오류 메시지 등) */
|
||||
export type CellTooltipCallbackParams = { row: Record<string, string | number>; fieldName: string };
|
||||
export type CellTooltipCallback = (params: CellTooltipCallbackParams) => string | undefined;
|
||||
export type CellTooltipCallbackParams = {
|
||||
row: Record<string, string | number>;
|
||||
fieldName: string;
|
||||
};
|
||||
export type CellTooltipCallback = (
|
||||
params: CellTooltipCallbackParams,
|
||||
) => string | undefined;
|
||||
|
||||
export type DataGridProps = {
|
||||
columnInfo: ColumnInfo;
|
||||
@@ -254,6 +264,11 @@ export type DataGridProps = {
|
||||
current: (() => Record<string, string | number>[]) | null;
|
||||
};
|
||||
onRowClick?: (rowData: Record<string, string | number>) => void; // 행 클릭 이벤트
|
||||
/** CheckBar 행 체크 변경 */
|
||||
onItemChecked?: (itemIndex: number, checked: boolean) => void;
|
||||
/** CheckBar 헤더 전체 선택/해제 */
|
||||
onItemAllChecked?: (checked: boolean) => void;
|
||||
onScrollToBottom?: () => void;
|
||||
statusInfo?: SewerageSupplyRateStatusInfo | null;
|
||||
/** 강조 및 스크롤할 행의 ID */
|
||||
highlightedRowId?: string | number | null;
|
||||
@@ -265,6 +280,7 @@ export type DataGridProps = {
|
||||
compactFullWidth?: boolean;
|
||||
/** CompactDataGrid 전용: 그리드 영역 높이 Tailwind 클래스 */
|
||||
compactGridHeightClass?: string;
|
||||
gridHeight?: number;
|
||||
};
|
||||
|
||||
export type TabDataGridProps = {
|
||||
|
||||
Reference in New Issue
Block a user