Browse Source

缺陷统计

wangziqian 5 years ago
parent
commit
bb82058219

+ 8 - 0
src/api/statisticsApi/requireStatistics.js

@@ -73,3 +73,11 @@ export function getReqUnlockData(data) {
     data
   })
 }
+// 缺陷统计
+export function getBugStatisticData(data) {
+  return request({
+    url: TeamManagement + '/requirement/getBugStatisticData',
+    method: 'post',
+    data
+  })
+}

+ 84 - 0
src/views/quality/components/bugList.vue

@@ -0,0 +1,84 @@
+<template>
+  <section>
+    <div class="repair-list">
+      <div v-for="(item, index) in chartData.bugCount" :key="'time'+index" class="repair-item">
+        <span>{{ item.label }}</span>
+        <div class="repair-time">{{ item.countStr }}个</div>
+        <div v-show="Number(item.chainRatio)>=0" class="repair-up">环比:<i class="el-icon-caret-top" /><span>{{ item.chainRatio }}%</span></div>
+        <div v-show="Number(item.chainRatio)<0" class="repair-down">环比:<i class="el-icon-caret-bottom" /><span>{{ item.chainRatio.substring(1,item.chainRatio.length) }}%</span></div>
+        <div v-show="item.chainRatio === '--'" class="repair-up">环比:<span>{{ item.chainRatio }}%</span></div>
+      </div>
+    </div>
+    <div class="repair-list">
+      <div v-for="(item, index) in chartData.averageBugCount" :key="'time'+index" class="repair-item">
+        <span>{{ item.label }}</span>
+        <div class="repair-time">{{ item.countStr }}个</div>
+        <div v-show="Number(item.chainRatio)>=0" class="repair-up">环比:<i class="el-icon-caret-top" /><span>{{ item.chainRatio }}%</span></div>
+        <div v-show="Number(item.chainRatio)<0" class="repair-down">环比:<i class="el-icon-caret-bottom" /><span>{{ item.chainRatio.substring(1,item.chainRatio.length) }}%</span></div>
+        <div v-show="item.chainRatio === '--'" class="repair-up">环比:<span>{{ item.chainRatio }}%</span></div>
+      </div>
+    </div>
+    <div class="repair-list">
+      <div v-for="(item, index) in chartData.averageBugRepairTime" :key="'time'+index" class="repair-item">
+        <span>{{ item.label }}</span>
+        <div class="repair-time">{{ item.countStr }}个</div>
+        <div v-show="Number(item.chainRatio)>=0" class="repair-up">环比:<i class="el-icon-caret-top" /><span>{{ item.chainRatio }}%</span></div>
+        <div v-show="Number(item.chainRatio)<0" class="repair-down">环比:<i class="el-icon-caret-bottom" /><span>{{ item.chainRatio.substring(1,item.chainRatio.length) }}%</span></div>
+        <div v-show="item.chainRatio === '--'" class="repair-up">环比:<span>{{ item.chainRatio }}%</span></div>
+      </div>
+    </div>
+  </section>
+</template>
+<script>
+export default {
+  props: {
+    chartData: {
+      type: Object,
+      default: () => {},
+      required: false
+    }
+  },
+  watch: {
+    chartData: {
+      handler(newV) {
+        this.chartData = newV
+      },
+      immediate: true,
+      deep: true
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.repair-list {
+  display: flex;
+  justify-content: space-between;
+  width: 84%;
+  margin: 20px auto;
+  background:rgba(255,255,255,1);
+  box-shadow:0px 2px 8px rgba(0,0,0,0.15);
+  border-radius: 4px;
+  .repair-item {
+    position: relative;
+    width: 20%;
+    font-size: 12px;
+    font-weight: bold;
+    padding: 11px 17px 11px 17px;
+    display: flex;
+    padding-left: 60px;
+    flex-direction: column;
+    color: #909399;
+    .repair-time {
+      color: #303133;
+      font-size: 18px;
+      margin:25px 0;
+    }
+  }
+  .repair-up i , .repair-up span{
+    color:#F32850
+  }
+  .repair-down i, .repair-down span {
+    color:#9FFF39
+  }
+}
+</style>

+ 70 - 0
src/views/quality/components/changeRequireChart.vue

@@ -0,0 +1,70 @@
+<template>
+  <section>
+    <div class="chart-contain">
+      <el-table
+        :data="chartData"
+        border
+        max-height="400px"
+        :header-cell-style="{background: 'rgba(232,232,232,0.6)'}"
+        style="width: 100%"
+      >
+        <el-table-column
+          prop="id"
+          label="任务ID"
+          width="180"
+          align="center"
+        />
+        <el-table-column
+          prop="name"
+          label="任务名称"
+          width="180"
+          align="center"
+        />
+        <el-table-column
+          prop="count"
+          label="排期解锁次数"
+          align="center"
+        />
+        <el-table-column
+          label="解锁原因"
+          align="center"
+        >
+          <template slot-scope="scope">
+            <div v-for="(item,index) in scope.row.remarkList" :key="'item-require'+index" class="reason">{{ item }}</div>
+          </template>
+        </el-table-column>
+      </el-table>
+    </div>
+  </section>
+</template>
+<script>
+export default {
+  props: {
+    chartData: {
+      type: Array,
+      default: () => [],
+      required: false
+    }
+  },
+  watch: {
+    chartData: {
+      handler(newV) {
+        this.chartData = newV
+      },
+      immediate: true,
+      deep: true
+    }
+  }
+}
+</script>
+<style lang="scss" scoped>
+.chart-contain {
+  position: relative;
+  width: 84%;
+  margin: auto;
+  margin-top: 20px;
+}
+.reason {
+  text-align: left;
+}
+</style>

+ 44 - 8
src/views/quality/requireStatistics.vue

@@ -22,8 +22,6 @@
             @change="dateType = ''"
           />
         </el-form-item>
-      </el-form>
-      <el-form :model="chartForm" class="demo-form-inline" :inline="true">
         <el-form-item label="责任团队:">
           <el-select
             v-model="chartForm.team"
@@ -148,6 +146,14 @@
         <h3>需求方向分布图</h3>
         <belong-chart :chart-data="orntDistributeData" />
       </div> -->
+      <div class="chart-item">
+        <h3>排期发生变更的任务({{ changeTotal }})</h3>
+        <change-require-chart :chart-data="changeRequireData" />
+      </div>
+      <div class="chart-item">
+        <h3>缺陷统计</h3>
+        <bug-list :chart-data="bugListData" />
+      </div>
     </el-main>
   </el-container>
 </template>
@@ -164,7 +170,9 @@ import {
   getRequireRdDeliveryPeriodicData,
   getDistributeData,
   getStatusStayData,
-  getOrntDistributeData
+  getOrntDistributeData,
+  getReqUnlockData,
+  getBugStatisticData
 } from '@/api/statisticsApi/requireStatistics'
 import statusChart from './components/statusChart'
 import tendencyChart from './components/tendencyChart'
@@ -173,6 +181,8 @@ import developmentCycle from './components/developmentCycle'
 import distributionChart from './components/distributionChart'
 import statusStayChart from './components/statusStayChart'
 // import belongChart from './components/belongChart'
+import changeRequireChart from './components/changeRequireChart'
+import bugList from './components/bugList'
 export default {
   components: {
     statusChart,
@@ -180,8 +190,10 @@ export default {
     cycleStatistic,
     developmentCycle,
     distributionChart,
-    statusStayChart
+    statusStayChart,
     // belongChart
+    changeRequireChart,
+    bugList
   },
   data() {
     return {
@@ -213,7 +225,10 @@ export default {
       orntDistributeData: null, // 所属需求方向数据
       distributeData: null, // 需求分布图数据
       statusStayData: null, // 状态停留图数据
-      moduleDistribute: null // 模块分布图数据
+      moduleDistribute: null, // 模块分布图数据
+      changeRequireData: null, // 排期变更需求数据
+      changeTotal: 0, // 变更总数
+      bugListData: {} // 缺陷统计数据
     }
   },
   computed: {
@@ -258,9 +273,6 @@ export default {
     this.getTeamList()
     this.getRequireDirection()
   },
-  mounted() {
-    this.onSubmit()
-  },
   methods: {
     onSubmit() {
       if (this.activeTab === '2' && this.distributeStatus === 1) {
@@ -274,6 +286,8 @@ export default {
       this.getOrntDistributeData()
       this.getDistributeData()
       this.getStatusStayData()
+      this.getReqUnlockData()
+      this.getBugStatisticData()
     },
     setDate(type) { // 日期筛选
       let startDate = null
@@ -395,6 +409,28 @@ export default {
       }
       bfs(arr)
       return { children: arr, name: '总量', count: num }
+    },
+    async getReqUnlockData() { // 排期发生变更的需求
+      const params = {
+        ...this.globalParams,
+        type: Number(this.activeTab),
+        distributeType: this.distributeStatus
+      }
+      const res = await getReqUnlockData(params)
+      if (res.code === 200) {
+        this.changeRequireData = res.data || []
+        this.changeRequireData.map(item => {
+          this.changeTotal += item.count
+        })
+      }
+    },
+    async getBugStatisticData() { // 缺陷统计
+      const params = {
+        ...this.globalParams,
+        type: Number(this.activeTab)
+      }
+      const res = await getBugStatisticData(params)
+      if (res.code === 200) this.bugListData = res.data
     }
   }
 }