Przeglądaj źródła

新增bugList和treeNode的展示

181250114 4 lat temu
rodzic
commit
4ed14a9d39
2 zmienionych plików z 364 dodań i 80 usunięć
  1. 189 62
      src/views/DevGroupPage.vue
  2. 175 18
      src/views/DevStudentPage.vue

+ 189 - 62
src/views/DevGroupPage.vue

@@ -74,31 +74,67 @@
           </el-descriptions>
         </el-card>
       </el-card>
+
       <!-- 测试信息 -->
-      <el-card class="box-card" style="margin-top: 20px">
-        <div slot="header" class="clearfix">
-          <span>测试信息</span>
-        </div>
-        <el-card class="box-innercard">
-          <div slot="header" class="clearfix">
-            <span>接口测试</span>
-          </div>
-          <el-descriptions :column="2">
-            <el-descriptions-item label="接口测试总数">{{
-              test.test_times
-            }}</el-descriptions-item>
-            <el-descriptions-item label="接口测试执行次数">{{
-              test.test_concurrency_count
-            }}</el-descriptions-item>
-            <el-descriptions-item label="接口测试失败次数">{{
-              test.test_concurrency_failure
-            }}</el-descriptions-item>
-            <el-descriptions-item label="接口测试通过次数">{{
-              test.test_concurrency_success
-            }}</el-descriptions-item>
-          </el-descriptions>
+<!--      <el-card class="box-card" style="margin-top: 20px">-->
+<!--        <div slot="header" class="clearfix">-->
+<!--          <span>测试信息</span>-->
+<!--        </div>-->
+<!--        <el-card class="box-innercard">-->
+<!--          <div slot="header" class="clearfix">-->
+<!--            <span>接口测试</span>-->
+<!--          </div>-->
+<!--          <el-descriptions :column="2">-->
+<!--            <el-descriptions-item label="接口测试总数">{{-->
+<!--              test.test_times-->
+<!--            }}</el-descriptions-item>-->
+<!--            <el-descriptions-item label="接口测试执行次数">{{-->
+<!--              test.test_concurrency_count-->
+<!--            }}</el-descriptions-item>-->
+<!--            <el-descriptions-item label="接口测试失败次数">{{-->
+<!--              test.test_concurrency_failure-->
+<!--            }}</el-descriptions-item>-->
+<!--            <el-descriptions-item label="接口测试通过次数">{{-->
+<!--              test.test_concurrency_success-->
+<!--            }}</el-descriptions-item>-->
+<!--          </el-descriptions>-->
+<!--        </el-card>-->
+<!--      </el-card>-->
+
+        <!-- bug信息 -->
+        <el-card class="box-card" style="margin-top: 20px">
+            <div slot="header" class="clearfix">
+                <span>缺陷信息</span>
+            </div>
+            <el-descriptions :column="2">
+                <el-descriptions-item label="缺陷数目">{{
+                    bugList.bug_times
+                    }}</el-descriptions-item>
+                <el-descriptions-item label="高优先级缺陷数目">{{
+                    bugList.high_times
+                    }}</el-descriptions-item>
+                <el-descriptions-item label="已经修复的缺陷数目">{{
+                    bugList.finished_times
+                    }}</el-descriptions-item>
+            </el-descriptions>
+        </el-card>
+        <!-- treeNode信息 -->
+        <el-card class="box-card" style="margin-top: 20px">
+            <div slot="header" class="clearfix">
+                <span>需求树信息</span>
+            </div>
+            <el-descriptions :column="2">
+                <el-descriptions-item label="需求节点数目">{{
+                    treeNode.treeNode_times
+                    }}</el-descriptions-item>
+                <el-descriptions-item label="高优先级需求数目">{{
+                    treeNode.high_treeNode_times
+                    }}</el-descriptions-item>
+                <el-descriptions-item label="已经完成的需求数目">{{
+                    treeNode.finished_treeNode_times
+                    }}</el-descriptions-item>
+            </el-descriptions>
         </el-card>
-      </el-card>
       <!-- 部署信息 -->
       <el-card class="box-card" style="margin-top: 20px">
         <div slot="header" class="clearfix">
@@ -116,21 +152,29 @@
           }}</el-descriptions-item>
         </el-descriptions>
       </el-card>
+
+
       <!-- 图表 -->
       <el-card class="box-card" style="margin-top: 20px">
         <el-row :gutter="20">
-          <el-col :span="8">
+          <el-col :span="6">
             <p class="table_font">commit贡献占比</p>
             <div id="main1" class="pie"
           /></el-col>
-          <el-col :span="8">
-            <p class="table_font">接口测试贡献占比</p>
-            <div id="main2" class="pie"
-          /></el-col>
-          <el-col :span="8">
-            <p class="table_font">流水线部署贡献占比</p>
-            <div id="main3" class="pie"
-          /></el-col>
+            <el-col :span="6">
+                <p class="table_font">流水线部署贡献占比</p>
+                <div id="main2" class="pie"
+                />
+            </el-col>
+            <el-col :span="6">
+                <p class="table_font">缺陷贡献占比</p>
+                <div id="main3" class="pie"
+                /></el-col>
+            <el-col :span="6">
+                <p class="table_font">需求树贡献占比</p>
+                <div id="main4" class="pie"
+                />
+            </el-col>
         </el-row>
       </el-card>
     </div>
@@ -168,9 +212,15 @@ export default {
         // { name: "kcy", times: 2, proportion: 0.2 },
         // { name: "pyy", times: 6, proportion: 0.6 },
       ],
+      bugContribution: [],
+      treeContribution: [],
+
       commitPie: [],
       testPie: [],
       deployPie: [],
+      bugListPie: [],
+      treePie: [],
+
       arrange: {
         // total: 10,
         // pass: 20,
@@ -194,6 +244,9 @@ export default {
         //   "- fix: 修复登录页面的错误",
         // ],
       },
+      bugList: {},
+      treeNode: {},
+
       userList: [
         // { id: 11, name: "测试", number: "2222" },
         // { id: 12, name: "测试2", number: "2222" },
@@ -207,10 +260,12 @@ export default {
   },
   async mounted() {
     await this.getData();
-    this.getAnalysis();
+    await this.getAnalysis();
     this.getCommitPie();
-    this.getTestPie();
+    // this.getTestPie();
     this.getDeployPie();
+    this.getBugPie();
+    this.getTreePie();
   },
   methods: {
     async getData(){
@@ -232,6 +287,10 @@ export default {
           this.interfaceContribution = res.content.test.test_contribution;
           this.arrange = res.content.pipeline;
           this.pipelineContribution = res.content.pipeline.pipeline_contribution;
+          this.bugList = res.content.buglist;
+          this.bugContribution = res.content.buglist.bug_contribution;
+          this.treeNode = res.content.treeNode;
+          this.treeContribution = res.content.treeNode.treeNode_contribution;
         }
         // console.log("done");
         // console.log(this.commitContribution);
@@ -240,7 +299,7 @@ export default {
       }
     },
 
-    getAnalysis() {
+    async getAnalysis() {
       // console.log("analysis");
       // console.log(this.commitContribution);
       for (let i = 0; i < this.commitContribution.length; i++) {
@@ -261,7 +320,21 @@ export default {
           name: this.pipelineContribution[i].name,
         });
       }
+      for(let i = 0; i < this.bugContribution.length; i++) {
+          this.bugListPie.push({
+              value : this.bugContribution[i].times,
+              name: this.bugContribution[i].name,
+          })
+      }
+      // console.log(this.bugListPie);
+      for(let i = 0; i < this.treeContribution.length; i++) {
+          this.treePie.push({
+              value: this.treeContribution[i].times,
+              name: this.treeContribution[i].name,
+          })
+      }
     },
+
     getCommitPie() {
       // 绘制图表
       var myChart1 = echarts.init(document.getElementById("main1"));
@@ -290,35 +363,35 @@ export default {
       myChart1.setOption(option);
     },
 
-    getTestPie() {
-      var myChart2 = echarts.init(document.getElementById("main2"));
-      // 指定图表的配置项和数据
-      var option = {
-        title: {
-          // text: 'commit占比信息',
-        },
-        grid: {
-          top: 90,
-        },
-        tooltip: {
-          trigger: "item",
-        },
-        series: [
-          {
-            name: "测试次数",
-            center: ["50%", "40%"],
-            type: "pie", // 设置图表类型为饼图
-            radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
-            data: this.testPie,
-          },
-        ],
-      };
-      // 使用刚指定的配置项和数据显示图表。
-      myChart2.setOption(option);
-    },
+    // getTestPie() {
+    //   var myChart2 = echarts.init(document.getElementById("main2"));
+    //   // 指定图表的配置项和数据
+    //   var option = {
+    //     title: {
+    //       // text: 'commit占比信息',
+    //     },
+    //     grid: {
+    //       top: 90,
+    //     },
+    //     tooltip: {
+    //       trigger: "item",
+    //     },
+    //     series: [
+    //       {
+    //         name: "测试次数",
+    //         center: ["50%", "40%"],
+    //         type: "pie", // 设置图表类型为饼图
+    //         radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+    //         data: this.testPie,
+    //       },
+    //     ],
+    //   };
+    //   // 使用刚指定的配置项和数据显示图表。
+    //   myChart2.setOption(option);
+    // },
 
     getDeployPie() {
-      var myChart3 = echarts.init(document.getElementById("main3"));
+      var myChart3 = echarts.init(document.getElementById("main2"));
       // 指定图表的配置项和数据
       var option = {
         title: {
@@ -343,6 +416,60 @@ export default {
       // 使用刚指定的配置项和数据显示图表。
       myChart3.setOption(option);
     },
+
+      getBugPie() {
+          var myChart4 = echarts.init(document.getElementById("main3"));
+          // 指定图表的配置项和数据
+          var option = {
+              title: {
+                  // text: 'commit占比信息',
+              },
+              grid: {
+                  top: 90,
+              },
+              tooltip: {
+                  trigger: "item",
+              },
+              series: [
+                  {
+                      name: "提交缺陷次数",
+                      center: ["50%", "40 %"],
+                      type: "pie", // 设置图表类型为饼图
+                      radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+                      data: this.bugListPie,
+                  },
+              ],
+          };
+          // 使用刚指定的配置项和数据显示图表。
+          myChart4.setOption(option);
+      },
+
+      getTreePie() {
+          var myChart5 = echarts.init(document.getElementById("main4"));
+          // 指定图表的配置项和数据
+          var option = {
+              title: {
+                  // text: 'commit占比信息',
+              },
+              grid: {
+                  top: 90,
+              },
+              tooltip: {
+                  trigger: "item",
+              },
+              series: [
+                  {
+                      name: "提交需求次数",
+                      center: ["50%", "40 %"],
+                      type: "pie", // 设置图表类型为饼图
+                      radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+                      data: this.treePie,
+                  },
+              ],
+          };
+          // 使用刚指定的配置项和数据显示图表。
+          myChart5.setOption(option);
+      },
   },
 };
 </script>

+ 175 - 18
src/views/DevStudentPage.vue

@@ -65,31 +65,68 @@
       </el-card>
       <el-button type="text" @click="showModel1">commit组成信息</el-button>
     </el-card>
-    <!-- 测试信息 -->
+<!--    &lt;!&ndash; 测试信息 &ndash;&gt;-->
+<!--    <el-card class="box-card" style="margin-top: 20px">-->
+<!--      <div slot="header" class="clearfix">-->
+<!--        <span>测试信息</span>-->
+<!--      </div>-->
+<!--      <el-card class="box-innercard">-->
+<!--        <div slot="header" class="clearfix">-->
+<!--          <span>接口测试</span>-->
+<!--        </div>-->
+<!--        <el-descriptions :column="2">-->
+<!--          <el-descriptions-item label="接口测试总数">{{-->
+<!--            test.test_times-->
+<!--          }}</el-descriptions-item>-->
+<!--          <el-descriptions-item label="接口测试执行次数">{{-->
+<!--            test.test_concurrency_count-->
+<!--          }}</el-descriptions-item>-->
+<!--          <el-descriptions-item label="接口测试失败次数">{{-->
+<!--            test.test_concurrency_failure-->
+<!--          }}</el-descriptions-item>-->
+<!--          <el-descriptions-item label="接口测试通过次数">{{-->
+<!--            test.test_concurrency_success-->
+<!--          }}</el-descriptions-item>-->
+<!--        </el-descriptions>-->
+<!--      </el-card>-->
+<!--      <el-button type="text" @click="showModel2">接口测试通过率</el-button>-->
+<!--    </el-card>-->
+
+    <!-- bug信息 -->
     <el-card class="box-card" style="margin-top: 20px">
       <div slot="header" class="clearfix">
-        <span>测试信息</span>
+        <span>缺陷信息</span>
       </div>
-      <el-card class="box-innercard">
-        <div slot="header" class="clearfix">
-          <span>接口测试</span>
-        </div>
-        <el-descriptions :column="2">
-          <el-descriptions-item label="接口测试总数">{{
-            test.test_times
+      <el-descriptions :column="2">
+        <el-descriptions-item label="缺陷数目">{{
+          bugList.bug_times
           }}</el-descriptions-item>
-          <el-descriptions-item label="接口测试执行次数">{{
-            test.test_concurrency_count
+        <el-descriptions-item label="高优先级缺陷数目">{{
+          bugList.high_times
           }}</el-descriptions-item>
-          <el-descriptions-item label="接口测试失败次数">{{
-            test.test_concurrency_failure
+        <el-descriptions-item label="已经修复的缺陷数目">{{
+          bugList.finished_times
           }}</el-descriptions-item>
-          <el-descriptions-item label="接口测试通过次数">{{
-            test.test_concurrency_success
+      </el-descriptions>
+      <el-button type="text" @click="showModel4">缺陷修复率</el-button>
+    </el-card>
+    <!-- treeNode信息 -->
+    <el-card class="box-card" style="margin-top: 20px">
+      <div slot="header" class="clearfix">
+        <span>需求树信息</span>
+      </div>
+      <el-descriptions :column="2">
+        <el-descriptions-item label="需求节点数目">{{
+          treeNode.treeNode_times
           }}</el-descriptions-item>
-        </el-descriptions>
-      </el-card>
-      <el-button type="text" @click="showModel2">接口测试通过率</el-button>
+        <el-descriptions-item label="高优先级需求数目">{{
+          treeNode.high_treeNode_times
+          }}</el-descriptions-item>
+        <el-descriptions-item label="已经完成的需求数目">{{
+          treeNode.finished_treeNode_times
+          }}</el-descriptions-item>
+      </el-descriptions>
+      <el-button type="text" @click="showModel5">需求完成率</el-button>
     </el-card>
     <!-- 部署信息 -->
     <el-card class="box-card" style="margin-top: 20px">
@@ -142,6 +179,28 @@
         }"
       ></div>
     </el-dialog>
+    <el-dialog :visible.sync="visible4">
+      <div
+              class="righttop"
+              ref="charts4"
+              :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+      ></div>
+    </el-dialog>
+    <el-dialog :visible.sync="visible5">
+      <div
+              class="righttop"
+              ref="charts5"
+              :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+      ></div>
+    </el-dialog>
   </Layout>
 </template>
 
@@ -167,6 +226,13 @@ export default {
       user: {},
       test: {},
       commitMessage: {},
+      visible4: false,
+      bugAnalysis: [],
+      bugList:{},
+      visible5: false,
+      treeAnalysis:[],
+      treeNode:{},
+      //项目列表
       productList: [],
     };
   },
@@ -185,12 +251,15 @@ export default {
             user_id: this.$route.params.id,
           },
         });
+        // console.log(res);
         if (res.success) {
           this.user = res.content;
           this.productList = res.content.projects;
           this.commitMessage = res.content.commit;
           this.test = res.content.test;
+          this.bugList = res.content.buglist;
           this.pipeline = res.content.pipeline;
+          this.treeNode = res.content.treeNode;
         }
       } catch (e) {
         this.$message.error(e.message);
@@ -224,6 +293,24 @@ export default {
         value: this.test.test_concurrency_success,
         name: "接口测试通过次数",
       });
+      //bug信息图表
+      this.bugAnalysis.push({
+        value: this.bugList.finished_times,
+        name: "已完成的缺陷数目",
+      });
+      this.bugAnalysis.push({
+        value: (this.bugList.bug_times - this.bugList.finished_times),
+        name: "未完成的缺陷数目",
+      });
+      //需求信息图表
+      this.treeAnalysis.push({
+        value: this.treeNode.finished_treeNode_times,
+        name: "已完成的需求数目",
+      });
+      this.treeAnalysis.push({
+        value: (this.treeNode.treeNode_times - this.treeNode.finished_treeNode_times),
+        name: "未完成的需求数目",
+      })
     },
     initBarChart1() {
       let newPromise = new Promise((resolve) => {
@@ -306,6 +393,60 @@ export default {
         });
       });
     },
+    initBarChart4() {
+      let newPromise = new Promise((resolve) => {
+        resolve();
+      });
+      newPromise.then(() => {
+        let myChart4 = echarts.init(this.$refs.charts4);
+        myChart4.setOption({
+          title: {
+            text: "缺陷修复率",
+          },
+          grid: {
+            top: 90,
+          },
+          tooltip: {
+            trigger: "item",
+          },
+          series: [
+            {
+              name: "缺陷数目",
+              type: "pie", // 设置图表类型为饼图
+              radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+              data: this.bugAnalysis,
+            },
+          ],
+        });
+      });
+    },
+    initBarChart5() {
+      let newPromise = new Promise((resolve) => {
+        resolve();
+      });
+      newPromise.then(() => {
+        let myChart5 = echarts.init(this.$refs.charts5);
+        myChart5.setOption({
+          title: {
+            text: "需求完成率",
+          },
+          grid: {
+            top: 90,
+          },
+          tooltip: {
+            trigger: "item",
+          },
+          series: [
+            {
+              name: "需求数目",
+              type: "pie", // 设置图表类型为饼图
+              radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+              data: this.treeAnalysis,
+            },
+          ],
+        });
+      });
+    },
     showModel1() {
       this.visible1 = true;
     },
@@ -315,6 +456,12 @@ export default {
     showModel3() {
       this.visible3 = true;
     },
+    showModel4() {
+      this.visible4 = true;
+    },
+    showModel5() {
+      this.visible5 = true;
+    },
   },
   watch: {
     visible1: function (val) {
@@ -332,6 +479,16 @@ export default {
         this.initBarChart3();
       }
     },
+    visible4: function (val) {
+      if (val) {
+        this.initBarChart4();
+      }
+    },
+    visible5: function (val) {
+      if (val) {
+        this.initBarChart5();
+      }
+    },
   },
 };
 </script>