优化
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import SmartLoadingCandidateInbounds from './SmartLoadingCandidateInbounds.vue'
|
||||
import type { SmartLoadingCandidate } from '../types'
|
||||
|
||||
describe('sealed pallet composition', () => {
|
||||
it('shows the two inbound portions, not the whole pallet count twice', async () => {
|
||||
const candidate = { unitType: 'SEALED_PALLET', inboundCode: 'I180', availablePackageCount: 13,
|
||||
groupMembers: [{ accountId: '1', inboundId: '180', inboundCode: 'I180', availablePackageCount: 3 },
|
||||
{ accountId: '1', inboundId: '181', inboundCode: 'I181', availablePackageCount: 10 }] } as SmartLoadingCandidate
|
||||
const wrapper = mount(SmartLoadingCandidateInbounds, { props: { candidate } })
|
||||
expect(wrapper.get('summary').text()).toBe('2 个入仓码 · 展开')
|
||||
expect(wrapper.text()).toContain('I180:3 箱')
|
||||
expect(wrapper.text()).toContain('I181:10 箱')
|
||||
expect(wrapper.text()).not.toContain('13 箱')
|
||||
expect(wrapper.findAll('button')).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import type { SmartLoadingCandidate } from '../types'
|
||||
|
||||
defineProps<{ candidate: SmartLoadingCandidate }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<details v-if="candidate.unitType === 'SEALED_PALLET' && candidate.groupMembers.length">
|
||||
<summary>{{ candidate.groupMembers.length }} 个入仓码 · 展开</summary>
|
||||
<div v-for="member in candidate.groupMembers" :key="`${member.accountId}:${member.inboundId}`">
|
||||
{{ member.inboundCode || '—' }}:{{ member.availablePackageCount }} 箱
|
||||
</div>
|
||||
</details>
|
||||
<span v-else>{{ candidate.inboundCode || '—' }}</span>
|
||||
</template>
|
||||
Reference in New Issue
Block a user