|
|
@@ -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>
|