2025-12-02 15:52:35 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div :class="{'g-coil-no': isGCoilNo}">
|
2025-12-15 11:05:27 +08:00
|
|
|
|
<!-- 有coilId时显示popover,无则只显示标签 -->
|
|
|
|
|
|
<el-popover
|
2026-04-03 14:53:45 +08:00
|
|
|
|
v-if="coilId || (coil && coil.currentCoilNo)"
|
2025-12-15 11:05:27 +08:00
|
|
|
|
placement="left"
|
|
|
|
|
|
width="200"
|
|
|
|
|
|
trigger="hover"
|
|
|
|
|
|
>
|
|
|
|
|
|
<div class="coil-info">
|
|
|
|
|
|
<div class="info-item">
|
|
|
|
|
|
<span class="label">物料名称:</span>
|
|
|
|
|
|
<span class="value">{{ itemName }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="info-item">
|
|
|
|
|
|
<span class="label">材质:</span>
|
|
|
|
|
|
<span class="value">{{ material }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="info-item">
|
|
|
|
|
|
<span class="label">生产厂家:</span>
|
|
|
|
|
|
<span class="value">{{ manufacturer }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="info-item">
|
|
|
|
|
|
<span class="label">规格:</span>
|
|
|
|
|
|
<span class="value">
|
|
|
|
|
|
{{ specification }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</div>
|
2026-03-03 17:36:18 +08:00
|
|
|
|
<div class="info-item">
|
|
|
|
|
|
<span class="label">净重:</span>
|
|
|
|
|
|
<span class="value">{{ netWeight }}</span>
|
|
|
|
|
|
</div>
|
2026-03-12 17:03:02 +08:00
|
|
|
|
<div class="info-item" v-if="length">
|
|
|
|
|
|
<span class="label">长度:</span>
|
|
|
|
|
|
<span class="value">{{ length }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="info-item" v-if="actualLength">
|
|
|
|
|
|
<span class="label">实测长度:</span>
|
|
|
|
|
|
<span class="value">{{ actualLength }}</span>
|
|
|
|
|
|
</div>
|
2026-03-26 15:13:08 +08:00
|
|
|
|
<div class="info-item" v-if="actualLength">
|
|
|
|
|
|
<span class="label">实测厚度:</span>
|
|
|
|
|
|
<span class="value">{{ actualThickness }}</span>
|
|
|
|
|
|
</div>
|
2026-03-12 17:03:02 +08:00
|
|
|
|
<div class="info-item" v-if="actualWidth">
|
|
|
|
|
|
<span class="label">实测宽度:</span>
|
|
|
|
|
|
<span class="value">{{ actualWidth }}</span>
|
|
|
|
|
|
</div>
|
2026-03-03 17:36:18 +08:00
|
|
|
|
<div class="info-item">
|
|
|
|
|
|
<span class="label">厂家卷号:</span>
|
|
|
|
|
|
<span class="value">{{ supplierCoilNo }}</span>
|
|
|
|
|
|
</div>
|
2025-12-15 11:05:27 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-02-26 11:33:50 +08:00
|
|
|
|
<el-tag type="info" size="small" slot="reference">{{ currentCoilNo }}</el-tag>
|
2025-12-15 11:05:27 +08:00
|
|
|
|
</el-popover>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 无coilId时仅显示标签 -->
|
2026-02-26 11:33:50 +08:00
|
|
|
|
<el-tag v-else type="info" size="small">{{ currentCoilNo }}</el-tag>
|
2025-12-02 15:52:35 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2025-12-15 11:05:27 +08:00
|
|
|
|
import { getMaterialCoil } from '@/api/wms/coil'
|
|
|
|
|
|
|
2025-12-02 15:52:35 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
props: {
|
|
|
|
|
|
coilNo: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: ''
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
coilId: {
|
|
|
|
|
|
type: String,
|
|
|
|
|
|
default: ''
|
|
|
|
|
|
},
|
2026-03-28 14:08:27 +08:00
|
|
|
|
coil: {
|
|
|
|
|
|
type: Object,
|
|
|
|
|
|
default: () => {}
|
|
|
|
|
|
}
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
data() { // 修正:data应该是函数
|
|
|
|
|
|
return {
|
|
|
|
|
|
coilInfo: {}
|
2025-12-02 15:52:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
isGCoilNo() {
|
2025-12-15 11:05:27 +08:00
|
|
|
|
return this.coilNo && this.coilNo.startsWith('G');
|
|
|
|
|
|
},
|
|
|
|
|
|
specification() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.specification || this.coil?.specification || '-'
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
itemName() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.itemName || this.coil?.itemName || '-'
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
material() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.material || this.coil?.material || '-'
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
manufacturer() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.manufacturer || this.coil?.manufacturer || '-'
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
2026-02-26 11:33:50 +08:00
|
|
|
|
currentCoilNo() {
|
2026-04-03 14:53:45 +08:00
|
|
|
|
return this.coilNo || this.coil?.currentCoilNo || this.coilInfo?.currentCoilNo || '-'
|
2026-03-03 17:36:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
netWeight() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.netWeight || this.coil?.netWeight || '-'
|
2026-03-03 17:36:18 +08:00
|
|
|
|
},
|
|
|
|
|
|
supplierCoilNo() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.supplierCoilNo || this.coil?.supplierCoilNo || '-'
|
2026-03-19 17:50:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
length() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.length || this.coil?.length || '-'
|
2026-03-19 17:50:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
actualLength() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.actualLength || this.coil?.actualLength || '-'
|
2026-03-19 17:50:37 +08:00
|
|
|
|
},
|
|
|
|
|
|
actualWidth() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.actualWidth || this.coil?.actualWidth || '-'
|
2026-03-19 17:50:37 +08:00
|
|
|
|
},
|
2026-03-26 15:13:08 +08:00
|
|
|
|
actualThickness() {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
return this.coilInfo.actualThickness || this.coil?.actualThickness || '-'
|
2026-03-26 15:13:08 +08:00
|
|
|
|
},
|
2025-12-15 11:05:27 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
getCoilInfo() {
|
|
|
|
|
|
if (!this.coilId) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
getMaterialCoil(this.coilId).then(res => {
|
|
|
|
|
|
this.coilInfo = res.data || {};
|
|
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
console.error('获取钢卷信息失败:', err);
|
|
|
|
|
|
this.coilInfo = {};
|
|
|
|
|
|
})
|
2025-12-02 15:52:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2025-12-15 11:05:27 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
|
// 组件挂载时获取线圈信息
|
|
|
|
|
|
this.getCoilInfo();
|
|
|
|
|
|
},
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
// 监听coilId变化,重新获取信息
|
|
|
|
|
|
coilId(newVal) {
|
|
|
|
|
|
if (newVal) {
|
|
|
|
|
|
this.getCoilInfo();
|
|
|
|
|
|
} else {
|
2026-03-28 14:08:27 +08:00
|
|
|
|
this.coilInfo = this.coil || {};
|
2025-12-15 11:05:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-02 15:52:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
/* 调整容器布局,让边框完整包裹标签 */
|
|
|
|
|
|
.g-coil-no {
|
|
|
|
|
|
display: inline-block; /* 让容器尺寸贴合内部el-tag */
|
|
|
|
|
|
border: 2px solid #67c23a !important;
|
|
|
|
|
|
border-radius: 4px; /* 可选:和el-tag圆角保持一致,更美观 */
|
2025-12-15 11:05:27 +08:00
|
|
|
|
padding: 1px; /* 调整内边距,避免边框和标签重叠 */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 弹窗信息样式 */
|
|
|
|
|
|
.coil-info {
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
line-height: 1.8;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.coil-info .info-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.coil-info .info-item:last-child {
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.coil-info .label {
|
|
|
|
|
|
color: #666;
|
|
|
|
|
|
width: 70px;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.coil-info .value {
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
word-break: break-all;
|
2025-12-02 15:52:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|