Pārlūkot izejas kodu

新增兵力列表、想定新增模型功能

xyh 1 gadu atpakaļ
vecāks
revīzija
1330f5bcc6
2 mainītis faili ar 271 papildinājumiem un 2 dzēšanām
  1. 37 1
      src/views/simulation/index.vue
  2. 234 1
      src/views/situation/index.vue

+ 37 - 1
src/views/simulation/index.vue

@@ -23,7 +23,6 @@
             <el-table-column label="操作" align="center">
               <template slot-scope="scope">
                 <el-button type="primary" @click="getJson(scope.row)">导入</el-button>
-                <!-- <el-button type="primary" @click="saveJson()">保存</el-button> -->
               </template>
             </el-table-column>
           </el-table>
@@ -39,12 +38,31 @@
             <el-table-column label="消息" align="center" prop="context"></el-table-column>
           </el-table>
         </el-tab-pane>
+        <el-tab-pane name="sixth">
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">红方兵力</span>
+            <span><i class="el-icon-s-flag"></i></span>
+          </el-tooltip>
+          <el-table :data="redList">
+            <el-table-column label="序号" prop="order" width="50px"></el-table-column>
+            <el-table-column label="名称" align="center" prop="name"></el-table-column>
+            <el-table-column label="干扰度" align="center" prop="disturb"></el-table-column>
+            <el-table-column label="状态" align="center" prop="status">
+              <template slot-scope="scope">
+        <el-tag
+          :type="scope.row.status === '存活' ? 'success' : 'danger'"
+          disable-transitions>{{scope.row.status}}</el-tag>
+      </template>
+            </el-table-column>
+          </el-table>
+        </el-tab-pane>
       </el-tabs>
       <div class="buttons">
         <el-button icon="el-icon-full-screen" circle @click="ismax()"></el-button>
         <el-button icon="el-icon-house" circle @click="home()"></el-button>
         <el-button icon="el-icon-plus" circle @click="big()"></el-button>
         <el-button icon="el-icon-minus" circle @click="small()"></el-button>
+        <el-tag>想定:{{xdName}}</el-tag>
       </div>
     </el-row>
     <!-- <TimeLine :showLayers="showLayers" :timeDataArray="timeDataArray" class="TimeLine"></TimeLine> -->
@@ -89,6 +107,7 @@ export default {
       save: false,
       messageList: [],
       situation: [],
+      xdName: '',
       nameIdList: [],
       satelliteRange: [],
       missileList: {},
@@ -103,6 +122,8 @@ export default {
       center: [],
       move_data: {},
       order: 1,
+      redOrder: 1,
+      redList: [],
       _viewer2D: null,
       _viewer3D: null,
       mousevalue: null,
@@ -165,11 +186,13 @@ export default {
   methods: {
     async getJson(row) {
       this.order = 1;
+      this.redOrder = 1;
       this.finish = false;
       this.messageList = [];
       this.nameIdList = [];
       this.satelliteRange = [];
       this.missileList = {};
+      this.redList = [];
       this.thaadList = {};
       let redunit = [];
       let blueunit = [];
@@ -197,6 +220,7 @@ export default {
           console.log('response.data :>> ', response.data);
           // // 处理成功的响应
           // jsonData = response.data
+          this.xdName = response.data.xdname
           blueunit = response.data.blueunit
           redunit = response.data.redunit
           satellite = response.data.satellite
@@ -606,6 +630,12 @@ export default {
             disturb: disturb,
             id: this.id
         }
+            this.redList.push({
+              order: this.redOrder++,
+              name: name,
+              disturb: disturb,
+              status: '存活'
+            })
           }
         }
        
@@ -1142,6 +1172,12 @@ export default {
             viewer.entities.remove(missile)
             this.nameIdList = this.nameIdList.filter(item => item.id !== this.missileList[key].id);
             delete this.missileList[key]
+            for(let i =0;i<this.redList;i++){
+              if(this.redList[i].name === key){
+                this.redList[i].status = '被拦截'
+                break
+              }
+            }
             break
           }
         }

+ 234 - 1
src/views/situation/index.vue

@@ -47,6 +47,29 @@
             </el-table-column>
           </el-table>
         </el-tab-pane>
+        <el-tab-pane name="sixth">
+          <el-button type="primary" @click="addRed()">新增</el-button>
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">红方兵力</span>
+            <span><i class="el-icon-message-solid"></i></span>
+          </el-tooltip>
+          <el-table :data="redList">
+            <el-table-column label="序号" prop="order" width="50px"></el-table-column>
+            <el-table-column label="名称" align="center" prop="name"></el-table-column>
+            <el-table-column label="干扰" align="center" prop="method"></el-table-column>
+          </el-table>
+        </el-tab-pane>
+        <el-tab-pane name="7th">
+          <el-button type="primary" @click="addBlue()">新增</el-button>
+          <el-tooltip placement="right" effect="light" slot="label">
+            <span slot="content" class="item">蓝方兵力</span>
+            <span><i class="el-icon-bell"></i></span>
+          </el-tooltip>
+          <el-table :data="blueList">
+            <el-table-column label="序号" prop="order" width="50px"></el-table-column>
+            <el-table-column label="名称" align="center" prop="name"></el-table-column>
+          </el-table>
+        </el-tab-pane>
       </el-tabs>
       <div class="buttons">
         <el-button icon="el-icon-full-screen" circle @click="ismax()"></el-button>
@@ -57,6 +80,60 @@
       </div>
     </el-row>
     <div v-if="isShow" class="modeltooltip" ref="modeltooltip">{{ modeltooltip }}</div>
+    <div>
+      <el-dialog title="新增红方作战单元" :visible ="redVisible" width="50%">
+        <el-form ref="form" :model="redForm" label-width="80px">
+  <el-form-item label="单元名称">
+    <el-input v-model="redForm.name"></el-input>
+  </el-form-item>
+  <el-form-item label="干扰样式">
+    <el-select v-model="redForm.method" placeholder="请选择干扰样式">
+      <el-option label="噪声调频干扰" value="噪声调频干扰"></el-option>
+      <el-option label="噪声调幅干扰" value="噪声调幅干扰"></el-option>
+      <el-option label="噪声直放干扰" value="噪声直放干扰"></el-option>
+      <el-option label="间接采样转发干扰" value="间接采样转发干扰"></el-option>
+    </el-select>
+  </el-form-item>
+  <el-form-item label="单元经度">
+    <el-input v-model="redForm.lon"></el-input>
+  </el-form-item>
+  <el-form-item label="单元纬度">
+    <el-input v-model="redForm.lat"></el-input>
+  </el-form-item>
+  <el-form-item label="单元高度">
+    <el-input v-model="redForm.h"></el-input>
+  </el-form-item>
+
+</el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="saveNewRed()" type="primary">保存</el-button>
+          <el-button @click="redVisible = false">关闭</el-button>
+        </div>
+      </el-dialog>
+    </div>
+    <div>
+      <el-dialog title="新增蓝方作战单元" :visible ="blueVisible" width="50%">
+        <el-form ref="form" :model="blueForm" label-width="80px">
+  <el-form-item label="单元名称">
+    <el-input v-model="blueForm.name"></el-input>
+  </el-form-item>
+  <el-form-item label="单元经度">
+    <el-input v-model="blueForm.lon"></el-input>
+  </el-form-item>
+  <el-form-item label="单元纬度">
+    <el-input v-model="blueForm.lat"></el-input>
+  </el-form-item>
+  <el-form-item label="单元高度">
+    <el-input v-model="blueForm.h"></el-input>
+  </el-form-item>
+
+</el-form>
+        <div slot="footer" class="dialog-footer">
+          <el-button @click="saveNewBlue()" type="primary">保存</el-button>
+          <el-button @click="blueVisible = false">关闭</el-button>
+        </div>
+      </el-dialog>
+    </div>
   </div>
 </template>
 <script>
@@ -83,8 +160,25 @@ export default {
   },
   data() {
     return {
+      redForm: {
+          name: '',
+          method: '',
+          lat: '',
+          lon: '',
+          h: '',
+        },
+        blueForm: {
+          name: '',
+          lat: '',
+          lon: '',
+          h: '',
+        },
       save: false,
       situation: [],
+      redVisible: false,
+      blueVisible: false,
+      redList: [],
+      blueList: [],
       nameIdList:[],
       leftwidth: 12,
       unit: [],
@@ -147,6 +241,130 @@ export default {
     this.pointMove();
   },
   methods: {
+    saveNewRed(){
+      for(let i = 0;i<this.redList.length;i++)
+      {
+        if(this.redForm.name === this.redList[i].name)
+        {
+          this.$message("请勿输入已有单元名字")
+          return
+        }
+      }
+      this.redList.push({
+        order: this.redList.length+1,
+        name: this.redForm.name,
+        method: this.redForm.method
+      })
+      this.markLocationbyJson(parseFloat(this.redForm.lat), parseFloat(this.redForm.lon), parseFloat(this.redForm.h), this.redForm.name, "red")
+        let point1 = {
+          longitude: parseFloat(this.redForm.lon),
+          latitude: parseFloat(this.redForm.lat),
+          height: parseFloat(this.redForm.h)
+        }
+        let item = this.jsonData.center[0]
+        console.log('item :>> ', item);
+        let point2 = {
+          longitude: parseFloat(item[item.name].properties.lon),
+          latitude: parseFloat(item[item.name].properties.lat),
+          height: parseFloat(item[item.name].properties.h)
+        }
+        this.markLine(point1, point2, "red")
+        this.jsonData.redunit.push({
+            name: this.redForm.name,
+            type: "弹道导弹",
+            belong: "红方",
+            health: 100,
+            target: "thaad1",
+            team: "1",
+            component_movementid: 12398127321,
+            component_movementjson: {
+                id: 12398127321,
+                type: "DF-WD-001",
+                properties: {
+                    launch_lon: this.redForm.lon,
+                    launch_lat: this.redForm.lat,
+                    launch_h: this.redForm.h,
+                    target_lon: item[item.name].properties.lon,
+                    target_lat: item[item.name].properties.lat,
+                    target_h: item[item.name].properties.h,
+                    apogee_height: 100000,
+                    fly_time: 900,
+                    filepath: "test.csv",
+                    sample_time: 1
+                }
+            },
+            components_cnt: 1,
+            components_ids: "20",
+            components_json: {
+                干扰器1: {
+                    id: 20,
+                    number: "G1",
+                    type: "GR-NBLD-001",
+                    N: 1,
+                    ts: 10000000,
+                    tr: 0.0004,
+                    tau: 0.0001,
+                    f0: 1000000,
+                    method: this.redForm.method,
+                    url: "ws://localhost:1240"
+                }
+            },
+            unit_json: null
+        })
+      this.redVisible = false
+
+    },
+    saveNewBlue(){
+      for(let i = 0;i<this.blueList.length;i++)
+      {
+        if(this.blueForm.name === this.blueList[i].name)
+        {
+          this.$message("请勿输入已有单元名字")
+          return
+        }
+      }
+      this.blueList.push({
+        order: this.blueList.length+1,
+        name: this.blueForm.name,
+      })
+      this.markLocationbyJson(parseFloat(this.blueForm.lat), parseFloat(this.blueForm.lon), parseFloat(this.blueForm.h), this.blueForm.name, "blue")
+       
+        this.jsonData.blueunit.push({
+            name: this.blueForm.name,
+            type: "末端拦截",
+            belong: "蓝方",
+            health: 100,
+            team: "2",
+            task: "对威胁进行探测与拦截",
+            pos: {
+                lat: this.blueForm.lat,
+                lon:this.blueForm.lon,
+                height: this.blueForm.h,
+                h: this.blueForm.h
+            },
+        })
+      this.blueVisible = false
+
+    },
+    addRed(){
+      this.redForm = {
+          name: '',
+          method: '',
+          lat: '',
+          lon: '',
+          h: '',
+        }
+        this.redVisible = true
+    },
+    addBlue(){
+      this.blueForm = {
+          name: '',
+          lat: '',
+          lon: '',
+          h: '',
+        }
+        this.blueVisible = true
+    },
     async saveJson() {
       if (this.save) {
         const jsonData = JSON.stringify(this.jsonData);
@@ -196,6 +414,8 @@ export default {
       let blueunit = [];
       let satellite = [];
       let center = [];
+      this.redList = [];
+      this.blueList = [];
       // let fileInfoStr = row.blueunit;
       // let fileInfoArr = JSON.parse(fileInfoStr);
       // for (let i = 0; i < fileInfoArr.length; i++) {
@@ -330,6 +550,19 @@ export default {
           // jsonData = response.data
           blueunit = response.data.blueunit
           redunit = response.data.redunit
+          for(let i = 0;i<redunit.length;i++){
+            this.redList.push({
+              order : i+1,
+              name: redunit[i].name,
+              method: redunit[i].components_json["干扰器1"].method
+            })
+          }
+          for(let i=0 ;i<blueunit.length;i++){
+            this.blueList.push({
+              order: i+1,
+              name: blueunit[i].name
+            })
+          }
           satellite = response.data.satellite
           center = response.data.center
           this.save = true
@@ -765,7 +998,7 @@ export default {
       }
       if (type == 'blue') {
         console.log(' radar!!!');
-        const range = 100000;
+        const range = 700000;
         this.$data._viewer2D.entities.add({
           id: this.id,
           position: position,