handy 1 месяц назад
Родитель
Сommit
615c39c496
2 измененных файлов с 66 добавлено и 9 удалено
  1. 27 8
      src/App.vue
  2. 39 1
      src/components/WarehouseMap.vue

+ 27 - 8
src/App.vue

@@ -139,7 +139,7 @@
         <div ref="refreshControlRef" class="refresh-control">
           <button
             class="refresh-btn"
-            :disabled="loading"
+            :disabled="loading || refreshing"
             @click="handleManualRefresh"
             @contextmenu.prevent="handleRefreshContextMenu"
           >
@@ -232,6 +232,8 @@ const getInitialRefreshInterval = () => {
 const currentLevel = ref(getInitialLevel())
 const locations = ref<LocationResourceDataVO[]>([])
 const loading = ref(false)
+const refreshing = ref(false)
+const hasLoadedOnce = ref(false)
 const error = ref('')
 const showLoginModal = ref(false)
 const selectedCategory = ref('')
@@ -327,25 +329,39 @@ const refreshCountdownText = computed(() => {
   return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`
 })
 
-const loadLocationData = async () => {
+const loadLocationData = async (options: { silent?: boolean } = {}) => {
+  const { silent = false } = options
   if (!isAuthenticated()) {
     showLoginModal.value = true
     return
   }
 
-  loading.value = true
-  error.value = ''
+  const shouldUseSilentRefresh = silent && hasLoadedOnce.value
+  if (shouldUseSilentRefresh) {
+    refreshing.value = true
+  } else {
+    loading.value = true
+    error.value = ''
+  }
+
   try {
     const data = await fetchLocationData({
       warehouse: config.warehouse,
       locLevel: currentLevel.value
     })
     locations.value = data
+    hasLoadedOnce.value = true
   } catch (err: any) {
-    error.value = err.message || '加载数据失败,请检查接口连接'
+    if (!shouldUseSilentRefresh) {
+      error.value = err.message || '加载数据失败,请检查接口连接'
+    }
     console.error('Failed to load location data:', err)
   } finally {
-    loading.value = false
+    if (shouldUseSilentRefresh) {
+      refreshing.value = false
+    } else {
+      loading.value = false
+    }
   }
 }
 
@@ -355,7 +371,7 @@ const scheduleNextRefresh = () => {
   }
   nextRefreshAt.value = Date.now() + refreshIntervalMs.value
   refreshTimer = window.setTimeout(async () => {
-    await loadLocationData()
+    await loadLocationData({ silent: true })
     scheduleNextRefresh()
   }, refreshIntervalMs.value)
 }
@@ -367,7 +383,7 @@ const handleLevelChange = () => {
 }
 
 const handleManualRefresh = () => {
-  loadLocationData()
+  loadLocationData({ silent: true })
   scheduleNextRefresh()
 }
 
@@ -450,6 +466,9 @@ const handleLogout = () => {
   }
   removeToken()
   locations.value = []
+  hasLoadedOnce.value = false
+  loading.value = false
+  refreshing.value = false
   showLoginModal.value = true
 }
 

+ 39 - 1
src/components/WarehouseMap.vue

@@ -19,9 +19,21 @@
               {{ getHeatLabel(cell) }}
             </div>
             <div class="loc-group">{{ cell.locGroup1 }}</div>
-            <div :class="['location-id', { 'location-id-mismatch': cell.categoryMismatch }]">
+            <div
+              :class="[
+                'location-id',
+                {
+                  'location-id-mismatch': cell.categoryMismatch && !hasAbnormalLocationAttribute(cell),
+                  'location-id-abnormal-attribute': hasAbnormalLocationAttribute(cell)
+                }
+              ]"
+            >
               {{ cell.locationId }}
             </div>
+            <div v-if="cell.categoryMismatch" class="location-attribute-tag">热度编号异常</div>
+            <div v-if="hasAbnormalLocationAttribute(cell)" class="location-attribute-tag">
+              {{ getLocationAttributeLabel(cell) }}
+            </div>
             <div v-if="cell.containerCode" class="container-code">
               {{ cell.containerCode }}
             </div>
@@ -291,6 +303,17 @@ const getHeatLabel = (cell: GridCell) => {
   return cell.category
 }
 
+const hasAbnormalLocationAttribute = (cell: GridCell) => {
+  return Boolean(cell.locationAttribute && cell.locationAttribute !== 'OK')
+}
+
+const getLocationAttributeLabel = (cell: GridCell) => {
+  if (!cell.locationAttribute) {
+    return '-'
+  }
+  return LOCATION_ATTRIBUTE_LABEL_MAP[cell.locationAttribute] || cell.locationAttribute
+}
+
 const getCellTitle = (cell: GridCell | null) => {
   if (!cell) return '过道'
   if (!isCellMatched(cell)) return '未命中筛选条件'
@@ -574,6 +597,21 @@ onBeforeUnmount(() => {
   color: #ff4d4f;
 }
 
+.location-id.location-id-abnormal-attribute {
+  color: #ff4d4f;
+}
+
+.location-attribute-tag {
+  max-width: 100%;
+  font-size: calc(var(--cell-id-font-size, 11px) - 2px);
+  color: #ff4d4f;
+  text-align: center;
+  line-height: 1.1;
+  white-space: nowrap;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
 .container-code {
   max-width: 100%;
   font-size: calc(var(--cell-id-font-size, 11px) - 2px);