fix(admin): remove warehouse selector from loading lists

This commit is contained in:
2026-08-10 18:07:33 +08:00
parent 1595fbcae2
commit b593d72222
5 changed files with 27 additions and 38 deletions
@@ -99,6 +99,12 @@ const filteredCandidates = computed(() => {
.some((value) => String(value || '').toLowerCase().includes(keyword)))
})
function preferredContainerId() {
const visible = filteredContainers.value
if (String(appliedQuery.value.status || '').trim()) return visible[0]?.id || ''
return visible.find((item) => item.planStatus === 'EDITING')?.id || visible[0]?.id || ''
}
const candidateColumns: DataTableColumn[] = [
{ key: 'actions', label: '操作', width: 92, fixed: 'left', slotName: 'actions' },
{ key: 'order', label: '订单/入库单', minWidth: 170, slotName: 'order' },
@@ -192,7 +198,7 @@ async function load() {
? await Promise.all(Array.from({ length: firstPage.pages - 1 }, (_, index) => listContainers({ page: index + 2, size: 100 })))
: []
containers.value = [firstPage, ...remainingPages].flatMap((page) => page.records)
if (!filteredContainers.value.some((item) => item.id === selectedContainerId.value)) selectedContainerId.value = filteredContainers.value[0]?.id || ''
if (!filteredContainers.value.some((item) => item.id === selectedContainerId.value)) selectedContainerId.value = preferredContainerId()
await loadSelectedData()
} catch (error) {
loadError.value = getApiErrorDetails(error, '智能装柜工作台加载失败')
@@ -209,7 +215,7 @@ async function selectContainer(containerId: string) {
async function applyFilters(model: QueryModel) {
appliedQuery.value = { ...model }
if (!filteredContainers.value.some((item) => item.id === selectedContainerId.value)) {
selectedContainerId.value = filteredContainers.value[0]?.id || ''
selectedContainerId.value = preferredContainerId()
await loadSelectedData()
}
}
@@ -317,7 +323,6 @@ onMounted(load)
preference-key="global-smart-loading-query"
:search-on-reset="false"
@search="applyFilters"
@reset="applyFilters"
/>
<LoadErrorState v-if="loadError" title="智能装柜工作台加载失败" :message="loadError.message" :loading="loading" @retry="load">