2026-08-15 12:33:29 +08:00
|
|
|
<script setup lang="ts">
|
2026-10-08 17:08:03 +08:00
|
|
|
import { computed, onMounted, watch } from 'vue'
|
2026-08-15 12:33:29 +08:00
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
import AdminPage from '@/shared/components/AdminPage.vue'
|
|
|
|
|
import LoadingListDetailDrawer from '../components/LoadingListDetailDrawer.vue'
|
2026-10-08 17:08:03 +08:00
|
|
|
import { useLoadingListDetail } from '../useLoadingListDetail'
|
|
|
|
|
import { printLoadingList } from '../printLoadingList'
|
2026-08-15 12:33:29 +08:00
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const router = useRouter()
|
2026-10-08 17:08:03 +08:00
|
|
|
const { detail, loading, error, load } = useLoadingListDetail()
|
2026-08-15 12:33:29 +08:00
|
|
|
const planId = computed(() => String(route.params.planId || ''))
|
|
|
|
|
const warehouseId = computed(() => typeof route.query.warehouseId === 'string' ? route.query.warehouseId : '')
|
|
|
|
|
|
|
|
|
|
async function loadDetail() {
|
2026-10-08 17:08:03 +08:00
|
|
|
const result = await load('confirmed', planId.value, warehouseId.value)
|
|
|
|
|
if (!result || detail.value !== result || route.query.print !== '1') return
|
|
|
|
|
await printLoadingList()
|
|
|
|
|
const { print: _print, ...query } = route.query
|
|
|
|
|
await router.replace({ name: 'loading-list-detail', params: { planId: planId.value }, query })
|
2026-08-15 12:33:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function goBack() {
|
|
|
|
|
if (window.history.length > 1) router.back()
|
|
|
|
|
else void router.push({ name: 'loading-lists' })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onMounted(() => void loadDetail())
|
2026-08-26 15:32:22 +08:00
|
|
|
watch([planId, warehouseId], () => void loadDetail())
|
2026-08-15 12:33:29 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
<AdminPage>
|
|
|
|
|
<div class="confirmed-loading-detail-page">
|
2026-10-08 17:08:03 +08:00
|
|
|
<LoadingListDetailDrawer dense
|
2026-08-15 12:33:29 +08:00
|
|
|
mode="confirmed"
|
|
|
|
|
:loading="loading"
|
|
|
|
|
:detail="detail"
|
|
|
|
|
:error="error"
|
|
|
|
|
:can-edit="false"
|
2026-08-18 16:39:44 +08:00
|
|
|
@back="goBack"
|
2026-08-15 12:33:29 +08:00
|
|
|
@retry="loadDetail"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</AdminPage>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.confirmed-loading-detail-page { display: grid; min-width: 0; max-width: 1280px; gap: 16px; }
|
2026-08-17 19:13:25 +08:00
|
|
|
@media (min-width: 1920px) { .confirmed-loading-detail-page { width: 100%; max-width: none; gap: 12px; } }
|
2026-08-15 12:33:29 +08:00
|
|
|
</style>
|