123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555 |
- <template>
- <div class="container">
- <el-row :gutter="10" style="height:100%;">
- <el-col style="height:100%;position: relative;" :span="24">
- <el-radio-group class="model" v-model="pattern" label="size control" size="small">
- <el-radio-button label="two-dimensional" @click="pattern = 'two-dimensional'">二维态势</el-radio-button>
- <el-radio-button label="three-dimensional" @click="pattern = 'three-dimensional'">三维态势</el-radio-button>
- </el-radio-group>
- <el-card class="table1">
- <div slot="header" class="clearfix">
- <span>兵力装备显示</span>
- </div>
- <el-table :data="maptable" @current-change="instanceChange" :row-style="{ height: '20px' }" :cell-style="{ padding: '0px' }">
- <el-table-column prop="platID" label="ID"></el-table-column>
- <el-table-column prop="platName" label="名称"></el-table-column>
- <el-table-column prop="isEnemy" label="敌我属性"></el-table-column>
- </el-table>
- </el-card>
- <el-card class="table2">
- <div slot="header" class="clearfix">
- <span>战损显示</span>
- </div>
- <el-table :data="healthtable" @current-change="instanceChange" :row-style="{ height: '20px' }" :cell-style="{ padding: '0px' }">
- <el-table-column prop="platID" label="ID"></el-table-column>
- <el-table-column prop="platName" label="名称"></el-table-column>
- <el-table-column prop="platState" label="健康度"></el-table-column>
- </el-table>
- </el-card>
- <div v-show="pattern == 'two-dimensional'" class="echarts-box">
- <div id="mapEchart" class="mapecharts"></div>
- </div>
- <div v-show="pattern == 'three-dimensional'" class="main-layout">
- <div id="cesiumContainer" class="mapecharts"></div>
- </div>
- </el-col>
- </el-row>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- export default ({
- computed: {
- ...mapGetters([
- 'map',
- 'init',
- 'platforms',
- 'instances',
- 'properties',
- 'platformShow'
- ]),
- },
- watch: {
- init: {
- handler: function (val, oldVal) {
- console.log(val)
- this.setTimer();
- }
- },
- platforms: {
- handler: function (val, oldVal) {
- }
- },
- instances: {
- handler: function (val, oldVal) {
- this.instancetable = val
- }
- },
- platformID: {
- handler: function (val, oldVal) {
- this.$wst.send({
- url: 'getRadarInstances',
- data: { PlatformID: val }
- })
- }
- },
- properties: {
- handler: function (val, oldVal) {
- this.propertyinittable = val.InitParams
- this.propertycontroltable = val.CtrlParams
- }
- },
- platformShow: {
- handler: function (val, oldVal) {
- this.resizeDom()
- }
- }
- },
- data() {
- return {
- pattern: "two-dimensional",
- instancetable: null,
- propertyinittable: null,
- propertycontroltable: null,
- timer: null,
- mapEchart: null,
- maptable: [
- {
- 'platID': '1001',
- 'platName': '弹道导弹1',
- 'isEnemy': '我方'
- },
- {
- 'platID': '1002',
- 'platName': '弹道导弹2',
- 'isEnemy': '我方'
- },
- // {
- // 'platID': '1003',
- // 'platName': '弹道导弹3',
- // 'isEnemy': '我方'
- // },
- // {
- // 'platID': '1004',
- // 'platName': '弹道导弹4',
- // 'isEnemy': '我方'
- // },
- // {
- // 'platID': '1005',
- // 'platName': '弹道导弹5',
- // 'isEnemy': '我方'
- // },
- // {
- // 'platID': '1006',
- // 'platName': '弹道导弹6',
- // 'isEnemy': '我方'
- // },
- // {
- // 'platID': '1007',
- // 'platName': '弹道导弹7',
- // 'isEnemy': '我方'
- // },
- {
- 'platID': '6001',
- 'platName': 'THADD系统1',
- 'isEnemy': '敌方'
- },
- {
- 'platID': '6002',
- 'platName': 'THADD系统2',
- 'isEnemy': '敌方'
- },
- ],
- healthtable: [
- {
- 'platID': '1001',
- 'platName': '弹道导弹1',
- 'platState': "85%"
- },
- {
- 'platID': '1002',
- 'platName': '弹道导弹2',
- 'platState': "90%"
- },
- // {
- // 'platID': '1003',
- // 'platName': '弹道导弹3',
- // 'platState': "90%"
- // },
- // {
- // 'platID': '1004',
- // 'platName': '弹道导弹4',
- // 'platState': "95%"
- // },
- // {
- // 'platID': '1005',
- // 'platName': '弹道导弹5',
- // 'platState': "100%"
- // },
- // {
- // 'platID': '1006',
- // 'platName': '弹道导弹6',
- // 'platState': "100%"
- // },
- // {
- // 'platID': '1007',
- // 'platName': '弹道导弹7',
- // 'platState': "100%"
- // },
- {
- 'platID': '6001',
- 'platName': 'THADD系统1',
- 'platState': "80%"
- },
- {
- 'platID': '6002',
- 'platName': 'THADD系统2',
- 'platState': '80%'
- },
- ],
- mapOption: {
- aria: {
- show: true
- },
- tooltip: {
- formatter: '{a}&name:{b}&location:{c}',
- },
- legend: {
- orient: 'vertical',
- left: 'left',
- data: ['categoryA', 'categoryB', 'categoryC']
- },
- geo: {
- map: "china",
- // zoom: 1,
- // center: [120.397128, 25.916527],
- roam: true,
- scaleLimit: {
- min: 1,
- max: 20
- },
- label: {
- color: "#fff",
- show: true
- },
- emphasis: {
- label: {
- color: "#fff",
- show: true
- },
- itemStyle: {
- areaColor: {
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [
- {
- offset: 0,
- color: "#073684" // 0% 处的颜色
- },
- {
- offset: 1,
- color: "#2B91B7" // 100% 处的颜色
- }
- ]
- }
- }
- },
- itemStyle: {
- areaColor: {
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [
- {
- offset: 0,
- color: "#073684" // 0% 处的颜色
- },
- {
- offset: 1,
- color: "#061E3D" // 100% 处的颜色
- }
- ]
- },
- borderColor: "#87ADCB",
- shadowColor: "rgba(10,76,139,1)",
- shadowOffsetY: 0,
- shadowBlur: 60,
- borderWidth: 1
- },
- tooltip: {
- show: false
- }
- },
- series: [
- {
- name: '我方飞机',
- type: 'scatter',
- coordinateSystem: 'geo',
- symbol: 'image://' + require('@/assets/image/redairplane.png'),
- symbolSize: 20,
- data: null,
- label: {
- normal: {
- formatter: '{b}',
- position: 'right',
- show: false
- },
- emphasis: {
- show: true
- }
- },
- itemStyle: {
- normal: {
- color: '#ddb926'
- //color: '#0000ff'
- }
- }
- },
- {
- name: '我方dddd',
- type: 'scatter',
- coordinateSystem: 'geo',
- symbol: 'image://' + require('@/assets/image/redmissile.png'),
- symbolSize: 20,
- data: null,
- label: {
- normal: {
- formatter: '{b}',
- position: 'right',
- show: false
- },
- emphasis: {
- show: true
- }
- },
- itemStyle: {
- normal: {
- color: '#ddb926'
- //color: '#0000ff'
- }
- }
- },
- {
- name: '敌方',
- type: 'scatter',
- coordinateSystem: 'geo',
- symbol: 'image://' + require('@/assets/image/blueradar.png'),
- symbolSize: 20,
- data: null,
- label: {
- normal: {
- formatter: '{b}',
- position: 'right',
- show: false
- },
- emphasis: {
- show: true
- }
- },
- itemStyle: {
- normal: {
- color: '#ff0000'
- }
- }
- },
- ]
- }
- }
- },
- mounted() {
- this.echartsInit();
- this.cesiumInit();
- // 页面加载设置高度自适应
- window.onresize = () => {
- this.resizeDom()
- };
- // 页面加载设置高度自适应
- this.resizeDom()
- if (this.init == 100) {
- this.setTimer();
- }
- },
- beforeDestroy() {
- this.timerDestory()
- },
- methods: {
- setTimer() {
- if (this.timer == null) {
- this.timer = setInterval(() => {
- console.log('开始定时...每过一秒执行一次')
- this.echartsInit()
- }, 1000)
- }
- },
- //初始化echarts
- echartsInit() {
- 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);
- this.resizeDom()
- },
- //初始化echarts
- cesiumInit() {
- this.viewer = new this.Cesium.Viewer('cesiumContainer', {
- animation: true, // 是否显示时间轴动画
- baseLayerPicker: false,
- // homeButton: false,
- // geocoder: false,
- timeline: false,
- fullscreenButton: false,
- // sceneModePicker: false,
- navigationHelpButton: false,
- imageryProvider: new this.Cesium.ArcGisMapServerImageryProvider({
- url: 'https://server.arcgisonline.com/arcgis/rest/services/World_Terrain_Base/MapServer'
- }),
- });
- this.viewer._cesiumWidget._creditContainer.style.display = "none";
- },
- //通过窗体高宽计算容器高宽,渲染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';
- },
- echartsChange() {
- this.timerDestory()
- this.echartsInit();
- this.setTimer();
- },
- timerDestory() {
- if (this.timer) {
- clearInterval(this.timer);
- }
- },
- submitForm(map) {
- console.log("放入数据")
- this.mapOption.series[0].data = this.map.data.friend.Planes;
- this.mapOption.series[1].data = this.map.data.friend.Missiles;
- this.mapOption.series[2].data = this.map.data.enemy.Radars;
- this.$echarts.init(document.getElementById(map)).setOption(this.mapOption);
- console.log(this.mapOption);
- },
- instanceChange(val) {
- if (val.instanceName.includes("信号侦察")) {
- this.$wst.send({
- url: 'getESMParams',
- data: { InstanceID: val.instanceID }
- })
- } else
- if (val.instanceName.includes("导航")) {
- this.$wst.send({
- url: 'getNavParams',
- data: { InstanceID: val.instanceID }
- })
- } else
- if (val.instanceName.includes("雷达")) {
- this.$wst.send({
- url: 'getRadarParams',
- data: { InstanceID: val.instanceID }
- })
- } else
- if (val.instanceName.includes("电子攻击")) {
- this.$wst.send({
- url: 'getECMParams',
- data: { InstanceID: val.instanceID }
- })
- }
- }
- },
- })
- </script>
- <style scoped>
- .model {
- position: absolute;
- top: 20px;
- left: 100px;
- z-index: 999;
- }
- .table1 {
- position: absolute;
- top: 40px;
- right: 20px;
- z-index: 999;
- width: 400px;
- height: 400px;
- }
- .table1 /deep/ .el-card__header {
- background-color: #11144e;
- color: white;
- }
- .table2 {
- position: absolute;
- top: 460px;
- right: 20px;
- z-index: 999;
- width: 400px;
- height: 400px;
- }
- .table2 /deep/ .el-card__header {
- background-color: #11144e;
- color: white;
- }
- .box-card {
- min-height: 100%;
- height: 100%;
- }
- /deep/ .el-card__body {
- height: 100% !important;
- padding: 0px !important;
- }
- .echarts-box {
- height: 100%;
- width: 100%;
- background-image: url('~@/assets/image/map-bg.png');
- background-repeat: no-repeat;
- background-size: 100% 100%;
- }
- .main-layout {
- height: 100%;
- width: 100%;
- }
- .container {
- height: 100%;
- }
- .mapecharts {
- width: 100%;
- height: 100%;
- }
- .tableHeight {
- flex-grow: 1;
- height: 33%;
- }
- .tableHeight /deep/ .el-card__body {
- height: calc(100% - 95px) !important;
- }
- </style>
|