优化
This commit is contained in:
@@ -7,10 +7,10 @@ const queryToolbarSource = readFileSync(join(process.cwd(), 'src/shared/componen
|
||||
|
||||
describe('CarrierRatesView source contract', () => {
|
||||
it('keeps operation column first and covers every required business field', () => {
|
||||
const customerColumn = "key: 'customer', label: '所属企业'"
|
||||
const scopeColumn = "key: 'scope', label: '适用范围'"
|
||||
const destinationColumn = "key: 'destinationCode', prop: 'destinationCode'"
|
||||
expect(source.indexOf("key: 'actions'")).toBeLessThan(source.indexOf(customerColumn))
|
||||
expect(source.indexOf(customerColumn)).toBeLessThan(source.indexOf(destinationColumn))
|
||||
expect(source.indexOf("key: 'actions'")).toBeLessThan(source.indexOf(scopeColumn))
|
||||
expect(source.indexOf(scopeColumn)).toBeLessThan(source.indexOf(destinationColumn))
|
||||
expect(source.indexOf(destinationColumn)).toBeLessThan(source.indexOf("key: 'rate'"))
|
||||
for (const label of ['起运仓', '业务类型', '渠道编码', '船司', 'FBA 目的仓', '计费单位', '单价', '币种', '固定附加费', '有效期', '备注', '生效时间', '结束时间']) {
|
||||
expect(source).toContain(label)
|
||||
@@ -27,41 +27,35 @@ describe('CarrierRatesView source contract', () => {
|
||||
expect(source).not.toContain('编辑价格')
|
||||
})
|
||||
|
||||
it('keeps the customer company scope in the query toolbar without exposing tenant concepts', () => {
|
||||
expect(source).toContain("key: 'customerId'")
|
||||
expect(source.indexOf("key: 'customerId'")).toBeLessThan(source.indexOf("key: 'rateCode'"))
|
||||
expect(source).toContain("'aria-label': '所属企业'")
|
||||
expect(source).toContain('listPlatformTenants')
|
||||
expect(source).toContain('masterDataLoaded')
|
||||
it('treats carrier rates as platform-wide data without a customer selector', () => {
|
||||
expect(source).toContain("key: 'scope', label: '适用范围'")
|
||||
expect(source).toContain('全部客户')
|
||||
expect(source).not.toContain("key: 'customerId'")
|
||||
expect(source).not.toContain('listPlatformTenants')
|
||||
expect(source).not.toContain('PlatformTenantSelector')
|
||||
expect(source).not.toContain('selectedTenantId')
|
||||
expect(source).not.toContain('租户')
|
||||
})
|
||||
|
||||
it('uses semantic compact filter widths and keeps the customer selection empty by default', () => {
|
||||
it('uses semantic compact filter widths without a customer field', () => {
|
||||
for (const field of [
|
||||
"key: 'customerId',\n type: 'select',\n width: 280",
|
||||
"key: 'rateCode', type: 'input', width: 220",
|
||||
"key: 'destinationCode', type: 'input', width: 220",
|
||||
"key: 'channelCode', type: 'input', width: 220",
|
||||
"key: 'chargeUnit', type: 'select', width: 180",
|
||||
"key: 'status', type: 'select', width: 160",
|
||||
]) expect(source).toContain(field)
|
||||
expect(source).toContain("customerId: ''")
|
||||
expect(source).toContain("placeholder: customerLoadError.value ? '企业列表加载失败' : '全部客户'")
|
||||
expect(source).not.toContain(':search-on-reset="false"')
|
||||
expect(source).not.toContain('请先选择所属企业')
|
||||
expect(source).not.toContain('请选择所属企业并查询价格数据')
|
||||
expect(source).not.toContain('customers.value[0]')
|
||||
})
|
||||
|
||||
it('loads all customers initially and after reset while preserving row scope for record actions', () => {
|
||||
it('loads the platform-wide list and keeps row actions independent of customer scope', () => {
|
||||
expect(source).toContain('void loadRateData()')
|
||||
expect(source).toContain("listPlatformCarrierRates(customerId ? { customerId } : {})")
|
||||
expect(source).toContain('loadRateData(customerId)')
|
||||
expect(source).toContain('getPlatformCarrierRate(String(row.tenantId), row.id)')
|
||||
expect(source).toContain('retirePlatformCarrierRate(String(row.tenantId), row.id)')
|
||||
expect(source).toContain('customerLabel(detail.tenantId)')
|
||||
expect(source).toContain('listPlatformCarrierRates({ rateCode: filters.value.rateCode })')
|
||||
expect(source).toContain('getPlatformCarrierRate(row.id)')
|
||||
expect(source).toContain('retirePlatformCarrierRate(row.id)')
|
||||
expect(source).toContain('<dt>适用范围</dt><dd>全部客户</dd>')
|
||||
})
|
||||
|
||||
it('loads shared carrier master data under the platform public scope', () => {
|
||||
@@ -73,8 +67,8 @@ describe('CarrierRatesView source contract', () => {
|
||||
expect(source).not.toContain('loadCustomerMasterData')
|
||||
})
|
||||
|
||||
it('keeps customer rate queries independent from edit-only master data', () => {
|
||||
expect(source).toContain('await loadRateData(customerId)')
|
||||
it('keeps public rate queries independent from edit-only master data', () => {
|
||||
expect(source).toContain('await loadRateData()')
|
||||
expect(source).not.toContain('loadPlatformMasterData(customerId)')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user