Преглед на файлове

fix:仿真任务更新接口替换

linchengzhe преди 1 година
родител
ревизия
0bcd555225
променени са 2 файла, в които са добавени 86 реда и са изтрити 114 реда
  1. 3 1
      src/api/multimode.js
  2. 83 113
      src/views/multimodeSimulation/simulationEdit.vue

+ 3 - 1
src/api/multimode.js

@@ -11,6 +11,7 @@ export default{
   viewMulationSceneResult: basePart +'/simulationProject/viewMultiSimulationProjectResult', // 查看场景评价结果
   createMulationTask:basePart + '/simulationProject/addMultiSimulationProject', // 创建仿真任务
   addMulationSceneList:basePart + '/simulationProject/addMultiSimulationScene', // 添加仿真场景列表数据
+  updateMulationSceneList:basePart + '/simulationProject/updateMultiSimulationProjectDetail', // 更新仿真场景列表
   deleteMulationScene :basePart + '/simulationProject/deleteMultiSimulationScene', // 删除多模式场景
   copyMulationScene:basePart+'/simulationProject/copyMultiSimulationScene', // 复制场景列表
   saveMulationTask : basePart + '/simulationProject/submitMultiSimulationProjectDetail', // 提交多模式任务
@@ -20,4 +21,5 @@ export default{
   queryMapDetailByID: basePart + '/simulationMap/getSimulationMap', // 获取地图详情
   updateMapDetail:basePart + '/simulationMap/updateSimulationMap', // 更新地图信息
   deleteMapById:basePart + '/simulationMap/deleteSimulationMap', // 删除地图列表
-}
+}
+

+ 83 - 113
src/views/multimodeSimulation/simulationEdit.vue

@@ -1,115 +1,64 @@
 <template>
-  <div
-    style="
+  <div style="
       width: 100%;
       display: flex;
       flex-direction: column;
       padding: 20px 50px;
-    "
-  >
-    <p
-      style="
+    ">
+    <p style="
         font-size: 18px;
         font-weight: bold;
         border-bottom: 1px solid #ccc;
         padding-bottom: 15px;
-      "
-    >
+      ">
       基础信息
     </p>
     <search-layout :needBox="true">
       <template slot="searchItem1">
         <span class="label">项目名称</span>
-        <el-input
-          v-model="baseInfo.projectName"
-          size="small"
-          clearable
-          placeholder="请输入"
-          maxlength="60"
-          :disabled="!isEdit"
-        >
+        <el-input v-model="baseInfo.projectName" size="small" clearable placeholder="请输入" maxlength="60"
+          :disabled="!isEdit">
         </el-input>
       </template>
       <template slot="searchItem3">
         <span class="label">最大仿真时间(s)</span>
-        <el-input
-          v-model="baseInfo.projectMaxSeconds"
-          size="small"
-          clearable
-          placeholder="请输入"
-          maxlength="60"
-          :disabled="!isEdit"
-        >
+        <el-input v-model="baseInfo.projectMaxSeconds" size="small" clearable placeholder="请输入" maxlength="60"
+          :disabled="!isEdit">
         </el-input>
         <span style="color: red" class="label">(最小是5,最大4500)</span>
       </template>
       <template slot="searchItem8">
         <span class="label">项目描述</span>
-        <el-input
-          v-model="baseInfo.projectDescription"
-          size="small"
-          clearable
-          placeholder="请输入"
-          maxlength="60"
-          :disabled="!isEdit"
-        >
+        <el-input v-model="baseInfo.projectDescription" size="small" clearable placeholder="请输入" maxlength="60"
+          :disabled="!isEdit">
         </el-input>
       </template>
     </search-layout>
-    <p
-      style="
+    <p style="
         font-size: 18px;
         font-weight: bold;
         border-bottom: 1px solid #ccc;
         padding-bottom: 15px;
         margin-top: 30px;
-      "
-    >
+      ">
       场景详情
     </p>
     <div style="display: flex; justify-content: end; margin: 20px 50px">
-      <el-button
-        v-if="configBtnShow"
-        class="addBtn"
-        icon="el-icon-circle-plus-outline"
-        @click="addConfig"
-        type="primary"
-        >添加</el-button
-      >
-      <el-button
-        v-if="configBtnShow"
-        class="addBtn"
-        icon="el-icon-circle-plus-outline"
-        @click="copyConfig"
-        type="primary"
-        >复制配置</el-button
-      >
+      <el-button v-if="configBtnShow" class="addBtn" icon="el-icon-circle-plus-outline" @click="addConfig"
+        type="primary">添加</el-button>
+      <el-button v-if="configBtnShow" class="addBtn" icon="el-icon-circle-plus-outline" @click="copyConfig"
+        type="primary">复制配置</el-button>
     </div>
-    <tableList
-      v-if="tableShow"
-      ref="table"
-      style="margin: 0 30px 30px"
-      :columns="columns"
-      :getDataWay="getDataWay"
-      :pagination="pagination"
-      selection
-      index
-      :needSelectedCallBack="true"
-      :selectedCallBack="selectedCallBackB"
-      :selectedAllCallBack="selectedAllCallBackB"
-    >
+    <tableList v-if="tableShow" ref="table" style="margin: 0 30px 30px" :columns="columns" :getDataWay="getDataWay"
+      :pagination="pagination" selection index :needSelectedCallBack="true" :selectedCallBack="selectedCallBackB"
+      :selectedAllCallBack="selectedAllCallBackB">
       <el-table-column label="操作" slot="cgInfos" align="center" width="180">
         <template v-slot="scope">
-          <span v-if="!isEdit && ![2,4,6,null].includes(scope.row.taskStatus)" @click="toEvaluate(scope.row)" class="elIcon">
+          <span v-if="!isEdit && ![2, 4, 6, null].includes(scope.row.taskStatus)" @click="toEvaluate(scope.row)"
+            class="elIcon">
             评价结果
           </span>
-          <i
-            v-if="isEdit"
-            @click="navigatorEdit(scope.row.id)"
-            class="elIcon el-icon-edit-outline"
-            title="编辑"
-          >
-            
+          <i v-if="isEdit" @click="navigatorEdit(scope.row.id)" class="elIcon el-icon-edit-outline" title="编辑">
           </i>
           <i v-if="isEdit" @click="deleteScene(scope.row.id)" class="elIcon el-icon-delete" title="删除">
           </i>
@@ -131,7 +80,7 @@ export default {
   name: 'simulationEdit',
   components: { searchLayout, tableList },
 
-  data() {
+  data () {
     return {
       isEdit: true, // 模式, 默认编辑模式 false 预览
       tableShow: false, // 是否显示表格,新增默认不显示
@@ -181,7 +130,7 @@ export default {
       },
     }
   },
-  mounted() {
+  mounted () {
     this.isEdit = ['edit', 'add'].includes(this.$route.query.mode)
       ? true
       : false
@@ -196,7 +145,7 @@ export default {
   },
   methods: {
     // 获取任务详情信息
-    getTaskDetailById(id) {
+    getTaskDetailById (id) {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.queryMulationDetailById,
@@ -215,7 +164,7 @@ export default {
         }
       })
     },
-    deleteScene(id) {
+    deleteScene (id) {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.deleteMulationScene,
@@ -232,7 +181,7 @@ export default {
       })
     },
     // 提交
-    saveTask() {
+    saveTask () {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.saveMulationTask,
@@ -254,13 +203,13 @@ export default {
       })
     },
     // 刷新场景列表
-    refreshList(param) {
+    refreshList (param) {
       param
         ? this.$refs['table'].loadData(param)
         : this.$refs['table'].loadData()
     },
     // 复制场景列表
-    copyConfig() {
+    copyConfig () {
       if (this.selectSceneIds.length <= 0) {
         this.$message.warning('请选择要复制的列表')
         return
@@ -282,7 +231,7 @@ export default {
       }
     },
     // 新增场景列表
-    addConfig() {
+    addConfig () {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.addMulationSceneList,
@@ -301,7 +250,7 @@ export default {
       })
     },
     // 单列表选中
-    selectedCallBackB(row, type) {
+    selectedCallBackB (row, type) {
       // 选中
       if (type == 1) {
         const arr = this.selectSceneIds
@@ -315,7 +264,7 @@ export default {
       }
     },
     // 全选
-    selectedAllCallBackB(row) {
+    selectedAllCallBackB (row) {
       const arr = []
       row.forEach((item) => {
         arr.push(item.id)
@@ -323,52 +272,73 @@ export default {
       this.selectSceneIds = arr
     },
     // 创建仿真任务
-    createTask() {
-      if (
-        this.baseInfo.projectName &&
-        this.baseInfo.projectMaxSeconds &&
-        this.baseInfo.projectDescription
-      ) {
+    createTask () {
+      // 编辑,更新
+      if (this.isEdit) {
         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 || '查询信息失败')
-          }
-        })
+            method: 'post',
+            url: this.$api.multimode.updateMulationSceneList,
+            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('仿真任务更新成功')
+            } else {
+              this.$message.error(res.message || '任务更新失败')
+            }
+          })
       } else {
-        this.$message.warning('请填写完整信息后再保存')
+        // 创建
+        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() {
+    cancelHandle () {
       this.$router.back()
     },
     // 跳转场景评价
-    toEvaluate(row) {
+    toEvaluate (row) {
       this.$router.push({
         path: '/evaluationResults',
         query: { id: row.id },
       })
     },
-    navigatorEdit(id) {
+    navigatorEdit (id) {
       this.$router.push({
         name: 'multimodeSimulationEdit',
         query: {
           sceneId: id,
-          projectId:this.projectId
+          projectId: this.projectId
         },
       })
     },