|
@@ -24,10 +24,10 @@
|
|
|
<!-- 统计维度选择 -->
|
|
<!-- 统计维度选择 -->
|
|
|
<el-col :span="4">
|
|
<el-col :span="4">
|
|
|
<el-form-item label="统计维度">
|
|
<el-form-item label="统计维度">
|
|
|
- <el-select
|
|
|
|
|
- v-model="queryParams.dimension"
|
|
|
|
|
- placeholder="请选择统计维度"
|
|
|
|
|
- @change="handleDimensionChange"
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="queryParams.dimension"
|
|
|
|
|
+ placeholder="请选择统计维度"
|
|
|
|
|
+ @change="handleDimensionChange"
|
|
|
clearable
|
|
clearable
|
|
|
style="width: 100%">
|
|
style="width: 100%">
|
|
|
<el-option label="个人" :value="1"></el-option>
|
|
<el-option label="个人" :value="1"></el-option>
|
|
@@ -95,9 +95,9 @@
|
|
|
<el-table-column prop="companyName" label="公司名称"/>
|
|
<el-table-column prop="companyName" label="公司名称"/>
|
|
|
<el-table-column prop="deptName" label="部门名称" v-if="showDeptNameColumn" />
|
|
<el-table-column prop="deptName" label="部门名称" v-if="showDeptNameColumn" />
|
|
|
<!-- 根据维度决定是否显示人员姓名 -->
|
|
<!-- 根据维度决定是否显示人员姓名 -->
|
|
|
- <el-table-column prop="companyUserName" label="人员姓名" v-if="showUserNameColumn" />
|
|
|
|
|
|
|
+ <el-table-column prop="companyUserName" label="人员名称" v-if="showUserNameColumn" />
|
|
|
<!-- 更新以下列为新的字段名 -->
|
|
<!-- 更新以下列为新的字段名 -->
|
|
|
- <el-table-column prop="sendCount" label="发送数">
|
|
|
|
|
|
|
+ <el-table-column prop="sendCount" label="发课数">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.sendCount || 0 }}
|
|
{{ scope.row.sendCount || 0 }}
|
|
|
</template>
|
|
</template>
|
|
@@ -107,11 +107,23 @@
|
|
|
{{ scope.row.completeNum || 0 }}
|
|
{{ scope.row.completeNum || 0 }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <!-- 完播率 -->
|
|
|
|
|
+ <el-table-column prop="completeRate" label="完播率" width="100">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ {{ calculateCompleteRate(scope.row) }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="answerNum" label="答题数">
|
|
<el-table-column prop="answerNum" label="答题数">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.answerNum || 0 }}
|
|
{{ scope.row.answerNum || 0 }}
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <!-- 答题率 -->
|
|
|
|
|
+ <el-table-column prop="answerRate" label="答题率" width="100">
|
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
|
+ {{ calculateAnswerRate(scope.row) }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column prop="redPacketNum" label="红包领取数">
|
|
<el-table-column prop="redPacketNum" label="红包领取数">
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
{{ scope.row.redPacketNum || 0 }}
|
|
{{ scope.row.redPacketNum || 0 }}
|
|
@@ -270,7 +282,7 @@ export default {
|
|
|
return getSearchDeptInfo({ id: companyId }).then(response => {
|
|
return getSearchDeptInfo({ id: companyId }).then(response => {
|
|
|
const deptData = response.data || [];
|
|
const deptData = response.data || [];
|
|
|
this.deptList = deptData;
|
|
this.deptList = deptData;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果后端直接返回树形结构(第一层数据有children),直接使用
|
|
// 如果后端直接返回树形结构(第一层数据有children),直接使用
|
|
|
// 否则通过buildDeptTree构建树形结构
|
|
// 否则通过buildDeptTree构建树形结构
|
|
|
const hasTreeStructure = deptData.some(dept => dept.children && dept.children.length > 0);
|
|
const hasTreeStructure = deptData.some(dept => dept.children && dept.children.length > 0);
|
|
@@ -301,9 +313,9 @@ export default {
|
|
|
deptList.forEach(dept => {
|
|
deptList.forEach(dept => {
|
|
|
// 如果后端返回的数据中已经有children字段且有值,则使用后端的children
|
|
// 如果后端返回的数据中已经有children字段且有值,则使用后端的children
|
|
|
// 否则初始化为空数组
|
|
// 否则初始化为空数组
|
|
|
- deptMap[dept.deptId] = {
|
|
|
|
|
- ...dept,
|
|
|
|
|
- children: (dept.children && dept.children.length > 0) ? dept.children : []
|
|
|
|
|
|
|
+ deptMap[dept.deptId] = {
|
|
|
|
|
+ ...dept,
|
|
|
|
|
+ children: (dept.children && dept.children.length > 0) ? dept.children : []
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -399,7 +411,7 @@ export default {
|
|
|
getSearchDeptInfo({ id: companyId }).then(response => {
|
|
getSearchDeptInfo({ id: companyId }).then(response => {
|
|
|
const deptData = response.data || [];
|
|
const deptData = response.data || [];
|
|
|
this.deptList = deptData;
|
|
this.deptList = deptData;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// 如果后端直接返回树形结构(第一层数据有children),直接使用
|
|
// 如果后端直接返回树形结构(第一层数据有children),直接使用
|
|
|
// 否则通过buildDeptTree构建树形结构
|
|
// 否则通过buildDeptTree构建树形结构
|
|
|
const hasTreeStructure = deptData.some(dept => dept.children && dept.children.length > 0);
|
|
const hasTreeStructure = deptData.some(dept => dept.children && dept.children.length > 0);
|
|
@@ -476,6 +488,32 @@ export default {
|
|
|
|
|
|
|
|
handleCurrentChange(val) {
|
|
handleCurrentChange(val) {
|
|
|
this.currentPage = val;
|
|
this.currentPage = val;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 计算完播率:完课数 / 发送数
|
|
|
|
|
+ calculateCompleteRate(row) {
|
|
|
|
|
+ const sendCount = row.sendCount || 0;
|
|
|
|
|
+ const completeNum = row.completeNum || 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (sendCount === 0) {
|
|
|
|
|
+ return '0%';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const rate = (completeNum / sendCount * 100).toFixed(2);
|
|
|
|
|
+ return rate + '%';
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 计算答题率:答题数 / 完课数
|
|
|
|
|
+ calculateAnswerRate(row) {
|
|
|
|
|
+ const completeNum = row.completeNum || 0;
|
|
|
|
|
+ const answerNum = row.answerNum || 0;
|
|
|
|
|
+
|
|
|
|
|
+ if (completeNum === 0) {
|
|
|
|
|
+ return '0%';
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const rate = (answerNum / completeNum * 100).toFixed(2);
|
|
|
|
|
+ return rate + '%';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -532,4 +570,4 @@ export default {
|
|
|
padding: 20px 50px;
|
|
padding: 20px 50px;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|