isv-robot 2 سال پیش
والد
کامیت
351237e448
2فایلهای تغییر یافته به همراه33 افزوده شده و 5 حذف شده
  1. 32 1
      src/views/dashboard-screen/chart-map/chartMap.vue
  2. 1 4
      src/views/dashboard-screen/jryl/index.vue

+ 32 - 1
src/views/dashboard-screen/chart-map/chartMap.vue

@@ -1,14 +1,45 @@
 <template>
   <div class="iframe-wrap">
-    <iframe id="mapFrame" ref="mapFrame" src="https://gis.isvbytes.com" frameborder="none"/>
+    <iframe id="mapFrame" ref="mapFrame" src="http://localhost:14000" frameborder="none" :onload="loadDone"/>
   </div>
 
 </template>
 <script>
+import {chartMap} from '@/api/dashboard-json'
+
 export default {
   name: 'ChartMap',
   created() {
     window['mapFrame'] = this.$refs.mapFrame
+  },
+  mounted() {
+    this.$refs.mapFrame.onload = () => {
+      this.loadDone()
+    }
+  },
+  methods: {
+    loadDone() {
+      chartMap().then(res => {
+        const data = (res.info || []).map(item => {
+          const ret = {
+            title: item.title?.replace('运行工区', ''),
+            data: {}
+          }
+          item.xaxis.forEach((key, index) => {
+            ret.data[key] = item.series[index].data
+          })
+          return ret
+        })
+        this.$refs.mapFrame.contentWindow.postMessage(
+          {
+            data: data
+          },
+          '*'
+        )
+        console.log('data', data)
+      })
+      console.log('loadDone')
+    }
   }
 }
 </script>

+ 1 - 4
src/views/dashboard-screen/jryl/index.vue

@@ -267,11 +267,8 @@ export default {
               position: ['50%', -barWidth - 10],
               fontSize: this.EchartfontSize(16),
               color: '#ffffff',
-              // formatter: (evt) => {
-              //   console.log('evt', evt)
-              // }
               formatter: (evt) => {
-                return data[0][0] > 0 ? evt?.value : ' '
+                return data[0][0] > 0 ? (evt || {})?.value : ' '
               }
             },
             data: data[0]