| | |
| | | import { windDir } from '@/constant/wind-dir'; |
| | | import { map } from './index_old'; |
| | | import { checkboxOptions } from '@/constant/checkbox-options'; |
| | | import { useToolboxStore } from '@/stores/toolbox'; |
| | | |
| | | const toolboxStore = useToolboxStore(); |
| | | |
| | | export const DialogUtil = { |
| | | show: true, |
| | | toggleDataDialog() { |
| | | this.show = !this.show; |
| | | if (this.show) { |
| | | return '数据弹框:开'; |
| | | } else { |
| | | return '数据弹框:关'; |
| | | } |
| | | }, |
| | | // 当前打开的弹框及位置坐标 |
| | | marker: undefined, |
| | | lnglat: undefined, |
| | | /** |
| | | * 创建弹出框 |
| | | * @param {*} factorDatas 监测数据 |
| | |
| | | offset: new AMap.Pixel(16, -45), |
| | | autoMove: false |
| | | }); |
| | | return m.window; |
| | | return m; |
| | | }, |
| | | |
| | | /** |
| | |
| | | return info; |
| | | }, |
| | | |
| | | /** |
| | | * 开启一个新的数据弹框 |
| | | * @param {String} deviceType 设备类型 |
| | | * @param {String} deviceCode 设备编号 |
| | | * @param {Array} factorDatas 监测数据 |
| | | * @param {Number} i 数据索引 |
| | | * @param {Function} onClose 弹框关闭回调 |
| | | * @returns |
| | | */ |
| | | openNewWindow(deviceType, deviceCode, factorDatas, i, onClose) { |
| | | if (!this.show) return; |
| | | const window = this.createInfoWindow( |
| | | if (!toolboxStore.dataDialogStatus) return; |
| | | this.marker = this.createInfoWindow( |
| | | deviceType, |
| | | deviceCode, |
| | | factorDatas, |
| | | i, |
| | | onClose |
| | | ); |
| | | window.open(map, factorDatas.lnglats_GD[i]); |
| | | this.marker.window.open(map, factorDatas.lnglats_GD[i]); |
| | | this.lnglat = factorDatas.lnglats_GD[i]; |
| | | }, |
| | | |
| | | /** |
| | | * 打开缓存中的弹框 |
| | | */ |
| | | openWindow() { |
| | | if (this.marker && this.lnglat) { |
| | | // this.marker.close(); |
| | | this.marker.window.open(map, this.lnglat); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 关闭已弹出的弹框 |
| | | */ |
| | | closeWindow() { |
| | | if (this.marker) { |
| | | // this.marker.close(); |
| | | this.marker.window.close(); |
| | | } |
| | | } |
| | | }; |