Browse Source

融入分析页面

181250114 3 years ago
parent
commit
60ac72a9f9

+ 5 - 3
src/components/Analysis/AnalysisGroupCard.vue

@@ -285,7 +285,7 @@ export default {
   },
 
   async mounted() {
-    // await this.getData();
+    await this.getData();
     await this.getAnalysis();
     this.getCommitPie();
     // this.getTestPie();
@@ -299,7 +299,8 @@ export default {
       try{
         let res = await getGroupAnalysis({
           params: {
-            user_id: this.$route.params.id,
+            // user_id: this.$route.params.id,
+            user_id: 1575,
           },
         });
         // console.log(res);
@@ -327,7 +328,8 @@ export default {
       try{
         let res1 = await getGroupScore({
           params: {
-            user_id: this.$route.params.id,
+            // user_id: this.$route.params.id,
+            user_id: 1575,
           }
         });
         // console.log(res1);

+ 327 - 0
src/components/Analysis/AnalysisStudentCard.vue

@@ -172,6 +172,61 @@
             </el-card>
             <el-button type="text" @click="showModel3">部署通过率</el-button>
         </el-card>
+        <el-dialog v-model="visible1">
+            <div
+                    class="righttop"
+                    ref="charts1"
+                    :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+            ></div>
+        </el-dialog>
+        <el-dialog v-model="visible2">
+            <div
+                    class="righttop"
+                    ref="charts2"
+                    :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+            ></div>
+        </el-dialog>
+        <el-dialog v-model="visible3">
+            <div
+                    class="righttop"
+                    ref="charts3"
+                    :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+            ></div>
+        </el-dialog>
+        <el-dialog v-model="visible4">
+            <div
+                    class="righttop"
+                    ref="charts4"
+                    :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+            ></div>
+        </el-dialog>
+        <el-dialog v-model="visible5">
+            <div
+                    class="righttop"
+                    ref="charts5"
+                    :style="{
+          width: '100%',
+          height: '280px',
+          background: 'rgba(255,0,0,0)',
+        }"
+            ></div>
+        </el-dialog>
     </div>
 </template>
 
@@ -210,6 +265,278 @@ export default {
       bonus:0.0,
     };
   },
+  async mounted() {
+    await this.getData();
+    this.getAnaylysis();
+  },
+  methods: {
+    async getData() {
+      try {
+        let res = await getStudentAnalysis({
+          params: {
+            // user_id: this.$route.params.id,
+            user_id: 1575,
+          },
+        });
+        // 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);
+      }
+      try{
+        let res1 = await getStudentScore({
+          params: {
+            // user_id: this.$route.params.id,
+            user_id: 1575,
+          }
+        });
+        // console.log(res1);
+        if(res1.success){
+          this.totalScore = res1.content.totalScore;
+          this.commitScore = res1.content.commitScore;
+          this.bugScore = res1.content.bugScore;
+          this.nodeScore = res1.content.nodeScore;
+          this.pipelineScore = res1.content.pipelineScore;
+          this.bonus = res1.content.bonus;
+        }
+      } catch (e) {
+        this.$message.error(e.message);
+      }
+    },
+    getAnaylysis() {
+      //部署信息图表
+      this.deployAnalysis.push({
+        value: this.pipeline.pipeline_deploy,
+        name: "部署成功次数",
+      });
+      this.deployAnalysis.push({
+        value: this.pipeline.pipline_failure,
+        name: "部署失败次数",
+      });
+      //commit信息图表
+      this.commitAnalysis.push({
+        value: this.commitMessage.feature_commit,
+        name: "feature_commit次数",
+      });
+      this.commitAnalysis.push({
+        value: this.commitMessage.buglist_commit,
+        name: "buglist_commit次数",
+      });
+      //test信息图表
+      this.testAnalysis.push({
+        value: this.test.test_concurrency_failure,
+        name: "接口测试失败次数",
+      });
+      this.testAnalysis.push({
+        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) => {
+        resolve();
+      });
+      newPromise.then(() => {
+        let myChart1 = echarts.init(this.$refs.charts1);
+        myChart1.setOption({
+          title: {
+            text: "commit占比信息",
+          },
+          grid: {
+            top: 90,
+          },
+          tooltip: {
+            trigger: "item",
+          },
+          series: [
+            {
+              name: "commit次数",
+              type: "pie", // 设置图表类型为饼图
+              radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+              data: this.commitAnalysis,
+            },
+          ],
+        });
+      });
+    },
+    initBarChart2() {
+      let newPromise = new Promise((resolve) => {
+        resolve();
+      });
+      newPromise.then(() => {
+        let myChart2 = echarts.init(this.$refs.charts2);
+        myChart2.setOption({
+          title: {
+            text: "接口测试通过率",
+          },
+          grid: {
+            top: 90,
+          },
+          tooltip: {
+            trigger: "item",
+          },
+          series: [
+            {
+              name: "测试次数",
+              type: "pie", // 设置图表类型为饼图
+              radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+              data: this.testAnalysis,
+            },
+          ],
+        });
+      });
+    },
+    initBarChart3() {
+      let newPromise = new Promise((resolve) => {
+        resolve();
+      });
+      newPromise.then(() => {
+        let myChart3 = echarts.init(this.$refs.charts3);
+        myChart3.setOption({
+          title: {
+            text: "部署通过率",
+          },
+          grid: {
+            top: 90,
+          },
+          tooltip: {
+            trigger: "item",
+          },
+          series: [
+            {
+              name: "部署次数",
+              type: "pie", // 设置图表类型为饼图
+              radius: "55%", // 饼图的半径,外半径为可视区尺寸(容器高宽中较小一项)的 55% 长度。
+              data: this.deployAnalysis,
+            },
+          ],
+        });
+      });
+    },
+    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;
+    },
+    showModel2() {
+      this.visible2 = true;
+    },
+    showModel3() {
+      this.visible3 = true;
+    },
+    showModel4() {
+      this.visible4 = true;
+    },
+    showModel5() {
+      this.visible5 = true;
+    },
+  },
+  watch: {
+    visible1: function (val) {
+      if (val) {
+        this.initBarChart1();
+      }
+    },
+    visible2: function (val) {
+      if (val) {
+        this.initBarChart2();
+      }
+    },
+    visible3: function (val) {
+      if (val) {
+        this.initBarChart3();
+      }
+    },
+    visible4: function (val) {
+      if (val) {
+        this.initBarChart4();
+      }
+    },
+    visible5: function (val) {
+      if (val) {
+        this.initBarChart5();
+      }
+    },
+  },
 };
 </script>