This commit is contained in:
2026-08-28 16:53:58 +08:00
parent 863cd97689
commit 921847d70c
2 changed files with 39 additions and 41 deletions
+15 -22
View File
@@ -771,6 +771,14 @@
}
return true
},
requireEvidenceMutation() {
if (!this.requireEvidenceCapture()) return false
if (!isRemoteReady(this.evidenceIdentity.inboundId)) {
this.showToast('当前会话未连接服务端,证据保留本地', 'warning')
return false
}
return true
},
requirePickingOperation() {
if (this.pickingOperationReady) return true
this.showToast('任务尚未领取完成,请稍候或刷新重试', 'warning')
@@ -1172,10 +1180,8 @@
this.debugSubmit('refresh.incremental', { previousTaskVersion, taskVersion: this.pickingVersion, addedItemIds, pickingCompleted: this.pickingCompleted })
if (addedItemIds.length) this.showToast(`已同步 ${addedItemIds.length} 条新增待拣明细`, 'warning')
}
if (this.loadingStageReady) {
this.activeStage = 'evidence'
await this.loadLoadingEvidence()
}
await this.loadLoadingEvidence()
if (this.loadingStageReady) this.activeStage = 'evidence'
} catch (error) {
if (requestId !== this.taskRequestId) return
this.debugSubmit('refresh.error', { requestId, message: error.message || '', code: error.code || '', statusCode: error.statusCode || '', requestIdFromServer: error.requestId || '', traceId: error.traceId || '' })
@@ -1183,7 +1189,7 @@
} finally { if (requestId === this.taskRequestId) this.remoteLoading = false }
},
async loadLoadingEvidence() {
if (!this.loadingStageReady || !this.evidenceIdentity || !isRemoteReady(this.evidenceIdentity.inboundId)) return
if (!this.evidenceIdentity?.inboundId || !isRemoteReady(this.evidenceIdentity.inboundId)) return
const contextId = this.evidenceContextId
const identity = { ...this.evidenceIdentity }
try {
@@ -1286,18 +1292,13 @@
this.showToast('带锁码照已上传,请输入封签号并点击保存封签', 'success')
return
}
if (!this.loadingStageReady) {
this.rememberEvidenceDraft(identity)
this.showToast('照片已上传,拣货完成后自动保存', 'success')
return
}
await this.saveEvidence(type, null, path)
},
async flushPendingEvidence() {
if (!this.loadingStageReady) return
if (!this.evidenceIdentity?.inboundId) return
const pending = this.evidenceSlots.flatMap((slot) => this.evidenceEntries(slot.type).filter((entry) => !entry.id && entry.localPath).map((entry) => ({ type: slot.type, path: entry.localPath, fileId: entry.fileId })))
for (const item of pending) {
if (!this.loadingStageReady) return
if (!this.evidenceIdentity?.inboundId) return
if (item.fileId && item.type !== 'SEAL') await this.saveEvidence(item.type, null, item.path)
else if (item.fileId) continue
else await this.queueEvidenceUpload(item.type, item.path)
@@ -1322,18 +1323,11 @@
this.showToast('带锁码照已上传,请输入封签号并点击保存封签', 'success')
return
}
if (!this.loadingStageReady) {
this.rememberEvidenceDraft(identity)
this.showToast('照片已上传,拣货完成后自动保存', 'success')
return
}
await this.saveEvidence(type)
},
async saveEvidence(type, operationId = null, localPath = null) {
if (!this.requireEvidenceStage()) return
if (!this.requireEvidenceMutation()) return
if (type === 'SEAL' && !String(this.sealNo || '').trim()) { this.showToast('请输入封签号后点击保存封签', 'warning'); return }
if (!this.evidenceIdentity?.inboundId) { this.showToast('状态尚未同步,请刷新重试', 'warning'); return }
if (!isRemoteReady(this.evidenceIdentity.inboundId)) { this.showToast('当前会话未连接服务端,证据保留本地', 'warning'); return }
const contextId = this.evidenceContextId
const identity = { ...this.evidenceIdentity }
const inboundId = identity.inboundId
@@ -1365,7 +1359,6 @@
if (this.sealSaving) return
if (!String(this.sealNo || '').trim()) { this.showToast('请输入封签号', 'warning'); return }
this.rememberEvidenceDraft()
if (!this.loadingStageReady) { this.showToast('封签号已暂存,装柜状态同步后自动保存', 'success'); return }
const current = [...this.evidenceEntries('SEAL')].reverse().find((item) => item.fileId && !item.id)
if (!current) { this.showToast('当前封签已保存,无需重复提交', 'success'); return }
const operationId = stableOperationId('seal', stableTaskOperationIdentity(this.draftIdentity()), { fileId: String(current.fileId), sealNo: String(this.sealNo).trim() })
@@ -1377,7 +1370,7 @@
}
},
async voidEvidencePhoto(photo) {
if (!this.requireEvidenceStage()) return
if (!this.requireEvidenceMutation()) return
if (!photo?.id || !this.evidenceIdentity?.inboundId) return
const contextId = this.evidenceContextId
const identity = { ...this.evidenceIdentity }