|
|
|
@ -38,7 +38,7 @@ |
|
|
|
|
|
|
|
<!-- 标签信息展示 --> |
|
|
|
<div class="info-container" v-if="showInfo"> |
|
|
|
<div class="info-card" v-if="transferMode === 'label'"> |
|
|
|
<div class="info-card" v-if="transferMode === 'label' && !isLabelMultiMode"> |
|
|
|
<div class="info-row"> |
|
|
|
<span class="label">标签条码</span> |
|
|
|
<span class="value">{{ labelInfo.labelCode }}</span> |
|
|
|
@ -83,10 +83,13 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- 按库位调拨时显示标签列表 --> |
|
|
|
<div class="location-labels" v-if="transferMode === 'location'"> |
|
|
|
<!-- 库位模式,或标签模式下查询到多条时显示列表 --> |
|
|
|
<div class="location-labels" v-if="isListMode"> |
|
|
|
<div class="location-info"> |
|
|
|
<span class="location-subtitle">库位:{{ scanCode }}</span> |
|
|
|
<div class="location-info-row"> |
|
|
|
<span class="location-subtitle">{{ listTitle }}</span> |
|
|
|
<span class="location-total">总数:{{ listTotalQuantity }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="labels-table"> |
|
|
|
<div class="table-header"> |
|
|
|
@ -97,16 +100,16 @@ |
|
|
|
<div class="col">标签数量</div> |
|
|
|
</div> |
|
|
|
<div class="table-body"> |
|
|
|
<div class="table-row" v-for="(item, index) in locationLabels" :key="index"> |
|
|
|
<div class="col">{{ index + 1 }}</div> |
|
|
|
<div class="table-row" v-for="(item, index) in currentDisplayLabels" :key="(item.labelCode || 'row') + '-' + index"> |
|
|
|
<div class="col">{{ currentDisplayLabels.length - index }}</div> |
|
|
|
<div class="col">{{ item.labelCode }}</div> |
|
|
|
<div class="col">{{ item.partNo }}</div> |
|
|
|
<div class="col">{{ item.unit || '-' }}</div> |
|
|
|
<div class="col">{{ item.quantity }}</div> |
|
|
|
</div> |
|
|
|
<div class="empty-state" v-if="locationLabels.length === 0"> |
|
|
|
<div class="empty-state" v-if="currentDisplayLabels.length === 0"> |
|
|
|
<i class="el-icon-info" style="font-size: 24px;"></i> |
|
|
|
<p>该库位下暂无标签</p> |
|
|
|
<p>{{ transferMode === 'location' ? '该库位下暂无标签' : '该标签下暂无可调拨标签' }}</p> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
@ -180,10 +183,51 @@ export default { |
|
|
|
batchNo: '' |
|
|
|
}, |
|
|
|
|
|
|
|
// 标签模式下,父标签查询命中的多条子标签 |
|
|
|
labelMultiLabels: [], |
|
|
|
|
|
|
|
// 库位下的标签列表 |
|
|
|
locationLabels: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
isLabelMultiMode() { |
|
|
|
return this.transferMode === 'label' && this.labelMultiLabels.length > 1 |
|
|
|
}, |
|
|
|
isListMode() { |
|
|
|
return this.transferMode === 'location' || this.isLabelMultiMode |
|
|
|
}, |
|
|
|
currentDisplayLabels() { |
|
|
|
return this.transferMode === 'location' ? this.locationLabels : this.labelMultiLabels |
|
|
|
}, |
|
|
|
listTitle() { |
|
|
|
const scanText = this.scanCode.trim() |
|
|
|
return this.transferMode === 'location' ? `库位:${scanText}` : `标签:${scanText}` |
|
|
|
}, |
|
|
|
listTotalQuantity() { |
|
|
|
const total = this.currentDisplayLabels.reduce((sum, item) => { |
|
|
|
const qty = Number(item.quantity) |
|
|
|
return sum + (Number.isNaN(qty) ? 0 : qty) |
|
|
|
}, 0) |
|
|
|
|
|
|
|
if (Number.isInteger(total)) { |
|
|
|
return total |
|
|
|
} |
|
|
|
|
|
|
|
return Number(total.toFixed(6)).toString() |
|
|
|
}, |
|
|
|
labelSourceLocation() { |
|
|
|
if (this.labelInfo.locationId) { |
|
|
|
return this.labelInfo.locationId |
|
|
|
} |
|
|
|
|
|
|
|
const uniqueLocations = [...new Set(this.labelMultiLabels.map(item => item.locationId).filter(Boolean))] |
|
|
|
return uniqueLocations.length === 1 ? uniqueLocations[0] : '' |
|
|
|
}, |
|
|
|
labelBuNo() { |
|
|
|
return this.labelInfo.buNo || (this.labelMultiLabels[0] && this.labelMultiLabels[0].buNo) || '' |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
// 聚焦扫描框 |
|
|
|
this.$nextTick(() => { |
|
|
|
@ -264,9 +308,19 @@ export default { |
|
|
|
const { data } = await getCrossAreaTransferInfo(params) |
|
|
|
if (data && data.code === 0) { |
|
|
|
if (this.transferMode === 'label') { |
|
|
|
this.labelInfo = data.data || {} |
|
|
|
console.log('标签信息:', this.labelInfo) |
|
|
|
this.locationLabels = [] |
|
|
|
const labelData = data.data || [] |
|
|
|
if (Array.isArray(labelData)) { |
|
|
|
this.labelMultiLabels = labelData |
|
|
|
this.labelInfo = labelData[0] || {} |
|
|
|
console.log('标签列表:', this.labelMultiLabels) |
|
|
|
} else { |
|
|
|
this.labelInfo = labelData |
|
|
|
this.labelMultiLabels = [] |
|
|
|
console.log('标签信息:', this.labelInfo) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.labelMultiLabels = [] |
|
|
|
this.locationLabels = data.data || [] |
|
|
|
console.log('库位标签列表:', this.locationLabels) |
|
|
|
} |
|
|
|
@ -301,7 +355,7 @@ export default { |
|
|
|
return |
|
|
|
} |
|
|
|
// 检查目标库位是否与源库位相同 |
|
|
|
if (this.transferMode === 'label' && targetLocation === this.labelInfo.locationId) { |
|
|
|
if (this.transferMode === 'label' && this.labelSourceLocation && targetLocation === this.labelSourceLocation) { |
|
|
|
this.$message.warning('目标库位不能与当前库位相同') |
|
|
|
if (this.$refs.locationInput) { |
|
|
|
this.$refs.locationInput.focus(); |
|
|
|
@ -322,15 +376,22 @@ export default { |
|
|
|
this.$message.error('缺少必要参数,请重新登录') |
|
|
|
return |
|
|
|
} |
|
|
|
const buNo = this.transferMode === 'label' |
|
|
|
? this.labelBuNo |
|
|
|
: ((this.locationLabels[0] && this.locationLabels[0].buNo) || '') |
|
|
|
if (!buNo) { |
|
|
|
this.$message.error('未获取到BU信息,请重新扫描') |
|
|
|
return |
|
|
|
} |
|
|
|
try { |
|
|
|
this.loading = true |
|
|
|
const params = { |
|
|
|
scanCode: this.scanCode.trim(), |
|
|
|
transferMode: this.transferMode, |
|
|
|
sourceLocation: this.transferMode === 'label' ? this.scanCode.trim() : this.labelInfo.locationId, |
|
|
|
sourceLocation: this.scanCode.trim(), |
|
|
|
targetLocation: targetLocation, |
|
|
|
site: site, |
|
|
|
buNo: this.transferMode === 'label' ? this.labelInfo.buNo : this.locationLabels[0].buNo, |
|
|
|
buNo: buNo, |
|
|
|
warehouseId: warehouseId, |
|
|
|
operator: operator |
|
|
|
} |
|
|
|
@ -368,6 +429,7 @@ export default { |
|
|
|
orderRef2: '', |
|
|
|
batchNo: '' |
|
|
|
} |
|
|
|
this.labelMultiLabels = [] |
|
|
|
this.locationLabels = [] |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
@ -517,8 +579,12 @@ export default { |
|
|
|
/* 信息展示 */ |
|
|
|
.info-container { |
|
|
|
flex: 1; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
padding: 0 16px; |
|
|
|
margin-bottom: 10px; |
|
|
|
min-height: 0; |
|
|
|
overflow: hidden; |
|
|
|
} |
|
|
|
|
|
|
|
.info-card { |
|
|
|
@ -567,18 +633,25 @@ export default { |
|
|
|
border-radius: 8px; |
|
|
|
overflow: hidden; |
|
|
|
flex: 1; |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
max-height: 410px; |
|
|
|
min-height: 0; |
|
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); |
|
|
|
border: 1px solid #f0f0f0; |
|
|
|
} |
|
|
|
|
|
|
|
.location-info { |
|
|
|
padding: 6px 8px; |
|
|
|
padding: 8px 10px; |
|
|
|
background: #f8f9fa; |
|
|
|
border-bottom: 2px solid #17B3A3; |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
|
|
|
|
.location-info-row { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: space-between; |
|
|
|
gap: 12px; |
|
|
|
} |
|
|
|
|
|
|
|
.location-title { |
|
|
|
@ -590,21 +663,32 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
.location-subtitle { |
|
|
|
display: block; |
|
|
|
color: #666; |
|
|
|
font-size: 12px; |
|
|
|
font-weight: 500; |
|
|
|
} |
|
|
|
|
|
|
|
.location-total { |
|
|
|
color: #17B3A3; |
|
|
|
font-size: 12px; |
|
|
|
font-weight: 600; |
|
|
|
} |
|
|
|
|
|
|
|
.labels-table { |
|
|
|
flex: 1; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
min-height: 0; |
|
|
|
} |
|
|
|
|
|
|
|
.table-body { |
|
|
|
flex: 1; |
|
|
|
overflow-y: auto; |
|
|
|
max-height: 360px; |
|
|
|
min-height: 0; |
|
|
|
padding-bottom: 8px; |
|
|
|
box-sizing: border-box; |
|
|
|
-webkit-overflow-scrolling: touch; |
|
|
|
touch-action: pan-y; |
|
|
|
} |
|
|
|
|
|
|
|
.table-body::-webkit-scrollbar { |
|
|
|
|