fix(pl): 修正合同额度统计中的销售及框架合同类型文案。
This commit is contained in:
1 parent
0d1d264bc7
commit
72cf0d9c3d
3 files changed
+41
-6
No files matched your search
@@ -261,3 +261,31 @@ test('statistics API maps each view to the server endpoint and preserves respons
|
||||
)
|
||||
assert.deepEqual(calls[1].options.params, { certType: 'transport', pageSize: 20 })
|
||||
})
|
||||
|
||||
import * as statisticsLabels from '../src/views/pl/quota-statistics/labels'
|
||||
test('contract type tags translate all server values and legacy framework', () => {
|
||||
const template = parse(
|
||||
readFileSync(
|
||||
new URL('../src/views/pl/quota-statistics/StatisticsPanel.vue', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
).descriptor.template!.content
|
||||
const expression = template.match(
|
||||
/v-else-if="column.prop === 'contractType'"[^>]*>\s*\{\{([\s\S]*?)\}\}/
|
||||
)![1]
|
||||
const renderLabel = new Function(
|
||||
'row',
|
||||
...Object.keys(statisticsLabels),
|
||||
`return (${expression})`
|
||||
)
|
||||
for (const [contractType, label] of Object.entries({
|
||||
sale: '销售合同',
|
||||
purchase: '采购合同',
|
||||
framework_sale: '框架销售合同',
|
||||
framework_purchase: '框架采购合同',
|
||||
framework: '框架合同',
|
||||
'': '—'
|
||||
})) {
|
||||
assert.equal(renderLabel({ contractType }, ...Object.values(statisticsLabels)), label)
|
||||
}
|
||||
})
|
||||
@@ -113,11 +113,7 @@
|
||||
:type="row.status === 'active' ? 'success' : 'info'"
|
||||
>{{ statusLabel(row.status) }}</el-tag
|
||||
><el-tag v-else-if="column.prop === 'contractType'" size="small">{{
|
||||
row.contractType === 'purchase'
|
||||
? '采购合同'
|
||||
: row.contractType === 'sales'
|
||||
? '销售合同'
|
||||
: row.contractType || '—'
|
||||
contractTypeLabel(row.contractType)
|
||||
}}</el-tag
|
||||
><span v-else>{{ row[column.prop] ?? '—' }}</span></template
|
||||
>
|
||||
@@ -161,7 +157,7 @@
|
||||
import ContractScopeDialog from '../quota-cert/ContractScopeDialog.vue'
|
||||
import StatisticsDetail from './StatisticsDetail.vue'
|
||||
import { createStatisticsLoader } from './loader'
|
||||
import { statusLabel } from './labels'
|
||||
import { statusLabel, contractTypeLabel } from './labels'
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
mode: 'contract' | 'certificate'
|
||||
|
||||
@@ -12,3 +12,14 @@ export const statusLabel = (value: string) =>
|
||||
consumed: '已核销',
|
||||
cancelled: '已取消'
|
||||
})[value] || value
|
||||
|
||||
export const contractTypeLabel = (value?: string | null) =>
|
||||
({
|
||||
sale: '销售合同',
|
||||
purchase: '采购合同',
|
||||
framework_sale: '框架销售合同',
|
||||
framework_purchase: '框架采购合同',
|
||||
framework: '框架合同'
|
||||
})[value || ''] ||
|
||||
value ||
|
||||
'—'
|
||||
Reference in new issue
Block a user