优化
This commit is contained in:
@@ -17,7 +17,7 @@ import type { InboundOrderSummary } from '../core/types'
|
||||
import InboundMeasurementPanel from '../measurement/InboundMeasurementPanel.vue'
|
||||
import MeasurementReviewPanel from '../review/MeasurementReviewPanel.vue'
|
||||
import { inboundProcessStatusLabels, inboundReviewStatusLabels, inboundStatusLabel } from '../status'
|
||||
import { buildInboundTaskQuery, type InboundTaskMode } from '../task-list'
|
||||
import { buildInboundTaskQuery, loadAllActiveCustomers, type InboundTaskMode } from '../task-list'
|
||||
|
||||
type FilterModel = QueryModel & {
|
||||
customerId: string
|
||||
@@ -43,6 +43,7 @@ const warehouseOptions = ref<Array<{ label: string; value: string }>>([])
|
||||
const selectedInbound = ref<InboundOrderSummary | null>(null)
|
||||
const taskDialogOpen = ref(false)
|
||||
let requestSerial = 0
|
||||
let optionsRequestSerial = 0
|
||||
let disposed = false
|
||||
let activatedOnce = false
|
||||
|
||||
@@ -109,14 +110,15 @@ function dateParam(value: string | undefined, end = false) {
|
||||
}
|
||||
|
||||
async function loadOptions() {
|
||||
const serial = ++optionsRequestSerial
|
||||
customerLoadError.value = null
|
||||
try {
|
||||
const [customerPage, warehousePage] = await Promise.all([
|
||||
listPlatformTenants({ page: 1, size: 200, status: 'ACTIVE' }),
|
||||
const [customerRecords, warehousePage] = await Promise.all([
|
||||
loadAllActiveCustomers((query) => listPlatformTenants(query)),
|
||||
listPlatformWarehouses(1, 200),
|
||||
])
|
||||
if (disposed) return
|
||||
customers.value = customerPage.records
|
||||
if (disposed || serial !== optionsRequestSerial) return
|
||||
customers.value = customerRecords
|
||||
warehouseOptions.value = warehousePage.records.map((warehouse) => ({
|
||||
label: `${warehouse.warehouseName} · ${warehouse.warehouseCode}`,
|
||||
value: String(warehouse.id),
|
||||
@@ -190,7 +192,7 @@ onActivated(() => {
|
||||
}
|
||||
void loadTasks()
|
||||
})
|
||||
onBeforeUnmount(() => { disposed = true; requestSerial += 1 })
|
||||
onBeforeUnmount(() => { disposed = true; requestSerial += 1; optionsRequestSerial += 1 })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user