From 47c9c3941cd491cd2a0963486d7ab6c5e8331dac Mon Sep 17 00:00:00 2001 From: zhongwenkai <3478244299@qq.com> Date: Mon, 29 Jun 2026 12:01:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?style:=20=E5=A4=87=E4=BB=B6=E5=87=BA?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=92=8C=E7=89=A9=E6=96=99=E5=87=BA=E5=85=A5?= =?UTF-8?q?=E5=BA=93=E5=BA=93=E5=8C=BA=E5=8F=AF=E4=BB=A5=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/materialInbound/materialConfirm.vue | 87 ++++++---- .../materialOutbound/materialConfirm.vue | 73 ++++++-- .../sparepartInbound/sparepartConfirm.vue | 115 ++++++------ .../sparepartOutbound/sparepartConfirm.vue | 163 +++++++++++------- 4 files changed, 273 insertions(+), 165 deletions(-) diff --git a/src/pages_function/pages/materialInbound/materialConfirm.vue b/src/pages_function/pages/materialInbound/materialConfirm.vue index f799e39..2a310d0 100644 --- a/src/pages_function/pages/materialInbound/materialConfirm.vue +++ b/src/pages_function/pages/materialInbound/materialConfirm.vue @@ -71,27 +71,21 @@ 库区 - - - - {{ selectedArea ? selectedArea.label : (loadingAreas ? '加载中...' : '请选择') }} - - - - - - - {{ item.label }} - + + + + + + 选择 - 暂无数据 - + @@ -161,11 +155,11 @@ const inboundQty = ref(null) const warehouseOptions = ref([]) const selectedWarehouse = ref(null) -// 库区下拉 +// 库区 const areaOptions = ref([]) const selectedArea = ref(null) -const showAreaDropdown = ref(false) const loadingAreas = ref(false) +const areaScanInput = ref('') const materialImage = computed(() => { const images = material.value.images @@ -295,17 +289,41 @@ async function loadWarehouses() { } // 库区 -function toggleAreaDropdown() { - if (!selectedWarehouse.value) { - uni.showToast({ title: '请先选择仓库', icon: 'none' }) - return +function getAreaIndex(selected, options) { + if (!selected) return -1 + const index = options.findIndex((item) => String(item.value) === String(selected.value)) + return index >= 0 ? index : -1 +} + +function onAreaChange(event) { + const index = Number(event.detail.value) + if (index >= 0 && index < areaOptions.value.length) { + selectedArea.value = areaOptions.value[index] + areaScanInput.value = selectedArea.value.label } - showAreaDropdown.value = !showAreaDropdown.value } -function handleSelectArea(item) { - selectedArea.value = item - showAreaDropdown.value = false + +function getAreaScanId(value) { + const text = String(value || '').trim() + if (!text) return '' + const match = text.match(/WAREHOUSE_AREA[-_:](\d+)/i) + if (match) return match[1] + const tail = text.match(/(\d+)$/) + return tail ? tail[1] : text } + +async function onAreaScanConfirm() { + const areaId = getAreaScanId(areaScanInput.value) + if (!areaId) return + const area = areaOptions.value.find((item) => String(item.value) === String(areaId)) + if (!area) { + uni.showToast({ title: '未找到该库区', icon: 'none' }) + return + } + selectedArea.value = area + areaScanInput.value = area.label +} + async function loadAreas(warehouseId) { if (!warehouseId) return loadingAreas.value = true @@ -363,9 +381,7 @@ async function loadStockCount() { } } -onHide(() => { - showAreaDropdown.value = false -}) +onHide(() => {})