录音时长,调整字段映射关系
This commit is contained in:
@@ -47,8 +47,8 @@
|
||||
<text class="stat-label">总录音时长</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">{{ todayDuration }}</text>
|
||||
<text class="stat-label">今日录音时长</text>
|
||||
<text class="stat-value">{{ recordingCount }}</text>
|
||||
<text class="stat-label">录音总条数</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
</view>
|
||||
<view class="item-right">
|
||||
<text class="item-duration">{{ item.duration }}</text>
|
||||
<text class="item-count">{{ item.recordingCount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -137,7 +138,7 @@ export default {
|
||||
timeRangeIndex: 0, // 默认选择1个月
|
||||
showTimeRangeDropdown: false, // 控制下拉菜单显示
|
||||
totalDuration: '0 分钟',
|
||||
todayDuration: '0 分钟',
|
||||
recordingCount: '0',
|
||||
dataList: [],
|
||||
loading: false
|
||||
}
|
||||
@@ -406,20 +407,22 @@ export default {
|
||||
if (!statisticsList || statisticsList.length === 0) {
|
||||
// 没有数据时重置显示
|
||||
this.totalDuration = '0 分钟';
|
||||
this.todayDuration = '0 分钟';
|
||||
this.recordingCount = '0';
|
||||
this.dataList = [];
|
||||
return;
|
||||
}
|
||||
|
||||
// 注意:salesTotalDuration 是销售人员在所有门店的总时长(所有记录的值都相同)
|
||||
// 所以应该使用第一条记录的 salesTotalDuration 作为总时长,而不是累加
|
||||
// 注意:salesTotalDurationStatistic 是销售人员在所有门店的总时长(所有记录的值都相同)
|
||||
// 所以应该使用第一条记录的 salesTotalDurationStatistic 作为总时长,而不是累加
|
||||
const firstItem = statisticsList[0];
|
||||
const totalDurationMinutes = firstItem.salesTotalDuration || 0;
|
||||
const totalDurationMinutes = firstItem.salesTotalDurationStatistic || firstItem.salesTotalDuration || 0;
|
||||
|
||||
// 构建数据列表(展示每个门店的统计数据)
|
||||
const formattedList = statisticsList.map(item => {
|
||||
// 使用门店录音总时长作为该条记录的时长
|
||||
const dealershipDuration = item.dealershipTotalDuration || 0;
|
||||
// 使用销售人员录音总时长作为该条记录的时长
|
||||
const salesDuration = item.salesTotalDuration || 0;
|
||||
// 获取录音条数
|
||||
const recordingCount = item.salesRecordingCount || 0;
|
||||
|
||||
// 格式化日期
|
||||
const date = this.formatDate(item.statisticsDate);
|
||||
@@ -437,7 +440,8 @@ export default {
|
||||
return {
|
||||
date: date,
|
||||
description: description,
|
||||
duration: this.formatDuration(dealershipDuration),
|
||||
duration: this.formatDuration(salesDuration),
|
||||
recordingCount: `${recordingCount} 条`,
|
||||
// 保存原始数据,方便后续使用
|
||||
rawData: item
|
||||
};
|
||||
@@ -454,24 +458,14 @@ export default {
|
||||
this.totalDuration = this.formatDuration(totalDurationMinutes);
|
||||
this.dataList = formattedList;
|
||||
|
||||
// 计算今日录音时长(从统计数据中查找今天的记录)
|
||||
const today = new Date();
|
||||
const todayStr = this.formatDate(today.toISOString());
|
||||
const todayItem = statisticsList.find(item => {
|
||||
const itemDate = this.formatDate(item.statisticsDate);
|
||||
return itemDate === todayStr;
|
||||
});
|
||||
|
||||
if (todayItem) {
|
||||
// 今日时长使用该日期的门店录音总时长
|
||||
this.todayDuration = this.formatDuration(todayItem.dealershipTotalDuration || 0);
|
||||
} else {
|
||||
this.todayDuration = '0 分钟';
|
||||
}
|
||||
// 获取录音总条数(使用第一条记录的 salesRecordingCountStatistic 或 salesRecordingCount)
|
||||
// 注意:如果后端返回的是 salesRecordingCount,则使用该字段;如果是 salesRecordingCountStatistic,则使用该字段
|
||||
const recordingCount = firstItem.salesRecordingCountStatistic || firstItem.salesRecordingCount || 0;
|
||||
this.recordingCount = String(recordingCount);
|
||||
|
||||
console.log('[RecordingDuration] 数据处理完成:', {
|
||||
totalDuration: this.totalDuration,
|
||||
todayDuration: this.todayDuration,
|
||||
recordingCount: this.recordingCount,
|
||||
dataListCount: this.dataList.length,
|
||||
statisticsListLength: statisticsList.length
|
||||
});
|
||||
@@ -756,6 +750,13 @@ export default {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #007aff;
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.item-count {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #666666;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user