[ST] - fix: 전남광주통합특별시 본청 데이터 관련 로직 수정, 2-3지표 컬럼 로직 수정
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -2021,6 +2021,13 @@ 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) &&
|
||||
@@ -2092,7 +2099,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 && (
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -11,9 +11,14 @@ 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_UNIFIED_SIDO_CD,
|
||||
isJeonnamGwangjuHeadquartersOperableRow,
|
||||
isJeonnamGwangjuSidoAllSearch,
|
||||
isJeonnamGwangjuSidoAllToolbarException,
|
||||
isSewerageFinanceStatsCd,
|
||||
shouldRestrictFinanceVerificationToHeadquarters,
|
||||
} from "./lib/jeonnam-gwangju-sido-all-toolbar";
|
||||
export {
|
||||
filterBySelectedAdmdstCd,
|
||||
|
||||
@@ -5,6 +5,22 @@ import type { Sido } from "../model/statistics-interface";
|
||||
/** 전남광주통합특별시 — 도 목록에 있어 시군구 전체 조회 시 버튼이 숨겨짐 */
|
||||
export const JEONNAM_GWANGJU_UNIFIED_SIDO_CD = "1200000000";
|
||||
|
||||
export const JEONNAM_GWANGJU_HEADQUARTERS_ADMDST_NM = "본청";
|
||||
|
||||
/** 입력 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 +59,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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user