2025-07-28 18:25:02 +08:00
|
|
|
<template>
|
|
|
|
|
<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-07-29 15:00:15 +08:00
|
|
|
<slot name="default" :material="material">
|
2025-08-11 16:17:27 +08:00
|
|
|
{{ material.rawMaterialName ? material.rawMaterialName : '-' }}
|
2025-07-29 15:00:15 +08:00
|
|
|
</slot>
|
2025-07-28 18:25:02 +08:00
|
|
|
</span>
|
2025-07-30 15:21:57 +08:00
|
|
|
<el-dialog :visible="showDetail" @close="showDetail = false" :title="material.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-07-31 18:07:51 +08:00
|
|
|
<el-descriptions-item label="原材料ID">{{ material.rawMaterialId }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="原材料名称">{{ material.rawMaterialName }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="原材料编码">{{ material.rawMaterialCode }}</el-descriptions-item>
|
2025-11-04 16:45:30 +08:00
|
|
|
<el-descriptions-item label="规格">{{ material.specification }}</el-descriptions-item>
|
2025-07-29 15:16:51 +08:00
|
|
|
</el-descriptions>
|
|
|
|
|
<BomInfo :bomId="material.bomId" />
|
2025-07-28 18:25:02 +08:00
|
|
|
</el-dialog>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { mapState } from 'vuex';
|
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: {
|
|
|
|
|
materialId: {
|
|
|
|
|
type: [String, Number],
|
|
|
|
|
required: true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
showDetail: false,
|
2025-07-29 15:00:15 +08:00
|
|
|
material: {},
|
2025-07-28 18:25:02 +08:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
...mapState({
|
|
|
|
|
materialMap: state => state.category.rawMaterialMap // 假设vuex中为material模块
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
materialId: {
|
2025-07-29 15:00:15 +08:00
|
|
|
handler: function (newVal) {
|
2025-08-11 16:17:27 +08:00
|
|
|
const res = this.materialMap[this.materialId] ? this.materialMap[this.materialId] : {};
|
2025-07-28 18:25:02 +08:00
|
|
|
this.material = res;
|
|
|
|
|
},
|
|
|
|
|
immediate: true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
.material-name {
|
|
|
|
|
color: #1890ff;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
|
|
|
|
</style>
|