优化
This commit is contained in:
@@ -80,7 +80,8 @@ test('relabel API covers claim, unit outcomes, completion and review with encode
|
||||
test('carton relabel uses one scan input and shows the confirmed FBA mapping after saving', async () => {
|
||||
const page = await read('../src/pages/relabel/relabel.vue')
|
||||
assert.equal((page.match(/name="quickCarton"/g) || []).length, 1)
|
||||
assert.match(page, /v-if="taskTab === 'sku' && selectedItem && remaining\(selectedItem\) > 0"/)
|
||||
assert.match(page, /name="quickSku"/)
|
||||
assert.match(page, /v-if="taskTab === 'sku' && selectedItem && action !== 'RELABEL' && remaining\(selectedItem\) > 0"/)
|
||||
assert.match(page, /selectItem\(item\) \{ if \(this\.taskTab === 'carton'\) \{ this\.activeTarget = 'quick-carton'; return \}/)
|
||||
const start = page.indexOf('async submitCarton(raw)')
|
||||
const scan = page.slice(start, page.indexOf('removePhoto(index)', start))
|
||||
@@ -90,6 +91,17 @@ test('carton relabel uses one scan input and shows the confirmed FBA mapping aft
|
||||
assert.match(scan, /confirmedItem\?\.fbaCartonMark/)
|
||||
})
|
||||
|
||||
test('mixed relabel keeps SKU work open after carton work and only carton tab mounts pallet work', async () => {
|
||||
const page = await read('../src/pages/relabel/relabel.vue')
|
||||
const body = page.match(/remaining\(item\) \{([^\n]+)\},/)[1]
|
||||
const remaining = new Function('item', body)
|
||||
const mixed = { operationType: 'CARTON_AND_SKU', expectedPackages: 1, relabelledPackages: 1,
|
||||
cartonProcessedPackages: 1, skuProcessedPackages: 0, skippedPackages: 0, exceptionPackages: 0 }
|
||||
assert.equal(remaining.call({ taskTab: 'sku' }, mixed), 1)
|
||||
assert.equal(remaining.call({ taskTab: 'carton' }, mixed), 0)
|
||||
assert.match(page, /<RelabelPalletWork v-if="taskTab === 'carton'"/)
|
||||
})
|
||||
|
||||
test('relabel list opens a row directly in execution and completion returns to the list', async () => {
|
||||
const page = await read('../src/pages/relabel/relabel.vue')
|
||||
assert.doesNotMatch(page, /name="relabelTask"/)
|
||||
@@ -105,13 +117,23 @@ test('relabel list opens a row directly in execution and completion returns to t
|
||||
|
||||
test('relabel review is a read-only list and completed execution details stay hidden', async () => {
|
||||
const page = await read('../src/pages/relabel/relabel.vue')
|
||||
assert.match(page, /showCurrent\(\) \{ if \(!this\.current \|\| this\.stage === 'review'\) return false; if \(this\.stage === 'execute'\) return this\.current\.taskStatus === 'PROCESSING' && this\.current\.claimedByCurrentOperator/)
|
||||
const body = page.match(/showCurrent\(\) \{([^\n]+)\},/)[1]
|
||||
const visible = new Function(body)
|
||||
const context = { stage: 'execute', current: { relabelNo: 'RL-1', taskStatus: 'PROCESSING' }, candidates: [{ relabelNo: 'RL-1', taskStatus: 'PROCESSING', claimedByCurrentOperator: true }] }
|
||||
assert.equal(visible.call(context), true, 'detail without ownership field must use server candidate ownership')
|
||||
assert.equal(visible.call({ ...context, candidates: [] }), false)
|
||||
assert.equal(visible.call({ ...context, stage: 'review' }), false)
|
||||
assert.equal(visible.call({ ...context, current: { ...context.current, taskStatus: 'WAIT_REVIEW' } }), false)
|
||||
assert.match(page, /stageSubtitle\(\) \{ return this\.stage === 'review' \? '仅展示当前仓库已完成现场换标并等待复核的单据'/)
|
||||
const reviewList = page.slice(page.indexOf('<view v-else class="task-list">'), page.indexOf('<view v-if="showCurrent"'))
|
||||
assert.doesNotMatch(reviewList, /@tap|详情/)
|
||||
assert.match(page, /<button v-if="stage !== 'review'" class="link-button"[^>]*@tap="loadCandidates"/)
|
||||
assert.match(page, /<button v-if="stage !== 'review'" class="link-button"[^>]*@tap="bootstrap"/)
|
||||
assert.match(page, /if \(this\.stage === 'execute'\) this\.startScanner\(\)/)
|
||||
assert.match(page, /if \(this\.stage === 'execute' && this\.taskCode\) await this\.openTask/)
|
||||
const bootstrapBody = page.match(/async bootstrap\(\) \{([^\n]+)\},/)[1]
|
||||
const bootstrap = new (Object.getPrototypeOf(async function () {}).constructor)(bootstrapBody)
|
||||
const opened = []
|
||||
await bootstrap.call({ ...context, taskCode: 'STALE', loadCandidates: async () => {}, openTask: async (no) => opened.push(no) })
|
||||
assert.deepEqual(opened, ['RL-1'])
|
||||
})
|
||||
|
||||
test('warehouse drafts are isolated by operator and warehouse and retain retry keys until success', () => {
|
||||
|
||||
Reference in New Issue
Block a user