优化
This commit is contained in:
@@ -246,6 +246,31 @@ it('highlights only the allowed current step and keeps other actions secondary',
|
||||
expect(section.findAll('button').filter(item => !item.element.closest('details')).map(item => item.text())).toEqual(['安排来货'])
|
||||
})
|
||||
|
||||
it.each([
|
||||
['all current permissions', ['platform:fleet:capacity-offer:manage', 'platform:fleet:trip:booking-edit', 'platform:fleet:trip:edit', 'platform:overseas-warehouse:dispatch:create'], true],
|
||||
['legacy smart permission', ['platform:fleet:capacity-offer:manage', 'platform:fleet:trip:booking-edit', 'platform:fleet:trip:edit', 'platform:overseas-warehouse:inbound-order:smart-dispatch'], false],
|
||||
['missing offer manage', ['platform:fleet:trip:booking-edit', 'platform:fleet:trip:edit', 'platform:overseas-warehouse:dispatch:create'], false],
|
||||
['missing booking edit', ['platform:fleet:capacity-offer:manage', 'platform:fleet:trip:edit', 'platform:overseas-warehouse:dispatch:create'], false],
|
||||
['missing trip edit', ['platform:fleet:capacity-offer:manage', 'platform:fleet:trip:booking-edit', 'platform:overseas-warehouse:dispatch:create'], false],
|
||||
['missing dispatch create', ['platform:fleet:capacity-offer:manage', 'platform:fleet:trip:booking-edit', 'platform:fleet:trip:edit'], false],
|
||||
])('keeps table and dialog arrange-dispatch authority aligned: %s', async (_, codes, allowed) => {
|
||||
state.links = new Set(codes)
|
||||
state.manage = codes.includes('platform:fleet:capacity-offer:manage')
|
||||
const row: CapacityInquiry = { ...inquiry, progress: { ...inquiry.progress, primaryAction: 'BIND' } }
|
||||
const table = shallowMount(CapacityInquiryTable, { props: { rows: [row], total: 1, loading: false }, global: { stubs: {
|
||||
DataTable: { props: ['data'], template: '<div><slot name="actions" :row="data[0]" /></div>' },
|
||||
RowActions: { name: 'RowActions', props: ['actions'], template: '<div />' },
|
||||
} } })
|
||||
wrappers.push(table)
|
||||
const actions = table.getComponent({ name: 'RowActions' }).props('actions') as { key: string; visible?: boolean }[]
|
||||
expect(actions.find(action => action.key === 'bind')?.visible).toBe(allowed)
|
||||
const { wrapper: dialog } = mount(CapacityInquiryDialog, { modelValue: true, offer, inquiry: row, readonly: true })
|
||||
await flushPromises()
|
||||
const bind = dialog.findAll('button').find(button => button.text() === '确认排入本车')
|
||||
expect(Boolean(bind)).toBe(allowed)
|
||||
if (bind) { await bind.trigger('click'); expect(dialog.emitted('action')?.at(-1)).toEqual(['bind', row]) }
|
||||
})
|
||||
|
||||
it('shows the selected destination capacity when confirming and never treats unknown capacity as zero', async () => {
|
||||
state.manage = true
|
||||
const knownOffer = { ...offer, capacityKnown: true, destinations: [
|
||||
|
||||
Reference in New Issue
Block a user