Преглед изворни кода

fix:多仿真保存更新状态校验

linchengzhe пре 1 година
родитељ
комит
91adaf0202
1 измењених фајлова са 19 додато и 16 уклоњено
  1. 19 16
      src/views/multimodeSimulation/simulationEdit.vue

+ 19 - 16
src/views/multimodeSimulation/simulationEdit.vue

@@ -83,6 +83,7 @@ export default {
   data () {
     return {
       isEdit: true, // 模式, 默认编辑模式 false 预览
+      isUpdate: false, //  更新模式
       tableShow: false, // 是否显示表格,新增默认不显示
       configBtnShow: false,
       projectId: '', // 仿真任务id
@@ -134,6 +135,7 @@ export default {
     this.isEdit = ['edit', 'add'].includes(this.$route.query.mode)
       ? true
       : false
+    this.isUpdate = ['edit', 'preview'].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
@@ -274,23 +276,23 @@ export default {
     // 创建仿真任务
     createTask () {
       // 编辑,更新
-      if (this.isEdit) {
+      if (this.isUpdate) {
         this.$axios({
-            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 || '任务更新失败')
-            }
-          })
+          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 {
         // 创建
         if (
@@ -314,6 +316,7 @@ export default {
               this.isEdit = false
               this.configBtnShow = true
               this.tableShow = true
+              this.isUpdate = true
             } else {
               this.$message.error(res.message || '查询信息失败')
             }