Browse Source

修复图表显示0的问题

reedliuqing_i 5 years ago
parent
commit
c553fade75

+ 1 - 1
src/views/projectManage/projectList/projectViewDetails.vue

@@ -37,7 +37,7 @@
               新建
               <i class="el-icon-arrow-down el-icon--right" />
             </el-button>
-            <el-dropdown-menu slot="dropdown" >
+            <el-dropdown-menu slot="dropdown">
               <el-dropdown-item @click.native="createDialogVisible = true">新建需求</el-dropdown-item>
               <el-dropdown-item @click.native="reated_task()">新建任务</el-dropdown-item>
             </el-dropdown-menu>

+ 18 - 2
src/views/projectManage/requirement/details/index.vue

@@ -371,7 +371,15 @@ export default {
             barWidth: '60%',
             label: {
               show: true,
-              position: 'inside'
+              position: 'inside',
+              formatter: function(params) {
+                // 如果值大于0 正常显示,否则不显示
+                if (params.value > 0) {
+                  return params.value
+                } else {
+                  return ''
+                }
+              }
             },
             data: []
           }
@@ -434,7 +442,15 @@ export default {
             barWidth: '60%',
             label: {
               show: true,
-              position: 'inside'
+              position: 'inside',
+              formatter: function(params) {
+                // 如果值大于0 正常显示,否则不显示
+                if (params.value > 0) {
+                  return params.value
+                } else {
+                  return ''
+                }
+              }
             },
             data: []
           }

+ 13 - 1
src/views/projectManage/taskList/taskViewDetails.vue

@@ -787,6 +787,10 @@ export default {
           xAxis: {
             type: 'category',
             data: this.echarts_name,
+            axisTick: {
+              alignWithLabel: true,
+              show: false
+            },
             axisLine: { show: true, lineStyle: { type: 'dashed' }}
           },
           yAxis: [
@@ -805,7 +809,15 @@ export default {
               itemStyle: { normal: { color: '#409EFF' }},
               label: {
                 show: true,
-                position: 'inside'
+                position: 'inside',
+                formatter: function(params) {
+                // 如果值大于0 正常显示,否则不显示
+                  if (params.value > 0) {
+                    return params.value
+                  } else {
+                    return ''
+                  }
+                }
               }
             }
           ]

+ 52 - 10
src/views/projectManage/version/list/index.vue

@@ -48,16 +48,20 @@
           :header-cell-style="{ background: '#6AB4FF', color: '#FFFFFF',textAlign: 'center'}"
           :cell-style="{textAlign: 'center'}"
         >
-          <el-table-column prop="priority" label="优先级" min-width="6%">
+          <el-table-column prop="priority" label="优先级" min-width="7%">
             <template v-slot="scope">
               <div class="div_priority" :style="{background: priorityColors[scope.row.priority%priorityColors.length]}">{{ 'P'+scope.row.priority }}</div>
             </template>
           </el-table-column>
-          <el-table-column prop="requirementName" label="需求名称" min-width="20%">
+          <el-table-column prop="requirementName" label="需求名称" min-width="30%">
             <template v-slot="scope">
-              <div style="cursor: pointer;" @click="getToRequirementDetails(scope.row.id)">
-                {{ scope.row.requirementName }}
-                <div v-if="scope.row.delay" class="div_requirement_name">{{ searchTitle.version +'版本已延期' }}</div>
+              <div>
+                <el-tooltip class="item" effect="dark" placement="bottom" :content="scope.row.requirementName" :disabled="scope.row.requirementName.length < 6">
+                  <div style="cursor: pointer;" @click="getToRequirementDetails(scope.row.id)">
+                    {{ getRequirementName(scope.row.requirementName) }}
+                    <div v-if="scope.row.delay" class="div_requirement_name">{{ searchTitle.version +'版本已延期' }}</div>
+                  </div>
+                </el-tooltip>
               </div>
             </template>
           </el-table-column>
@@ -81,7 +85,7 @@
               />
             </template>
           </el-table-column>
-          <el-table-column prop="statusInfoHealthyList" label="任务健康分布" min-width="30%">
+          <el-table-column prop="statusInfoHealthyList" label="任务健康分布" min-width="32%">
             <template v-slot="scope">
               <version-chart
                 :chart-id="'taskHealthCount' + scope.$index"
@@ -93,7 +97,7 @@
         </el-table>
         <el-pagination
           background
-          layout="->,total, sizes, prev, pager, next, jumper"
+          layout="->,total, prev, pager, next, jumper"
           :current-page="searchForm.curIndex"
           :page-size="searchForm.pageSize"
           :page-sizes="[15,30,45,total]"
@@ -141,7 +145,7 @@ export default {
         taskStageMap: {}
       },
       taskOptionTemplate: {
-        color: ['#69B3FF'],
+        color: ['#409EFF'],
         title: {
           show: false
         },
@@ -197,7 +201,15 @@ export default {
             barWidth: '60%',
             label: {
               show: true,
-              position: 'inside'
+              position: 'inside',
+              formatter: function(params) {
+                // 如果值大于0 正常显示,否则不显示
+                if (params.value > 0) {
+                  return params.value
+                } else {
+                  return ''
+                }
+              }
             },
             data: []
           }
@@ -261,7 +273,16 @@ export default {
             barWidth: '60%',
             label: {
               show: true,
-              position: 'inside'
+              position: 'inside',
+              formatter: function(params) {
+                // 如果值大于0 正常显示,否则不显示
+                if (params.value > 0) {
+                  console.log(params)
+                  return params.value
+                } else {
+                  return ''
+                }
+              }
             },
             data: []
           }
@@ -338,6 +359,7 @@ export default {
       this.taskOptionList = []
       for (const i in data) {
         const option = JSON.parse(JSON.stringify(this.taskOptionTemplate))
+        option.series[0].label.formatter = this.formatter
         for (const j in data[i].statusInfoCountList) {
           option.xAxis[0].data.push(data[i].statusInfoCountList[j].statusString)
           option.series[0].data.push(data[i].statusInfoCountList[j].count)
@@ -349,6 +371,7 @@ export default {
       this.taskHealthOptionList = []
       for (const i in data) {
         const option = JSON.parse(JSON.stringify(this.taskHealthOptionTemplate))
+        option.series[0].label.formatter = this.formatter
         for (const j in data[i].statusInfoHealthyList) {
           option.xAxis[0].data.push(data[i].statusInfoHealthyList[j].statusString)
           const item = {
@@ -362,6 +385,14 @@ export default {
         this.taskHealthOptionList.push(option)
       }
     },
+    formatter: function(params) {
+      // 如果值大于0 正常显示,否则不显示
+      if (params.value > 0) {
+        return params.value
+      } else {
+        return ''
+      }
+    },
     showAppClientEnum() {
       showAppClientEnum()
         .then(res => {
@@ -403,6 +434,16 @@ export default {
             this.$message.warning(res.msg)
           }
         })
+    },
+    getRequirementName(name) {
+      let requirementName = name
+      if (name) {
+        if (name.length > 5) {
+          requirementName = requirementName.substring(0, 6) + '......'
+        }
+      }
+      requirementName += ' '
+      return requirementName
     }
   }
 }
@@ -437,6 +478,7 @@ export default {
   margin: auto;
 }
 .div_requirement_name {
+  display: inline-block;
   width:fit-content;
   margin: auto;
   padding: 0px 5px 0 10px;