diff --git a/scripts/tests/trafficRecords.test.mjs b/scripts/tests/trafficRecords.test.mjs index c91b516..a0c1d55 100644 --- a/scripts/tests/trafficRecords.test.mjs +++ b/scripts/tests/trafficRecords.test.mjs @@ -110,3 +110,37 @@ test('退款后处理状态与权限码常量', () => { assert.equal(constants.labelOf(constants.TRAFFIC_DECISION_LABELS, 'new_value'), 'new_value') assert.equal(constants.labelOf(constants.TRAFFIC_DECISION_LABELS, ''), '-') }) + +test('卡 / 设备展示优先用 ICCID、设备号,没有时才显示内部 ID', () => { + assert.equal( + utils.assetDisplay({ iot_card_id: 367218, iccid: '89860624660030813727' }), + '89860624660030813727' + ) + assert.equal( + utils.assetDisplay({ + device_id: 49323, + device_virtual_no: '60003081372', + device_imei: '869555083099518' + }), + '60003081372(IMEI 869555083099518)' + ) + assert.equal( + utils.assetDisplay({ + device_id: 1, + device_virtual_no: '862639078983683', + device_imei: '862639078983683' + }), + '862639078983683' + ) + assert.equal( + utils.assetDisplay({ device_id: 1, device_imei: '869555083099518' }), + '869555083099518' + ) + assert.equal(utils.assetDisplay({ iot_card_id: 367218 }), '卡ID 367218') + assert.equal(utils.assetDisplay({ device_id: 49323 }), '设备ID 49323') + assert.equal(utils.assetDisplay({}), '-') + assert.equal(utils.nameOrId('移动账户A', 3), '移动账户A') + assert.equal(utils.nameOrId('', 3), 'ID 3') + assert.equal(utils.nameOrId('', 7, '账号ID'), '账号ID 7') + assert.equal(utils.nameOrId(undefined, 0), '-') +}) diff --git a/src/components/business/traffic-records/CardDailyUsages.vue b/src/components/business/traffic-records/CardDailyUsages.vue index 3511e27..13abb74 100644 --- a/src/components/business/traffic-records/CardDailyUsages.vue +++ b/src/components/business/traffic-records/CardDailyUsages.vue @@ -23,7 +23,9 @@ - + + + @@ -47,10 +49,10 @@