[ST] - refactor: 2-5 맨홀 지표 변경된 테이블에 맞게 수정, 일반검증 항목 입력기간일 시 등록/수정 불가

This commit is contained in:
2026-09-04 16:05:26 +09:00
parent 794691f05e
commit 8039ab8281
17 changed files with 376 additions and 991 deletions
@@ -5,130 +5,18 @@ import { footerInt } from "@/components/util/grid/footerSummary";
// 하수도 통계 관리 > 02.하수관로 > tab 5. 맨홀 현황
// SeweragePipeInputManholeStatusItem + commonInfo.ctpvNm (그리드 행에 병합)
// API: yy14=2015년 이전(2014년 데이터) … yy{(현재연도-1)%100} (필드 접두 yy + 연도 끝자리)
const MANHOLE_START_YEAR = 2014;
const MANHOLE_LAST_DATA_YEAR = Math.max(MANHOLE_START_YEAR, new Date().getFullYear() - 1);
const MANHOLE_YY_MIN = MANHOLE_START_YEAR % 100;
const MANHOLE_YY_MAX = MANHOLE_LAST_DATA_YEAR % 100;
const calendarYearFromYy = (yy: number) => 2000 + yy;
/** yy14(2014) 구간은 헤더에 「2015년 이전」 표기 (합계·검토 컬럼과 동일) */
const manholeYearHeaderText = (yy: number): string => {
const y = calendarYearFromYy(yy);
return y === MANHOLE_START_YEAR ? "2015년 이전" : `${y}년`;
};
const intCol = (name: string, headerText: string): ColumnConfig => ({
const intCol = (name: string, headerText: string, editable = true): ColumnConfig => ({
name,
fieldName: name,
header: { text: headerText },
footer: footerInt,
// editable: false,
editable,
valueType: ValueType.NUMBER,
dataFormat: "#,##0",
...(editable ? {} : { styleName: "rg-cell-total" }),
});
const yearlySumFields = (suffix: "WholMnhlCnt" | "Step1MnhlCnt" | "Step2MnhlCnt" | "Step3MnhlCnt" | "Step4MnhlCnt" | "Step5MnhlCnt") =>
Array.from({ length: MANHOLE_YY_MAX - MANHOLE_YY_MIN + 1 }, (_, i) => `yy${MANHOLE_YY_MIN + i}${suffix}`);
function totalBlockColumns(): ColumnConfig[] {
return [
{
...intCol("totalWholMnhlCnt", "계"),
styleName: "rg-cell-total",
editable: false,
computed: { fields: yearlySumFields("WholMnhlCnt"), type: "sum" as const },
},
{
...intCol("totalStep1MnhlCnt", "주철"),
styleName: "rg-cell-total",
editable: false,
computed: { fields: yearlySumFields("Step1MnhlCnt"), type: "sum" as const },
},
{
...intCol("totalStep2MnhlCnt", "주철(조화)"),
styleName: "rg-cell-total",
editable: false,
computed: { fields: yearlySumFields("Step2MnhlCnt"), type: "sum" as const },
},
{
...intCol("totalStep3MnhlCnt", "콘크리트"),
styleName: "rg-cell-total",
editable: false,
computed: { fields: yearlySumFields("Step3MnhlCnt"), type: "sum" as const },
},
{
...intCol("totalStep4MnhlCnt", "기타"),
styleName: "rg-cell-total",
editable: false,
computed: { fields: yearlySumFields("Step4MnhlCnt"), type: "sum" as const },
},
{
...intCol("totalStep5MnhlCnt", "추락방지시설설치맨홀(개)"),
styleName: "rg-cell-total",
editable: false,
computed: { fields: yearlySumFields("Step5MnhlCnt"), type: "sum" as const },
},
];
}
function yyBlockColumns(yy: number): ColumnConfig[] {
const p = `yy${yy}`;
return [
{
...intCol(`${p}WholMnhlCnt`, "계"),
styleName: "rg-cell-total",
editable: false,
computed: {
fields: [
`${p}Step1MnhlCnt`,
`${p}Step2MnhlCnt`,
`${p}Step3MnhlCnt`,
`${p}Step4MnhlCnt`,
`${p}Step5MnhlCnt`,
],
type: "sum" as const,
},
},
intCol(`${p}Step1MnhlCnt`, "주철"),
intCol(`${p}Step2MnhlCnt`, "주철(조화)"),
intCol(`${p}Step3MnhlCnt`, "콘크리트"),
intCol(`${p}Step4MnhlCnt`, "기타"),
intCol(`${p}Step5MnhlCnt`, "추락방지시설설치맨홀(개)"),
];
}
function yyYearLayout(yy: number): ColumnLayoutItem {
const y = calendarYearFromYy(yy);
const p = `yy${yy}`;
return {
name: `year${y}`,
hideChildHeaders: false,
header: { text: manholeYearHeaderText(yy) },
items: [
{
name: `year${y}Material`,
hideChildHeaders: false,
header: { text: "맨홀뚜껑 재질(개)" },
items: [
`${p}WholMnhlCnt`,
`${p}Step1MnhlCnt`,
`${p}Step2MnhlCnt`,
`${p}Step3MnhlCnt`,
`${p}Step4MnhlCnt`,
],
},
`${p}Step5MnhlCnt`,
],
};
}
const yearLayoutItems: ColumnLayoutItem[] = [];
for (let yy = MANHOLE_YY_MIN; yy <= MANHOLE_YY_MAX; yy++) {
yearLayoutItems.push(yyYearLayout(yy));
}
export const ManholeStatusInpColumn = {
columns: [
{
@@ -160,12 +48,19 @@ export const ManholeStatusInpColumn = {
editable: false,
styleName: "rg-cell-readonly",
footer: { text: "합계" },
// editable: false,
},
...totalBlockColumns(),
...Array.from({ length: MANHOLE_YY_MAX - MANHOLE_YY_MIN + 1 }, (_, i) =>
yyBlockColumns(MANHOLE_YY_MIN + i)
).flat(),
{
...intCol("wholMnhlCnt", "계", false),
computed: {
fields: ["frlvlMnhlCnt", "sclvlMnhlCnt", "thlvlMnhlCnt", "folvlMnhlCnt"],
type: "sum" as const,
},
},
intCol("frlvlMnhlCnt", "주철"),
intCol("sclvlMnhlCnt", "주철(조화)"),
intCol("thlvlMnhlCnt", "콘크리트"),
intCol("folvlMnhlCnt", "기타"),
intCol("filvlMnhlCnt", "추락방지시설설치맨홀(개)"),
{ name: "rmrk", fieldName: "rmrk", header: { text: "비고" } },
{
name: "admdstCd",
@@ -194,31 +89,17 @@ export const ManholeStatusInpColumn = {
"admdstNm",
"emphsMngSeNm",
{
name: "yearlyTotal",
name: "mtrlGroup",
hideChildHeaders: false,
header: { text: "연도별총계" },
items: [
{
name: "yearlyTotalMaterial",
hideChildHeaders: false,
header: { text: "맨홀뚜껑 재질(개)" },
items: [
"totalWholMnhlCnt",
"totalStep1MnhlCnt",
"totalStep2MnhlCnt",
"totalStep3MnhlCnt",
"totalStep4MnhlCnt",
],
},
"totalStep5MnhlCnt",
],
header: { text: "맨홀뚜껑 재질(개)" },
items: ["wholMnhlCnt", "frlvlMnhlCnt", "sclvlMnhlCnt", "thlvlMnhlCnt", "folvlMnhlCnt"],
},
...yearLayoutItems,
"filvlMnhlCnt",
"rmrk",
"admdstCd",
"emphsMngSeCd",
] as ColumnLayoutItem[],
rowStartNum: 3,
rowStartNum: 2,
fixedColumns: 2,
tabKey: "ST00020005",
tabLabel: "맨홀 현황",