fix: return completed loading tasks to the task list

This commit is contained in:
2026-11-05 16:30:49 +08:00
parent 63fac79814
commit 500103e734
4 changed files with 108 additions and 6 deletions
+21 -1
View File
@@ -922,8 +922,13 @@
})
},
persistSession() {
const identity = this.draftIdentity()
const completed = this.remotePick?.taskStatus === 'COMPLETED'
if (completed) this.completedBoxes = { ...this.completedBoxes, [this.currentBoxIndex]: true }
this.saveCurrentBoxDraft()
savePickingSession({ boxes: this.boxes, currentBoxIndex: this.currentBoxIndex, itemStates: this.itemStates, partialQuantities: this.partialQuantities, scannedBoxCodes: this.scannedBoxCodes, boxDrafts: this.boxDrafts, completedBoxes: this.completedBoxes, scanValue: this.scanValue, scanHistory: this.scanHistory }, this.draftIdentity())
// 完成任务仍更新作业记录的内存快照,空身份阻止重新写入其持久化草稿。
savePickingSession({ boxes: this.boxes, currentBoxIndex: this.currentBoxIndex, itemStates: this.itemStates, partialQuantities: this.partialQuantities, scannedBoxCodes: this.scannedBoxCodes, boxDrafts: this.boxDrafts, completedBoxes: this.completedBoxes, scanValue: this.scanValue, scanHistory: this.scanHistory }, completed ? {} : identity)
if (completed) clearPickingDraft(identity)
},
leavePicking() { this.persistSession(); this.activeOverlay = ''; navigateBackOr('/pages/home/home') },
clearTimers() { clearTimeout(this._toastTimer); clearTimeout(this._evidencePreviewOpenTimer) },
@@ -1186,6 +1191,16 @@
this.currentBox.boxNo = task.currentContainerNo
this.currentBox.currentContainerNo = task.currentContainerNo
const remoteTask = normalizePickingTask(task)
// 刷新确认后台已完成时直接返回任务列表,不再停留在已完成柜子内。
if (remoteTask.taskStatus === 'COMPLETED') {
this.remotePick = remoteTask
this.pickingVersion = remoteTask.pickingVersion ?? remoteTask.version
if (this.activeOverlay) this.closeOverlay()
this.boxDropdownOpen = false
this.persistSession()
navigateBackOr('/pages/tasks/tasks')
return
}
this.assignmentVersion = remoteTask.assignment?.version ?? remoteTask.assignmentVersion ?? (remoteTask.workflowStatus === 'UNASSIGNED' ? 0 : null)
if (remoteTask.workflowStatus !== 'AWAITING_REVIEW' && this.assignmentVersion === null) throw new Error('任务领取状态尚未同步,请刷新重试')
let claimed = null
@@ -1470,6 +1485,11 @@
}
this.remoteError = ''
this.showToast('装柜已完成', 'success')
// 收起页面内浮层,避免 onBackPress 拦截完成后的程序化返回。
if (this.activeOverlay) this.closeOverlay()
this.boxDropdownOpen = false
this.persistSession()
navigateBackOr('/pages/tasks/tasks')
} catch (error) {
if (!this.isEvidenceContextActive(contextId, identity)) return
if (accepted) {