fix(admin): restore loading list detail page navigation

This commit is contained in:
2026-10-08 13:59:20 +08:00
parent d7911ad09d
commit f24b592705
8 changed files with 123 additions and 76 deletions
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue'
import { computed, nextTick, onMounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { getApiErrorDetails, type ApiErrorDetails } from '@/shared/api/http'
import AdminPage from '@/shared/components/AdminPage.vue'
@@ -37,6 +37,14 @@ async function loadDetail() {
return
}
detail.value = result
loading.value = false
if (route.query.print === '1') {
await nextTick()
if (sequence !== loadSequence) return
window.print()
const { print: _print, ...query } = route.query
await router.replace({ name: 'loading-list-detail', params: { planId: planId.value }, query })
}
} catch (cause) {
if (sequence !== loadSequence) return
detail.value = null
@@ -51,6 +59,10 @@ function goBack() {
else void router.push({ name: 'loading-lists' })
}
function printDetail() {
window.print()
}
onMounted(() => void loadDetail())
watch([planId, warehouseId], () => void loadDetail())
</script>
@@ -58,6 +70,7 @@ watch([planId, warehouseId], () => void loadDetail())
<template>
<AdminPage>
<div class="confirmed-loading-detail-page">
<el-button v-if="detail" class="print-action" :disabled="loading" @click="printDetail">打印</el-button>
<LoadingListDetailDrawer
mode="confirmed"
:loading="loading"
@@ -73,5 +86,6 @@ watch([planId, warehouseId], () => void loadDetail())
<style scoped>
.confirmed-loading-detail-page { display: grid; min-width: 0; max-width: 1280px; gap: 16px; }
@media print { .print-action { display: none; } }
@media (min-width: 1920px) { .confirmed-loading-detail-page { width: 100%; max-width: none; gap: 12px; } }
</style>