|
@@ -69,7 +69,7 @@
|
|
|
</p>
|
|
|
<div style="display: flex; justify-content: end; margin: 20px 50px">
|
|
|
<el-button
|
|
|
- v-if="isEdit"
|
|
|
+ v-if="configBtnShow"
|
|
|
class="addBtn"
|
|
|
icon="el-icon-circle-plus-outline"
|
|
|
@click="addConfig"
|
|
@@ -77,7 +77,7 @@
|
|
|
>添加</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
- v-if="isEdit"
|
|
|
+ v-if="configBtnShow"
|
|
|
class="addBtn"
|
|
|
icon="el-icon-circle-plus-outline"
|
|
|
@click="copyConfig"
|
|
@@ -86,6 +86,7 @@
|
|
|
>
|
|
|
</div>
|
|
|
<tableList
|
|
|
+ v-if="tableShow"
|
|
|
ref="table"
|
|
|
style="margin: 0 30px 30px"
|
|
|
:columns="columns"
|
|
@@ -95,12 +96,23 @@
|
|
|
>
|
|
|
<el-table-column label="操作" slot="cgInfos" align="center" width="180">
|
|
|
<template v-slot="scope">
|
|
|
- <span v-if="!isEdit" @click="toEvaluate" class="elIcon"> 评价结果 </span>
|
|
|
- <span v-if="isEdit" @click="navigatorEdit" class="elIcon"> 编辑 </span>
|
|
|
- <span v-if="isEdit" @click="" class="elIcon"> 删除 </span>
|
|
|
+ <span v-if="!isEdit" @click="toEvaluate(scope.row)" class="elIcon">
|
|
|
+ 评价结果
|
|
|
+ </span>
|
|
|
+ <span v-if="isEdit" @click="navigatorEdit" class="elIcon">
|
|
|
+ 编辑
|
|
|
+ </span>
|
|
|
+ <span v-if="isEdit" @click="deleteScene(scope.row.id)" class="elIcon">
|
|
|
+ 删除
|
|
|
+ </span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</tableList>
|
|
|
+ <div style="display: flex; justify-content: center; margin-top: 30px">
|
|
|
+ <el-button type="primary" @click="createTask">保存</el-button>
|
|
|
+ <el-button type="primary" @click="saveTask">提交</el-button>
|
|
|
+ <el-button @click="cancelHandle">取消</el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -114,23 +126,26 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
isEdit: true, // 模式, 默认编辑模式 false 预览
|
|
|
+ tableShow: false, // 是否显示表格,新增默认不显示
|
|
|
+ configBtnShow: false,
|
|
|
+ projectId: '', // 仿真任务id
|
|
|
baseInfo: {
|
|
|
projectName: '', // 项目名称
|
|
|
- projectMaxSeconds: 0, // 最大仿真时间
|
|
|
+ projectMaxSeconds: '', // 最大仿真时间
|
|
|
projectDescription: '', // 项目描述
|
|
|
},
|
|
|
columns: [
|
|
|
{
|
|
|
label: '地图文件',
|
|
|
- prop: 'id',
|
|
|
+ prop: 'mapName',
|
|
|
},
|
|
|
{
|
|
|
label: '车辆数量',
|
|
|
- prop: 'projectName',
|
|
|
+ prop: 'carNums',
|
|
|
},
|
|
|
{
|
|
|
label: '创建时间',
|
|
|
- prop: 'sceneNums',
|
|
|
+ prop: 'createTime',
|
|
|
},
|
|
|
{
|
|
|
label: '操作',
|
|
@@ -148,56 +163,160 @@ export default {
|
|
|
},
|
|
|
getDataWay: {
|
|
|
//加载表格数据
|
|
|
- dataType: 'data',
|
|
|
+ dataType: 'url',
|
|
|
type: 'post',
|
|
|
- // firstRequest: false,
|
|
|
- data: [
|
|
|
- {
|
|
|
- id: 'd1245825a1aa5a6',
|
|
|
- projectKey: '20240130-1',
|
|
|
- projectName: '1007',
|
|
|
- projectStatus: 0,
|
|
|
- projectStatusValue: '未开始',
|
|
|
- createTime: '2024-01-30 16:15:43',
|
|
|
- sceneNums: 1,
|
|
|
- },
|
|
|
- {
|
|
|
- id: 'd4582d2a6',
|
|
|
- projectKey: '20240130-1',
|
|
|
- projectName: '1007',
|
|
|
- projectStatus: 1,
|
|
|
- projectStatusValue: '已结束',
|
|
|
- createTime: '2024-01-30 16:15:43',
|
|
|
- sceneNums: 1,
|
|
|
- },
|
|
|
- ],
|
|
|
+ data: this.$api.multimode.queryMulationSceneList,
|
|
|
param: {
|
|
|
- share: '0',
|
|
|
+ projectId: this.$route.query.id || '',
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log('加桌', this.$route.query.mode)
|
|
|
- this.isEdit = this.$route.query.mode == 'edit' ? true : false
|
|
|
+ this.isEdit = ['edit', 'add'].includes(this.$route.query.mode)
|
|
|
+ ? true
|
|
|
+ : false
|
|
|
+ this.configBtnShow = this.$route.query.mode == 'edit' ? true : false
|
|
|
+ if (['edit', 'preview'].includes(this.$route.query.mode)) {
|
|
|
+ this.tableShow = true
|
|
|
+ }
|
|
|
+ if (this.$route.query.id) {
|
|
|
+ this.projectId = this.$route.query.id
|
|
|
+ this.getTaskDetailById(this.$route.query.id)
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 获取任务详情信息
|
|
|
+ getTaskDetailById(id) {
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: this.$api.multimode.queryMulationDetailById,
|
|
|
+ data: {
|
|
|
+ projectId: id,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.baseInfo = {
|
|
|
+ projectName: res.info.projectName, // 项目名称
|
|
|
+ projectMaxSeconds: res.info.projectMaxSeconds, // 最大仿真时间
|
|
|
+ projectDescription: res.info.projectDescription, // 项目描述
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message || '查询信息失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ deleteScene(id) {
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: this.$api.multimode.deleteMulationScene,
|
|
|
+ data: {
|
|
|
+ sceneId: id,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.refreshList({ projectId: this.projectId })
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message || '删除失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ saveTask() {
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: this.$api.multimode.saveMulationTask,
|
|
|
+ data: {
|
|
|
+ projectId: this.projectId,
|
|
|
+ projectName: this.baseInfo.projectName,
|
|
|
+ projectMaxSeconds: this.baseInfo.projectMaxSeconds,
|
|
|
+ projectDescription: this.baseInfo.projectDescription,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ this.$router.push({
|
|
|
+ path:'/multimodeSimulation'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message || '提交失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 刷新场景列表
|
|
|
+ refreshList(param) {
|
|
|
+ param
|
|
|
+ ? this.$refs['table'].loadData(param)
|
|
|
+ : this.$refs['table'].loadData()
|
|
|
+ },
|
|
|
copyConfig() {},
|
|
|
- addConfig() {},
|
|
|
- toEvaluate(){
|
|
|
+ // 新增场景列表
|
|
|
+ addConfig() {
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: this.$api.multimode.addMulationSceneList,
|
|
|
+ data: {
|
|
|
+ projectId: this.projectId,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success('添加成功')
|
|
|
+ this.refreshList({ projectId: this.projectId })
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message || '添加失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 创建仿真任务
|
|
|
+ createTask() {
|
|
|
+ if (
|
|
|
+ this.baseInfo.projectName &&
|
|
|
+ this.baseInfo.projectMaxSeconds &&
|
|
|
+ this.baseInfo.projectDescription
|
|
|
+ ) {
|
|
|
+ this.$axios({
|
|
|
+ method: 'post',
|
|
|
+ url: this.$api.multimode.createMulationTask,
|
|
|
+ data: {
|
|
|
+ projectName: this.baseInfo.projectName,
|
|
|
+ projectMaxSeconds: this.baseInfo.projectMaxSeconds,
|
|
|
+ projectDescription: this.baseInfo.projectDescription,
|
|
|
+ },
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success('仿真任务创建成功')
|
|
|
+ this.getDataWay.param.projectId = res.info.projectId
|
|
|
+ this.projectId = res.info.projectId
|
|
|
+ this.isEdit = false
|
|
|
+ this.configBtnShow = true
|
|
|
+ this.tableShow = true
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.message || '查询信息失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message.warning('请填写完整信息后再保存')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cancelHandle() {
|
|
|
+ this.$router.back()
|
|
|
+ },
|
|
|
+ // 跳转场景评价
|
|
|
+ toEvaluate(row) {
|
|
|
this.$router.push({
|
|
|
path: '/evaluationResults',
|
|
|
+ query: { id: row.id },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ navigatorEdit() {
|
|
|
+ this.$router.push({
|
|
|
+ name: 'multimodeSimulationEdit',
|
|
|
+ query: {
|
|
|
+ sceneId: 'b1e8fb96cf8a41d9a0364d29a9289628',
|
|
|
+ },
|
|
|
})
|
|
|
},
|
|
|
- navigatorEdit(){
|
|
|
- this.$router.push({
|
|
|
- name: 'multimodeSimulationEdit',
|
|
|
- query: {
|
|
|
- sceneId: 'b1e8fb96cf8a41d9a0364d29a9289628'
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
- }
|
|
|
},
|
|
|
}
|
|
|
</script>
|