wuxiang %!s(int64=2) %!d(string=hai) anos
pai
achega
55fb2d1332

+ 14 - 5
src/layout/Header/index.vue

@@ -2,21 +2,30 @@
     <el-header class="MainHeader">
     <div class="title"><dv-border-box-10 style="padding: 5px;"><span style="margin-left: 2px;">电子攻防建模仿真系统</span></dv-border-box-10></div>
     <div class="DimensionButtons"> 
-        <el-button :type="this.dimension == 2 ? 'success' : 'danger'" @click="dimensionswitch(2)" round>二维</el-button>
-        <el-button :type="this.dimension == 3 ? 'success' : 'danger'" @click="dimensionswitch(3)" round>三维</el-button>
-        <el-button :type="this.dimension == 5 ? 'success' : 'danger'" @click="dimensionswitch(5)" round>一体化</el-button>
+        <el-button :type="dimension == 2 ? 'success' : 'danger'" @click="dimensionswitch(2)" round>二维</el-button>
+        <el-button :type="dimension == 3 ? 'success' : 'danger'" @click="dimensionswitch(3)" round>三维</el-button>
+        <el-button :type="dimension == 5 ? 'success' : 'danger'" @click="dimensionswitch(5)" round>一体化</el-button>
     </div>   
     </el-header>
 </template>
 <script>
+import { mapGetters } from "vuex";
 export default {
     data(){
       return{
-        dimension: 5,
+  
       }
     },
+    computed: {
+    ...mapGetters([
+      "dimension"
+    ])
+  },
     methods: {
-        }
+      dimensionswitch(val){
+        this.$store.commit("app/setDimension",val);
+      }
+    }
 }
 </script>
 <style lang="scss" scoped>

+ 4 - 29
src/layout/Main/index.vue

@@ -16,30 +16,10 @@ import { mapGetters } from 'vuex'
 export default {
   name: 'AppMain',
   computed: {
-    ...mapGetters([
-      'init',
-      'platforms',
-      'platformShow',
-      'platformID'
-    ]),
     key() {
       return this.$router.path
     }
   },
-  watch: {
-       init: {
-          handler: function(val, oldVal){
-
-            this.$wst.send({url:'getPlatformTable'})
-  
-          }
-       },
-       platforms: {
-          handler: function(val, oldVal){
-            this.tableData = val;  
-          }
-       }
-  },
   data(){
     return{
       tableData: [
@@ -47,16 +27,11 @@ export default {
     }
   },
   mounted(){
-      if(this.init == 100) {
-           this.$wst.send({url:'getPlatformTable'})
-      }
+
   },
   
   methods:{
-    handleCurrentChange(val) {
-      
-      this.$store.commit("app/setPlatformID",val.platformID)
-    }
+
 
   }
   
@@ -103,7 +78,7 @@ export default {
     font-size: 12px;
   }
 
-/deep/ .el-card{
+/* /deep/ .el-card{
   background: transparent !important;
   border: none;
   color: white;
@@ -187,6 +162,6 @@ height: 100%;
 
 /deep/.el-form-item__label{
   color: white !important;
-}
+} */
 </style>
 

+ 3 - 1
src/store/getters.js

@@ -1,7 +1,9 @@
 const getters = {
     //app
     isCollapse: state => state.app.isCollapse,
+    dimension: state => state.app.dimension,
     //userInfo
-    userInfo: state => state.user.userInfo
+    userInfo: state => state.user.userInfo,
+
 }
 export default getters

+ 4 - 1
src/store/modules/app.js

@@ -2,6 +2,7 @@ const getDefaultState = () => {
     return {
 
         isCollapse: false,
+        dimension: 5
 
     }
 }
@@ -13,13 +14,15 @@ const mutations = {
 
     setIsCollapse(state, isCollapse) {
         state.isCollapse = isCollapse
+    },
+    setDimension(state, dimension) {
+        state.dimension = dimension
     }
 }
 
 const actions = {
 
 
-
 }
 
 export default {

+ 24 - 21
src/views/situation/index.vue

@@ -1,15 +1,6 @@
 <template>
   <div class="container">
-    <el-row style="height: 40px">
-      <div class="myHeader">
-        <el-button :type="this.dimension == 2 ? 'success' : 'danger'" @click="dimensionswitch(2)" round>二维</el-button>
-        <el-button :type="this.dimension == 3 ? 'success' : 'danger'" @click="dimensionswitch(3)" round>三维</el-button>
-        <el-button :type="this.dimension == 5 ? 'success' : 'danger'" @click="dimensionswitch(5)" round>
-          一体化
-        </el-button>
-      </div>
-    </el-row>
-    <el-row id="earth" style="height: 790px; width: 100%; display: flex; position: relative">
+    <el-row id="earth" style="height: 100%; width: 100%; display: flex; position: relative">
       <el-col style="height: 100%; position: relative" :span="this.leftwidth">
         <div class="main-layout" v-on:mouseover="changeActive('2D')">
           <div id="2DcesiumContainer" class="map" @click="onMapClick"></div>
@@ -70,25 +61,20 @@
 </template>
 <script>
 import screenfull from "screenfull";
-import fireController from "@/api/fireController";
+import fireController from "@/api/fireController.js";
 import { getToken } from "@/utils";
 import axios from "axios";
 import Model from "@/views/situation/Model.vue";
 import satelliteModel from '@/assets/model/satelite.glb';
+import { mapGetters } from "vuex";
 export default {
   components: {
     Model
   },
   computed: {
-    leftwidth() {
-      if (this.dimension === 2) {
-        return 24;
-      } else if (this.dimension === 3) {
-        return 0;
-      } else if (this.dimension === 5) {
-        return 12;
-      }
-    }
+    ...mapGetters([
+      "dimension"
+    ])
   },
   data() {
     return {
@@ -96,13 +82,13 @@ export default {
       situation: [],
       nameIdList:[],
       websocket: null,
+      leftwidth: 12,
       unit: [],
       satellite: [],
       center: [],
       move_data: {},
       viewer2D: null,
       viewer3D: null,
-      dimension: 5,
       mousevalue: null,
       // 选中的点
       selectedMarker: null,
@@ -122,6 +108,20 @@ export default {
       id: 1
     };
   },
+  watch: {
+    dimension: {
+      handler: function (val, oldVal) {
+        console.log(val)
+        if (val == 2) {
+          this.leftwidth = 24;
+        } else if (val == 3) {
+          this.leftwidth = 0;
+        } else if (val == 5) {
+          this.leftwidth = 12;
+        }
+      },
+    },
+  },
   created() {
     this.getData();
   },
@@ -1042,6 +1042,9 @@ this.viewer3D.entities.values.forEach(entity => {
   display: none !important;
 }
 
+.container{
+  height: 100%;
+}
 .modeltooltip {
   position: absolute;
   padding: 5px;