| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <template>
- <div class="iframe-wrap">
- <iframe id="mapFrame" ref="mapFrame" src="/gis/index.html" 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>
- <style scoped lang="scss">
- .iframe-wrap {
- width: 100%;
- height: 100%;
- iframe {
- width: 100%;
- height: 100%;
- }
- }
- ::v-deep {
- #container {
- background-image: none !important;
- }
- }
- </style>
|