feat:换电记录增加使用时间字段

This commit is contained in:
yangqingyuan
2024-08-18 20:32:01 +08:00
parent 428c8fde3f
commit 0885d828e6
2 changed files with 24 additions and 1 deletions

View File

@@ -14,6 +14,8 @@ export interface EquipmentRecord {
createTime?: string; createTime?: string;
tenantId?: number; tenantId?: number;
merchantCode?: string; merchantCode?: string;
//使用时间按天算
duration?:number;
} }
/** /**

View File

@@ -272,6 +272,11 @@
<template v-if="column.key === 'expirationDay'"> <template v-if="column.key === 'expirationDay'">
<span class="ele-text-danger">{{ expirationDay(record) }}</span> <span class="ele-text-danger">{{ expirationDay(record) }}</span>
</template> </template>
<template v-if="column.key === 'duration'">
<span class="ele-text-danger">{{ countDuration (record)}}</span>
</template>
</template> </template>
</ele-pro-table> </ele-pro-table>
</a-spin> </a-spin>
@@ -612,7 +617,8 @@ const columns3 = ref<ColumnItem[]>([
}, },
{ {
title: '使用电池', title: '使用电池',
dataIndex: 'use' dataIndex: 'duration',
key:'duration'
}, },
{ {
title: '操作人', title: '操作人',
@@ -765,6 +771,21 @@ const expirationDay = (order) => {
} }
}; };
const countDuration = (equipmentRecord) =>{//计算使用时间
if (equipmentRecord.eventType ==="电池解绑"){
if (equipmentRecord.duration !== null){
return equipmentRecord.duration+'天'
}
return '0天'
} else {
if (equipmentRecord.duration !== null){
return equipmentRecord.duration+'天';
}else {
return '';
}
}
}
const getFiles = () => { const getFiles = () => {
if (order.orderSourceData != '') { if (order.orderSourceData != '') {
const array = JSON.parse(<string>order.orderSourceData); const array = JSON.parse(<string>order.orderSourceData);