Преглед изворни кода

优化新建月报时间轴

qinzhipeng_v@didiglobal.com пре 4 година
родитељ
комит
998d2de198

+ 36 - 33
src/views/monthlyReport/childrenPage/editReport/components/SubTitle.vue

@@ -1,7 +1,15 @@
 <template>
   <span><span class="query-bug">线下缺陷 - </span>
     <span v-for="(item, index) in reportTextList" :key="index">
-      <span class="query-bug" @click.stop="query(item, index)">{{ item.label }}</span>
+      <span class="query-bug" @click.stop="query(item, index)">
+        <span v-if="index === 0">新增bug{{ item.label }}个,</span>
+        <span v-if="index === 1">其中P0 bug数<span style="color: red;">{{ item.label }}</span>个,</span>
+        <span v-if="index === 2">P1 bug数{{ item.label }}个;</span>
+        <span v-if="index === 3">P0&P1平均修复时长{{ item.label }}H;</span>
+        <span v-if="index === 4">P0&P1 24小时修复率{{ item.label }}%;</span>
+        <span v-if="index === 5">reopen {{ item.label }}次。</span>
+      </span>
+      <!-- 新增bug 78个,其中P0 bug数XX(标红)个,P1 bug数XX个;P0&P1平均修复时长 23.8H;P0&P1 24小时修复率70.0%;reopen XX次。 -->
     </span>
     <span @click.stop>
       <drawer-all v-if="openDrawer" v-clickoutside="() => openDrawer = false" :drawer="openDrawer" :data="requireList" @clone="openDrawer = false" />
@@ -28,13 +36,15 @@ export default {
       reportTextList: [],
       openDrawer: false,
       requireList: {},
-      bugPriority: ['全部', 'P0&P1', 'P1以上'],
+      bugPriority: ['全部', 'P0', 'P1', 'P1以上'],
+      bugPrioritys: ['全部', 'P0&P1', 'P1以上'],
       bugHour: ['全部修复', '24小时内修复', '24小时未修复']
     }
   },
   watch: {
     subTitle: {
       handler(newV) {
+        console.log(newV, '数据')
         this.getReportList(newV)
       },
       immediate: true
@@ -47,31 +57,35 @@ export default {
         this.reportTextList = [...this.reportTextList, { label: item.label, option: item.reportBugs }]
       })
     },
+    setList(data, index) {
+      if (data.option[0]) {
+        const [q, w, e, r, t] = [[], [], [], [], []]
+        data.option.map(item => {
+          q.push(item.id) // 全部
+          if (item.priority === 0) { r.push(item.id) } // P0
+          if (item.priority === 1) { t.push(item.id) } // P1
+          if (item.priority < 2) { w.push(item.id) } // P0&P1
+          if (item.priority > 1) { e.push(item.id) } // P1以上
+        })
+        return index === 3 ? [q, w, e] : [q, r, t]
+      }
+    },
     query(data, index) {
-      const [q, w, e] = [[], [], []]
-      if (index <= 3) {
-        if (data.option[0]) {
-          data.option.map(item => {
-            q.push(item.id) // 全部
-            if (item.priority < 2) { w.push(item.id) } // P0&P1
-            if (item.priority > 1) { e.push(item.id) } // P1以上
-          })
-        }
-        let title = '新增缺陷'
-        if (index === 2 || index === 3) {
-          title = '缺陷修复时长'
-          index === 2 ? index = 0 : ''
-          index === 3 ? index = 1 : ''
-        }
-        const yaxis = [q, w, e]
-        this.requireList = { toType: '缺陷', xaxis: this.bugPriority, title: title, yaxis: yaxis, dataIndex: index }
-      } else if (index > 3) {
+      if (index <= 2) {
+        const yaxis = this.setList(data, index)
+        this.requireList = { toType: '缺陷', xaxis: this.bugPriority, title: '新增缺陷', yaxis: yaxis, dataIndex: index }
+      } else if (index === 3) {
+        const yaxis = this.setList(data, index)
+        this.requireList = { toType: '缺陷', xaxis: this.bugPrioritys, title: '缺陷修复时长', yaxis: yaxis, dataIndex: 0 }
+      } else if (index === 5) {
+        const yaxis = data.option.map(item => { return item.id })
+        this.requireList = { toType: '缺陷', title: '累计reopen', yaxis: yaxis }
+      } else if (index === 4) {
         let [one, tow, three] = [[], [], []]
         const [a, s, d, f, g, h, j, k, l] = [[], [], [], [], [], [], [], [], []]
         if (data.option[0]) {
           data.option.map(item => {
             if (item.isRepaired && item.repairTime < 24) { // 24小时内修复
-              this.setOption(item, one)
               f.push(item.id) // 全部
               if (item.priority < 2) { g.push(item.id) } // P0&P1
               if (item.priority > 1) { h.push(item.id) } // P1以上
@@ -89,21 +103,10 @@ export default {
             tow = [j, k, l]
           })
         }
-        if (index === 4 || index === 5) {
-          index === 4 ? index = 0 : ''
-          index === 5 ? index = 1 : ''
-        }
         const yaxis = [tow, one, three]
-        this.requireList = { toType: '缺陷', xaxis: this.bugHour, towTimeLine: this.bugPriority, title: '缺陷24小时修复', yaxis: yaxis, dataIndex: index }
+        this.requireList = { toType: '缺陷', xaxis: this.bugHour, towTimeLine: this.bugPrioritys, title: '缺陷24小时修复', yaxis: yaxis, dataIndex: 1 }
       }
       this.openDrawer = true
-    },
-    setOption(item, data) {
-      const [q, w, e] = [[], [], []]
-      q.push(item.id)
-      if (item.priority < 2) { w.push(item.id) }
-      if (item.priority > 1) { e.push(item.id) }
-      data = [q, w, e]
     }
   }
 }

+ 4 - 2
src/views/monthlyReport/components/monthlyEards.vue

@@ -15,8 +15,10 @@
         已完成:{{ data.finishNum }}
       </div>
       <div v-for="(i, v) in data.keyProblems" :key="v">
-        <span>{{ `${v + 1}、${i.name}` }}</span>
-        归属:<span>{{ i.team + '团队' || '无 ' }} - {{ i.charge || '无' }}</span>
+        <div v-if="i.team || i.charge">
+          <span>{{ `${v + 1}、${i.name}` }}</span>
+          归属:<span>{{ i.team ? i.team + '团队 - ' : '' }} {{ i.charge || '' }}</span>
+        </div>
       </div>
       <div v-for="(q, index) in data.returnBackDataList" :key="index">
         <span>{{ `${data.keyProblems.length + index + 1}、${q.name}` }}</span>

+ 6 - 4
src/views/quality/components/drawerAll.vue

@@ -190,10 +190,12 @@ export default {
       }
       this.$nextTick(() => { // 时间轴定位
         const dateId = document.getElementById('index')
-        dateId.scrollLeft = Number(this.defaultKey) * 109 - 60
-        if (this.Statistics.towTimeLine) {
-          const dateIds = document.getElementById('index1')
-          dateIds.scrollLeft = Number(this.defaultKey2) * 100 - 60
+        if (dateId) {
+          dateId.scrollLeft = Number(this.defaultKey) * 109 - 60
+          if (this.Statistics.towTimeLine) {
+            const dateIds = document.getElementById('index1')
+            dateIds.scrollLeft = Number(this.defaultKey2) * 100 - 60
+          }
         }
       })
     },