2025-07-28 18:25:02 +08:00
|
|
|
|
<template>
|
2025-11-15 16:39:05 +08:00
|
|
|
|
<div>
|
2025-11-24 17:21:26 +08:00
|
|
|
|
<el-popover
|
|
|
|
|
|
trigger="hover"
|
|
|
|
|
|
placement="top"
|
|
|
|
|
|
width="400"
|
|
|
|
|
|
:visible-arrow="true"
|
|
|
|
|
|
append-to-body
|
|
|
|
|
|
popper-class="product-info-popover"
|
2025-07-29 15:16:51 +08:00
|
|
|
|
>
|
2025-11-24 17:21:26 +08:00
|
|
|
|
<!-- popover 内容(原dialog中的描述列表) -->
|
|
|
|
|
|
<el-descriptions :column="2" class="popover-content">
|
2025-07-31 18:07:51 +08:00
|
|
|
|
<el-descriptions-item label="产品名称">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.productName || '--' }}
|
2025-07-29 15:16:51 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="产品编码">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.productCode || '--' }}
|
2025-07-29 15:16:51 +08:00
|
|
|
|
</el-descriptions-item>
|
2025-11-04 16:45:30 +08:00
|
|
|
|
<el-descriptions-item label="规格">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.specification || '--' }}
|
2025-11-04 16:45:30 +08:00
|
|
|
|
</el-descriptions-item>
|
2025-11-14 18:16:16 +08:00
|
|
|
|
<el-descriptions-item label="材质">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.material || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="表面处理">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.surfaceTreatment || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="锌层">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.zincLayer || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="厂家">
|
2025-11-24 17:21:26 +08:00
|
|
|
|
{{ productFull.manufacturer || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
2025-07-29 15:16:51 +08:00
|
|
|
|
</el-descriptions>
|
2025-11-24 17:21:26 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 触发元素(原产品名称文本) -->
|
|
|
|
|
|
<span slot="reference" class="product-name">
|
|
|
|
|
|
<slot name="default" :product="productFull">
|
2026-01-10 09:57:44 +08:00
|
|
|
|
{{ productFull.productName || '未知' }}[{{ productFull.specification || '无规格' }}]({{ productFull.material || '无材质' }})-{{ productFull.manufacturer || '无厂家' }}
|
2025-11-24 17:21:26 +08:00
|
|
|
|
</slot>
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</el-popover>
|
2025-07-28 18:25:02 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
export default {
|
|
|
|
|
|
name: 'ProductInfo',
|
|
|
|
|
|
props: {
|
2025-11-15 16:04:41 +08:00
|
|
|
|
product: {
|
|
|
|
|
|
type: Object,
|
2025-11-15 16:39:05 +08:00
|
|
|
|
default: () => ({})
|
2025-07-29 15:00:15 +08:00
|
|
|
|
},
|
2025-07-28 18:25:02 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
2025-11-24 17:21:26 +08:00
|
|
|
|
// 移除showDetail,无需弹窗控制
|
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-24 17:21:26 +08:00
|
|
|
|
};
|
2025-11-18 10:14:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-07-29 15:00:15 +08:00
|
|
|
|
methods: {
|
2025-11-24 17:21:26 +08:00
|
|
|
|
// 移除clickHandle方法,无需点击触发
|
2025-07-29 15:00:15 +08:00
|
|
|
|
},
|
2025-07-28 18:25:02 +08:00
|
|
|
|
};
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.product-name {
|
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
text-decoration: underline;
|
2025-11-24 17:21:26 +08:00
|
|
|
|
/* 增加内边距,优化悬停触发区域 */
|
|
|
|
|
|
padding: 2px 4px;
|
2025-07-29 15:16:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|