This commit is contained in:
2026-09-15 09:58:15 +08:00
parent 3f998bdb88
commit 4bf66d9571
90 changed files with 1599 additions and 1388 deletions
@@ -100,6 +100,33 @@ describe('FinanceCustomerArapView G2 operations', () => {
vi.mocked(showExportTaskCreatedDialog).mockReset().mockResolvedValue(false)
})
it.each([
['DRAFT', ['详情', '编辑', '提交审核', ''], true],
['APPROVED', ['详情', '调整', '作废'], false],
['PENDING', ['详情', '作废'], false],
])('keeps fee-source actions reachable at the three-action boundary: %s', async (reviewStatus, labels, overflow) => {
const row = { ...feeSummary, sourceSystem: 'FINANCE', sourceType: 'MANUAL', reviewStatus } as FinanceFeeSourceSummary
vi.mocked(listFinanceFeeSources).mockResolvedValue({ records: [row], total: 1, pages: 1 })
const wrapper = await mountView(['platform:finance:customer-arap:list', 'platform:finance:fee-source:edit'])
await loadRows(wrapper)
const actions = wrapper.get('.el-table__body-wrapper .density-actions')
expect(actions.findAll('button').map(button => button.text().trim())).toEqual(labels)
expect(actions.find('.el-dropdown').exists()).toBe(overflow)
if (overflow) {
const trigger = actions.get('button[title="更多费用来源操作"]')
expect(trigger.text()).toBe('')
await trigger.trigger('click')
await flushPromises()
const item = [...document.querySelectorAll<HTMLElement>('.el-dropdown-menu__item')].find(item => item.textContent?.trim() === '作废')
expect(item).toBeTruthy()
vi.mocked(getFinanceFeeSource).mockResolvedValueOnce({ ...detail, ...row })
item!.click()
await flushPromises()
expect(document.body.textContent).toContain('作废费用')
expect(voidFinanceFeeSource).not.toHaveBeenCalled()
}
})
it('shows detail from the list permission but keeps G2 operations independent', async () => {
const wrapper = await mountView(['platform:finance:customer-arap:list'])
await loadRows(wrapper)
@@ -212,7 +239,7 @@ describe('FinanceCustomerArapView G2 operations', () => {
it('restores the independent detail route from its fee source id', async () => {
const wrapper = await mountView(['platform:finance:customer-arap:list'], '/finance/customer-arap/42')
expect(getFinanceFeeSource).toHaveBeenCalledWith('42')
expect(wrapper.text()).toContain('费用来源详情')
expect(wrapper.get('.density-detail-title').text()).toContain('运费')
expect(wrapper.text()).toContain('IB-91')
expect(wrapper.router.currentRoute.value.name).toBe('finance-customer-arap-detail')
})
@@ -237,27 +264,29 @@ describe('FinanceCustomerArapView G2 operations', () => {
expect(page).toContain('width: min(100%, 1920px)')
expect(page).toContain('@media (min-width: 1920px)')
expect(page).toContain('grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr)')
expect(page).toContain('.finance-arap-detail__layout :deep(.detail-page-layout__content)')
expect(page).toContain('finance-density-detail')
expect(page).not.toContain('max-width: 520px')
})
it('renders all permitted fee-source row operations as small plain primary buttons with icons', () => {
it('renders permitted fee-source row operations as shared outlined text buttons', () => {
const page = readFileSync(resolve(process.cwd(), 'src/modules/finance/pages/FinanceCustomerArapView.vue'), 'utf8')
expect(page).toContain('<el-button v-if="canViewSource" size="small" plain type="primary" @click="openDetail(row)"><Eye :size="15" />详情</el-button>')
expect(page).toContain('@click="openDetail(row)">详情</el-button>')
expect(page).toContain("@click=\"openMutation(row, 'SUBMIT')\"")
expect(page).toContain("@click=\"openMutation(row, 'ADJUST')\"")
expect(page).toContain('!isUpstreamSource(row)')
expect(page).toContain('!isUpstreamSource(detail)')
expect(page).toContain("['INBOUND_FEE', 'CONTAINER_FEE'].includes(type)")
expect(page).toContain("=== 'LASTLEG'")
expect(page).not.toMatch(/<template #actions[\s\S]*?<el-button[^>]*\blink\b/)
const actions = page.slice(page.indexOf('<template #actions'), page.indexOf('<template #customerName'))
expect(actions).not.toMatch(/<el-button[^>]*\blink\b/)
expect(page).toContain('white-space: nowrap')
})
it('resolves blank detail customer names and keeps source labels business-facing', async () => {
vi.mocked(getFinanceFeeSource).mockResolvedValueOnce({ ...detail, customerName: '', sourceType: 'NEW_SOURCE' })
const wrapper = await mountView(['platform:finance:customer-arap:list'], '/finance/customer-arap/42')
expect(wrapper.text()).toContain('运费 · 客户A')
expect(wrapper.get('.density-detail-title').text()).toContain('运费')
expect(wrapper.get('.finance-detail-context').text()).toBe('客户A')
expect(wrapper.text()).toContain('其他费用来源')
expect(wrapper.text()).not.toContain('其他来源')
expect(wrapper.text()).not.toContain('NEW_SOURCE')
@@ -322,7 +351,7 @@ describe('FinanceCustomerArapView G2 operations', () => {
statementGenerated: false, businessDateFrom: '2026-08-01', businessDateTo: '2026-08-31', keyword: '运费',
},
})
expect(showExportTaskCreatedDialog).toHaveBeenCalledWith({ taskName: '客户应收应付费用来源', taskNo: 'EXP-3' })
expect(showExportTaskCreatedDialog).toHaveBeenCalledWith({ taskName: '客户应收应付费用来源', taskNo: 'EXP-3', dense: true })
})
it('does not expose fee-source export without download-center access', async () => {