This commit is contained in:
2026-08-19 09:42:12 +08:00
parent 80cfca5056
commit 0cd13f0b4d
18 changed files with 86 additions and 50 deletions
@@ -181,8 +181,9 @@ describe('InboundFeeDetailManager', () => {
expect(document.querySelector('.fee-form .el-select')?.classList.contains('is-disabled')).toBe(false)
})
it('fails closed when a payable fee item has no supplier category', async () => {
it('allows any loaded ACTIVE supplier when a payable fee item has no supplier category', async () => {
vi.mocked(listInboundFeeItemOptions).mockResolvedValue([{ id: '31', feeTypeName: '未映射费用', feeCode: 'UNMAPPED', supplierCategory: null, warehouseReceivable: false, warehousePayable: true }])
vi.mocked(listInboundFeeSupplierOptions).mockResolvedValue([{ id: '41', supplierName: '测试供应商', category: 'CUSTOMS' }])
const wrapper = mountManager([
'firstleg:inbound:fee-detail:view', 'firstleg:inbound:fee-detail:edit',
'firstleg:fee-item:view', 'platform:supplier:list',
@@ -191,10 +192,10 @@ describe('InboundFeeDetailManager', () => {
await wrapper.findAll('button').find((button) => button.text().includes('新增费用'))?.trigger('click')
await flushPromises()
const state = (wrapper.vm.$ as unknown as { setupState: { save(): Promise<void>; form: { direction: string; feeItemId: string; supplierId: string | null; amount: number } } }).setupState
state.form.direction = 'PAYABLE'; state.form.feeItemId = '31'; state.form.supplierId = '41'; state.form.amount = 100; await flushPromises()
state.form.direction = 'PAYABLE'; state.form.feeItemId = '31'; await flushPromises(); state.form.supplierId = '41'; state.form.amount = 100
await state.save(); await flushPromises()
expect(createInboundFeeDetail).not.toHaveBeenCalled()
expect(document.body.textContent).toContain('该应付费用项目未配置供应商类别,已阻断保存')
expect(listInboundFeeSupplierOptions).toHaveBeenCalledWith(null)
expect(createInboundFeeDetail).toHaveBeenCalledWith('100', '88', expect.objectContaining({ direction: 'PAYABLE', supplierId: '41' }))
})
it('refreshes fee rows and the order detail after every successful write', () => {