浏览代码

统计问题

wang_xy 1 年之前
父节点
当前提交
2bb394c40f
共有 1 个文件被更改,包括 22 次插入9 次删除
  1. 22 9
      src/views/zdsz/enginee/material/echarts_statistics/index.vue

+ 22 - 9
src/views/zdsz/enginee/material/echarts_statistics/index.vue

@@ -61,14 +61,24 @@ export default {
     },
     getsumStatus(district, index) {
       getsumStatus(district).then(res => {
-        console.log(this.dictLabelList[index], res)
-        let data = [{
-          value: parseInt(res.data.weishigong), name: '未施工'
-        }, {
-          value: parseInt(res.data.shigongzhong), name: '施工中'
-        }, {
-          value: parseInt(res.data.jungong), name: '竣工'
-        }]
+        let data;
+        if(res.data != null ){
+          data = [{
+            value: parseInt(res.data.weishigong), name: '未施工'
+          }, {
+            value: parseInt(res.data.shigongzhong), name: '施工中'
+          }, {
+            value: parseInt(res.data.jungong), name: '竣工'
+          }]
+        }else{
+          data = [{
+            value: 0, name: '未施工'
+          }, {
+            value: 0, name: '施工中'
+          }, {
+            value: 0, name: '竣工'
+          }]
+        }
         let color = ['#FFC881', '#5DB3FF', '#80D9AE'];
         let option = {
           title: {
@@ -76,7 +86,6 @@ export default {
             textStyle: {
               color: 'rgb(0 0 0)',
               fontSize: 18,
-              // fontWeight: 'normal',
             },
             x: 'center',
             y: '85%',
@@ -90,6 +99,10 @@ export default {
               name: '',
               type: 'pie',
               radius: '50%',
+              label: {
+                show: true,
+                formatter: '{b}:{c}',
+              },
               data: data,
               emphasis: {
                 itemStyle: {