feat(WEB): 공정관리/작업지시/작업자화면 기능 강화 및 템플릿 개선

- 공정관리: ProcessDetail/ProcessForm/ProcessList 개선, StepDetail/StepForm 신규 추가
- 작업지시: WorkOrderDetail/Edit/List UI 개선, 작업지시서 문서 추가
- 작업자화면: WorkerScreen 대폭 개선, MaterialInputModal/WorkLogModal 수정, WorkItemCard 신규
- 영업주문: 주문 상세 페이지 개선
- 입고관리: 상세/actions 수정
- 템플릿: IntegratedDetailTemplate/IntegratedListTemplateV2/UniversalListPage 기능 확장
- UI: confirm-dialog 개선

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
유병철
2026-01-29 22:56:01 +09:00
parent 106ce09482
commit 3fc63d0b3e
50 changed files with 5801 additions and 1377 deletions

View File

@@ -1,21 +1,24 @@
'use client';
/**
* 공정 등록/수정 폼 컴포넌트
* IntegratedDetailTemplate 마이그레이션 (2025-01-20)
* 공정 등록/수정 폼 컴포넌트 (리디자인)
*
* 기획서 스크린샷 1 기준:
* - 기본 정보: 공정명(자동생성), 공정형, 담당부서, 담당자, 생산일자, 상태
* - 품목 설정 정보: 품목 선택 팝업 연동
* - 단계 관리: 단계 등록/수정/삭제 (인라인)
*
* 제거된 섹션: 자동분류규칙, 작업정보, 설명
*/
import { useState, useCallback, useEffect } from 'react';
import { useState, useCallback, useEffect, useRef } from 'react';
import { useRouter } from 'next/navigation';
import { Plus, Wrench, Trash2, Pencil } from 'lucide-react';
import { Plus, GripVertical, Trash2, Package } from 'lucide-react';
import { IntegratedDetailTemplate } from '@/components/templates/IntegratedDetailTemplate';
import { processCreateConfig, processEditConfig } from './processConfig';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import { QuantityInput } from '@/components/ui/quantity-input';
import { Checkbox } from '@/components/ui/checkbox';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import {
@@ -25,20 +28,18 @@ import {
SelectTrigger,
SelectValue,
} from '@/components/ui/select';
import { Switch } from '@/components/ui/switch';
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, getDepartmentOptions, type DepartmentOption } from './actions';
// 작업일지 양식 옵션 (추후 API 연동 가능)
const WORK_LOG_OPTIONS = [
{ value: '스크린 작업일지', label: '스크린 작업일지' },
{ value: '절곡 작업일지', label: '절곡 작업일지' },
{ value: '슬랫 작업일지', label: '슬랫 작업일지' },
{ value: '재고생산 작업일지', label: '재고생산 작업일지' },
{ value: '포장 작업일지', label: '포장 작업일지' },
];
import type { Process, ClassificationRule, ProcessType, ProcessStep } from '@/types/process';
import { PROCESS_TYPE_OPTIONS } from '@/types/process';
import {
createProcess,
updateProcess,
getDepartmentOptions,
getProcessSteps,
type DepartmentOption,
} from './actions';
interface ProcessFormProps {
mode: 'create' | 'edit';
@@ -49,36 +50,48 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
const router = useRouter();
const isEdit = mode === 'edit';
// 상태
// 기본 정보 상태
const [processName, setProcessName] = useState(initialData?.processName || '');
const [processType, setProcessType] = useState<ProcessType>(
initialData?.processType || '생산'
);
const [department, setDepartment] = useState(initialData?.department || '');
const [workLogTemplate, setWorkLogTemplate] = useState(
initialData?.workLogTemplate || ''
const [manager, setManager] = useState(initialData?.manager || '');
const [useProductionDate, setUseProductionDate] = useState(
initialData?.useProductionDate ?? false
);
const [isActive, setIsActive] = useState(
initialData ? initialData.status === '사용중' : true
);
const [isLoading, setIsLoading] = useState(false);
// 품목 분류 규칙 (기존 로직 유지)
const [classificationRules, setClassificationRules] = useState<ClassificationRule[]>(
initialData?.classificationRules || []
);
const [requiredWorkers, setRequiredWorkers] = useState(
initialData?.requiredWorkers || 1
);
const [equipmentInfo, setEquipmentInfo] = useState(initialData?.equipmentInfo || '');
const [workSteps, setWorkSteps] = useState(initialData?.workSteps?.join(', ') || '');
const [note, setNote] = useState(initialData?.note || '');
const [isActive, setIsActive] = useState(initialData ? initialData.status === '사용중' : true);
const [isLoading, setIsLoading] = useState(false);
// 단계 목록 상태
const [steps, setSteps] = useState<ProcessStep[]>([]);
const [isStepsLoading, setIsStepsLoading] = useState(isEdit);
// 부서 목록 상태
const [departmentOptions, setDepartmentOptions] = useState<DepartmentOption[]>([]);
const [isDepartmentsLoading, setIsDepartmentsLoading] = useState(true);
// 규칙 모달 상태
// 품목 선택 모달 상태
const [ruleModalOpen, setRuleModalOpen] = useState(false);
const [editingRule, setEditingRule] = useState<ClassificationRule | undefined>(undefined);
// 부서 목록 로
// 드래그 상태
const [dragIndex, setDragIndex] = useState<number | null>(null);
const [dragOverIndex, setDragOverIndex] = useState<number | null>(null);
// 품목 개수 계산
const itemCount = classificationRules
.filter((r) => r.registrationType === 'individual')
.reduce((sum, r) => sum + (r.items?.length || 0), 0);
// 부서 목록 + 단계 목록 로드
useEffect(() => {
const loadDepartments = async () => {
setIsDepartmentsLoading(true);
@@ -89,20 +102,28 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
loadDepartments();
}, []);
// 규칙 추가/수정
useEffect(() => {
if (isEdit && initialData?.id) {
const loadSteps = async () => {
setIsStepsLoading(true);
const result = await getProcessSteps(initialData.id);
if (result.success && result.data) {
setSteps(result.data);
}
setIsStepsLoading(false);
};
loadSteps();
}
}, [isEdit, initialData?.id]);
// 품목 규칙 추가/수정
const handleSaveRule = useCallback(
(ruleData: Omit<ClassificationRule, 'id' | 'createdAt'>) => {
if (editingRule) {
// 수정 모드
setClassificationRules((prev) =>
prev.map((r) =>
r.id === editingRule.id
? { ...r, ...ruleData }
: r
)
prev.map((r) => (r.id === editingRule.id ? { ...r, ...ruleData } : r))
);
} else {
// 추가 모드
const newRule: ClassificationRule = {
...ruleData,
id: `rule-${Date.now()}`,
@@ -115,18 +136,6 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
[editingRule]
);
// 규칙 수정 모달 열기
const handleEditRule = useCallback((rule: ClassificationRule) => {
setEditingRule(rule);
setRuleModalOpen(true);
}, []);
// 규칙 삭제
const handleDeleteRule = useCallback((ruleId: string) => {
setClassificationRules((prev) => prev.filter((r) => r.id !== ruleId));
}, []);
// 모달 닫기
const handleModalClose = useCallback((open: boolean) => {
setRuleModalOpen(open);
if (!open) {
@@ -134,22 +143,91 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
}
}, []);
// 단계 삭제
const handleDeleteStep = useCallback((stepId: string) => {
setSteps((prev) => prev.filter((s) => s.id !== stepId));
}, []);
// 단계 상세 이동
const handleStepClick = (stepId: string) => {
if (isEdit && initialData?.id) {
router.push(`/ko/master-data/process-management/${initialData.id}/steps/${stepId}`);
}
};
// 단계 등록 이동
const handleAddStep = () => {
if (isEdit && initialData?.id) {
router.push(`/ko/master-data/process-management/${initialData.id}/steps/new`);
} else {
toast.info('공정을 먼저 등록한 후 단계를 추가할 수 있습니다.');
}
};
// 드래그&드롭
const dragNodeRef = useRef<HTMLElement | null>(null);
const handleDragStart = useCallback((e: React.DragEvent<HTMLTableRowElement>, index: number) => {
setDragIndex(index);
dragNodeRef.current = e.currentTarget;
e.dataTransfer.effectAllowed = 'move';
requestAnimationFrame(() => {
if (dragNodeRef.current) {
dragNodeRef.current.style.opacity = '0.4';
}
});
}, []);
const handleDragOver = useCallback((e: React.DragEvent<HTMLTableRowElement>, index: number) => {
e.preventDefault();
e.dataTransfer.dropEffect = 'move';
setDragOverIndex(index);
}, []);
const handleDragEnd = useCallback(() => {
if (dragNodeRef.current) {
dragNodeRef.current.style.opacity = '1';
}
dragNodeRef.current = null;
setDragIndex(null);
setDragOverIndex(null);
}, []);
const handleDrop = useCallback(
(e: React.DragEvent<HTMLTableRowElement>, dropIndex: number) => {
e.preventDefault();
if (dragIndex === null || dragIndex === dropIndex) {
handleDragEnd();
return;
}
setSteps((prev) => {
const updated = [...prev];
const [moved] = updated.splice(dragIndex, 1);
updated.splice(dropIndex, 0, moved);
return updated.map((step, i) => ({ ...step, order: i + 1 }));
});
handleDragEnd();
},
[dragIndex, handleDragEnd]
);
// 제출
const handleSubmit = async () => {
const handleSubmit = async (): Promise<{ success: boolean; error?: string }> => {
if (!processName.trim()) {
toast.error('공정명을 입력해주세요.');
return;
return { success: false, error: '공정명을 입력해주세요.' };
}
if (!department) {
toast.error('담당부서를 선택해주세요.');
return;
return { success: false, error: '담당부서를 선택해주세요.' };
}
const formData = {
processName: processName.trim(),
processType,
department,
workLogTemplate: workLogTemplate || undefined,
classificationRules: classificationRules.map((rule) => ({
registrationType: rule.registrationType,
ruleType: rule.ruleType,
@@ -159,10 +237,8 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
description: rule.description,
isActive: rule.isActive,
})),
requiredWorkers,
equipmentInfo: equipmentInfo.trim() || undefined,
workSteps: workSteps,
note: note.trim() || undefined,
requiredWorkers: 1,
workSteps: '',
isActive,
};
@@ -173,294 +249,343 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
if (result.success) {
toast.success('공정이 수정되었습니다.');
router.push('/ko/master-data/process-management');
return { success: true };
} else {
toast.error(result.error || '수정에 실패했습니다.');
return { success: false, error: result.error };
}
} else {
const result = await createProcess(formData);
if (result.success) {
toast.success('공정이 등록되었습니다.');
router.push('/ko/master-data/process-management');
return { success: true };
} else {
toast.error(result.error || '등록에 실패했습니다.');
return { success: false, error: result.error };
}
}
} catch {
toast.error('처리 중 오류가 발생했습니다.');
return { success: false, error: '처리 중 오류가 발생했습니다.' };
} finally {
setIsLoading(false);
}
};
// 취소
const handleCancel = () => {
router.back();
};
// ===== 폼 콘텐츠 렌더링 =====
const renderFormContent = useCallback(() => (
<>
<div className="space-y-6">
{/* 기본 정보 */}
<Card>
<CardHeader className="bg-muted/50">
<CardTitle className="text-base"> </CardTitle>
</CardHeader>
<CardContent className="pt-6">
{/* 반응형 6열 그리드: PC 6열, 태블릿 4열, 작은태블릿 2열, 모바일 1열 */}
{/* 4개 필드 → 2+1+2+1 = 6열 채움 */}
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-6">
<div className="space-y-2 lg:col-span-2">
<Label htmlFor="processName"> *</Label>
<Input
id="processName"
value={processName}
onChange={(e) => setProcessName(e.target.value)}
placeholder="예: 스크린"
/>
const renderFormContent = useCallback(
() => (
<>
<div className="space-y-6">
{/* 기본 정보 */}
<Card>
<CardHeader className="bg-muted/50">
<CardTitle className="text-base"> </CardTitle>
</CardHeader>
<CardContent className="pt-6">
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-6">
<div className="space-y-2">
<Label htmlFor="processName"> *</Label>
<Input
id="processName"
value={processName}
onChange={(e) => setProcessName(e.target.value)}
placeholder="예: 스크린"
/>
</div>
<div className="space-y-2">
<Label></Label>
<Select
value={processType}
onValueChange={(v) => setProcessType(v as ProcessType)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
{PROCESS_TYPE_OPTIONS.map((opt) => (
<SelectItem key={opt.value} value={opt.value}>
{opt.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label> *</Label>
<Select
value={department}
onValueChange={setDepartment}
disabled={isDepartmentsLoading}
>
<SelectTrigger>
<SelectValue
placeholder={isDepartmentsLoading ? '로딩 중...' : '선택하세요'}
/>
</SelectTrigger>
<SelectContent>
{departmentOptions.map((opt) => (
<SelectItem key={opt.id} value={opt.value}>
{opt.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label></Label>
<Input
value={manager}
onChange={(e) => setManager(e.target.value)}
placeholder="담당자명"
/>
</div>
<div className="space-y-2">
<Label></Label>
<div className="flex items-center gap-2 h-10">
<Switch
checked={useProductionDate}
onCheckedChange={setUseProductionDate}
/>
<span className="text-sm text-muted-foreground">
{useProductionDate ? '사용' : '미사용'}
</span>
</div>
</div>
<div className="space-y-2">
<Label></Label>
<Select
value={isActive ? '사용중' : '미사용'}
onValueChange={(v) => setIsActive(v === '사용중')}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="사용중"></SelectItem>
<SelectItem value="미사용"></SelectItem>
</SelectContent>
</Select>
</div>
</div>
<div className="space-y-2">
<Label></Label>
<Select
value={processType}
onValueChange={(v) => setProcessType(v as ProcessType)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
{PROCESS_TYPE_OPTIONS.map((opt) => (
<SelectItem key={opt.value} value={opt.value}>
{opt.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<div className="space-y-2 lg:col-span-2">
<Label> *</Label>
<Select value={department} onValueChange={setDepartment} disabled={isDepartmentsLoading}>
<SelectTrigger>
<SelectValue placeholder={isDepartmentsLoading ? "로딩 중..." : "선택하세요"} />
</SelectTrigger>
<SelectContent>
{departmentOptions.map((opt) => (
<SelectItem key={opt.id} value={opt.value}>
{opt.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label> </Label>
<Select value={workLogTemplate} onValueChange={setWorkLogTemplate}>
<SelectTrigger>
<SelectValue placeholder="선택하세요" />
</SelectTrigger>
<SelectContent>
{WORK_LOG_OPTIONS.map((opt) => (
<SelectItem key={opt.value} value={opt.value}>
{opt.label}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
</div>
</CardContent>
</Card>
</CardContent>
</Card>
{/* 자동 분류 규칙 */}
<Card>
<CardHeader className="bg-muted/50">
<div className="flex items-center justify-between">
<div>
<CardTitle className="text-base"> </CardTitle>
<p className="text-sm text-muted-foreground mt-1">
.
</p>
{/* 품목 설정 정보 */}
<Card>
<CardHeader className="bg-muted/50">
<div className="flex items-center justify-between">
<div>
<CardTitle className="text-base flex items-center gap-2">
<Package className="h-4 w-4" />
</CardTitle>
<p className="text-sm text-muted-foreground mt-1">
</p>
</div>
<div className="flex items-center gap-3">
<Badge variant="outline" className="text-sm">
{itemCount}
</Badge>
<Button
type="button"
variant="outline"
size="sm"
onClick={() => setRuleModalOpen(true)}
>
</Button>
</div>
</div>
<Button onClick={() => setRuleModalOpen(true)}>
<Plus className="h-4 w-4 mr-2" />
</Button>
</div>
</CardHeader>
<CardContent className="pt-6">
{classificationRules.length === 0 ? (
<div className="text-center py-12 text-muted-foreground">
<Wrench className="h-12 w-12 mx-auto mb-4 opacity-30" />
<p className="font-medium"> </p>
<p className="text-sm mt-1">
</p>
</div>
) : (
<div className="space-y-3">
{classificationRules.map((rule, index) => {
// 개별 품목인 경우 품목 개수 계산
const isIndividual = rule.registrationType === 'individual';
const itemCount = isIndividual
? rule.conditionValue.split(',').filter(Boolean).length
: 0;
</CardHeader>
</Card>
return (
<div
key={rule.id}
className="flex items-start justify-between p-4 border rounded-lg"
>
<div className="flex gap-3">
{/* 번호 */}
<span className="text-muted-foreground font-medium mt-0.5">
{index + 1}.
</span>
<div className="space-y-1">
{/* 제목 */}
<div className="font-medium">
{isIndividual ? (
<> - {itemCount} </>
) : (
<>
{rule.ruleType}{' '}
{
MATCHING_TYPE_OPTIONS.find(
(o) => o.value === rule.matchingType
)?.label
}{' '}
"{rule.conditionValue}"
</>
)}
</div>
{/* 뱃지 + 우선순위 */}
<div className="flex items-center gap-2">
<Badge variant="secondary" className="text-xs">
{isIndividual
? `${itemCount}개 품목 배정됨`
: rule.isActive
? '활성'
: '비활성'}
{/* 단계 테이블 */}
<Card>
<CardHeader className="bg-muted/50">
<div className="flex items-center justify-between">
<CardTitle className="text-base">
{!isStepsLoading && (
<span className="text-sm font-normal text-muted-foreground ml-2">
{steps.length}
</span>
)}
</CardTitle>
<Button type="button" size="sm" onClick={handleAddStep}>
<Plus className="h-4 w-4 mr-1" />
</Button>
</div>
</CardHeader>
<CardContent className="p-0">
{isStepsLoading ? (
<div className="p-8 text-center text-muted-foreground"> ...</div>
) : steps.length === 0 ? (
<div className="p-8 text-center text-muted-foreground">
{isEdit
? '등록된 단계가 없습니다. [단계 등록] 버튼으로 추가해주세요.'
: '공정을 먼저 등록한 후 단계를 추가할 수 있습니다.'}
</div>
) : (
<div className="overflow-x-auto">
<table className="w-full">
<thead>
<tr className="border-b bg-muted/30">
<th className="w-10 px-3 py-3" />
<th className="w-14 px-3 py-3 text-center text-xs font-medium text-muted-foreground">
No.
</th>
<th className="px-3 py-3 text-left text-xs font-medium text-muted-foreground">
</th>
<th className="px-3 py-3 text-left text-xs font-medium text-muted-foreground">
</th>
<th className="w-20 px-3 py-3 text-center text-xs font-medium text-muted-foreground">
</th>
<th className="w-20 px-3 py-3 text-center text-xs font-medium text-muted-foreground">
</th>
<th className="w-20 px-3 py-3 text-center text-xs font-medium text-muted-foreground">
</th>
<th className="w-16 px-3 py-3 text-center text-xs font-medium text-muted-foreground">
</th>
<th className="w-12 px-3 py-3" />
</tr>
</thead>
<tbody>
{steps.map((step, index) => (
<tr
key={step.id}
draggable
onDragStart={(e) => handleDragStart(e, index)}
onDragOver={(e) => handleDragOver(e, index)}
onDragEnd={handleDragEnd}
onDrop={(e) => handleDrop(e, index)}
onClick={() => handleStepClick(step.id)}
className={`border-b cursor-pointer transition-colors hover:bg-muted/50 ${
dragOverIndex === index && dragIndex !== index
? 'border-t-2 border-t-primary'
: ''
}`}
>
<td
className="w-10 px-3 py-3 text-center cursor-grab active:cursor-grabbing"
onClick={(e) => e.stopPropagation()}
>
<GripVertical className="h-4 w-4 text-muted-foreground mx-auto" />
</td>
<td className="w-14 px-3 py-3 text-center text-sm text-muted-foreground">
{index + 1}
</td>
<td className="px-3 py-3 text-sm font-mono">{step.stepCode}</td>
<td className="px-3 py-3 text-sm font-medium">{step.stepName}</td>
<td className="w-20 px-3 py-3 text-center">
<Badge
variant={step.isRequired ? 'default' : 'outline'}
className="text-xs"
>
{step.isRequired ? 'Y' : 'N'}
</Badge>
<span className="text-sm text-muted-foreground">
: {rule.priority}
</span>
</div>
{/* 설명 */}
<div className="text-sm text-muted-foreground">
{isIndividual
? `직접 선택한 품목 ${itemCount}`
: rule.description || ''}
</div>
</div>
</div>
{/* 수정/삭제 버튼 */}
<div className="flex items-center gap-1">
<Button
variant="ghost"
size="icon"
onClick={() => handleEditRule(rule)}
className="h-8 w-8"
>
<Pencil className="h-4 w-4" />
</Button>
<Button
variant="ghost"
size="icon"
onClick={() => handleDeleteRule(rule.id)}
className="h-8 w-8 text-muted-foreground hover:text-destructive"
>
<Trash2 className="h-4 w-4" />
</Button>
</div>
</div>
);
})}
</div>
)}
</CardContent>
</Card>
</td>
<td className="w-20 px-3 py-3 text-center">
<Badge
variant={step.needsApproval ? 'default' : 'outline'}
className="text-xs"
>
{step.needsApproval ? 'Y' : 'N'}
</Badge>
</td>
<td className="w-20 px-3 py-3 text-center">
<Badge
variant={step.needsInspection ? 'default' : 'outline'}
className="text-xs"
>
{step.needsInspection ? 'Y' : 'N'}
</Badge>
</td>
<td className="w-16 px-3 py-3 text-center">
<Badge
variant={step.isActive ? 'default' : 'secondary'}
className="text-xs"
>
{step.isActive ? 'Y' : 'N'}
</Badge>
</td>
<td className="w-12 px-3 py-3 text-center">
<Button
type="button"
variant="ghost"
size="icon"
className="h-7 w-7 text-muted-foreground hover:text-destructive"
onClick={(e) => {
e.stopPropagation();
handleDeleteStep(step.id);
}}
>
<Trash2 className="h-3.5 w-3.5" />
</Button>
</td>
</tr>
))}
</tbody>
</table>
</div>
)}
</CardContent>
</Card>
</div>
{/* 작업 정보 */}
<Card>
<CardHeader className="bg-muted/50">
<CardTitle className="text-base"> </CardTitle>
</CardHeader>
<CardContent className="pt-6">
{/* 반응형 6열 그리드: PC 6열, 태블릿 4열, 작은태블릿 2열, 모바일 1열 */}
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-6">
<div className="space-y-2">
<Label></Label>
<QuantityInput
value={requiredWorkers}
onChange={(value) => setRequiredWorkers(value ?? 1)}
min={1}
/>
</div>
<div className="space-y-2 lg:col-span-2">
<Label></Label>
<Input
value={equipmentInfo}
onChange={(e) => setEquipmentInfo(e.target.value)}
placeholder="예: 미싱기 3대, 절단기 1대"
/>
</div>
<div className="space-y-2 lg:col-span-3">
<Label> ( )</Label>
<Input
value={workSteps}
onChange={(e) => setWorkSteps(e.target.value)}
placeholder="예: 원단절단, 미싱, 핸드작업, 중간검사, 포장"
/>
</div>
</div>
</CardContent>
</Card>
{/* 품목 선택 모달 */}
<RuleModal
open={ruleModalOpen}
onOpenChange={handleModalClose}
onAdd={handleSaveRule}
editRule={editingRule}
/>
</>
),
[
processName,
processType,
department,
manager,
useProductionDate,
isActive,
classificationRules,
steps,
isStepsLoading,
ruleModalOpen,
editingRule,
departmentOptions,
isDepartmentsLoading,
itemCount,
dragIndex,
dragOverIndex,
handleSaveRule,
handleModalClose,
handleDeleteStep,
handleAddStep,
handleStepClick,
handleDragStart,
handleDragOver,
handleDragEnd,
handleDrop,
isEdit,
initialData?.id,
]
);
{/* 설명 */}
<Card>
<CardHeader className="bg-muted/50">
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="pt-6 space-y-6">
<div className="space-y-2">
<Label></Label>
<Textarea
value={note}
onChange={(e) => setNote(e.target.value)}
placeholder="공정에 대한 설명"
rows={4}
/>
</div>
<div className="flex items-center gap-2">
<Checkbox
id="isActive"
checked={isActive}
onCheckedChange={(checked) => setIsActive(checked as boolean)}
/>
<Label htmlFor="isActive" className="font-normal">
</Label>
</div>
</CardContent>
</Card>
</div>
{/* 규칙 추가/수정 모달 */}
<RuleModal
open={ruleModalOpen}
onOpenChange={handleModalClose}
onAdd={handleSaveRule}
editRule={editingRule}
/>
</>
), [
processName, processType, department, workLogTemplate, classificationRules,
requiredWorkers, equipmentInfo, workSteps, note, isActive, ruleModalOpen,
editingRule, departmentOptions, isDepartmentsLoading, handleSaveRule,
handleEditRule, handleDeleteRule, handleModalClose,
]);
// Config 선택 (create/edit)
const config = isEdit ? processEditConfig : processCreateConfig;
return (
@@ -468,8 +593,6 @@ export function ProcessForm({ mode, initialData }: ProcessFormProps) {
config={config}
mode={isEdit ? 'edit' : 'create'}
isLoading={isDepartmentsLoading}
isSubmitting={isLoading}
onBack={handleCancel}
onCancel={handleCancel}
onSubmit={handleSubmit}
renderForm={renderFormContent}