From ced6b504a82f27839b4392ec7fdd76592516456e Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 17 七月 2026 14:58:19 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0

---
 src/views/wls/warehouse/components/location-select.vue |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/views/wls/warehouse/components/location-select.vue b/src/views/wls/warehouse/components/location-select.vue
index d732a9e..468f45c 100644
--- a/src/views/wls/warehouse/components/location-select.vue
+++ b/src/views/wls/warehouse/components/location-select.vue
@@ -3,7 +3,7 @@
 
 import { computed, ref, useAttrs, watch, watchEffect } from 'vue';
 
-import { Select, SelectOption, Tag, Tooltip } from 'ant-design-vue';
+import { Select, SelectOption, Tooltip } from 'ant-design-vue';
 
 import { getWarehouseLocationSimpleList } from '#/api/mes/wm/warehouse/location';
 
@@ -73,11 +73,21 @@
   },
 );
 
-/** 浠撳簱鍙樻洿鎴栧垵濮嬪寲鏃堕噸鏂板姞杞藉簱鍖哄垪琛� */
+/** 浠撳簱鍙樻洿鏃舵竻绌哄凡閫夊簱鍖哄苟閲嶆柊鍔犺浇鍒楄〃 */
 watchEffect(async () => {
+  if (!props.warehouseId) {
+    allList.value = [];
+    return;
+  }
   allList.value = await getWarehouseLocationSimpleList(props.warehouseId);
-  if (props.modelValue !== null) {
-    selectedItem.value = allList.value.find((o) => o.id === props.modelValue);
+  // 浠撳簱鍙樻洿鏃舵竻绌哄凡閫夌殑搴撳尯
+  if (props.modelValue !== null && props.modelValue !== undefined) {
+    const stillExists = allList.value.find((o) => o.id === props.modelValue);
+    if (!stillExists) {
+      selectedItem.value = undefined;
+      emit('update:modelValue', undefined);
+      emit('change', undefined);
+    }
   }
 });
 </script>
@@ -99,14 +109,12 @@
       :disabled="disabled"
       :filter-option="filterOption"
       :placeholder="placeholder"
+      :popup-match-select-width="false"
       show-search
       @change="handleChange"
     >
       <SelectOption v-for="item in allList" :key="item.id" :value="item.id">
-        <div class="flex items-center gap-2">
-          <span>{{ item.name }}</span>
-          <Tag v-if="item.code" color="blue">缂栧彿: {{ item.code }}</Tag>
-        </div>
+        {{ item.name }}
       </SelectOption>
     </Select>
   </Tooltip>

--
Gitblit v1.9.3