فهرست منبع

设备相关展示增加动态获取数据

xiaost 2 سال پیش
والد
کامیت
fe5b34865c
2فایلهای تغییر یافته به همراه60 افزوده شده و 51 حذف شده
  1. 1 1
      src/components/echart/bottom/bottomLeft2Chart/chart.vue
  2. 59 50
      src/views/centerRight2.vue

+ 1 - 1
src/components/echart/bottom/bottomLeft2Chart/chart.vue

@@ -138,7 +138,7 @@ export default {
     },
     async getdata() {
       //20220211 -+formatDate(new Date()
-      await this.$http.get("kanban/datalist.action?caller=WCDAYTURNOUT&_noc=1&page=1&pageSize=100&condition=sp_ymd=20220211")
+      await this.$http.get("kanban/datalist.action?caller=WCDAYTURNOUT&_noc=1&page=1&pageSize=100&condition=1=1")
               .then((result)=>{
                         let dataList = JSON.parse(result.data.data);
                         let xAxis0 = new Array();

+ 59 - 50
src/views/centerRight2.vue

@@ -27,63 +27,72 @@ export default {
   data() {
     return {
       config: {
-        data: [
-          {
-            name: '南阳',
-            value: 167
-          },
-          {
-            name: '周口',
-            value: 67
-          },
-          {
-            name: '漯河',
-            value: 123
-          },
-          {
-            name: '郑州',
-            value: 55
-          },
-          {
-            name: '西峡',
-            value: 98
-          }
-        ]
+        data: []
       },
       // 通过率和达标率的组件复用数据
-            rate: [
-              {
-                id: 'centerRate1',
-                tips: 60,
-                colorData: {
-                  textStyle: '#3fc0fb',
-                  series: {
-                    color: ['#00bcd44a', 'transparent'],
-                    dataColor: {
-                      normal: '#03a9f4',
-                      shadowColor: '#97e2f5'
-                    }
-                  }
-                }
-              },
-              {
-                id: 'centerRate2',
-                tips: 40,
-                colorData: {
-                  textStyle: '#67e0e3',
-                  series: {
-                    color: ['#faf3a378', 'transparent'],
-                    dataColor: {
-                      normal: '#ff9800',
-                      shadowColor: '#fcebad'
-                    }
+      rate: [
+            {
+              id: 'centerRate1',
+              tips: 60,
+              colorData: {
+                textStyle: '#3fc0fb',
+                series: {
+                  color: ['#00bcd44a', 'transparent'],
+                  dataColor: {
+                    normal: '#03a9f4',
+                    shadowColor: '#97e2f5'
                   }
                 }
               }
-            ]
+            }
+      ]
     }
   },
-  components: { CenterChart }
+  components: { CenterChart },
+  mounted () {
+    this.drawTimingFn();
+  },
+
+  methods: {
+    drawTimingFn () {
+      this.setData();
+      setInterval(() => {
+        this.setData(); //获取-数据
+      }, 30000);
+    },
+    async setData () {
+      // 设备类别维保执行情况
+      await this.$http.get("kanban/datalist.action?caller=DeviceMaintainData&_noc=1&page=1&pageSize=100&condition=1=1")
+              .then((result)=>{
+                        let dataList = JSON.parse(result.data.data);
+                        let datas = new Array();
+                        for (let index = 0; index < dataList.length; index++) {
+                          const element = dataList[index];
+                          datas.push({
+                            name:element.name ,
+                            value:element.value,
+                          });
+                        }
+                        this.config.data = datas;
+                        this.config = { ...this.config };
+                      },(result)=>{
+                        console.error(result)
+                      }
+              );
+
+      //饼图pie,设备保养执行率
+      await this.$http.get("kanban/datalist.action?caller=DeviceMaintainRate&_noc=1&page=1&pageSize=100&condition=1=1")
+              .then((result)=>{
+                        let dataList = JSON.parse(result.data.data);
+                        this.rate[0].tips = dataList[0].rate
+                      },(result)=>{
+                        console.error(result)
+                      }
+              );
+
+    }
+  }
+
 }
 </script>