From 29c41165cc86b72fa5bfa55d033bed29fc80e908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Thu, 5 Mar 2026 11:05:01 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[approvals]=20=EA=B1=B0=EB=9E=98?= =?UTF-8?q?=EC=B2=98=20=EC=84=A0=ED=83=9D=20=ED=9B=84=20=EB=93=9C=EB=A1=AD?= =?UTF-8?q?=EB=8B=A4=EC=9A=B4=EC=9D=B4=20=EB=8B=A4=EC=8B=9C=20=EC=97=B4?= =?UTF-8?q?=EB=A6=AC=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 선택 시 selected 플래그 설정 + blur로 포커스 해제 - onInput/onFocus에서 selected 상태면 검색 차단 - 다시 직접 타이핑 시 selected 해제되어 검색 재개 --- .../views/approvals/partials/_expense-form.blade.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/views/approvals/partials/_expense-form.blade.php b/resources/views/approvals/partials/_expense-form.blade.php index 80f13496..29d70d56 100644 --- a/resources/views/approvals/partials/_expense-form.blade.php +++ b/resources/views/approvals/partials/_expense-form.blade.php @@ -599,6 +599,7 @@ function vendorSearch(item) { let dropdown = null; let results = []; let highlighted = -1; + let selected = false; function removeDropdown() { if (dropdown) { dropdown.remove(); dropdown = null; } @@ -640,16 +641,20 @@ function renderDropdown(inputEl) { item.vendor_id = results[idx].id; item.vendor_biz_no = results[idx].biz_no || ''; inputEl.value = results[idx].name; - inputEl.dispatchEvent(new Event('input', { bubbles: true })); + selected = true; } removeDropdown(); + inputEl.blur(); }); }); } return { onInput(value) { + if (selected) { selected = false; return; } item.vendor = value; + item.vendor_id = null; + item.vendor_biz_no = ''; highlighted = -1; clearTimeout(debounceTimer); if (value.length < 1) { removeDropdown(); return; } @@ -657,7 +662,8 @@ function renderDropdown(inputEl) { }, onFocus() { - if (item.vendor && item.vendor.length >= 1) { + if (selected) return; + if (item.vendor && item.vendor.length >= 1 && !dropdown) { this.search(item.vendor); } }, @@ -690,7 +696,9 @@ function renderDropdown(inputEl) { item.vendor_id = p.id; item.vendor_biz_no = p.biz_no || ''; this.$refs.vinput.value = p.name; + selected = true; removeDropdown(); + this.$refs.vinput.blur(); } }, };