From b6a40a2d8fdcffb3accfc7e424c0726a87a59ddf Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期五, 05 十二月 2025 21:20:59 +0800
Subject: [PATCH] 提交
---
项目代码/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue | 609 +++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 564 insertions(+), 45 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
index 1b7dafd..48d960a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
@@ -586,62 +586,430 @@
},
openSplitDialog() {
- console.log('寮�濮嬫墦寮�鎷嗗寘寮圭獥');
-
- if (this.isOpeningDialog) {
- console.log('姝e湪鎵撳紑寮圭獥锛岃烦杩�');
- return;
- }
+ console.log('绱ф�ヤ慨澶嶇増锛氭墦寮�鎷嗗寘寮圭獥');
if (!this.scanData.palletCode) {
this.$message.warning('璇峰厛鎵弿鎵樼洏鐮�');
return;
}
- this.isOpeningDialog = true;
+ // 1. 鍏抽棴鎵�鏈塚ue寮圭獥
+ this.closeAllDialogs();
+
+ // 2. 寮哄埗浠嶥OM涓Щ闄ゆ墍鏈夊脊绐�
+ setTimeout(() => {
+ const dialogs = document.querySelectorAll('.custom-dialog-overlay');
+ dialogs.forEach(dialog => {
+ if (dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+ });
+
+ // 濡傛灉宸茬粡瀛樺湪鎵嬪姩寮圭獥锛屽厛绉婚櫎
+ if (this.manualDialog && this.manualDialog.parentNode) {
+ this.manualDialog.parentNode.removeChild(this.manualDialog);
+ }
+
+ // 3. 绛夊緟涓�甯�
+ requestAnimationFrame(() => {
+ // 4. 鐩存帴鍒涘缓鏂板脊绐楋紝涓嶄緷璧朧ue鐨勫搷搴斿紡绯荤粺
+ this.createManualSplitDialog();
+ });
+ }, 10);
+ },
+
+ // 鍒涘缓鎵嬪姩鎷嗗寘寮圭獥
+ createManualSplitDialog() {
+ const newDialog = document.createElement('div');
+ newDialog.className = 'custom-dialog-overlay emergency-fix';
+
+ // 鐢熸垚闅忔満ID鐢ㄤ簬浜嬩欢缁戝畾
+ const dialogId = 'manual-dialog-' + Date.now();
+ newDialog.id = dialogId;
+
+ // 瀛樺偍寮曠敤
+ this.manualDialog = newDialog;
+
+ // 寮圭獥鍐呭
+ newDialog.innerHTML = `
+ <div class="custom-dialog-wrapper">
+ <div class="custom-dialog" style="width: 500px;">
+ <div class="custom-dialog-header">
+ <h3 style="margin: 0; color: #303133;">鎷嗗寘鎿嶄綔</h3>
+ <button class="close-button" onclick="document.getElementById('${dialogId}').remove()" style="
+ font-size: 18px;
+ color: #909399;
+ padding: 0;
+ width: 24px;
+ height: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background: none;
+ border: none;
+ cursor: pointer;
+ ">脳</button>
+ </div>
+ <div class="custom-dialog-body" style="padding: 20px;">
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">璁㈠崟缂栧彿:</span>
+ <input type="text" value="${this.scanData.orderNo}" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鎵樼洏缂栧彿:</span>
+ <input type="text" value="${this.scanData.palletCode}" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鍘熸潯鐮�:</span>
+ <div style="flex: 1; display: flex; align-items: center; gap: 10px;">
+ <input type="text" id="${dialogId}-barcode" placeholder="鎵弿鍘熸潯鐮�" style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ ">
+ <button id="${dialogId}-viewChain" style="
+ padding: 8px 16px;
+ background: #409eff;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ white-space: nowrap;
+ ">鏌ョ湅鎷嗗寘閾�</button>
+ </div>
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鐗╂枡缂栫爜:</span>
+ <input type="text" id="${dialogId}-materiel" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鍓╀綑鏁伴噺:</span>
+ <input type="text" id="${dialogId}-remain" disabled style="
+ flex: 1;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ background-color: #f5f7fa;
+ color: #909399;
+ ">
+ </div>
+ </div>
+
+ <div style="margin-bottom: 15px;">
+ <div style="display: flex; align-items: center; margin-bottom: 5px;">
+ <span style="width: 100px; text-align: right; padding-right: 12px; color: #606266;">鎷嗗寘鏁伴噺:</span>
+ <div style="flex: 1;">
+ <input type="number" id="${dialogId}-splitQty" value="1" min="0.01" step="0.01" style="
+ width: 100%;
+ padding: 8px 12px;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ ">
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div class="custom-dialog-footer" style="
+ padding: 10px 20px 20px;
+ text-align: right;
+ border-top: 1px solid #ebeef5;
+ ">
+ <button id="${dialogId}-cancel" style="
+ padding: 9px 15px;
+ background: white;
+ color: #606266;
+ border: 1px solid #dcdfe6;
+ border-radius: 4px;
+ cursor: pointer;
+ margin-right: 10px;
+ ">鍙栨秷</button>
+ <button id="${dialogId}-confirm" style="
+ padding: 9px 15px;
+ background: #409eff;
+ color: white;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ ">纭鎷嗗寘</button>
+ </div>
+ </div>
+ </div>
+ `;
+
+ // 娣诲姞鏍峰紡
+ newDialog.style.cssText = `
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0,0,0,0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 999999;
+ `;
+
+ // 寮圭獥瀹瑰櫒鏍峰紡
+ const wrapper = newDialog.querySelector('.custom-dialog-wrapper');
+ if (wrapper) {
+ wrapper.style.position = 'relative';
+ wrapper.style.zIndex = '1000000';
+ }
+
+ // 寮圭獥鍐呭鏍峰紡
+ const dialog = newDialog.querySelector('.custom-dialog');
+ if (dialog) {
+ dialog.style.background = 'white';
+ dialog.style.borderRadius = '4px';
+ dialog.style.maxWidth = '90vw';
+ dialog.style.maxHeight = '90vh';
+ dialog.style.boxShadow = '0 2px 12px 0 rgba(0, 0, 0, 0.1)';
+ dialog.style.overflow = 'auto';
+ }
+
+ // 寮圭獥澶撮儴鏍峰紡
+ const header = newDialog.querySelector('.custom-dialog-header');
+ if (header) {
+ header.style.display = 'flex';
+ header.style.justifyContent = 'space-between';
+ header.style.alignItems = 'center';
+ header.style.padding = '20px 20px 10px';
+ header.style.borderBottom = '1px solid #ebeef5';
+ }
+
+ document.body.appendChild(newDialog);
+ console.log('绱ф�ュ脊绐楀凡鍒涘缓');
+
+ // 缁戝畾浜嬩欢
+ this.bindManualDialogEvents(dialogId);
+
+ // 鑷姩鑱氱劍鍒版潯鐮佽緭鍏ユ
+ setTimeout(() => {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (barcodeInput) {
+ barcodeInput.focus();
+ // 娣诲姞鍥炶溅閿洃鍚�
+ barcodeInput.addEventListener('keyup', (event) => {
+ if (event.key === 'Enter') {
+ this.onManualSplitBarcodeScan(dialogId);
+ }
+ });
+ }
+ }, 100);
+ },
+
+ // 缁戝畾鎵嬪姩寮圭獥浜嬩欢
+ bindManualDialogEvents(dialogId) {
+ const vm = this; // 淇濆瓨Vue瀹炰緥寮曠敤
+
+ // 鏌ョ湅鎷嗗寘閾炬寜閽�
+ const viewChainBtn = document.getElementById(`${dialogId}-viewChain`);
+ if (viewChainBtn) {
+ viewChainBtn.onclick = () => {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (barcodeInput && barcodeInput.value.trim()) {
+ vm.viewSplitChainFromManualDialog(barcodeInput.value.trim(), dialogId);
+ } else {
+ ElMessage.warning('璇峰厛杈撳叆鏉$爜');
+ }
+ };
+ }
+
+ // 鍙栨秷鎸夐挳
+ const cancelBtn = document.getElementById(`${dialogId}-cancel`);
+ if (cancelBtn) {
+ cancelBtn.onclick = () => {
+ const dialog = document.getElementById(dialogId);
+ if (dialog && dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+ };
+ }
+
+ // 纭鎷嗗寘鎸夐挳
+ const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+ if (confirmBtn) {
+ confirmBtn.onclick = () => {
+ vm.handleManualSplitPackage(dialogId);
+ };
+ }
+
+ // 鏉$爜杈撳叆妗嗗彉鍖栦簨浠�
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (barcodeInput) {
+ // 闃叉姈澶勭悊
+ let timeout;
+ barcodeInput.addEventListener('input', () => {
+ clearTimeout(timeout);
+ timeout = setTimeout(() => {
+ if (barcodeInput.value.trim()) {
+ vm.onManualSplitBarcodeScan(dialogId);
+ }
+ }, 500);
+ });
+ }
+ },
+
+ // 鎵嬪姩寮圭獥鐨勬潯鐮佹壂鎻忓鐞�
+ async onManualSplitBarcodeScan(dialogId) {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ if (!barcodeInput || !barcodeInput.value.trim()) return;
+
+ const barcode = barcodeInput.value.trim();
try {
- // 鏂规硶1: 浣跨敤 setTimeout 纭繚寮傛鎵ц
- setTimeout(() => {
- console.log('鎵ц寮圭獥鎵撳紑閫昏緫');
+ const res = await http.post('/api/OutboundBatchPicking/split-package-info', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ barcode: barcode
+ });
+
+ if (res.status) {
+ // 鏇存柊鐗╂枡缂栫爜
+ const materielInput = document.getElementById(`${dialogId}-materiel`);
+ if (materielInput) {
+ materielInput.value = res.data.materielCode || '';
+ }
- // 鍏堝叧闂墍鏈夊脊绐�
- this.closeAllDialogsImmediately();
+ // 鏇存柊鍓╀綑鏁伴噺
+ const remainInput = document.getElementById(`${dialogId}-remain`);
+ if (remainInput) {
+ remainInput.value = res.data.remainQuantity || 0;
+ }
- // 浣跨敤 requestAnimationFrame 纭繚鍦ㄤ笅涓�甯ф墦寮�
- requestAnimationFrame(() => {
- console.log('璁剧疆寮圭獥鐘舵�佷负 true');
-
- // 閲嶇疆琛ㄥ崟
- this.resetSplitForm();
- this.splitForm.orderNo = this.scanData.orderNo;
- this.splitForm.palletCode = this.scanData.palletCode;
-
- // 鍏抽敭锛氱洿鎺ヨ缃脊绐楃姸鎬�
- this.showCustomSplitDialog = true;
-
- console.log('寮圭獥鐘舵�佸凡璁剧疆锛岀瓑寰匘OM鏇存柊');
-
- // 浣跨敤 nextTick 纭繚DOM鏇存柊瀹屾垚
- this.$nextTick(() => {
- console.log('DOM鏇存柊瀹屾垚锛屽脊绐楀簲璇ユ樉绀轰簡');
- this.isOpeningDialog = false;
-
- // 灏濊瘯鑱氱劍鍒拌緭鍏ユ
- setTimeout(() => {
- const input = this.$refs.splitFormRef?.$el?.querySelector('input');
- if (input) {
- input.focus();
- console.log('杈撳叆妗嗗凡鑱氱劍');
- }
- }, 100);
- });
- });
- }, 0);
-
+ // 鏇存柊鎷嗗寘鏁伴噺锛堥粯璁や负1锛屼笉瓒呰繃鍓╀綑鏁伴噺锛�
+ const splitQtyInput = document.getElementById(`${dialogId}-splitQty`);
+ if (splitQtyInput) {
+ const maxQty = res.data.remainQuantity || 0;
+ splitQtyInput.max = maxQty;
+ const currentVal = parseFloat(splitQtyInput.value) || 1;
+ if (currentVal > maxQty) {
+ splitQtyInput.value = Math.min(1, maxQty);
+ }
+ }
+ } else {
+ ElMessage.error(res.message || '鑾峰彇鎷嗗寘淇℃伅澶辫触');
+ }
} catch (error) {
- console.error('鎵撳紑鎷嗗寘寮圭獥鍑洪敊:', error);
- this.isOpeningDialog = false;
+ console.error('鑾峰彇鎷嗗寘淇℃伅澶辫触:', error);
+ ElMessage.error('鑾峰彇鎷嗗寘淇℃伅澶辫触');
+ }
+ },
+
+ // 浠庢墜鍔ㄥ脊绐楁煡鐪嬫媶鍖呴摼
+ viewSplitChainFromManualDialog(barcode, dialogId) {
+ // 鍏堝叧闂墜鍔ㄥ脊绐�
+ const dialog = document.getElementById(dialogId);
+ if (dialog && dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+
+ // 寤惰繜涓�涓嬶紝鐒跺悗鎵撳紑Vue鐨勬媶鍖呴摼寮圭獥
+ setTimeout(() => {
+ this.viewSplitChain(barcode);
+ }, 50);
+ },
+
+ // 澶勭悊鎵嬪姩寮圭獥鐨勬媶鍖呮搷浣�
+ async handleManualSplitPackage(dialogId) {
+ const barcodeInput = document.getElementById(`${dialogId}-barcode`);
+ const splitQtyInput = document.getElementById(`${dialogId}-splitQty`);
+
+ if (!barcodeInput || !barcodeInput.value.trim()) {
+ ElMessage.warning('璇疯緭鍏ュ師鏉$爜');
+ return;
+ }
+
+ if (!splitQtyInput || !splitQtyInput.value || parseFloat(splitQtyInput.value) <= 0) {
+ ElMessage.warning('璇疯緭鍏ユ湁鏁堢殑鎷嗗寘鏁伴噺');
+ return;
+ }
+
+ const originalBarcode = barcodeInput.value.trim();
+ const splitQuantity = parseFloat(splitQtyInput.value);
+
+ try {
+ // 鏄剧ず鍔犺浇鐘舵��
+ const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+ if (confirmBtn) {
+ confirmBtn.disabled = true;
+ confirmBtn.textContent = '澶勭悊涓�...';
+ }
+
+ const res = await http.post('/api/OutboundBatchPicking/split-package', {
+ orderNo: this.scanData.orderNo,
+ palletCode: this.scanData.palletCode,
+ originalBarcode: originalBarcode,
+ splitQuantity: splitQuantity
+ });
+
+ if (res.status) {
+ ElMessage.success('鎷嗗寘鎴愬姛');
+
+ // 鍏抽棴鎵嬪姩寮圭獥
+ const dialog = document.getElementById(dialogId);
+ if (dialog && dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+
+ // 閲嶆柊鍔犺浇鏁版嵁
+ await this.loadPalletData();
+ } else {
+ ElMessage.error(res.message || '鎷嗗寘澶辫触');
+
+ // 鎭㈠鎸夐挳鐘舵��
+ if (confirmBtn) {
+ confirmBtn.disabled = false;
+ confirmBtn.textContent = '纭鎷嗗寘';
+ }
+ }
+ } catch (error) {
+ console.error('鎷嗗寘澶辫触:', error);
+ ElMessage.error('鎷嗗寘澶辫触');
+
+ // 鎭㈠鎸夐挳鐘舵��
+ const confirmBtn = document.getElementById(`${dialogId}-confirm`);
+ if (confirmBtn) {
+ confirmBtn.disabled = false;
+ confirmBtn.textContent = '纭鎷嗗寘';
+ }
}
},
closeAllDialogsImmediately() {
@@ -910,11 +1278,26 @@
closeAllDialogs() {
this.activeDialog = null;
// 纭繚鎵�鏈夊脊绐楃姸鎬侀兘琚噸缃�
+// 鍏抽棴Vue寮圭獥
this.showCustomSplitDialog = false;
this.showRevertSplitDialog = false;
this.showBatchReturnDialog = false;
this.showEmptyPalletDialog = false;
this.showSplitChainDialog = false;
+
+ // 鍏抽棴鎵嬪姩寮圭獥
+ if (this.manualDialog && this.manualDialog.parentNode) {
+ this.manualDialog.parentNode.removeChild(this.manualDialog);
+ this.manualDialog = null;
+ }
+
+ // 绉婚櫎鎵�鏈夌揣鎬ュ脊绐�
+ const emergencyDialogs = document.querySelectorAll('.emergency-fix');
+ emergencyDialogs.forEach(dialog => {
+ if (dialog.parentNode) {
+ dialog.parentNode.removeChild(dialog);
+ }
+ });
},
// 鍥炲簱鐩稿叧鏂规硶
@@ -1318,4 +1701,140 @@
width: 100%;
}
}
+
+/* 鍘熸湁鐨勬牱寮忎繚鎸佷笉鍙� */
+.OutboundPicking-container {
+ padding: 20px;
+}
+
+.scanner-form {
+ display: flex;
+ gap: 10px;
+ align-items: center;
+ flex-wrap: wrap;
+}
+
+.scanner-form .el-input {
+ width: 200px;
+}
+
+.summary-info {
+ display: flex;
+ gap: 20px;
+ flex-wrap: wrap;
+}
+
+.table-actions {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 10px;
+ padding: 0 10px;
+}
+
+.selection-count {
+ font-size: 12px;
+ color: #909399;
+}
+
+/* 鍘熸湁鐨勮嚜瀹氫箟寮圭獥鏍峰紡 */
+.custom-dialog-overlay {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background-color: rgba(0, 0, 0, 0.5);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 2000;
+}
+
+.custom-dialog-wrapper {
+ position: relative;
+ z-index: 2001;
+}
+
+.custom-dialog {
+ background: white;
+ border-radius: 4px;
+ width: 500px;
+ max-width: 90vw;
+ max-height: 90vh;
+ box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
+ overflow: auto;
+}
+
+.custom-dialog-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 20px 20px 10px;
+ border-bottom: 1px solid #ebeef5;
+}
+
+.custom-dialog-header h3 {
+ margin: 0;
+ color: #303133;
+}
+
+.close-button {
+ font-size: 18px;
+ color: #909399;
+ padding: 0;
+ width: 24px;
+ height: 24px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+
+.close-button:hover {
+ color: #409EFF;
+ background-color: transparent;
+}
+
+.custom-dialog-body {
+ padding: 20px;
+}
+
+.custom-dialog-footer {
+ padding: 10px 20px 20px;
+ text-align: right;
+ border-top: 1px solid #ebeef5;
+}
+
+.custom-dialog-footer .el-button {
+ margin-left: 10px;
+}
+
+@media (max-width: 768px) {
+ .custom-dialog {
+ width: 95vw;
+ margin: 10px;
+ }
+
+ .scanner-form {
+ flex-direction: column;
+ align-items: stretch;
+ }
+
+ .scanner-form .el-input {
+ width: 100%;
+ }
+}
+
+/* 鏂板锛氭墜鍔ㄥ脊绐楃殑鎸夐挳鎮仠鏁堟灉 */
+:deep(button) {
+ transition: all 0.3s;
+}
+
+:deep(button:hover) {
+ opacity: 0.8;
+}
+
+:deep(button:active) {
+ opacity: 0.6;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3