feat(销售时间线): 添加全部录音按钮及处理逻辑
新增全部录音按钮并实现其点击事件处理逻辑,同时将API端点从本地地址改为生产环境地址。处理函数结构与未归属录音类似,但调用不同的API接口获取数据。
This commit is contained in:
@@ -6,7 +6,8 @@
|
|||||||
<span style="font-size: 14px;">客户转化全流程跟踪</span>
|
<span style="font-size: 14px;">客户转化全流程跟踪</span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button @click="handleUnassignedRecordingsClick" class="unassigned-recordings-btn">尚未归属录音</button>
|
<button @click="handleUnassignedRecordingsClick" class="unassigned-recordings-btn" style="margin-right: 10px;">尚未归属录音</button>
|
||||||
|
<button @click="handleAllRecordingsClick" class="unassigned-recordings-btn">全部录音</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -432,7 +433,66 @@ const handleUnassignedRecordingsClick = async () => {
|
|||||||
// 优先使用路由参数,其次是 Pinia store 中的用户信息,最后是备用值
|
// 优先使用路由参数,其次是 Pinia store 中的用户信息,最后是备用值
|
||||||
const user_name = routeParams.user_name || userStore.userInfo?.username || 'example_user';
|
const user_name = routeParams.user_name || userStore.userInfo?.username || 'example_user';
|
||||||
|
|
||||||
const response = await axios.post('http://192.168.15.121:8890/api/v1/sales_timeline/get_sale_unassigned_call_info', {
|
const response = await axios.post('https://mldash.nycjy.cn/api/v1/sales_timeline/get_sale_unassigned_call_info', {
|
||||||
|
user_name: user_name
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('API Response:', response.data.data);
|
||||||
|
|
||||||
|
// --- 数据处理逻辑,以支持分类 ---
|
||||||
|
const apiData = response.data.data;
|
||||||
|
const tempCategorizedData = {}; // 临时对象
|
||||||
|
let uniqueId = 0;
|
||||||
|
|
||||||
|
for (const category in apiData) {
|
||||||
|
if (Object.prototype.hasOwnProperty.call(apiData, category)) {
|
||||||
|
const categoryData = apiData[category];
|
||||||
|
tempCategorizedData[category] = []; // 为每个分类创建一个空数组
|
||||||
|
|
||||||
|
if (categoryData && Array.isArray(categoryData.records)) {
|
||||||
|
categoryData.records.forEach(record => {
|
||||||
|
tempCategorizedData[category].push({ // 将记录添加到对应的分类数组中
|
||||||
|
id: uniqueId++,
|
||||||
|
name: `录音 ${uniqueId}`,
|
||||||
|
time: new Date(record.record_create_time).toLocaleString('zh-CN'),
|
||||||
|
type: record.record_tag,
|
||||||
|
downloadUrl: record.record_file_addr,
|
||||||
|
duration: record.call_duration ? `${record.call_duration} 分钟` : '未知',
|
||||||
|
score: record.score || '暂无',
|
||||||
|
details: record.report_content || '暂无详细报告内容。'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新状态
|
||||||
|
categorizedRecordings.value = tempCategorizedData;
|
||||||
|
recordingCategories.value = Object.keys(tempCategorizedData);
|
||||||
|
// 默认选中第一个Tab
|
||||||
|
if (recordingCategories.value.length > 0) {
|
||||||
|
selectedCategory.value = recordingCategories.value[0];
|
||||||
|
} else {
|
||||||
|
selectedCategory.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
showUnassignedRecordingsModal.value = true;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('API请求失败:', error);
|
||||||
|
alert('获取录音列表失败,请稍后再试。');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// --- 新增:处理全部录音按钮点击事件 ---
|
||||||
|
const handleAllRecordingsClick = async () => {
|
||||||
|
try {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
const routeParams = getRequestParams(); // 获取路由参数
|
||||||
|
|
||||||
|
// 优先使用路由参数,其次是 Pinia store 中的用户信息,最后是备用值
|
||||||
|
const user_name = routeParams.user_name || userStore.userInfo?.username || 'example_user';
|
||||||
|
|
||||||
|
const response = await axios.post('https://mldash.nycjy.cn/api/v1/sales_timeline/get_sale_all_call_info', {
|
||||||
user_name: user_name
|
user_name: user_name
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user