From 390c1a8450e9714e1a6f3194450f47a0557c7dca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=ED=98=81=EC=84=B1?= Date: Thu, 22 Jan 2026 19:45:52 +0900 Subject: [PATCH] =?UTF-8?q?feat(WEB):=20=ED=9A=8C=EA=B3=84=20=ED=8F=BC=20u?= =?UTF-8?q?seDevFill=20=ED=9B=85=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EC=B6=9C=EA=B8=88=20=ED=95=84=EB=93=9C=20=ED=8E=B8=EC=A7=91=20?= =?UTF-8?q?=EA=B0=80=EB=8A=A5=ED=95=98=EA=B2=8C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DepositDetailClientV2: 입금 폼 자동채우기 훅 추가 - WithdrawalDetailClientV2: 출금 폼 자동채우기 훅 추가 - withdrawalDetailConfig: 출금일, 출금계좌, 수취인명, 출금금액 편집 가능하게 변경 - DocumentCreate: 매입(지출결의서) 폼 자동채우기 훅 추가 --- .../DepositDetailClientV2.tsx | 10 ++++++ .../WithdrawalDetailClientV2.tsx | 10 ++++++ .../withdrawalDetailConfig.ts | 34 +++++++++++-------- .../approval/DocumentCreate/index.tsx | 18 ++++++++++ 4 files changed, 58 insertions(+), 14 deletions(-) diff --git a/src/components/accounting/DepositManagement/DepositDetailClientV2.tsx b/src/components/accounting/DepositManagement/DepositDetailClientV2.tsx index 644abdcd..ecb7e2c0 100644 --- a/src/components/accounting/DepositManagement/DepositDetailClientV2.tsx +++ b/src/components/accounting/DepositManagement/DepositDetailClientV2.tsx @@ -13,6 +13,7 @@ import { updateDeposit, deleteDeposit, } from './actions'; +import { useDevFill, generateDepositData } from '@/components/dev'; // ===== Props ===== interface DepositDetailClientV2Props { @@ -29,6 +30,15 @@ export default function DepositDetailClientV2({ const [deposit, setDeposit] = useState(null); const [isLoading, setIsLoading] = useState(initialMode !== 'create'); + // ===== DevFill: 자동 입력 기능 ===== + useDevFill('deposit', useCallback(() => { + if (initialMode === 'create') { + const mockData = generateDepositData(); + setDeposit(mockData as unknown as DepositRecord); + toast.success('입금 데이터가 자동 입력되었습니다.'); + } + }, [initialMode])); + // ===== 데이터 로드 ===== useEffect(() => { const loadDeposit = async () => { diff --git a/src/components/accounting/WithdrawalManagement/WithdrawalDetailClientV2.tsx b/src/components/accounting/WithdrawalManagement/WithdrawalDetailClientV2.tsx index 8946dfa7..da3db8cb 100644 --- a/src/components/accounting/WithdrawalManagement/WithdrawalDetailClientV2.tsx +++ b/src/components/accounting/WithdrawalManagement/WithdrawalDetailClientV2.tsx @@ -13,6 +13,7 @@ import { updateWithdrawal, deleteWithdrawal, } from './actions'; +import { useDevFill, generateWithdrawalData } from '@/components/dev'; // ===== Props ===== interface WithdrawalDetailClientV2Props { @@ -29,6 +30,15 @@ export default function WithdrawalDetailClientV2({ const [withdrawal, setWithdrawal] = useState(null); const [isLoading, setIsLoading] = useState(initialMode !== 'create'); + // ===== DevFill: 자동 입력 기능 ===== + useDevFill('withdrawal', useCallback(() => { + if (initialMode === 'create') { + const mockData = generateWithdrawalData(); + setWithdrawal(mockData as unknown as WithdrawalRecord); + toast.success('출금 데이터가 자동 입력되었습니다.'); + } + }, [initialMode])); + // ===== 데이터 로드 ===== useEffect(() => { const loadWithdrawal = async () => { diff --git a/src/components/accounting/WithdrawalManagement/withdrawalDetailConfig.ts b/src/components/accounting/WithdrawalManagement/withdrawalDetailConfig.ts index e2a6af28..a93caee2 100644 --- a/src/components/accounting/WithdrawalManagement/withdrawalDetailConfig.ts +++ b/src/components/accounting/WithdrawalManagement/withdrawalDetailConfig.ts @@ -6,37 +6,37 @@ import { getVendors } from './actions'; // ===== 필드 정의 ===== const fields: FieldDefinition[] = [ - // 출금일 (readonly) + // 출금일 { key: 'withdrawalDate', label: '출금일', - type: 'text', - readonly: true, - placeholder: '-', + type: 'date', + placeholder: '출금일을 선택해주세요', + disabled: (mode) => mode === 'view', }, - // 출금계좌 (readonly) + // 출금계좌 { key: 'accountName', label: '출금계좌', type: 'text', - readonly: true, - placeholder: '-', + placeholder: '출금계좌를 입력해주세요', + disabled: (mode) => mode === 'view', }, - // 수취인명 (readonly) + // 수취인명 { key: 'recipientName', label: '수취인명', type: 'text', - readonly: true, - placeholder: '-', + placeholder: '수취인명을 입력해주세요', + disabled: (mode) => mode === 'view', }, - // 출금금액 (readonly) + // 출금금액 { key: 'withdrawalAmount', label: '출금금액', - type: 'text', - readonly: true, - placeholder: '-', + type: 'number', + placeholder: '출금금액을 입력해주세요', + disabled: (mode) => mode === 'view', }, // 적요 (editable) { @@ -115,6 +115,12 @@ export const withdrawalDetailConfig: DetailConfig = { }, transformSubmitData: (formData: Record): Partial => { return { + withdrawalDate: formData.withdrawalDate as string, + accountName: formData.accountName as string, + recipientName: formData.recipientName as string, + withdrawalAmount: typeof formData.withdrawalAmount === 'string' + ? parseInt(formData.withdrawalAmount.replace(/,/g, ''), 10) + : formData.withdrawalAmount as number, note: formData.note as string, vendorId: formData.vendorId as string, withdrawalType: formData.withdrawalType as WithdrawalRecord['withdrawalType'], diff --git a/src/components/approval/DocumentCreate/index.tsx b/src/components/approval/DocumentCreate/index.tsx index 75d89f93..84430909 100644 --- a/src/components/approval/DocumentCreate/index.tsx +++ b/src/components/approval/DocumentCreate/index.tsx @@ -42,6 +42,7 @@ import type { ExpenseEstimateData, } from './types'; import { isNextRedirectError } from '@/lib/utils/redirect-error'; +import { useDevFill, generatePurchaseApprovalData } from '@/components/dev'; // 초기 데이터 - SSR에서는 빈 문자열, 클라이언트에서 날짜 설정 const getInitialBasicInfo = (): BasicInfo => ({ @@ -119,6 +120,23 @@ export function DocumentCreate() { // 미리보기 모달 상태 const [isPreviewOpen, setIsPreviewOpen] = useState(false); + // ===== DevFill: 자동 입력 기능 ===== + useDevFill('purchaseApproval', useCallback(() => { + if (!isEditMode && !isCopyMode) { + const mockData = generatePurchaseApprovalData(); + setBasicInfo(prev => ({ + ...prev, + ...mockData.basicInfo, + draftDate: prev.draftDate || mockData.basicInfo.draftDate, + })); + setProposalData(prev => ({ + ...prev, + ...mockData.proposalData, + })); + toast.success('지출결의서 데이터가 자동 입력되었습니다.'); + } + }, [isEditMode, isCopyMode])); + // 수정 모드: 문서 로드 useEffect(() => { if (!isEditMode || !documentId) return;