2025-07-28 18:25:02 +08:00
|
|
|
|
<template>
|
2025-11-15 16:04:41 +08:00
|
|
|
|
<div>
|
2025-07-29 15:00:15 +08:00
|
|
|
|
<!-- 作用域插槽 -->
|
2025-10-31 11:52:45 +08:00
|
|
|
|
<span class="material-name" @click.stop="showDetail = true">
|
2025-11-18 10:14:55 +08:00
|
|
|
|
<slot name="default" :material="materialFull">
|
2025-11-18 10:30:25 +08:00
|
|
|
|
{{ materialFull.rawMaterialName || '未知' }}[{{ materialFull.specification || '无规格' }}] - (材质:{{ materialFull.material || '无材质' }})
|
2025-07-29 15:00:15 +08:00
|
|
|
|
</slot>
|
2025-07-28 18:25:02 +08:00
|
|
|
|
</span>
|
2025-11-18 10:14:55 +08:00
|
|
|
|
<el-dialog :visible="showDetail" @close="showDetail = false" :title="materialFull.rawMaterialName || '--'" width="600px"
|
2025-07-29 15:00:15 +08:00
|
|
|
|
append-to-body>
|
2025-07-29 15:16:51 +08:00
|
|
|
|
<el-descriptions :column="1" border>
|
2025-11-18 10:14:55 +08:00
|
|
|
|
<!-- <el-descriptions-item label="原材料ID">{{ materialFull.rawMaterialId }}</el-descriptions-item> -->
|
|
|
|
|
|
<el-descriptions-item label="原材料名称">{{ materialFull.rawMaterialName || '--' }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="原材料编码">{{ materialFull.rawMaterialCode || '--' }}</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="规格">{{ materialFull.specification || '--' }}</el-descriptions-item>
|
2025-11-14 18:16:16 +08:00
|
|
|
|
<el-descriptions-item label="材质">
|
2025-11-18 10:14:55 +08:00
|
|
|
|
{{ materialFull.material || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<el-descriptions-item label="表面处理">
|
2025-11-18 10:14:55 +08:00
|
|
|
|
{{ materialFull.surfaceTreatment || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<!-- 锌层 -->
|
|
|
|
|
|
<el-descriptions-item label="锌层">
|
2025-11-18 10:14:55 +08:00
|
|
|
|
{{ materialFull.zincLayer || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
|
<!-- 厂家 -->
|
|
|
|
|
|
<el-descriptions-item label="厂家">
|
2025-11-18 10:14:55 +08:00
|
|
|
|
{{ materialFull.manufacturer || '--' }}
|
2025-11-14 18:16:16 +08:00
|
|
|
|
</el-descriptions-item>
|
2025-07-29 15:16:51 +08:00
|
|
|
|
</el-descriptions>
|
2025-11-14 18:16:16 +08:00
|
|
|
|
<!-- <BomInfo :bomId="material.bomId" /> -->
|
2025-07-28 18:25:02 +08:00
|
|
|
|
</el-dialog>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-07-29 16:57:16 +08:00
|
|
|
|
import BomInfo from './BomInfo.vue';
|
|
|
|
|
|
|
2025-07-28 18:25:02 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
name: 'RawMaterialInfo',
|
2025-07-29 16:57:16 +08:00
|
|
|
|
components: {
|
|
|
|
|
|
BomInfo
|
|
|
|
|
|
},
|
2025-07-28 18:25:02 +08:00
|
|
|
|
props: {
|
2025-11-15 16:04:41 +08:00
|
|
|
|
material: {
|
|
|
|
|
|
type: Object,
|
2025-11-15 16:39:05 +08:00
|
|
|
|
// required: true,
|
|
|
|
|
|
default: () => ({})
|
2025-07-28 18:25:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
showDetail: false,
|
2025-11-15 14:11:12 +08:00
|
|
|
|
// material: {},
|
2025-07-28 18:25:02 +08:00
|
|
|
|
};
|
|
|
|
|
|
},
|
2025-11-18 10:14:55 +08:00
|
|
|
|
computed: {
|
|
|
|
|
|
materialFull() {
|
|
|
|
|
|
// 完整的material, 确保每个字段都有值
|
|
|
|
|
|
if (!this.material) {
|
|
|
|
|
|
return {};
|
|
|
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
|
|
|
rawMaterialId: this.material.rawMaterialId || '',
|
|
|
|
|
|
rawMaterialName: this.material.rawMaterialName || '',
|
|
|
|
|
|
rawMaterialCode: this.material.rawMaterialCode || '',
|
|
|
|
|
|
specification: this.material.specification || '',
|
|
|
|
|
|
material: this.material.material || '',
|
|
|
|
|
|
surfaceTreatment: this.material.surfaceTreatment || '',
|
|
|
|
|
|
zincLayer: this.material.zincLayer || '',
|
|
|
|
|
|
manufacturer: this.material.manufacturer || '',
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-11-15 16:04:41 +08:00
|
|
|
|
// computed: {
|
|
|
|
|
|
// ...mapState({
|
|
|
|
|
|
// materialMap: state => state.category.rawMaterialMap // 假设vuex中为material模块
|
|
|
|
|
|
// }),
|
|
|
|
|
|
// material() {
|
|
|
|
|
|
// // 检查 materialMap 是否已加载
|
|
|
|
|
|
// if (!this.materialMap || Object.keys(this.materialMap).length === 0) {
|
|
|
|
|
|
// return {};
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (!this.materialId) {
|
|
|
|
|
|
// return {};
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return this.materialMap[this.materialId.toString()] || {};
|
|
|
|
|
|
// },
|
|
|
|
|
|
// loading() {
|
|
|
|
|
|
// return !this.materialMap || Object.keys(this.materialMap).length === 0
|
|
|
|
|
|
// }
|
|
|
|
|
|
// },
|
2025-11-15 14:11:12 +08:00
|
|
|
|
// watch: {
|
|
|
|
|
|
// materialId: {
|
|
|
|
|
|
// handler: function (newVal) {
|
|
|
|
|
|
// const res = this.materialMap[newVal.toString()] ? this.materialMap[newVal.toString()] : {};
|
|
|
|
|
|
// this.material = res;
|
|
|
|
|
|
// },
|
|
|
|
|
|
// immediate: true
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2025-07-28 18:25:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.material-name {
|
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|