|
@@ -292,63 +292,43 @@ export default ({
|
|
|
},
|
|
|
methods: {
|
|
|
setTimer() {
|
|
|
-
|
|
|
+ if(this.timer == null) {
|
|
|
this.timer = setInterval(() => {
|
|
|
setTimeout(this.echartsInit(), 0);
|
|
|
|
|
|
- }, 2000)
|
|
|
-
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
},
|
|
|
//初始化echarts
|
|
|
echartsInit() {
|
|
|
+ if (this.mapEchart == null) {
|
|
|
+ this.mapEchart = this.$echarts.init(document.getElementById('mapEchart'))
|
|
|
+ }
|
|
|
if (this.pattern == 'local') {
|
|
|
if (this.init == 100) { this.$wst.send({ url: 'getLocalMap' }) }
|
|
|
if (this.map != null && this.map.type == 'local') { this.submitForm('mapEchart') }
|
|
|
- if (this.mapEchart == null) {
|
|
|
- this.mapEchart = this.$echarts.init(document.getElementById('mapEchart'))
|
|
|
- }
|
|
|
- this.mapEchart.setOption(this.mapOption);
|
|
|
} else
|
|
|
- if (this.pattern == 'remote') {
|
|
|
- if (this.init == 100) { this.$wst.send({ url: 'getRemoteMap' }) }
|
|
|
- if (this.map != null && this.map.type == 'remote') { this.submitForm('mapEchart') }
|
|
|
- if (this.mapEchart == null) {
|
|
|
- this.mapEchart = this.$echarts.init(document.getElementById('mapEchart'))
|
|
|
- }
|
|
|
- this.mapEchart.setOption(this.mapOption);
|
|
|
- } else
|
|
|
- if (this.pattern == 'combine') {
|
|
|
- if (this.init == 100) { this.$wst.send({ url: 'getCombineMap' }) }
|
|
|
- if (this.map != null && this.map.type == 'combine') { this.submitForm('mapEchart') }
|
|
|
- if (this.mapEchart == null) {
|
|
|
- this.mapEchart = this.$echarts.init(document.getElementById('mapEchart'))
|
|
|
- }
|
|
|
- this.mapEchart.setOption(this.mapOption);
|
|
|
- } else
|
|
|
- if (this.pattern == 'global') {
|
|
|
- if (this.init == 100) { this.$wst.send({ url: 'getGlobalMap' }) }
|
|
|
- if (this.map != null && this.map.type == 'global') { this.submitForm('mapEchart') }
|
|
|
- if (this.mapEchart == null) {
|
|
|
- this.mapEchart = this.$echarts.init(document.getElementById('mapEchart'))
|
|
|
- }
|
|
|
- this.mapEchart.setOption(this.mapOption);
|
|
|
- }
|
|
|
- this.resizeDom()
|
|
|
+ if (this.pattern == 'remote') {
|
|
|
+ if (this.init == 100) { this.$wst.send({ url: 'getRemoteMap' }) }
|
|
|
+ if (this.map != null && this.map.type == 'remote') { this.submitForm('mapEchart') }
|
|
|
+ } else
|
|
|
+ if (this.pattern == 'combine') {
|
|
|
+ if (this.init == 100) { this.$wst.send({ url: 'getCombineMap' }) }
|
|
|
+ if (this.map != null && this.map.type == 'combine') { this.submitForm('mapEchart') }
|
|
|
+ } else
|
|
|
+ if (this.pattern == 'global') {
|
|
|
+ if (this.init == 100) { this.$wst.send({ url: 'getGlobalMap' }) }
|
|
|
+ if (this.map != null && this.map.type == 'global') { this.submitForm('mapEchart') }
|
|
|
+
|
|
|
+ }
|
|
|
+ this.mapEchart.setOption(this.mapOption);
|
|
|
+ // this.resizeDom()
|
|
|
|
|
|
},
|
|
|
//通过窗体高宽计算容器高宽,渲染echart图表的div的宽高度以达到自适应目的
|
|
|
resizeDom() {
|
|
|
console.log("高度自适应")
|
|
|
- this.$echarts.init(document.getElementById('mapEchart')).resize()
|
|
|
- // var mapEchart = document.getElementById('mapEchart')
|
|
|
- // var mapEchart = document.getElementById('mapEchart')
|
|
|
- // var mapEchart = document.getElementById('mapEchart')
|
|
|
- // var mapEchart = document.getElementById('mapEchart')
|
|
|
- // const boxHeight = document.getElementsByClassName("echarts-box")[0].clientHeight
|
|
|
- // mapEchart.style.height = (boxHeight/2-65)+'px';
|
|
|
- // mapEchart.style.height = (boxHeight/2-65)+'px';
|
|
|
- // mapEchart.style.height = (boxHeight/2-65)+'px';
|
|
|
- // mapEchart.style.height = (boxHeight/2-65)+'px';
|
|
|
+ this.mapEchart.resize()
|
|
|
},
|
|
|
echartsChange() {
|
|
|
this.timerDestory()
|
|
@@ -366,7 +346,7 @@ export default ({
|
|
|
this.mapOption.series[0].data = this.map.data.friend;
|
|
|
// this.mapOption.series[1].data = this.map.data.friend.Missiles;
|
|
|
this.mapOption.series[2].data = this.map.data.enemy;
|
|
|
- this.$echarts.init(document.getElementById(map)).setOption(this.mapOption);
|
|
|
+ this.mapEchart.setOption(this.mapOption);
|
|
|
console.log(this.mapOption);
|
|
|
},
|
|
|
instanceChange(val) {
|
|
@@ -377,26 +357,26 @@ export default ({
|
|
|
data: { InstanceID: val.instanceID }
|
|
|
})
|
|
|
} else
|
|
|
- if (val.instanceName.includes("导航")) {
|
|
|
+ if (val.instanceName.includes("导航")) {
|
|
|
this.$wst.send({
|
|
|
url: 'getNavParams',
|
|
|
data: { InstanceID: val.instanceID }
|
|
|
})
|
|
|
|
|
|
- } else
|
|
|
- if (val.instanceName.includes("雷达")) {
|
|
|
+ } else
|
|
|
+ if (val.instanceName.includes("雷达")) {
|
|
|
this.$wst.send({
|
|
|
url: 'getRadarParams',
|
|
|
data: { InstanceID: val.instanceID }
|
|
|
})
|
|
|
|
|
|
- } else
|
|
|
- if (val.instanceName.includes("电子攻击")) {
|
|
|
+ } else
|
|
|
+ if (val.instanceName.includes("电子攻击")) {
|
|
|
this.$wst.send({
|
|
|
url: 'getECMParams',
|
|
|
data: { InstanceID: val.instanceID }
|
|
|
- })
|
|
|
- }
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
},
|