+
+ {rule.conditionValue}
{rule.description && (
diff --git a/src/components/process-management/ProcessForm.tsx b/src/components/process-management/ProcessForm.tsx
index 34999c1f..8a61338b 100644
--- a/src/components/process-management/ProcessForm.tsx
+++ b/src/components/process-management/ProcessForm.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useState, useCallback } from 'react';
+import { useState, useCallback, useEffect } from 'react';
import { useRouter } from 'next/navigation';
import { X, Save, Plus, Wrench, Trash2, Loader2, Pencil } from 'lucide-react';
import { Button } from '@/components/ui/button';
@@ -22,16 +22,7 @@ import { RuleModal } from './RuleModal';
import { toast } from 'sonner';
import type { Process, ClassificationRule, ProcessType } from '@/types/process';
import { PROCESS_TYPE_OPTIONS, MATCHING_TYPE_OPTIONS } from '@/types/process';
-import { createProcess, updateProcess } from './actions';
-
-// 담당부서 옵션 (추후 API 연동 가능)
-const DEPARTMENT_OPTIONS = [
- { value: '스크린생산부서', label: '스크린생산부서' },
- { value: '절곡생산부서', label: '절곡생산부서' },
- { value: '슬랫생산부서', label: '슬랫생산부서' },
- { value: '품질관리부서', label: '품질관리부서' },
- { value: '포장/출하부서', label: '포장/출하부서' },
-];
+import { createProcess, updateProcess, getDepartmentOptions, type DepartmentOption } from './actions';
// 작업일지 양식 옵션 (추후 API 연동 가능)
const WORK_LOG_OPTIONS = [
@@ -72,10 +63,27 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
const [isActive, setIsActive] = useState(initialData ? initialData.status === '사용중' : true);
const [isLoading, setIsLoading] = useState(false);
+ // 부서 목록 상태
+ const [departmentOptions, setDepartmentOptions] = useState([]);
+ const [isDepartmentsLoading, setIsDepartmentsLoading] = useState(true);
+
// 규칙 모달 상태
const [ruleModalOpen, setRuleModalOpen] = useState(false);
const [editingRule, setEditingRule] = useState(undefined);
+ // 부서 목록 로드
+ useEffect(() => {
+ const loadDepartments = async () => {
+ setIsDepartmentsLoading(true);
+ const result = await getDepartmentOptions();
+ if (result.success && result.data) {
+ setDepartmentOptions(result.data);
+ }
+ setIsDepartmentsLoading(false);
+ };
+ loadDepartments();
+ }, []);
+
// 규칙 추가/수정
const handleSaveRule = useCallback(
(ruleData: Omit) => {
@@ -242,14 +250,14 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
-