2025-07-28 18:25:02 +08:00
|
|
|
|
<template>
|
2025-11-15 16:39:05 +08:00
|
|
|
|
<div>
|
2025-10-31 11:52:45 +08:00
|
|
|
|
<span class="product-name" @click.stop="clickHandle">
|
2025-11-18 10:14:55 +08:00
|
|
|
|
<slot name="default" :product="productFull">
|
2025-11-18 10:30:25 +08:00
|
|
|
|
{{ productFull.productName || '未知' }}[{{ productFull.specification || '无规格' }}] - (材质:{{ productFull.material || '无材质' }})
|
2025-07-29 15:00:15 +08:00
|
|
|
|
</slot>
|
2025-07-28 18:25:02 +08:00
|
|
|
|
</span>
|
2025-07-29 15:16:51 +08:00
|
|
|
|
<el-dialog
|
|
|
|
|
|
:visible="showDetail"
|
|
|
|
|
|
@close="showDetail = false"
|
2025-11-18 10:14:55 +08:00
|
|
|
|
:title="productFull.productName || '--' "
|
2025-07-29 15:16:51 +08:00
|
|
|
|
width="500px"
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
>
|
|
|
|
|
|
<el-descriptions :column="1" border>
|
2025-07-31 18:07:51 +08:00
|
|
|
|
<el-descriptions-item label="产品名称">
|
2025-07-29 15:16:51 +08:00
|
|
|
|
{{ product.productName || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="产品编码">
|
|
|
|
|
|
{{ product.productCode || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
2025-11-04 16:45:30 +08:00
|
|
|
|
<el-descriptions-item label="规格">
|
|
|
|
|
|
{{ product.specification || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
2025-11-14 18:16:16 +08:00
|
|
|
|
<el-descriptions-item label="材质">
|
|
|
|
|
|
{{ product.material || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="表面处理">
|
|
|
|
|
|
{{ product.surfaceTreatment || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<!-- 锌层 -->
|
|
|
|
|
|
<el-descriptions-item label="锌层">
|
|
|
|
|
|
{{ product.zincLayer || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<!-- 厂家 -->
|
|
|
|
|
|
<el-descriptions-item label="厂家">
|
|
|
|
|
|
{{ product.manufacturer || '--' }}
|
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
|
2025-07-29 15:16:51 +08:00
|
|
|
|
</el-descriptions>
|
2025-11-14 18:16:16 +08:00
|
|
|
|
<!-- <BomInfo :bomId="product.bomId" /> -->
|
2025-07-28 18:25:02 +08:00
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-11-15 16:04:41 +08:00
|
|
|
|
// import { mapState } from 'vuex';
|
|
|
|
|
|
// import BomInfo from './BomInfo.vue';
|
2025-07-29 15:16:51 +08:00
|
|
|
|
|
2025-07-28 18:25:02 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'ProductInfo',
|
2025-11-15 16:04:41 +08:00
|
|
|
|
// components: {
|
|
|
|
|
|
// BomInfo
|
|
|
|
|
|
// },
|
2025-07-28 18:25:02 +08:00
|
|
|
|
props: {
|
2025-11-15 16:04:41 +08:00
|
|
|
|
product: {
|
|
|
|
|
|
type: Object,
|
2025-11-15 16:39:05 +08:00
|
|
|
|
// required: true,
|
|
|
|
|
|
default: () => ({})
|
2025-07-29 15:00:15 +08:00
|
|
|
|
},
|
2025-07-28 18:25:02 +08:00
|
|
|
|
},
|
2025-11-15 16:04:41 +08:00
|
|
|
|
// mounted() {
|
|
|
|
|
|
// console.log(this.productId, this.productMap);
|
|
|
|
|
|
// },
|
2025-07-28 18:25:02 +08:00
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
showDetail: false,
|
2025-11-15 14:11:12 +08:00
|
|
|
|
// product: {},
|
2025-07-28 18:25:02 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
2025-11-18 10:14:55 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
productFull() {
|
|
|
|
|
|
// 完整的product, 确保每个字段都有值
|
|
|
|
|
|
if (!this.product) {
|
|
|
|
|
|
return {};
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
productId: this.product.productId || '',
|
|
|
|
|
|
productName: this.product.productName || '',
|
|
|
|
|
|
productCode: this.product.productCode || '',
|
|
|
|
|
|
specification: this.product.specification || '',
|
|
|
|
|
|
material: this.product.material || '',
|
|
|
|
|
|
surfaceTreatment: this.product.surfaceTreatment || '',
|
|
|
|
|
|
zincLayer: this.product.zincLayer || '',
|
|
|
|
|
|
manufacturer: this.product.manufacturer || '',
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-11-15 16:04:41 +08:00
|
|
|
|
// computed: {
|
|
|
|
|
|
// ...mapState({
|
|
|
|
|
|
// productMap: state => state.category.productMap
|
|
|
|
|
|
// }),
|
|
|
|
|
|
// product() {
|
|
|
|
|
|
// // 检查 productMap 是否已加载
|
|
|
|
|
|
// if (!this.productMap || Object.keys(this.productMap).length === 0) {
|
|
|
|
|
|
// return {};
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (!this.productId) {
|
|
|
|
|
|
// return {};
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return this.productMap[this.productId.toString()] || {};
|
|
|
|
|
|
// },
|
|
|
|
|
|
// loading() {
|
|
|
|
|
|
// return !this.productMap || Object.keys(this.productMap).length === 0
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
2025-07-29 15:00:15 +08:00
|
|
|
|
methods: {
|
|
|
|
|
|
clickHandle() {
|
|
|
|
|
|
this.showDetail = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-11-15 14:11:12 +08:00
|
|
|
|
// watch: {
|
|
|
|
|
|
// productId: {
|
|
|
|
|
|
// handler(newVal) {
|
|
|
|
|
|
// if (!newVal) {
|
|
|
|
|
|
// this.product = {};
|
|
|
|
|
|
// }
|
|
|
|
|
|
// const res = this.productMap[newVal.toString()] ? this.productMap[newVal.toString()] : {};
|
|
|
|
|
|
// this.product = res;
|
|
|
|
|
|
// },
|
|
|
|
|
|
// immediate: true
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2025-07-28 18:25:02 +08:00
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.product-name {
|
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
|
}
|
2025-07-29 15:16:51 +08:00
|
|
|
|
|
|
|
|
|
|
/* 可选:调整描述列表的外边距 */
|
|
|
|
|
|
:deep(.el-descriptions) {
|
|
|
|
|
|
margin-top: -10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|