- 데이터 구조 변경: ItemData.details → ItemData.fieldGroups (그룹별 관리) - 각 필드 그룹마다 독립적으로 여러 항목 추가/수정/삭제 가능 - renderFieldsByGroup: 그룹별 입력 항목 목록 + 편집 + 추가 버튼 구현 - renderGridLayout/renderCardLayout: 품목별 그룹 카드 표시로 단순화 - handleFieldChange: groupId 파라미터 추가 (itemId, groupId, entryId, fieldName, value) - handleAddGroupEntry, handleRemoveGroupEntry, handleEditGroupEntry 핸들러 추가 - buttonActions handleBatchSave: fieldGroups 구조 처리하도록 수정 - 원본 데이터 표시 버그 수정: modalData의 중첩 구조 처리 사용 예: - 품목 1 - 그룹 1 (거래처 정보): 3개 항목 입력 가능 - 그룹 2 (단가 정보): 5개 항목 입력 가능 - 각 항목 클릭 → 수정 가능 - 저장 시 모든 입력 항목이 개별 레코드로 저장됨
81 lines
1.8 KiB
TypeScript
81 lines
1.8 KiB
TypeScript
/**
|
|
* 채번 규칙 템플릿
|
|
* 화면관리 시스템에 등록하여 드래그앤드롭으로 사용
|
|
*/
|
|
|
|
import { Hash } from "lucide-react";
|
|
|
|
export const getDefaultNumberingRuleConfig = () => ({
|
|
template_code: "numbering-rule-designer",
|
|
template_name: "코드 채번 규칙",
|
|
template_name_eng: "Numbering Rule Designer",
|
|
description: "코드 자동 채번 규칙을 설정하는 컴포넌트",
|
|
category: "admin" as const,
|
|
icon_name: "hash",
|
|
default_size: {
|
|
width: 1200,
|
|
height: 800,
|
|
},
|
|
layout_config: {
|
|
components: [
|
|
{
|
|
type: "numbering-rule" as const,
|
|
label: "채번 규칙 설정",
|
|
position: { x: 0, y: 0 },
|
|
size: { width: 1200, height: 800 },
|
|
ruleConfig: {
|
|
ruleId: "new-rule",
|
|
ruleName: "새 채번 규칙",
|
|
parts: [],
|
|
separator: "-",
|
|
resetPeriod: "none",
|
|
currentSequence: 1,
|
|
},
|
|
maxRules: 6,
|
|
style: {
|
|
padding: "16px",
|
|
backgroundColor: "#ffffff",
|
|
},
|
|
},
|
|
],
|
|
},
|
|
});
|
|
|
|
/**
|
|
* 템플릿 패널에서 사용할 컴포넌트 정보
|
|
*/
|
|
export const numberingRuleTemplate = {
|
|
id: "numbering-rule",
|
|
name: "채번 규칙",
|
|
description: "코드 자동 채번 규칙 설정",
|
|
category: "admin" as const,
|
|
icon: Hash,
|
|
defaultSize: { width: 1200, height: 800 },
|
|
components: [
|
|
{
|
|
type: "numbering-rule" as const,
|
|
widgetType: undefined,
|
|
label: "채번 규칙 설정",
|
|
position: { x: 0, y: 0 },
|
|
size: { width: 1200, height: 800 },
|
|
style: {
|
|
padding: "16px",
|
|
backgroundColor: "#ffffff",
|
|
},
|
|
ruleConfig: {
|
|
ruleId: "new-rule",
|
|
ruleName: "새 채번 규칙",
|
|
parts: [],
|
|
separator: "-",
|
|
resetPeriod: "none",
|
|
currentSequence: 1,
|
|
},
|
|
maxRules: 6,
|
|
},
|
|
],
|
|
};
|
|
|
|
|
|
|
|
|