fix(admin): align supplier carrier master data

This commit is contained in:
2026-08-27 10:12:20 +08:00
parent 29bb641524
commit 3e3c7e237a
14 changed files with 168 additions and 44 deletions
@@ -52,6 +52,7 @@ const partner: PlatformPartnerResource = {
partnerName: '深圳示例贸易有限公司',
partnerType: 'SHIPPER',
types: ['SHIPPER'],
carrierCode: null,
contactName: '张三',
contactPhone: '13800138000',
contactEmail: 'contact@example.com',
@@ -159,6 +160,25 @@ describe('PartnersView real API integration', () => {
expect(document.body.textContent).not.toContain('供应商')
})
it('uses the fixed carrier-code selector when the unit is a shipping company', async () => {
const wrapper = await mountView()
await wrapper.findAll('button').find((button) => button.text().trim() === '新增往来单位')?.trigger('click')
await flushPromises()
const typeSelect = wrapper.findAllComponents({ name: 'ElSelect' }).find((select) => select.props('multiple'))
typeSelect!.vm.$emit('update:modelValue', ['CARRIER'])
await flushPromises()
expect(document.body.textContent).toContain('船司标准编码')
const carrierValues = new Set(['MATSON', 'SML', 'ZIM', 'COSCO', 'EMC', 'HEDE', 'OTHER'])
const carrierOptions = wrapper.findAllComponents({ name: 'ElOption' }).filter((option) => carrierValues.has(String(option.props('value'))))
expect(carrierOptions.map((option) => option.props('value'))).toEqual(['MATSON', 'SML', 'ZIM', 'COSCO', 'EMC', 'HEDE', 'OTHER'])
expect(carrierOptions.map((option) => option.props('label'))).toContain('美森 (MATSON)')
expect(source).toContain('placeholder="请选择船司标准编码"')
expect(source).toContain("MATSON: '美森'")
expect(source).toContain("OTHER: '其他'")
expect(source).toContain("carrierCode: types.includes('CARRIER') ? form.carrierCode : null")
})
it('renders a padded detail layout without an empty data-scope cell', async () => {
const wrapper = await mountView()
const detailButton = wrapper.findAll('button').find((button) => button.text().trim() === '详情')