fix: handle risk explanation standard adjustment
This commit is contained in:
@@ -17,6 +17,7 @@ import {
|
||||
import {
|
||||
buildExpenseItemViewModel,
|
||||
buildDraftBlockingIssues,
|
||||
buildStandardAdjustmentMap,
|
||||
isApplicationDocumentRequest
|
||||
} from '../src/views/scripts/travelRequestDetailExpenseModel.js'
|
||||
import {
|
||||
@@ -687,6 +688,9 @@ test('expense detail table shows each item filled time from item creation time',
|
||||
test('expense detail table has per-item risk explanation column', () => {
|
||||
assert.match(detailViewTemplate, /<th class="col-risk-note">异常说明<\/th>/)
|
||||
assert.match(detailViewTemplate, /v-model="expenseEditor\.itemNote"/)
|
||||
assert.match(detailViewTemplate, /class="editor-textarea risk-note-editor-textarea"[\s\S]*rows="1"/)
|
||||
assert.match(detailViewTemplate, /@input="resizeExpenseNoteInput"/)
|
||||
assert.match(detailViewStyle, /\.risk-note-editor-textarea[\s\S]*max-height: 78px/)
|
||||
assert.match(detailViewTemplate, /hasExpenseRiskOrAbnormal\(item\)[\s\S]*待补充异常说明/)
|
||||
assert.match(detailViewScript, /itemNote: ''/)
|
||||
assert.match(detailViewScript, /expenseEditor\.itemNote = item\.itemNote \|\| ''/)
|
||||
@@ -697,6 +701,49 @@ test('expense detail table has per-item risk explanation column', () => {
|
||||
assert.match(requestsComposableScript, /const itemNote = String\(item\?\.item_note \|\| item\?\.itemNote \|\| ''\)\.trim\(\)/)
|
||||
})
|
||||
|
||||
test('expense detail shows standard-adjusted reimbursable amount separately from receipt amount', () => {
|
||||
assert.match(detailViewTemplate, /v-if="item\.hasStandardAdjustment" class="expense-adjusted-amount"/)
|
||||
assert.match(detailViewTemplate, /class="expense-original-amount"[\s\S]*item\.originalAmountDisplay/)
|
||||
assert.match(detailViewTemplate, /class="expense-reimbursable-amount"[\s\S]*item\.reimbursableAmountDisplay/)
|
||||
assert.match(detailViewTemplate, /submitConfirmAmountDisplay/)
|
||||
assert.match(detailViewStyle, /\.expense-original-amount[\s\S]*text-decoration-line: line-through/)
|
||||
assert.match(detailViewScript, /const expenseTotal = computed\(\(\) => \{[\s\S]*item\.reimbursableAmount/)
|
||||
assert.match(detailViewScript, /filterSubmitterStandardAdjustedRiskCards/)
|
||||
assert.match(detailViewScript, /acceptExpenseClaimStandardAdjustment/)
|
||||
assert.match(detailExpenseModelScript, /STANDARD_ADJUSTMENT_RISK_SOURCE = 'reimbursement_standard_adjustment'/)
|
||||
assert.match(requestsComposableScript, /STANDARD_ADJUSTMENT_RISK_SOURCE = 'reimbursement_standard_adjustment'/)
|
||||
assert.match(requestsComposableScript, /const visibleExpenseAmount = expenseItems\.reduce[\s\S]*item\.reimbursableAmount/)
|
||||
|
||||
const riskFlags = [
|
||||
{
|
||||
source: 'reimbursement_standard_adjustment',
|
||||
item_id: 'expense-item-1',
|
||||
original_amount: '880.00',
|
||||
reimbursable_amount: '600.00',
|
||||
employee_absorbed_amount: '280.00'
|
||||
}
|
||||
]
|
||||
const adjustmentMap = buildStandardAdjustmentMap({ riskFlags })
|
||||
assert.equal(adjustmentMap.get('expense-item-1').reimbursableAmount, 600)
|
||||
|
||||
const item = buildExpenseItemViewModel(
|
||||
{
|
||||
id: 'expense-item-1',
|
||||
itemType: 'hotel_ticket',
|
||||
itemReason: '北京住宿',
|
||||
itemAmount: 880,
|
||||
invoiceId: 'hotel.pdf'
|
||||
},
|
||||
0,
|
||||
{ riskFlags }
|
||||
)
|
||||
|
||||
assert.equal(item.itemAmount, 880)
|
||||
assert.equal(item.reimbursableAmount, 600)
|
||||
assert.equal(item.employeeAbsorbedAmount, 280)
|
||||
assert.equal(item.hasStandardAdjustment, true)
|
||||
})
|
||||
|
||||
test('expense item upload remains limited to one receipt per detail row', () => {
|
||||
assert.match(detailViewTemplate, /ref="expenseUploadInput"[\s\S]*type="file"/)
|
||||
assert.doesNotMatch(
|
||||
|
||||
Reference in New Issue
Block a user