[st] - fix: 하수관로 관종별 현황, 입력 가능 연도만 매설연장 컬럼 수정가능, 관리자 계정일 시 엑셀 업로드로 모든 cell 수정 가능

This commit is contained in:
2026-07-07 12:17:44 +09:00
parent 3c214f4725
commit e3a9851de6
7 changed files with 180 additions and 23 deletions
@@ -555,7 +555,7 @@ const PublicSewageFacilityInp = () => {
sggNm: lastSearchedValues.gugun === 'ALL' ? '' : lastSearchedValues.gugun ?? '',
sewerBzmnCd: lastSearchedValues.bsnmCd ?? '',
userId: userInfo.userUnqId,
// superAdmin: isAdminInfo ? 'superAdmin' : '',
superAdmin: isAdminInfo ? 'superAdmin' : '',
noApplicable,
saveList,
};
@@ -108,6 +108,48 @@ const getPipeTypeLastDataYear = () => {
return Math.max(1995, lastDataYear);
};
const PIPE_TYPE_STATUS_TAB_KEY = "ST00020003";
/** 조회 연도(statsYr)에 해당하는 연도별 매설연장 필드명 (y{year}LyngPrlg) */
const resolvePipeTypeEditableLyngField = (statsYr: string | null | undefined): string | null => {
if (!statsYr) return null;
const year = Number(statsYr);
if (!Number.isFinite(year)) return null;
const clamped = Math.min(getPipeTypeLastDataYear(), Math.max(1995, year));
return `y${clamped}LyngPrlg`;
};
/** ST00020003: 입력기간 통과 시 조회 연도의 매설연장(y{year}LyngPrlg)만 편집 가능 */
const applyPipeTypeStatusEditableColumns = (
cols: ColumnConfig[] | undefined,
canEdit: boolean,
periodEnterable: boolean,
statsYr: string | null,
): ColumnConfig[] =>
(cols ?? []).map((col) => {
if (!canEdit) {
return { ...col, editable: false as const, styleName: col.styleName ?? "rg-cell-readonly" };
}
const fieldName = col.fieldName ?? col.name;
const isYearLyngField =
fieldName !== "lyngPrlg" && typeof fieldName === "string" && fieldName.endsWith("LyngPrlg");
if (fieldName === "lyngPrlg" || isYearLyngField) {
const editableLyngField = periodEnterable ? resolvePipeTypeEditableLyngField(statsYr) : null;
const isTargetYear = editableLyngField !== null && fieldName === editableLyngField;
if (isTargetYear) {
const { styleName: _readonlyStyle, ...rest } = col;
return {
...rest,
editable: true as const,
};
}
return { ...col, editable: false as const, styleName: col.styleName ?? "rg-cell-readonly" };
}
return col;
});
const getManholeLastDataYear = () => {
const lastDataYear = new Date().getFullYear() - 1;
return Math.max(2014, lastDataYear);
@@ -507,11 +549,22 @@ const SewagePipeInp = () => {
const canEdit =
computeTabEnterable(tabStatusInfoMap.get(tab.tabKey) ?? null, inputPeriodEnterable) || isAdminInfo;
const applyEditable = (cols: ColumnConfig[] | undefined) =>
(cols ?? []).map((col: ColumnConfig) =>
canEdit
? col
: { ...col, editable: false as const, styleName: col.styleName ?? "rg-cell-readonly" }
);
tab.tabKey === PIPE_TYPE_STATUS_TAB_KEY
? applyPipeTypeStatusEditableColumns(
cols,
canEdit,
inputPeriodEnterable,
lastSearchedYear,
)
: (cols ?? []).map((col: ColumnConfig) =>
canEdit
? col
: {
...col,
editable: false as const,
styleName: col.styleName ?? "rg-cell-readonly",
},
);
if (tab.left && tab.right) {
return {
@@ -525,7 +578,7 @@ const SewagePipeInp = () => {
columns: applyColumnGuides(applyEditable(tab.columns), tab.tabKey),
};
});
}, [tabStatusInfoMap, isAdminInfo, inputPeriodEnterable, columnGuidesByTab]);
}, [tabStatusInfoMap, isAdminInfo, inputPeriodEnterable, columnGuidesByTab, lastSearchedYear]);
const commitToolbarSnapshotForLoadedTab = (
tabKey: string,
@@ -1546,7 +1599,7 @@ const SewagePipeInp = () => {
sggNm: values.gugun === "ALL" ? "" : (values.gugun ?? ""),
sewerBzmnCd: values.bsnmCd ?? "",
userId: userInfo.userUnqId,
// superAdmin: isAdminInfo ? "superAdmin" : "",
superAdmin: isAdminInfo ? "superAdmin" : "",
saveList,
};
@@ -1626,7 +1679,7 @@ const SewagePipeInp = () => {
sggNm: values.gugun === "ALL" ? "" : (values.gugun ?? ""),
sewerBzmnCd: values.bsnmCd ?? "",
userId: userInfo.userUnqId,
// superAdmin: isAdminInfo ? "superAdmin" : "",
superAdmin: isAdminInfo ? "superAdmin" : "",
saveList,
};
@@ -1711,7 +1764,7 @@ const SewagePipeInp = () => {
sggNm: values.gugun === "ALL" ? "" : (values.gugun ?? ""),
sewerBzmnCd: values.bsnmCd ?? "",
userId: userInfo.userUnqId,
// superAdmin: isAdminInfo ? "superAdmin" : "",
superAdmin: isAdminInfo ? "superAdmin" : "",
saveList,
};
@@ -1774,7 +1827,7 @@ const SewagePipeInp = () => {
sggNm: values.gugun === "ALL" ? "" : (values.gugun ?? ""),
sewerBzmnCd: values.bsnmCd ?? "",
userId: userInfo.userUnqId,
// superAdmin: isAdminInfo ? "superAdmin" : "",
superAdmin: isAdminInfo ? "superAdmin" : "",
saveList,
};
@@ -1853,7 +1906,7 @@ const SewagePipeInp = () => {
sggNm: values.gugun === "ALL" ? "" : (values.gugun ?? ""),
sewerBzmnCd: values.bsnmCd ?? "",
userId: userInfo.userUnqId,
// superAdmin: isAdminInfo ? "superAdmin" : "",
superAdmin: isAdminInfo ? "superAdmin" : "",
saveList,
};
@@ -2080,6 +2133,9 @@ const SewagePipeInp = () => {
});
}}
isExcelImport={excelToolbarEnabledForTab}
excelImportSkipNonEditable={
tabKey === PIPE_TYPE_STATUS_TAB_KEY ? !isAdminInfo : true
}
isExcelExport
showHeaderCheckbox={false}
fixedColumns={info.fixedColumns}
@@ -353,9 +353,9 @@ const SeweragePenetrationRateInp = () => {
statsCd: statsCd,
};
// if (isAdminInfo) {
// params.superAdmin = 'superAdmin';
// }
if (isAdminInfo) {
params.superAdmin = 'superAdmin';
}
try {
setIsLoading(true);
@@ -682,9 +682,9 @@ const SeweragePenetrationRateInp = () => {
sewerBzmnFrgnrWholPpltnCnt: footerFromApi?.sewerBzmnFrgnrWholPpltnCnt // 행정참고자료 외국인 합계
};
// if (isAdminInfo) {
// requestData.superAdmin = 'superAdmin';
// }
if (isAdminInfo) {
requestData.superAdmin = 'superAdmin';
}
const response = await statisticsInputSewSupplyRateApi.saveSewerageSupplyRate(requestData);