From 1a2e9c7cbab7096222b0b75ada21590877db2cf0 Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期五, 27 三月 2026 14:34:56 +0800
Subject: [PATCH] 修复出库详情的状态显示异常
---
项目代码/WMS/WMSClient/src/views/Home.vue | 139 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 106 insertions(+), 33 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue"
index daeffe0..a863757 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue"
@@ -65,10 +65,15 @@
<div class="roadway-section">
<h2 class="roadway-title">{{ Area.roadwayNo }} 绗�1宸烽亾绗�1鎺�(涓滈潰:鍖�>鍗�)</h2>
<div class="row" v-for="(item, index) in locationData.row1" :key="'row1-' + index">
- <div class="location-cell" :style="{ 'background-color': GetBgColor(column) }"
- v-for="(column, colIndex) in item.locationObj" :key="'row1-' + item.layer + '-' + colIndex"
- @mouseenter="showTooltip(column, $event)" @mouseleave="hideTooltip">
- {{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}
+ <div
+ class="location-cell"
+ :class="{ 'empty-cell': column.location_lock === -1 }"
+ :style="{ 'background-color': column.location_lock === -1 ? 'transparent' : GetBgColor(column) }"
+ v-for="(column, colIndex) in item.locationObj"
+ :key="'row1-' + item.layer + '-' + colIndex"
+ @mouseenter="column.location_lock !== -1 && showTooltip(column, $event)"
+ @mouseleave="hideTooltip">
+ <span v-if="column.location_lock !== -1">{{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}</span>
</div>
</div>
</div>
@@ -77,10 +82,15 @@
<div class="roadway-section">
<h2 class="roadway-title">{{ Area.roadwayNo }} 绗�1宸烽亾绗�2鎺�(瑗块潰:鍖�>鍗�)</h2>
<div class="row" v-for="(item, index) in locationData.row2" :key="'row2-' + index">
- <div class="location-cell" :style="{ 'background-color': GetBgColor(column) }"
- v-for="(column, colIndex) in item.locationObj" :key="'row2-' + item.layer + '-' + colIndex"
- @mouseenter="showTooltip(column, $event)" @mouseleave="hideTooltip">
- {{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}
+ <div
+ class="location-cell"
+ :class="{ 'empty-cell': column.location_lock === -1 }"
+ :style="{ 'background-color': column.location_lock === -1 ? 'transparent' : GetBgColor(column) }"
+ v-for="(column, colIndex) in item.locationObj"
+ :key="'row2-' + item.layer + '-' + colIndex"
+ @mouseenter="column.location_lock !== -1 && showTooltip(column, $event)"
+ @mouseleave="hideTooltip">
+ <span v-if="column.location_lock !== -1">{{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}</span>
</div>
</div>
</div>
@@ -97,7 +107,7 @@
<!-- 鍘熸枡搴撴樉绀哄唴瀹� -->
<div v-if="Area.warehouse === '鍘熸枡搴�'">
<p><strong>绾稿嵎:</strong><span>{{ currentLocation.paperRoll || "鏃�" }}</span></p>
- <p><strong>闂ㄥ箙:</strong><span>{{ currentLocation.width ? currentLocation.width + "m" : "鏃�" }}</span></p>
+ <p><strong>闂ㄥ箙:</strong><span>{{ currentLocation.width ? currentLocation.width : "鏃�" }}</span></p>
<p><strong>鏉$爜:</strong><span>{{ currentLocation.barcode || "鏃�" }}</span></p>
<p><strong>RFID:</strong><span>{{ currentLocation.rfid || "鏃�" }}</span></p>
</div>
@@ -317,37 +327,71 @@
if (x.data) {
this.locationData = x.data;
- // 瀵圭1鎺掓暟鎹繘琛屾帓搴�
- if (this.locationData.row1) {
+ // 纭繚璐т綅鎸夊垪鍙锋帓搴忓苟璁$畻鏈�澶у垪鏁帮紝鐢ㄤ簬瀵归綈
+ const ensureColumnsAlignment = (rowData) => {
+ if (!rowData || rowData.length === 0) return;
+
// 鎸夊眰鍙蜂粠楂樺埌浣庢帓搴�
- this.locationData.row1.sort((a, b) => parseInt(b.layer) - parseInt(a.layer));
-
- // 瀵规瘡灞傚唴鐨勮揣浣嶆寜鍒楀彿浠庡寳鍒板崡鎺掑簭锛�01-64锛�
- this.locationData.row1.forEach(layer => {
+ rowData.sort((a, b) => parseInt(b.layer) - parseInt(a.layer));
+
+ // 纭畾鏈�澶у垪鏁帮紙鍋囪鏄�64鍒楋紝浠�01-64锛�
+ const maxColumns = 64;
+
+ // 澶勭悊姣忓眰鏁版嵁
+ rowData.forEach(layer => {
+ // 瀵规瘡灞傚唴鐨勮揣浣嶆寜鍒楀彿浠庡寳鍒板崡鎺掑簭锛�01-64锛�
layer.locationObj.sort((a, b) => {
// 纭繚鍒楀彿鎸夋暟瀛楅『搴忔帓鍒�
const colA = parseInt(a.column);
const colB = parseInt(b.column);
return colA - colB;
});
- });
- }
-
- // 瀵圭2鎺掓暟鎹繘琛屽悓鏍风殑鎺掑簭
- if (this.locationData.row2) {
- // 鎸夊眰鍙蜂粠楂樺埌浣庢帓搴�
- this.locationData.row2.sort((a, b) => parseInt(b.layer) - parseInt(a.layer));
-
- // 瀵规瘡灞傚唴鐨勮揣浣嶆寜鍒楀彿浠庡寳鍒板崡鎺掑簭锛�01-64锛�
- this.locationData.row2.forEach(layer => {
- layer.locationObj.sort((a, b) => {
- // 纭繚鍒楀彿鎸夋暟瀛楅『搴忔帓鍒�
- const colA = parseInt(a.column);
- const colB = parseInt(b.column);
- return colA - colB;
+
+ // 鍒涘缓瀹屾暣鐨勫垪鏁扮粍
+ const completeColumns = [];
+
+ // 褰撳墠宸叉湁鐨勮揣浣嶏紝鎸夊垪鍙锋槧灏�
+ const existingLocations = {};
+ layer.locationObj.forEach(loc => {
+ existingLocations[parseInt(loc.column)] = loc;
});
+
+ // 閬嶅巻鎵�鏈夊彲鑳界殑鍒楀彿锛�1-64锛�
+ for (let col = 1; col <= maxColumns; col++) {
+ if (existingLocations[col]) {
+ // 濡傛灉璇ュ垪鏈夎揣浣嶆暟鎹紝鐩存帴浣跨敤
+ completeColumns.push(existingLocations[col]);
+ } else {
+ // 濡傛灉璇ュ垪娌℃湁璐т綅鏁版嵁锛屾坊鍔犵┖鍗犱綅绗�
+ completeColumns.push({
+ locationCode: `empty-${layer.row}-${String(col).padStart(2, '0')}-${layer.layer}`,
+ row: layer.row,
+ column: String(col).padStart(2, '0'),
+ layer: layer.layer,
+ location_lock: -1, // 鐗规畩鏍囪锛岀敤浜庤〃绀虹┖鍗犱綅绗�
+ paperRoll: '',
+ productName: '',
+ width: 0,
+ quantity: 0,
+ barcode: '',
+ rfid: '',
+ rfidCode: '',
+ inDate: null,
+ warehouseId: layer.warehouseId || 0
+ });
+ }
+ }
+
+ // 鏇存柊璇ュ眰鐨勮揣浣嶆暟鎹负瀹屾暣鍒�
+ layer.locationObj = completeColumns;
});
- }
+ };
+
+ // 澶勭悊绗�1鎺掓暟鎹�
+ ensureColumnsAlignment(this.locationData.row1);
+
+ // 澶勭悊绗�2鎺掓暟鎹�
+ ensureColumnsAlignment(this.locationData.row2);
}
// 鎻愬彇鎵�鏈夎揣浣嶇紪鍙�
@@ -667,12 +711,13 @@
margin-bottom: 8px;
cursor: pointer;
flex-wrap: nowrap;
+ width: 100%;
+ min-width: max-content;
}
.location-cell {
- width: 120px;
+ flex: 0 0 120px;
height: 50px;
- margin: 5px;
text-align: center;
font-size: 16px;
border-radius: 4px;
@@ -680,6 +725,34 @@
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
border: 1px solid #ccc;
background-color: #f9f9f9;
+ margin: 0 5px;
+}
+
+/* 绌哄崰浣嶇鏍峰紡 */
+.location-cell.empty-cell {
+ background-color: transparent;
+ border: none;
+ box-shadow: none;
+ cursor: default;
+}
+
+/* 娣诲姞璐т綅缃戞牸瀹瑰櫒鏍峰紡锛岀‘淇濇墍鏈夎瀵归綈 */
+.roadway-section {
+ overflow-x: auto;
+ overflow-y: hidden;
+}
+
+.location-cell {
+ width: 120px;
+ height: 50px;
+ text-align: center;
+ font-size: 16px;
+ border-radius: 4px;
+ line-height: 50px;
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
+ border: 1px solid #ccc;
+ background-color: #f9f9f9;
+ margin: 0;
}
/* 宸烽亾鍖哄煙鏍峰紡 */
--
Gitblit v1.9.3