Browse Source

更新 饼图渲染逻辑

王智慧 3 years ago
parent
commit
c3ba30c3aa
1 changed files with 9 additions and 3 deletions
  1. 9 3
      src/views/index/Index.vue

+ 9 - 3
src/views/index/Index.vue

@@ -440,7 +440,13 @@ function drawPie(type) {
     chartDom.value = document.getElementById("pie");
     myChart.value = echarts.init(chartDom.value);
   }
-
+  if (
+    indexData.value.finshDiscTons == 0 &&
+    indexData.value.unfinshDiscTons == 0
+  ) {
+    myChart.value.clear();
+    return;
+  }
   let option;
   option = {
     grid: {
@@ -456,8 +462,8 @@ function drawPie(type) {
         type: "pie",
         radius: ["60%", "85%"],
         data: [
-          { value: indexData.value.finshDiscTons || 0, name: "已卸货吨位" },
-          { value: indexData.value.unfinshDiscTons || 0, name: "剩余卸货吨位" },
+          { value: indexData.value.finshDiscTons, name: "已卸货吨位" },
+          { value: indexData.value.unfinshDiscTons, name: "剩余卸货吨位" },
         ],
         emphasis: {
           itemStyle: {