xyh 1 рік тому
батько
коміт
a383ae2e31
2 змінених файлів з 42 додано та 31 видалено
  1. 1 1
      src/views/login/index.vue
  2. 41 30
      src/views/simulation/index.vue

+ 1 - 1
src/views/login/index.vue

@@ -2,7 +2,7 @@
   <div class="login-form">
     <div class="login-box">
       <div class="login-input">
-        <span class="title">模型管理平台</span>
+        <span class="title">电子攻防建模仿真系统</span>
         <el-form
           :model="dataForm"
           :rules="dataRule"

+ 41 - 30
src/views/simulation/index.vue

@@ -56,6 +56,7 @@
           <el-table-column label="消息" align="center" prop="context"></el-table-column>
         </el-table>
         <div slot="footer" class="dialog-footer">
+          <el-button @click="exportReport()">导出报告</el-button>
           <el-button @click="dialogVisible = false">关闭</el-button>
         </div>
       </el-dialog>
@@ -73,7 +74,7 @@ import missileModel from 'public/static/model/basic_missle.glb';
 import centerModel from 'public/static/model/the_white_house.glb';
 import radarModel from 'public/static/model/radar.glb'
 import { mapGetters } from "vuex";
-import CesiumNavigation from 'cesium-navigation-es6/viewerCesiumNavigationMixin'
+import CesiumNavigation from 'cesium-navigation-es6/viewerCesiumNavigationMixin';
 export default {
   components: {
     TimeLine
@@ -92,6 +93,7 @@ export default {
       satelliteRange: [],
       missileList: {},
       thaadList: {},
+      finish: false,
       websocket: null,
       centerPosition: null,
       leftwidth: 12,
@@ -567,9 +569,11 @@ export default {
       console.log('position :>> ', position);
       let color = ''
       let modelUrl = ''
+      let size = 64
       if (type == 'red') {
         color = 'Red'
         modelUrl = missileModel
+        size = 100
         this.missileList[name] = {
           disturb: 20,
           id: this.id
@@ -612,7 +616,7 @@ export default {
           model: {
             uri: modelUrl, // 替换为你的3D模型文件路径
             scale: 1.0, // 调整3D模型的缩放大小
-            minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
+            minimumPixelSize: size // 设置3D模型的最小像素大小,确保在视图中可见
           },
           label: {
             text: type + ' ' + name,
@@ -637,7 +641,7 @@ export default {
           model: {
             uri: modelUrl, // 替换为你的3D模型文件路径
             scale: 1.0, // 调整3D模型的缩放大小
-            minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
+            minimumPixelSize: size // 设置3D模型的最小像素大小,确保在视图中可见
           },
           label: {
             text: type + ' ' + name,
@@ -664,7 +668,7 @@ export default {
           model: {
             uri: modelUrl, // 替换为你的3D模型文件路径
             scale: 1.0, // 调整3D模型的缩放大小
-            minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
+            minimumPixelSize: size // 设置3D模型的最小像素大小,确保在视图中可见
           },
           label: {
             text: type + ' ' + name,
@@ -683,7 +687,7 @@ export default {
           model: {
             uri: modelUrl, // 替换为你的3D模型文件路径
             scale: 1.0, // 调整3D模型的缩放大小
-            minimumPixelSize: 64 // 设置3D模型的最小像素大小,确保在视图中可见
+            minimumPixelSize: size // 设置3D模型的最小像素大小,确保在视图中可见
           },
           label: {
             text: type + ' ' + name,
@@ -779,8 +783,8 @@ export default {
       this.$data._viewer2D.clock.stopTime = stop.clone();
       this.$data._viewer3D.clock.stopTime = stop.clone();
       // 时间速率,数字越大时间过的越快,设置1好像是和实际时间一样
-      this.$data._viewer2D.clock.multiplier = stepTime;
-      this.$data._viewer3D.clock.multiplier = stepTime;
+      this.$data._viewer2D.clock.multiplier = 10;
+      this.$data._viewer3D.clock.multiplier = 10;
       // 时间轴绑定到viewer上去
       this.$data._viewer2D.timeline.zoomTo(start, stop);
       this.$data._viewer3D.timeline.zoomTo(start, stop);
@@ -792,24 +796,24 @@ export default {
         time: startTime,
         context: "开始模拟!!!"
       })
-      this.$data._viewer2D.clock.onTick.addEventListener(clock => {
-        const currentTime = clock.currentTime; // 获取当前时间轴的时间
-        const elapsedTime = this.Cesium.JulianDate.secondsDifference(
-          currentTime,
-          this.$data._viewer2D.clock.startTime
-        ); // 获取从起始时间到当前时间的秒数
-        if (parseInt(elapsedTime) % stepTime === 0 && elapsedTime != 0) {
-          // 当从起始时间到当前时间的秒数是 stepTime 的倍数时,发送请求
-          this.requestDataAndUpdateModel2D(startTime, elapsedTime);
-        }
-      });
+      // this.$data._viewer2D.clock.onTick.addEventListener(clock => {
+      //   const currentTime = clock.currentTime; // 获取当前时间轴的时间
+      //   const elapsedTime = this.Cesium.JulianDate.secondsDifference(
+      //     currentTime,
+      //     this.$data._viewer2D.clock.startTime
+      //   ); // 获取从起始时间到当前时间的秒数
+      //   if (parseInt(elapsedTime) % stepTime === 0 && parseInt(elapsedTime) !== 0 && this.$data._viewer2D.clock.shouldAnimate) {
+      //     // 当从起始时间到当前时间的秒数是 stepTime 的倍数时,发送请求
+      //     this.requestDataAndUpdateModel2D(startTime, elapsedTime);
+      //   }
+      // });
       this.$data._viewer3D.clock.onTick.addEventListener(clock => {
         const currentTime = clock.currentTime; // 获取当前时间轴的时间
         const elapsedTime = this.Cesium.JulianDate.secondsDifference(
           currentTime,
           this.$data._viewer3D.clock.startTime
         ); // 获取从起始时间到当前时间的秒数
-        if (parseInt(elapsedTime) % stepTime === 0 && elapsedTime != 0) {
+        if (parseInt(elapsedTime) % stepTime === 0 && parseInt(elapsedTime) !== 0) {
           // 当从起始时间到当前时间的秒数是 stepTime 的倍数时,发送请求
           this.requestDataAndUpdateModel3D(startTime, elapsedTime);
         }
@@ -942,7 +946,8 @@ export default {
             }
           }
         })
-
+      // this.$data._viewer2D.clock.shouldAnimate = true;
+      // this.$data._viewer3D.clock.shouldAnimate = true;
     },
     // 根据时间参数请求模型位置并更新 2D
     async requestDataAndUpdateModel2D(startTime, elapsedTime) {
@@ -982,10 +987,11 @@ export default {
           }
           this.judgeMissile(this.$data._viewer2D, newTimeString);
           //判断攻防是否结束
-          if (this.ifFinish(this.$data._viewer3D, newTimeString)) {
+          if (this.ifFinish(this.$data._viewer3D, newTimeString) && !this.finish) {
             // 停止时间轴动画
             this.$data._viewer2D.clock.shouldAnimate = false;
             this.dialogVisible = true
+            this.finish = true
           }
 
           //更新模型位置
@@ -1035,10 +1041,11 @@ export default {
           //判断是否有导弹被拦截
           this.judgeMissile(this.$data._viewer3D, newTimeString);
           //判断攻防是否结束
-          if (this.ifFinish(this.$data._viewer3D, newTimeString)) {
+          if (this.ifFinish(this.$data._viewer3D, newTimeString) && !this.finish) {
             // 停止时间轴动画
             this.$data._viewer3D.clock.shouldAnimate = false;
             this.dialogVisible = true
+            this.finish = true
           }
 
           //更新模型位置
@@ -1131,13 +1138,13 @@ export default {
       radar.ellipsoid.radii = new this.Cesium.Cartesian3(newRange, newRange, newRange);
     },
     isObjectEmpty(obj) {
-  for (let key in obj) {
-    if (obj.hasOwnProperty(key)) {
-      return false; // 如果对象有任何属性,返回 false
-    }
-  }
-  return true; // 如果对象没有任何属性,返回 true
-},
+      for (let key in obj) {
+        if (obj.hasOwnProperty(key)) {
+          return false; // 如果对象有任何属性,返回 false
+        }
+      }
+      return true; // 如果对象没有任何属性,返回 true
+    },
     //判断攻防是否完成
     ifFinish(viewer, time) {
       if (this.isObjectEmpty(this.missileList)) {
@@ -1150,7 +1157,7 @@ export default {
       }
       else {
         for (let key in this.missileList) {
-          let missilePos = viewer.entities.getById(this.messageList[key].id).position._value
+          let missilePos = viewer.entities.getById(this.missileList[key].id).position._value
           if (this.Cesium.Cartesian3.distance(this.centerPosition, missilePos) <= 100) {
             this.messageList.push({
               order: this.order,
@@ -1162,6 +1169,10 @@ export default {
         }
       }
       return false
+    },
+    exportReport() {
+     
+
     }
 
   }