2026-03-27 17:57:54 +08:00

65 lines
1.4 KiB
Vue

<template>
<div class="stockout-product-container">
<el-table
v-loading="loading"
:data="data"
border
size="small"
height="100%"
style="width: 100%"
>
<el-table-column
v-for="col in productColumns"
:key="col.prop"
:prop="col.prop"
:label="col.label"
:width="col.width"
:min-width="col.minWidth"
:fixed="col.fixed"
:align="col.align"
/>
</el-table>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
import { productColumns } from '../stockout-config'
import * as entryApi from '@/api/storage/entry'
const props = defineProps<{
id: string | number
}>()
const data = ref([])
const loading = ref(false)
const loadData = async () => {
if (!props.id) return
loading.value = true
try {
const res: any = await entryApi.getEntryDetail({ id: props.id })
if (res && res.code === 200) {
// 假设详情中有 details 数组
data.value = res.data.details || []
}
} catch (error) {
console.error('加载商品明细失败', error)
} finally {
loading.value = false
}
}
watch(() => props.id, loadData, { immediate: true })
onMounted(loadData)
</script>
<style scoped lang="scss">
.stockout-product-container {
height: 100%;
padding: 10px;
box-sizing: border-box;
}
</style>