维度分析

This commit is contained in:
ZLI263
2025-10-01 17:59:34 +08:00
parent 89f3c5bfcc
commit 655dc2b2d3

View File

@@ -0,0 +1,397 @@
<template>
<div class="app-container">
<!-- 查询条件区域 -->
<el-card class="filter-container" shadow="never">
<el-form ref="queryForm" :model="queryParams" :inline="true" label-width="100px">
<el-form-item label="工作流ID">
<el-input
v-model="queryParams.workflowId"
placeholder="请输入工作流ID"
clearable
style="width: 200px"
/>
</el-form-item>
<el-form-item label="状态">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
<el-option label="全部" value="" />
<el-option label="进行中" value="进行中" />
<el-option label="已完成" value="已完成" />
<el-option label="已失败" value="已失败" />
</el-select>
</el-form-item>
<el-form-item label="销售人员">
<el-input
v-model="queryParams.salesName"
placeholder="请输入销售人员姓名"
clearable
style="width: 200px"
/>
</el-form-item>
<el-form-item label="经销商">
<el-input
v-model="queryParams.dealershipName"
placeholder="请输入经销商名称"
clearable
style="width: 200px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">筛选</el-button>
<el-button icon="el-icon-delete" @click="resetQuery">清空</el-button>
</el-form-item>
</el-form>
</el-card>
<!-- 数据表格区域 -->
<el-card class="table-container" shadow="never">
<el-table
v-loading="loading"
:data="topSalesList"
style="width: 100%"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="序号" type="index" width="50" />
<el-table-column label="工作流ID" prop="workflowId" min-width="150" />
<el-table-column label="销售人员" prop="salesName" min-width="120" />
<el-table-column label="销售电话" prop="salesPhone" min-width="120" />
<el-table-column label="经销商" prop="dealershipName" min-width="150" />
<el-table-column label="经销商电话" prop="dealershipPhone" min-width="120" />
<el-table-column label="状态" prop="status" min-width="100">
<template slot-scope="scope">
<el-tag :type="getStatusType(scope.row.status)">
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="自然度评分" prop="naturalnessScore" min-width="120" />
<el-table-column label="连贯性评分" prop="coherenceScore" min-width="120" />
<el-table-column label="流畅度评分" prop="fluencyScore" min-width="120" />
<el-table-column label="总用时(秒)" prop="elapsedTime" min-width="120" />
<el-table-column label="创建时间" prop="createdAt" min-width="150" />
<el-table-column label="操作" width="200" fixed="right">
<template slot-scope="scope">
<el-button type="text" size="small" @click="handleView(scope.row)">查看详情</el-button>
<el-button type="text" size="small" @click="handleExport(scope.row)">导出</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<el-pagination
:current-page="queryParams.current"
:page-sizes="[10, 20, 50, 100]"
:page-size="queryParams.size"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
style="margin-top: 20px; text-align: right;"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
<!-- 详情对话框 -->
<el-dialog
title="TopSales评分详情"
:visible.sync="detailDialogVisible"
width="800px"
@close="handleDetailDialogClose"
>
<div v-if="currentRecord">
<el-descriptions :column="2" border>
<el-descriptions-item label="工作流ID">{{ currentRecord.workflowId }}</el-descriptions-item>
<el-descriptions-item label="状态">
<el-tag :type="getStatusType(currentRecord.status)">{{ currentRecord.status }}</el-tag>
</el-descriptions-item>
<el-descriptions-item label="销售人员">{{ currentRecord.salesName || '-' }}</el-descriptions-item>
<el-descriptions-item label="销售电话">{{ currentRecord.salesPhone || '-' }}</el-descriptions-item>
<el-descriptions-item label="经销商">{{ currentRecord.dealershipName || '-' }}</el-descriptions-item>
<el-descriptions-item label="经销商电话">{{ currentRecord.dealershipPhone || '-' }}</el-descriptions-item>
<el-descriptions-item label="自然度评分">{{ currentRecord.naturalnessScore }}</el-descriptions-item>
<el-descriptions-item label="连贯性评分">{{ currentRecord.coherenceScore }}</el-descriptions-item>
<el-descriptions-item label="流畅度评分">{{ currentRecord.fluencyScore }}</el-descriptions-item>
<el-descriptions-item label="顾问积极性评分">{{ currentRecord.advisorAggressivenessScore }}</el-descriptions-item>
<el-descriptions-item label="顾问一致性评分">{{ currentRecord.advisorConsistencyScore }}</el-descriptions-item>
<el-descriptions-item label="问候接待评分">{{ currentRecord.greetingReceptionScore }}</el-descriptions-item>
<el-descriptions-item label="品牌介绍评分">{{ currentRecord.brandIntroductionScore }}</el-descriptions-item>
<el-descriptions-item label="客户需求理解评分">{{ currentRecord.customerNeedsUnderstandingScore }}</el-descriptions-item>
<el-descriptions-item label="预算理解评分">{{ currentRecord.budgetUnderstandingScore }}</el-descriptions-item>
<el-descriptions-item label="推荐评分">{{ currentRecord.recommendationScore }}</el-descriptions-item>
<el-descriptions-item label="安全介绍评分">{{ currentRecord.safetyIntroductionScore }}</el-descriptions-item>
<el-descriptions-item label="健康环境介绍评分">{{ currentRecord.healthEnvironmentIntroductionScore }}</el-descriptions-item>
<el-descriptions-item label="技术介绍评分">{{ currentRecord.technologyIntroductionScore }}</el-descriptions-item>
<el-descriptions-item label="试驾邀请评分">{{ currentRecord.testDriveInvitationScore }}</el-descriptions-item>
<el-descriptions-item label="谈判成交评分">{{ currentRecord.negotiationDealScore }}</el-descriptions-item>
<el-descriptions-item label="总用时(秒)">{{ currentRecord.elapsedTime }}</el-descriptions-item>
<el-descriptions-item label="创建时间">{{ currentRecord.createdAt }}</el-descriptions-item>
</el-descriptions>
<!-- 显示原始内容 -->
<div style="margin-top: 20px;">
<h4>原始内容</h4>
<el-input
type="textarea"
:rows="6"
:value="currentRecord.srcContent"
readonly
/>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="detailDialogVisible = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { getTopSalesPage } from '@/api/sales'
export default {
name: 'DimensionAnalysis',
data() {
return {
loading: false,
topSalesList: [],
total: 0,
selectedIds: [],
// 查询参数
queryParams: {
current: 1,
size: 10,
workflowId: '',
status: '',
salesName: '',
dealershipName: ''
},
// 详情对话框
detailDialogVisible: false,
currentRecord: null
}
},
created() {
this.getList()
},
methods: {
// 获取列表数据
getList() {
this.loading = true
const params = { ...this.queryParams }
// 移除空值
Object.keys(params).forEach(key => {
if (params[key] === '' || params[key] === null || params[key] === undefined) {
delete params[key]
}
})
getTopSalesPage(params).then(response => {
console.log('TopSales列表响应:', response)
// 检查响应结构
if (response) {
// 如果响应直接是分页格式(根据您提供的后端数据格式)
if (response.records && Array.isArray(response.records)) {
console.log('检测到直接分页格式')
this.topSalesList = response.records
this.total = response.total || 0
if (response.current) {
this.queryParams.current = response.current
}
if (response.size) {
this.queryParams.size = response.size
}
} else if (response.data) {
console.log('检测到response.data字段')
// 如果响应有data字段
if (response.data.records && Array.isArray(response.data.records)) {
console.log('response.data是分页格式')
// 分页格式
this.topSalesList = response.data.records || []
this.total = response.data.total || 0
if (response.data.current) {
this.queryParams.current = response.data.current
}
if (response.data.size) {
this.queryParams.size = response.data.size
}
} else if (Array.isArray(response.data)) {
console.log('response.data是数组')
this.topSalesList = response.data
this.total = response.data.length
} else if (typeof response.data === 'object' && response.data.workflowId) {
console.log('response.data是TopSales对象')
// 单个TopSales对象
this.topSalesList = [response.data]
this.total = 1
} else {
console.log('response.data格式不匹配')
this.topSalesList = []
this.total = 0
}
} else if (Array.isArray(response)) {
console.log('响应直接是数组')
this.topSalesList = response
this.total = response.length
} else {
console.log('响应格式不匹配')
this.topSalesList = []
this.total = 0
}
} else {
console.log('响应为空')
this.$message.error('获取TopSales列表失败')
this.topSalesList = []
this.total = 0
}
console.log('最终topSalesList:', this.topSalesList)
console.log('最终total:', this.total)
this.loading = false
}).catch(error => {
console.error('获取TopSales列表失败:', error)
// 开发环境使用模拟数据
this.topSalesList = [
{
id: 1,
workflowId: 'WF-20250101-001',
salesName: '张三',
salesPhone: '13800138000',
dealershipName: '北京奔驰4S店',
dealershipPhone: '400-123-4567',
status: '已完成',
naturalnessScore: 85,
coherenceScore: 90,
fluencyScore: 88,
elapsedTime: 2.5,
createdAt: '2025-01-01 10:00:00'
},
{
id: 2,
workflowId: 'WF-20250101-002',
salesName: '李四',
salesPhone: '13800138001',
dealershipName: '上海奥迪4S店',
dealershipPhone: '400-123-4568',
status: '进行中',
naturalnessScore: 0,
coherenceScore: 0,
fluencyScore: 0,
elapsedTime: 0,
createdAt: '2025-01-01 11:00:00'
}
]
this.total = this.topSalesList.length
this.loading = false
})
},
// 获取状态类型
getStatusType(status) {
const statusMap = {
'succeeded': 'success',
'running': 'warning',
'failed': 'danger',
'已完成': 'success',
'进行中': 'warning',
'已失败': 'danger'
}
return statusMap[status] || 'info'
},
// 查询
handleQuery() {
this.queryParams.current = 1
this.getList()
},
// 重置查询
resetQuery() {
this.$refs.queryForm.resetFields()
this.queryParams = {
current: 1,
size: 10,
workflowId: '',
status: '',
salesName: '',
dealershipName: ''
}
this.getList()
},
// 选择变化
handleSelectionChange(selection) {
this.selectedIds = selection.map(item => item.id)
},
// 分页大小变化
handleSizeChange(val) {
this.queryParams.size = val
this.getList()
},
// 当前页变化
handleCurrentChange(val) {
this.queryParams.current = val
this.getList()
},
// 查看详情
handleView(row) {
this.currentRecord = row
this.detailDialogVisible = true
},
// 导出
handleExport(row) {
console.log('导出数据:', row)
this.$message.info('导出功能待实现')
},
// 详情对话框关闭
handleDetailDialogClose() {
this.currentRecord = null
}
}
}
</script>
<style scoped>
.filter-container {
margin-bottom: 20px;
}
.table-container {
margin-top: 20px;
}
.el-form-item {
margin-bottom: 15px;
}
.el-button--text {
padding: 0;
margin-right: 10px;
}
.el-button--text:last-child {
margin-right: 0;
}
.dialog-footer {
text-align: right;
}
.el-table .el-button--text {
font-size: 12px;
}
.el-table .el-button--text:hover {
color: #409EFF;
}
</style>