diff --git a/pages/work/storage/receiving/receivingDetail.vue b/pages/work/storage/receiving/receivingDetail.vue index c3ec986..5a75ea6 100644 --- a/pages/work/storage/receiving/receivingDetail.vue +++ b/pages/work/storage/receiving/receivingDetail.vue @@ -974,7 +974,7 @@ if(spaceInfo.code==200){ if (spaceInfo.total == 1 && this.selectedDetail.space_id!=spaceInfo.data[0].id) { const matchedSpace = spaceInfo.data[0] || {}; - const spaceLabel = matchedSpace.space_code || matchedSpace.custom_name || matchedSpace.custom_barcode || String(data || '').trim(); + const spaceLabel = matchedSpace.custom_name || matchedSpace.name || matchedSpace.space_name || matchedSpace.space_code || matchedSpace.custom_barcode || String(data || '').trim(); const updateData = { ...this.selectedDetail, // 保留原有的所有属性 space_id: spaceInfo.data[0].id diff --git a/pages/work/storage/relocation.vue b/pages/work/storage/relocation.vue index 2a1f953..e34aea0 100644 --- a/pages/work/storage/relocation.vue +++ b/pages/work/storage/relocation.vue @@ -122,7 +122,7 @@ @@ -398,14 +398,15 @@ applySpaceSelection(field, item) { const isSource = field === 'sourceSpace'; this.formData[isSource ? 'sourceSpaceId' : 'targetSpaceId'] = item?.id || item?.space_id || null; - this.formData[isSource ? 'sourceSpaceName' : 'targetSpaceName'] = this.getSpaceName(item); - this.formData[isSource ? 'sourceSpaceKeyword' : 'targetSpaceKeyword'] = this.getSpaceCode(item); + const spaceName = this.getSpaceName(item); + this.formData[isSource ? 'sourceSpaceName' : 'targetSpaceName'] = spaceName; + this.formData[isSource ? 'sourceSpaceKeyword' : 'targetSpaceKeyword'] = spaceName; if (isSource) { return; } - const targetInputText = String(this.formData.targetSpaceKeyword || this.formData.targetSpaceName || '').trim(); - this.speakMessage(`已识别移入库位,${targetInputText || this.getSpaceName(item)}`); + const targetNameText = String(this.formData.targetSpaceName || this.formData.targetSpaceKeyword || '').trim(); + this.speakMessage(`已识别移入库位,${targetNameText || spaceName}`); }, async searchStock(keyword) { const rawKeyword = String(keyword || '').trim(); @@ -476,7 +477,7 @@ if (prefillData.sourceSpace && typeof prefillData.sourceSpace === 'object') { this.formData.sourceSpaceId = prefillData.sourceSpace.id || null; this.formData.sourceSpaceName = prefillData.sourceSpace.name || ''; - this.formData.sourceSpaceKeyword = prefillData.sourceSpace.code || prefillData.sourceSpace.name || ''; + this.formData.sourceSpaceKeyword = prefillData.sourceSpace.name || prefillData.sourceSpace.code || ''; if (this.selectedStock && typeof this.selectedStock === 'object') { if (!this.selectedStock.space_name && prefillData.sourceSpace.name) { this.selectedStock.space_name = prefillData.sourceSpace.name; @@ -501,7 +502,7 @@ this.selectorVisible = false; }, getSpaceName(item) { - return item?.name || item?.space_name || item?.title || item?.barcode || item?.code || '未命名库位'; + return item?.custom_name || item?.name || item?.space_name || item?.title || item?.space_code || item?.barcode || item?.code || '未命名库位'; }, getSpaceCode(item) { return item?.barcode || item?.code || item?.space_code || item?.name || '';