靳炳淑 hace 6 años
padre
commit
2db531cee2

+ 1 - 27
src/views/student/Code/ProjectDetail/Statistics.vue

@@ -102,9 +102,7 @@ export default {
         { field: "commitMessage", label: "git提交部分规范情况得分" },
         { field: "score", label: "总评" },
         { field: "tolerateCommit", label: "剩余可允许的不规范提交次数" }
-      ],
-      defaultOpenedDetails: [1],
-      showDetailIcon: true
+      ]
     };
   },
   methods: {
@@ -175,16 +173,6 @@ export default {
       this.statistics.functionalTestFail
     ];
 
-    // this.data = [
-    //   { id: "functionScore", score: statistics.functionScore },
-    //   { id: "prodUnitScore", score: statistics.prodUnitScore },
-    //   { id: "otherUnitScore", score: statistics.otherUnitScore },
-    //   { id: "branch", score: statistics.branch },
-    //   { id: "commitMessage", score: statistics.commitMessage },
-    //   { id: "score", score: statistics.score },
-    //   { id: "tolerateCommit", score: statistics.tolerateCommit }
-    // ]; // score table
-
     this.drawChart(this.buildChartDOM, this.buildChartData);
     this.drawChart(this.prodUTChartDOM, this.prodUTChartData);
     this.drawChart(this.otherUTChartDOM, this.otherUTChartData);
@@ -201,25 +189,11 @@ export default {
         tolerateCommit: this.statistics.tolerateCommit
       }
     ];
-    this.$forceUpdate();
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.score-box {
-  display: flex;
-  flex-wrap: wrap;
-  .card-box {
-    margin: 20px 20px;
-    width: 160px;
-  }
-  .score-text {
-    margin-left: 12px;
-    font-weight: bold;
-  }
-}
-
 .chart-box {
   .h2 {
     font-weight: bolder;

+ 72 - 36
src/views/teacher/Code/ProjectDetail/Statistics.vue

@@ -1,26 +1,54 @@
 <template>
   <div>
     <!--得分情况-->
-    <div class="score-box">
-      <div class="card-box">
-        <card>
-          git分支部分规范情况得分
-          <span class="score-text">{{ statistics.branch }}</span>
-        </card>
-      </div>
-      <div class="card-box">
-        <card>
-          git提交部分规范情况得分
-          <span class="score-text">{{ statistics.commitMessage }}</span>
-        </card>
-      </div>
-      <div class="card-box">
-        <card>
-          剩余可允许的不规范提交次数
-          <span class="score-text">{{ statistics.tolerateCommit }}</span>
-        </card>
-      </div>
-    </div>
+    <!--score table-->
+    <section>
+      <b-table :data="data" ref="table">
+        <template slot-scope="props">
+          <b-table-column field="functionScore" label="功能测试得分" sortable>
+            {{ props.row.functionScore }}
+          </b-table-column>
+
+          <b-table-column
+            field="prodUnitScore"
+            label="生产环境单元测试得分"
+            sortable
+          >
+            {{ props.row.prodUnitScore }}
+          </b-table-column>
+
+          <b-table-column
+            field="otherUnitScore"
+            label="其他环境单元测试得分"
+            sortable
+          >
+            {{ props.row.otherUnitScore }}
+          </b-table-column>
+
+          <b-table-column field="branch" label="git分支规范得分" sortable>
+            {{ props.row.branch }}
+          </b-table-column>
+
+          <b-table-column
+            field="commitMessage"
+            label="git提交规范得分"
+            sortable
+          >
+            {{ props.row.commitMessage }}
+          </b-table-column>
+          <b-table-column
+            field="tolerateCommit"
+            label="剩余可允许的不规范提交次数"
+            sortable
+          >
+            {{ props.row.tolerateCommit }}
+          </b-table-column>
+          <b-table-column field="score" label="总评" sortable>
+            {{ props.row.score }}
+          </b-table-column>
+        </template>
+      </b-table>
+    </section>
 
     <!--构建情况-->
     <div class="chart-box">
@@ -47,13 +75,10 @@
 
 <script>
 import Chart from "chart.js";
-import Card from "@/components/Card";
 import { getCodeWorkStatistics } from "@/api/statistics";
 
 export default {
-  components: {
-    Card
-  },
+  components: {},
   props: {},
   data() {
     return {
@@ -66,7 +91,17 @@ export default {
       otherUTChartDOM: {},
       otherUTChartData: [],
       functionalTestChartDOM: {},
-      functionalTestChartData: []
+      functionalTestChartData: [],
+      data: [],
+      columns: [
+        { field: "functionScore", label: "功能测试得分" },
+        { field: "prodUnitScore", label: "生产环境单元测试得分" },
+        { field: "otherUnitScore", label: "其他环境单元测试得分" },
+        { field: "branch", label: "git分支部分规范情况得分" },
+        { field: "commitMessage", label: "git提交部分规范情况得分" },
+        { field: "score", label: "总评" },
+        { field: "tolerateCommit", label: "剩余可允许的不规范提交次数" }
+      ]
     };
   },
   methods: {
@@ -134,22 +169,23 @@ export default {
     this.drawChart(this.prodUTChartDOM, this.prodUTChartData);
     this.drawChart(this.otherUTChartDOM, this.otherUTChartData);
     this.drawChart(this.functionalTestChartDOM, this.functionalTestChartData);
+    this.data = [
+      {
+        id: "0",
+        functionScore: this.statistics.functionScore,
+        prodUnitScore: this.statistics.prodUnitScore,
+        otherUnitScore: this.statistics.otherUnitScore,
+        branch: this.statistics.branch,
+        commitMessage: this.statistics.commitMessage,
+        score: this.statistics.score,
+        tolerateCommit: this.statistics.tolerateCommit
+      }
+    ];
   }
 };
 </script>
 
 <style lang="scss" scoped>
-.score-box {
-  display: flex;
-  .card-box {
-    margin: 0 20px;
-  }
-  .score-text {
-    margin-left: 12px;
-    font-weight: bold;
-  }
-}
-
 .chart-box {
   .h2 {
     font-weight: bolder;