feat: 채번 규칙 테이블 기반 자동 필터링 구현
- 채번 규칙 scope_type을 table로 단순화 - 화면의 테이블명을 자동으로 감지하여 채번 규칙 필터링 - TextInputConfigPanel에 screenTableName prop 추가 - getAvailableNumberingRulesForScreen API로 테이블 기반 조회 - NumberingRuleDesigner에서 자동으로 테이블명 설정 - webTypeConfigConverter 유틸리티 추가 (기존 화면 호환성) - AutoGenerationConfig 타입 개선 (enabled, options.numberingRuleId) - 채번 규칙 선택 UI에서 ID 제거, 설명 추가 - 불필요한 console.log 제거 Backend: - numberingRuleService: 테이블 기반 필터링 로직 구현 - numberingRuleController: available-for-screen 엔드포인트 수정 Frontend: - TextInputConfigPanel: 테이블명 기반 채번 규칙 로드 - NumberingRuleDesigner: 적용 범위 UI 제거, 테이블명 자동 설정 - ScreenDesigner: webTypeConfig → autoGeneration 변환 로직 통합 - DetailSettingsPanel: autoGeneration 속성 매핑 개선
This commit is contained in:
@@ -8,19 +8,20 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@
|
||||
import { TextInputConfig } from "./types";
|
||||
import { AutoGenerationType, AutoGenerationConfig } from "@/types/screen";
|
||||
import { AutoGenerationUtils } from "@/lib/utils/autoGeneration";
|
||||
import { getAvailableNumberingRules } from "@/lib/api/numberingRule";
|
||||
import { getAvailableNumberingRules, getAvailableNumberingRulesForScreen } from "@/lib/api/numberingRule";
|
||||
import { NumberingRuleConfig } from "@/types/numbering-rule";
|
||||
|
||||
export interface TextInputConfigPanelProps {
|
||||
config: TextInputConfig;
|
||||
onChange: (config: Partial<TextInputConfig>) => void;
|
||||
screenTableName?: string; // 🆕 현재 화면의 테이블명
|
||||
}
|
||||
|
||||
/**
|
||||
* TextInput 설정 패널
|
||||
* 컴포넌트의 설정값들을 편집할 수 있는 UI 제공
|
||||
*/
|
||||
export const TextInputConfigPanel: React.FC<TextInputConfigPanelProps> = ({ config, onChange }) => {
|
||||
export const TextInputConfigPanel: React.FC<TextInputConfigPanelProps> = ({ config, onChange, screenTableName }) => {
|
||||
// 채번 규칙 목록 상태
|
||||
const [numberingRules, setNumberingRules] = useState<NumberingRuleConfig[]>([]);
|
||||
const [loadingRules, setLoadingRules] = useState(false);
|
||||
@@ -30,9 +31,20 @@ export const TextInputConfigPanel: React.FC<TextInputConfigPanelProps> = ({ conf
|
||||
const loadRules = async () => {
|
||||
setLoadingRules(true);
|
||||
try {
|
||||
const response = await getAvailableNumberingRules();
|
||||
let response;
|
||||
|
||||
// 🆕 테이블명이 있으면 테이블 기반 필터링, 없으면 전체 조회
|
||||
if (screenTableName) {
|
||||
console.log("🔍 TextInputConfigPanel: 테이블 기반 채번 규칙 로드", { screenTableName });
|
||||
response = await getAvailableNumberingRulesForScreen(screenTableName);
|
||||
} else {
|
||||
console.log("🔍 TextInputConfigPanel: 전체 채번 규칙 로드 (테이블명 없음)");
|
||||
response = await getAvailableNumberingRules();
|
||||
}
|
||||
|
||||
if (response.success && response.data) {
|
||||
setNumberingRules(response.data);
|
||||
console.log("✅ 채번 규칙 로드 완료:", response.data.length, "개");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("채번 규칙 목록 로드 실패:", error);
|
||||
@@ -45,7 +57,7 @@ export const TextInputConfigPanel: React.FC<TextInputConfigPanelProps> = ({ conf
|
||||
if (config.autoGeneration?.type === "numbering_rule") {
|
||||
loadRules();
|
||||
}
|
||||
}, [config.autoGeneration?.type]);
|
||||
}, [config.autoGeneration?.type, screenTableName]);
|
||||
|
||||
const handleChange = (key: keyof TextInputConfig, value: any) => {
|
||||
onChange({ [key]: value });
|
||||
@@ -174,7 +186,12 @@ export const TextInputConfigPanel: React.FC<TextInputConfigPanelProps> = ({ conf
|
||||
) : (
|
||||
numberingRules.map((rule) => (
|
||||
<SelectItem key={rule.ruleId} value={rule.ruleId}>
|
||||
{rule.ruleName} ({rule.ruleId})
|
||||
{rule.ruleName}
|
||||
{rule.description && (
|
||||
<span className="text-muted-foreground ml-2 text-xs">
|
||||
- {rule.description}
|
||||
</span>
|
||||
)}
|
||||
</SelectItem>
|
||||
))
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user