feat: Enhance numbering rule service with separator handling

- Introduced functionality to extract and manage individual separators for numbering rule parts.
- Added methods to join parts with their respective separators, improving code generation flexibility.
- Updated the numbering rule service to utilize the new separator logic during part processing.
- Enhanced the frontend components to support custom separators for each part, allowing for more granular control over numbering formats.
This commit is contained in:
kjs
2026-02-25 12:25:30 +09:00
parent 3ca511924e
commit 60b1ac1442
9 changed files with 328 additions and 191 deletions

View File

@@ -2054,11 +2054,11 @@ export class ButtonActionExecutor {
const { tableName, screenId } = context;
// 범용_폼_모달 키 찾기 (컬럼명에 따라 다를 수 있음)
// initializeForm에서 __tableSection_ (더블), 수정 시 _tableSection_ (싱글) 사용
const universalFormModalKey = Object.keys(formData).find((key) => {
const value = formData[key];
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
// _tableSection_ 키가 있는지 확인
return Object.keys(value).some((k) => k.startsWith("_tableSection_"));
return Object.keys(value).some((k) => k.startsWith("_tableSection_") || k.startsWith("__tableSection_"));
});
if (!universalFormModalKey) {
@@ -2117,11 +2117,18 @@ export class ButtonActionExecutor {
const originalGroupedData: any[] = modalData._originalGroupedData || formData._originalGroupedData || [];
for (const [key, value] of Object.entries(modalData)) {
if (key.startsWith("_tableSection_")) {
const sectionId = key.replace("_tableSection_", "");
tableSectionData[sectionId] = value as any[];
// initializeForm: __tableSection_ (더블), 수정 시: _tableSection_ (싱글) → 통일 처리
if (key.startsWith("_tableSection_") || key.startsWith("__tableSection_")) {
if (Array.isArray(value)) {
const normalizedKey = key.startsWith("__tableSection_")
? key.replace("__tableSection_", "")
: key.replace("_tableSection_", "");
// 싱글 언더스코어 키(수정된 데이터)가 더블 언더스코어 키(초기 데이터)보다 우선
if (!tableSectionData[normalizedKey] || key.startsWith("_tableSection_")) {
tableSectionData[normalizedKey] = value as any[];
}
}
} else if (!key.startsWith("_")) {
// _로 시작하지 않는 필드는 공통 필드로 처리
commonFieldsData[key] = value;
}
}
@@ -2306,10 +2313,11 @@ export class ButtonActionExecutor {
// originalGroupedData 전달이 누락된 경우를 처리
console.warn(`⚠️ [UPDATE] 원본 데이터 없음 - id가 있으므로 UPDATE 시도 (폴백): id=${item.id}`);
// ⚠️ 중요: commonFieldsData가 item보다 우선순위가 높아야 함
// item에 있는 기존 값(예: manager_id=123)이 commonFieldsData의 새 값(manager_id=234)을 덮어쓰지 않도록
// 순서: item(기존) → commonFieldsData(새로 입력) → userInfo(메타데이터)
const rowToUpdate = { ...item, ...commonFieldsData, ...userInfo };
// 마스터/디테일 테이블 분리 시: commonFieldsData 병합하지 않음
// → 동명 컬럼(예: memo)이 마스터 값으로 덮어씌워지는 문제 방지
const rowToUpdate = hasSeparateTargetTable
? { ...item, ...userInfo }
: { ...commonFieldsData, ...item, ...userInfo };
Object.keys(rowToUpdate).forEach((key) => {
if (key.startsWith("_")) {
delete rowToUpdate[key];
@@ -2330,17 +2338,20 @@ export class ButtonActionExecutor {
continue;
}
// 변경 사항 확인 (공통 필드 포함)
// ⚠️ 중요: commonFieldsData가 item보다 우선순위가 높아야 함 (새로 입력한 값이 기존 값을 덮어씀)
const currentDataWithCommon = { ...item, ...commonFieldsData };
const hasChanges = this.checkForChanges(originalItem, currentDataWithCommon);
// 변경 사항 확인
// 마스터/디테일 테이블이 분리된 경우(hasSeparateTargetTable):
// 마스터 필드(commonFieldsData)를 디테일에 병합하지 않음
// → 동명 컬럼(예: memo)이 마스터 값으로 덮어씌워지는 문제 방지
// 같은 테이블인 경우: 공통 필드 병합 유지 (공유 필드 업데이트 필요)
const dataForComparison = hasSeparateTargetTable ? item : { ...commonFieldsData, ...item };
const hasChanges = this.checkForChanges(originalItem, dataForComparison);
if (hasChanges) {
// 변경된 필드만 추출하여 부분 업데이트
const updateResult = await DynamicFormApi.updateFormDataPartial(
item.id,
originalItem,
currentDataWithCommon,
dataForComparison,
saveTableName,
);