This commit is contained in:
2026-10-21 15:10:54 +08:00
parent 457a95941d
commit e6c864a2a6
23 changed files with 239 additions and 72 deletions
@@ -24,7 +24,7 @@ const error = ref<ApiErrorDetails | null>(null)
const candidatePage = useDispatchCandidates(error)
const { candidates, page: cargoPage, size: cargoSize, total: cargoTotal } = candidatePage
const rows = ref<DispatchListRow[]>([]), page = ref(1), size = ref(10), total = ref(0)
const keyword = ref(''), queriedKeyword = ref(''), cargoKeyword = ref(''), queriedCargoKeyword = ref('')
const queriedKeyword = ref(''), cargoKeyword = ref(''), queriedCargoKeyword = ref('')
const selectedNo = ref(''), warehouseId = ref(''), warehouseName = ref('')
const detail = ref<DispatchDetail | null>(null), items = ref<DispatchItems | null>(null)
const reading = ref(false), listing = ref(false), preparing = ref(false), stale = ref(true)
@@ -54,9 +54,9 @@ async function loadList() {
} catch (cause) { if (alive && sequence === listGeneration) { rows.value = []; report(cause, '排车列表读取失败') } }
finally { if (alive && sequence === listGeneration) listing.value = false }
}
async function searchDispatches() {
async function searchDispatches(value: string) {
if (frozen.value) return
queriedKeyword.value = keyword.value.trim(); page.value = 1
queriedKeyword.value = value.trim(); page.value = 1
await loadList()
}
async function changePage(value: number) { if (!frozen.value) { page.value = value; await loadList() } }
@@ -205,18 +205,16 @@ onBeforeUnmount(() => { alive = false; generation++; listGeneration++; candidate
<LoadErrorState v-if="error" title="排车货物资料待核对" :message="error.message" :loading="loading || busy" retry-text="重新核对" @retry="retry"><template #details><ApiErrorMeta :details="error" /></template></LoadErrorState>
<section class="density-dialog-section existing-cargo-search" aria-label="已有排车查询">
<div class="existing-cargo-query">
<label for="existing-dispatch-number">排车单号</label>
<el-input id="existing-dispatch-number" v-model="keyword" aria-label="查找已有排车" placeholder="排车单号" :disabled="frozen || listing" @keyup.enter="searchDispatches" />
<el-button type="primary" :disabled="frozen || listing" @click="searchDispatches">查询排车</el-button>
<el-select :model-value="selectedNo" aria-label="选择已有排车" placeholder="选择装车前排车" :disabled="frozen || listing" @update:model-value="(value: string) => selectDispatch(value, rows.find(row => row.dispatchNo === value))">
<el-select :model-value="selectedNo" aria-label="选择已有排车" placeholder="输入单号搜索并选择排车" filterable remote :remote-method="searchDispatches" :loading="listing" :disabled="frozen" @update:model-value="(value: string) => selectDispatch(value, rows.find(row => row.dispatchNo === value))">
<el-option v-for="row in rows" :key="row.dispatchNo" :value="row.dispatchNo" :label="`${row.dispatchNo} · ${row.warehouseName || row.warehouseCode || '—'}`" :disabled="row.taskType !== 'DELIVERY' || row.status !== 'ACTIVE' || row.stage !== 'BEFORE_LOADING'" />
<el-option v-if="selectedNo && !rows.some(row => row.dispatchNo === selectedNo)" :value="selectedNo" :label="selectedNo" disabled />
<template #footer><el-pagination aria-label="已有排车分页" :current-page="page" :page-size="size" :total="total" :disabled="frozen || listing" layout="total, prev, pager, next" @update:current-page="changePage" /></template>
</el-select>
<el-pagination aria-label="已有排车分页" :current-page="page" :page-size="size" :total="total" :disabled="frozen || listing" layout="total, prev, pager, next" @update:current-page="changePage" />
<template v-if="selectedNo"><el-input id="existing-cargo-keyword" v-model="cargoKeyword" aria-label="查找可排货物" placeholder="订单号/入仓码" :disabled="locked || !canAdd" @keyup.enter="searchCargo" /><el-button type="primary" :disabled="locked || !canAdd" @click="searchCargo">查询货物</el-button><el-button :disabled="locked" @click="selectDispatch(selectedNo)">刷新本车</el-button></template>
</div>
<div v-if="selectedNo" class="existing-cargo-query existing-cargo-filter"><label for="existing-cargo-keyword">货物查询</label><el-input id="existing-cargo-keyword" v-model="cargoKeyword" aria-label="查找可排货物" placeholder="订单号/入仓码" :disabled="locked || !canAdd" @keyup.enter="searchCargo" /><el-button type="primary" :disabled="locked || !canAdd" @click="searchCargo">查询货物</el-button><el-button :disabled="locked" @click="selectDispatch(selectedNo)">刷新本车</el-button></div>
</section>
<p v-if="!selectedNo" class="density-dialog-note">选择已有排车后,在这里统一增减本车计划货物。</p>
<template v-if="selectedNo">
<p v-if="detail && !editable" class="density-dialog-note">仅有效、装车前的仓库派送排车允许调整计划货物。真实拣货仍在 PDA 完成。</p>
@@ -243,9 +241,9 @@ onBeforeUnmount(() => { alive = false; generation++; listGeneration++; candidate
</template>
<style scoped>
.existing-cargo-search { display: flex; flex-direction: column; gap: var(--admin-space-5); margin-top: var(--admin-space-5); }
.existing-cargo { margin-top: var(--admin-space-5); }
.existing-cargo-search { display: flex; flex-direction: column; gap: var(--admin-space-5); }
.existing-cargo-query { display: flex; align-items: center; flex-wrap: wrap; gap: var(--admin-space-3); }
.existing-cargo-query > label { width: 64px; flex: none; color: var(--cc-muted); }
.existing-cargo-query > .el-button { margin-left: 0; }
.existing-cargo-query > .el-input { width: 240px; }
.existing-cargo-query > .el-select { width: 350px; }