fix(pda): 修复海外作业兼容性并完善扫码与装车收尾

This commit is contained in:
2026-11-06 21:02:54 +08:00
parent fd6c1511ce
commit 31f2ba0c85
14 changed files with 227 additions and 30 deletions
+15
View File
@@ -30,6 +30,21 @@ test('five existing slots carry their business names into upload, replace and pr
assert.match(template, /:aria-label="`查看\$\{slotLabels\[slot\]\}大图`"/)
assert.doesNotMatch(template, /装车照片 \{\{ index \+ 1 \}\}/)
})
test('saving the final loading photo reports the confirmed complete snapshot after releasing busy state', async () => {
const completed = data({ recordVersion: '1', complete: true, stage: 'DELIVERING', editable: false,
photos: loadingPhotoSlots.map((slot, index) => ({ ...photo, slot, fileId: String(1001 + index) })) })
let uploads = 0
const { state, events } = component({ uploadLoadingPhoto: async () => { uploads++; return photo }, bindLoadingPhoto: async () => completed })
uni.chooseImage = async () => ({ tempFilePaths: ['final-photo', 'extra-photo'] })
await state.load()
await state.choose(photo.slot)
const savedIndex = events.findIndex(event => event[0] === 'saved')
assert.ok(savedIndex > 0)
assert.deepEqual(events[savedIndex - 1], ['busy-change', false])
assert.deepEqual(events[savedIndex], ['saved', completed])
assert.equal(uploads, 1)
})
test('refresh reads all photos saved by PC and refreshes the task stage without another write', async () => {
let latest = data({ photos: [photo] }), writes = 0, fail = false
const { state, events } = component({ getLoadingDocuments: async () => { if (fail) throw new Error('刷新失败'); return latest },