瀏覽代碼

feat:多仿真地图上传

linchengzhe 1 年之前
父節點
當前提交
e63bc289a2

+ 5 - 0
src/api/multimode.js

@@ -13,4 +13,9 @@ export default{
   addMulationSceneList:basePart + '/simulationProject/addMultiSimulationScene', // 添加仿真场景列表数据
   deleteMulationScene :basePart + '/simulationProject/deleteMultiSimulationScene', // 删除多模式场景
   saveMulationTask : basePart + '/simulationProject/submitMultiSimulationProjectDetail', // 提交多模式任务
+  queryMulationMapList:basePart + '/simulationMap/selectSimulationMapList', // 地图上传列表
+  addMulationMap : basePart + '/simulationMap/uploadSimulationMap', //新增多模式仿真地图
+  queryMapDetailByID: basePart + '/simulationMap/getSimulationMap', // 获取地图详情
+  updateMapDetail:basePart + '/simulationMap/updateSimulationMap', // 更新地图信息
+  deleteMapById:basePart + '/simulationMap/deleteSimulationMap', // 删除地图列表
 }

+ 10 - 0
src/router/multimodeSimulation.js

@@ -30,4 +30,14 @@ export default [
         },
         component: () => import("@/views/multimodeSimulation/evaluationResults.vue"),
     },
+    {
+        path: "/simulationMap",
+        name: "simulationMap",
+        meta: {
+            tabname: "地图上传",
+            menuKind: "simulationMap",
+            login: true
+        },
+        component: () => import("@/views/multimodeSimulation/simulationMap.vue"),
+    },
 ]

+ 40 - 46
src/views/multimodeSimulation/evaluationResults.vue

@@ -36,14 +36,13 @@
         margin-top: 30px;
       "
     >
-      在本次场景中,共发生X次碰撞/未发生碰撞,X次异常停车/未发生异常停车,冲出车道X次。
+      {{ describe }}
     </p>
     <tableList
       ref="table"
       style="margin: 30px 30px"
       :columns="columns"
       :getDataWay="getDataWay"
-      :pagination="pagination"
       index
     >
       <el-table-column label="操作" slot="cgInfos" align="center" width="180">
@@ -84,14 +83,16 @@
         </el-option>
       </el-select>
     </div>
-    <div style="width: 100%; height: 500px; border: 2px dashed #ccc;padding: 10px;" >
+    <div
+      style="width: 100%; height: 500px; border: 2px dashed #ccc; padding: 10px"
+    >
       <video
         ref="videoPlayer"
         controls
-        style="width: 100%; height: 100%;"
+        style="width: 100%; height: 100%"
         :controls="true"
       >
-        <source src="https://media.w3.org/2010/05/sintel/trailer.mp4" type="video/mp4" />
+        <source :src="videoList[viewKey]" type="video/mp4" />
         您的浏览器不支持视频标签。
       </video>
     </div>
@@ -109,63 +110,39 @@ export default {
       viewKey: '1',
       viewOptions: [
         {
-          value: '1',
+          value: '0',
           label: '总视角',
         },
         {
-          value: '2',
-          label: '车辆A',
-        },
-        {
-          value: '3',
-          label: '车辆B',
+          value: '1',
+          label: '多仿真视角',
         },
       ],
+      videoList: [], // 视频地址列表
+      describe: '', // 评价描述
       columns: [
         {
           label: '事故类型',
           prop: 'type',
         },
         {
-          label: '发生时间',
-          prop: 'time',
+          label: '状态',
+          prop: 'status',
         },
       ],
-      pagination: {
-        //分页使用
-        currentPage: 1,
-        pageSize: 10,
-        position: 'right',
-        pageSizes: [10, 30, 50, 100, 200],
-        layout: 'sizes, total, prev, pager, next, jumper',
-      },
       getDataWay: {
         //加载表格数据
         dataType: 'data',
         type: 'post',
         // firstRequest: false,
-        data: [
-          {
-            type: '碰撞',
-            time: '2024-01-30 16:15:43',
-          },
-          {
-            type: '异常停车',
-            time: '2024-01-20 07:15:43',
-          },
-          {
-            type: '冲出车道',
-            time: '2024-01-05 11:15:43',
-          },
-        ],
-        param: {
-          share: '0',
-        },
+        data: [],
+        param: {},
       },
     }
   },
-  methods:{
-    getMulationSceneResult(id){
+  methods: {
+    // 获取评价信息
+    getMulationSceneResult(id) {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.viewMulationSceneResult,
@@ -174,16 +151,33 @@ export default {
         },
       }).then((res) => {
         if (res.code == 200) {
-         
+          this.describe = res.info.phrases
+          this.getDataWay.data = [
+            {
+              type: '碰撞',
+              status: res.info.collisionDetail[0].abnormalTimeDescription,
+            },
+            {
+              type: '异常停车',
+              status: res.info.abnormalParkingDetail[0].abnormalTimeDescription,
+            },
+            {
+              type: '冲出车道',
+              status: res.info.outOfPavementDetail[0].abnormalTimeDescription,
+            },
+          ]
+          this.videoList = [
+            res.info.projectResultOverallUrl,
+            res.info.projectResultSimulationUrl,
+          ]
         } else {
           this.$message.error(res.message || '查询信息失败')
         }
       })
-    }
+    },
   },
-  mounted(){
-    console.log('t',this.$route.query.id)
+  mounted() {
     this.$route.query.id && this.getMulationSceneResult(this.$route.query.id)
-  }
+  },
 }
 </script>

+ 3 - 3
src/views/multimodeSimulation/simulationEdit.vue

@@ -99,7 +99,7 @@
           <span v-if="!isEdit" @click="toEvaluate(scope.row)" class="elIcon">
             评价结果
           </span>
-          <span v-if="isEdit" @click="navigatorEdit" class="elIcon">
+          <span v-if="isEdit" @click="navigatorEdit(scope.row.id)" class="elIcon">
             编辑
           </span>
           <span v-if="isEdit" @click="deleteScene(scope.row.id)" class="elIcon">
@@ -309,11 +309,11 @@ export default {
         query: { id: row.id },
       })
     },
-    navigatorEdit() {
+    navigatorEdit(id) {
       this.$router.push({
         name: 'multimodeSimulationEdit',
         query: {
-          sceneId: 'b1e8fb96cf8a41d9a0364d29a9289628',
+          sceneId: id,
         },
       })
     },

+ 13 - 1
src/views/multimodeSimulation/simulationHome.vue

@@ -49,11 +49,17 @@
         <el-button type="primary" @click="doSearch">查询</el-button>
       </template>
       <template slot="searchBtn2">
-        <el-button type="primary" @click="doReset">重置</el-button>
+        <!-- <el-button type="primary" @click="doReset">重置</el-button> -->
       </template>
     </search-layout>
     <div></div>
     <div style="display: flex; justify-content: end; margin: 20px 50px">
+      <el-button
+        class="addBtn"
+        icon="el-icon-circle-plus-outline"
+        @click="mapConfig"
+        type="primary"
+        >地图管理</el-button>
       <el-button
         class="addBtn"
         icon="el-icon-circle-plus-outline"
@@ -227,6 +233,12 @@ export default {
         query: { mode: 'add' },
       })
     },
+    // 跳转地图管理
+    mapConfig(){
+      this.$router.push({
+        path: '/simulationMap',
+      })
+    },
     jumpDetailPage(mode,id) {
       this.$router.push({
         path: '/simulationEdit',

+ 358 - 0
src/views/multimodeSimulation/simulationMap.vue

@@ -0,0 +1,358 @@
+<template>
+  <div class="multimodeSimulation">
+    <search-layout :needBox="true">
+      <template slot="searchItem1">
+        <span class="label">地图名称</span>
+        <el-input
+          v-model="searchParams.mapName"
+          size="small"
+          clearable
+          placeholder="请输入"
+          maxlength="60"
+        >
+        </el-input>
+      </template>
+      <template slot="searchItem1">
+        <span class="label">地图描述</span>
+        <el-input
+          v-model="searchParams.mapDescription"
+          size="small"
+          clearable
+          placeholder="请输入"
+          maxlength="60"
+        >
+        </el-input>
+      </template>
+      <template slot="searchBtn1">
+        <el-button type="primary" @click="doSearch">查询</el-button>
+      </template>
+    </search-layout>
+    <div></div>
+    <div style="display: flex; justify-content: end; margin: 20px 50px">
+      <el-button
+        class="addBtn"
+        icon="el-icon-circle-plus-outline"
+        @click="addConfig"
+        type="primary"
+        >新增</el-button
+      >
+    </div>
+    <tableList
+      ref="table"
+      style="margin: 0 30px 30px"
+      :columns="mapColumns"
+      :getDataWay="getDataWay"
+      :pagination="pagination"
+      index
+    >
+      <el-table-column label="操作" slot="cgInfos" align="center" width="180">
+        <template v-slot="scope">
+          <span @click="editMapDetail(scope.row)" class="elIcon"> 编辑 </span>
+          <span @click="deleteMapById(scope.row)" class="elIcon"> 删除 </span>
+        </template>
+      </el-table-column>
+    </tableList>
+    <el-dialog
+      :title="isEdit ? '编辑地图' : '新增地图'"
+      :visible.sync="editVisible"
+      width="480px"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      @close="closeDialog"
+    >
+      <el-form
+        ref="editInfo"
+        :model="editInfo"
+        label-width="150px"
+        style="display: flex; flex-wrap: wrap; justify-content: space-between"
+      >
+        <el-form-item label="地图名称">
+          <el-input
+            v-model="editInfo.mapName"
+            placeholder="请输入"
+            :disabled="isEdit"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="轨迹数量">
+          <el-input v-model="editInfo.pathNum" placeholder="请输入"></el-input>
+        </el-form-item>
+        <el-form-item label="地图描述">
+          <el-input
+            v-model="editInfo.mapDescription"
+            placeholder="请输入"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="OpenDrive文件" v-if="!isEdit">
+          <el-upload
+            :multiple="false"
+            action=""
+            class="upload-demo"
+            list-type="card"
+            :file-list="openFile"
+            :http-request="(e) => uploadHandle('opendrive', e)"
+            :on-remove="() => fileRemove('opendrive')"
+          >
+            <el-button size="small" type="primary">点击上传</el-button>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label="Json文件" v-if="!isEdit">
+          <el-upload
+            :multiple="false"
+            action=""
+            class="upload-demo"
+            list-type="card"
+            :file-list="jsonFile"
+            :http-request="(e) => uploadHandle('json', e)"
+            :on-remove="() => fileRemove('json')"
+          >
+            <el-button size="small" type="primary">点击上传</el-button>
+          </el-upload>
+        </el-form-item>
+        <el-form-item label="Osgb文件" v-if="!isEdit">
+          <el-upload
+            :multiple="false"
+            action=""
+            class="upload-demo"
+            list-type="card"
+            :file-list="osgbFile"
+            :http-request="(e) => uploadHandle('osgb', e)"
+            :on-remove="() => fileRemove('osgb')"
+          >
+            <el-button size="small" type="primary">点击上传</el-button>
+          </el-upload>
+        </el-form-item>
+      </el-form>
+      <div style="width: 100%; display: flex; justify-content: center">
+        <el-button @click="closeDialog">取消</el-button>
+        <el-button @click="addMulationMap" type="primary">确认</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+import searchLayout from '@/components/grid/searchLayout'
+import tableList from '@/components/grid/TableList'
+export default {
+  name: 'simulationHome', // 多模式仿真
+  components: { searchLayout, tableList },
+  data() {
+    return {
+      searchParams: {
+        mapName: '', // 地图名称
+        mapDescription: '', // 地图描述
+      },
+      selectMapId: '', // 当前编辑地图id
+      editVisible: false, // 地图编辑
+      isEdit: false,
+      openFile: [], // opendrive文件
+      jsonFile: [], // json文件
+      osgbFile: [], // osgb文件
+      // 地图管理表头
+      mapColumns: [
+        {
+          label: '地图名称',
+          prop: 'mapName',
+        },
+        {
+          label: '轨迹数量',
+          prop: 'pathNum',
+        },
+        {
+          label: '地图描述',
+          prop: 'mapDescription',
+        },
+        {
+          label: '创建时间',
+          prop: 'createTime',
+        },
+        {
+          label: '操作',
+          prop: 'cgInfos',
+          template: true,
+        },
+      ],
+      editInfo: {
+        mapName: '',
+        mapDescription: '',
+        pathNum: '',
+      }, // 编辑数据
+      pagination: {
+        //分页使用
+        currentPage: 1,
+        pageSize: 10,
+        position: 'right',
+        pageSizes: [10, 30, 50, 100, 200],
+        layout: 'sizes, total, prev, pager, next, jumper',
+      },
+      getDataWay: {
+        //加载表格数据
+        dataType: 'url',
+        type: 'post',
+        data: this.$api.multimode.queryMulationMapList,
+        param: {},
+      },
+    }
+  },
+  methods: {
+    refreshList(param) {
+      param
+        ? this.$refs['table'].loadData(param)
+        : this.$refs['table'].loadData()
+    },
+    doSearch() {
+      this.refreshList({ ...this.searchParams })
+    },
+    doReset() {
+      this.searchParams = {
+        mapName: '', // 地图名称
+        mapDescription: '', // 地图描述
+      }
+      this.refreshList()
+    },
+    // 仿真任务状态更新
+    updateTask(row) {
+      const { id, projectStatus } = row
+      this.$axios({
+        method: 'post',
+        url: this.$api.multimode.updateMulationStatus,
+        data: {
+          projectId: id,
+          projectStatus: projectStatus == 0 || 2 ? 1 : 2,
+        },
+      }).then((res) => {
+        if (res.code == 200) {
+          this.$message.success('状态更新成功')
+          this.doSearch()
+        } else {
+          this.$message.error(res.message || '更新失败')
+        }
+      })
+    },
+    uploadHandle(type, e) {
+      switch (type) {
+        case 'opendrive':
+          this.openFile = [e.file]
+          break
+        case 'json':
+          this.jsonFile = [e.file]
+          break
+        case 'osgb':
+          this.osgbFile = [e.file]
+          break
+      }
+    },
+    // 地图编辑
+    editMapDetail(row) {
+      const { id } = row
+      this.selectMapId = id
+      this.$axios({
+        method: 'post',
+        url: this.$api.multimode.queryMapDetailByID,
+        data: {
+          mapId: id,
+        },
+      }).then((res) => {
+        if (res.code == 200) {
+          this.editInfo = {
+            mapName: res.info.mapName,
+            mapDescription: res.info.mapDescription,
+            pathNum: res.info.pathNum,
+          }
+          this.editVisible = true
+          this.isEdit = true
+        } else {
+          this.$message.error(res.message || '查询详情信息失败')
+        }
+      })
+    },
+    fileRemove(type) {
+      switch (type) {
+        case 'opendrive':
+          this.openFile = []
+          break
+        case 'json':
+          this.jsonFile = []
+          break
+        case 'osgb':
+          this.osgbFile = []
+          break
+      }
+    },
+    // 更新地图
+    updateMap() {
+      this.$axios({
+        method: 'post',
+        url: this.$api.multimode.updateMapDetail,
+        data: {
+          mapId: this.selectMapId,
+          path_num:this.editInfo.pathNum,
+          map_description:this.editInfo.mapDescription
+        },
+      }).then((res) => {})
+    },
+    deleteMapById(row){
+      const { id } = row
+      this.$axios({
+        method: 'post',
+        url: this.$api.multimode.deleteMapById,
+        data: {
+          mapId: id,
+        },
+      }).then((res) => {})
+    },
+    addMulationMap() {
+      if (this.isEdit) {
+        this.updateMap()
+        return
+      }
+      // addMulationMap
+      let formData = new FormData()
+      const json = JSON.stringify(this.editInfo)
+      const blob = new Blob([json], {
+        type: 'application/json',
+      })
+      formData.append('content', blob)
+      formData.append('fileJson', this.jsonFile[0])
+      formData.append('fileDriver', this.openFile[0])
+      formData.append('fileOsgb', this.osgbFile[0])
+      this.$axios({
+        method: 'post',
+        url: this.$api.sceneLibrary.queryScoringRulesInfo,
+        data: formData,
+        withCredentials: true,
+        headers: {
+          'Content-type': 'multipart/form-data',
+        },
+      }).then((res) => {
+        console.log('res', res)
+      })
+    },
+    addConfig() {
+      this.editVisible = true
+      this.isEdit = false
+    },
+    closeDialog() {
+      this.editInfo = {
+        mapName: '',
+        mapDescription: '',
+        pathNum: '',
+      }
+      this.editVisible = false
+    },
+  },
+}
+</script>
+<style lang='less' scoped>
+// @import './common/util.less';
+.naturalDrivingScenarioListPanel {
+  .inputBox {
+    .label {
+      min-width: 75px;
+    }
+  }
+
+  .btnsPanel {
+    text-align: right;
+  }
+}
+</style>