style:生产报表-基础信息-查看产品信息字段修改

pull/1/head
黄伟杰 4 weeks ago
parent b865238720
commit 242d933c62

@ -1,20 +1,17 @@
<template>
<el-dialog v-model="dialogVisible" title="产品信息" width="80%" @close="handleClose">
<el-table v-loading="loading" :data="productList" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="产品编码" align="center" prop="id" width="120px" />
<el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="单位" align="center" prop="unitName" width="100px" />
<el-table-column label="物料编码" align="center" prop="bomId" width="120px" />
<el-table-column label="用量" align="center" prop="usageNumber" width="100px" />
<el-table-column label="良率%" align="center" prop="yieldRate" width="100px" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="是否启用" align="center" width="100px">
<template #default="scope">
<el-tag :type="scope.row.isEnable ? 'success' : 'danger'">
{{ scope.row.isEnable ? '是' : '否' }}
</el-tag>
</template>
</el-table-column>
<el-dialog v-model="dialogVisible" title="产品信息" width="900px" @close="handleClose">
<el-descriptions :column="5" border class="mb-20px" size="small">
<el-descriptions-item label="产品编码">{{ productInfo.barCode }}</el-descriptions-item>
<el-descriptions-item label="产品名称">{{ productInfo.productName }}</el-descriptions-item>
<el-descriptions-item label="数量">{{ productInfo.number }}</el-descriptions-item>
<el-descriptions-item label="单位">{{ productInfo.unitName }}</el-descriptions-item>
<el-descriptions-item label="规格">{{ productInfo.standard }}</el-descriptions-item>
</el-descriptions>
<el-table v-loading="loading" :data="materialList" :stripe="true" :show-overflow-tooltip="true">
<el-table-column label="原料编码" align="center" prop="productCode" min-width="130" />
<el-table-column label="原料名称" align="center" prop="productName" min-width="150" />
<el-table-column label="需求量" align="center" prop="usageNumber" width="100" />
<el-table-column label="单位" align="center" prop="unitName" width="80" />
</el-table>
</el-dialog>
</template>
@ -26,29 +23,34 @@ defineOptions({ name: 'ProductInfoDialog' })
const dialogVisible = ref(false)
const loading = ref(false)
const productList = ref<any[]>([])
const materialList = ref<any[]>([])
const productInfo = ref<any>({})
const open = async (productId: number) => {
const open = async (row: any) => {
dialogVisible.value = true
productInfo.value = row || {}
loading.value = true
try {
const data = await BomApi.getBomByProductId(productId)
productList.value = data || []
const data = await BomApi.getBomByProductId(row.productId)
materialList.value = data || []
} catch (error) {
console.error('Failed to fetch product info:', error)
productList.value = []
console.error('Failed to fetch material list:', error)
materialList.value = []
} finally {
loading.value = false
}
}
const handleClose = () => {
productList.value = []
materialList.value = []
productInfo.value = {}
}
defineExpose({
open
})
defineExpose({ open })
</script>
<style scoped></style>
<style scoped>
.mb-20px {
margin-bottom: 20px;
}
</style>

@ -72,9 +72,7 @@ watch(
/** 打开产品信息对话框 */
const openProductInfo = (row: any) => {
if (row?.productId) {
productInfoDialogRef.value?.open(row.productId)
}
productInfoDialogRef.value?.open(row)
}
</script>

Loading…
Cancel
Save