Przeglądaj źródła

统计页面修改

Guos 1 tydzień temu
rodzic
commit
615e3dcf04

+ 38 - 0
src/views/his/statistics/comprehensiveStatistics.vue

@@ -107,11 +107,23 @@
             {{ scope.row.completeNum || 0 }}
           </template>
         </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="答题数">
           <template slot-scope="scope">
             {{ scope.row.answerNum || 0 }}
           </template>
         </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="红包领取数">
           <template slot-scope="scope">
             {{ scope.row.redPacketNum || 0 }}
@@ -476,6 +488,32 @@ export default {
 
     handleCurrentChange(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 + '%';
     }
   }
 };