Browse Source

feat:多仿真任务列表添加重新运行按钮

linchengzhe 9 tháng trước cách đây
mục cha
commit
82d3fb3fce
2 tập tin đã thay đổi với 71 bổ sung89 xóa
  1. 5 1
      src/api/workManagement.js
  2. 66 88
      src/views/workManagement/simulationEvaluate.vue

+ 5 - 1
src/api/workManagement.js

@@ -42,10 +42,13 @@ const deleteRecord = basePart + '/simulationProject/deleteMultiSimulationSceneCa
 const settingsSimulation = basePart + '/simulationProject/setMultiSimulationSceneCarView';//设置仿真视角
 const saveOrUpdateSceneCarList = basePart + '/simulationProject/addOrUpdateMultiSimulationSceneCarList';//设置仿真视角
 const getMultiSimulationSceneDetail = basePart + '/simulationProject/getMultiSimulationSceneDetail';//获取多模式仿真场景详情
+const getMultiSimulationSceneStatus = basePart + '/simulationProject/updateMultiSimulationProjectSceneStatusRetry'; // 状态更新
 const getStandardTestReport = basePart + '/simulationProject/getProjectReportForAllReferenceScene'; // 标准化测试报告
 
 const selectAllSimulationMageGroupList = basePart + '/simulationMageGroup/selectAllSimulationMageGroupList';
 
+
+
 export default {
     addOrUpdateProject,
     selectProjectById,
@@ -91,5 +94,6 @@ export default {
     querySceneEvaluationDetail,
     getStandardTestReport,
 
-    selectAllSimulationMageGroupList
+    selectAllSimulationMageGroupList,
+    getMultiSimulationSceneStatus
 }

+ 66 - 88
src/views/workManagement/simulationEvaluate.vue

@@ -1,115 +1,68 @@
 <template>
   <router-view v-if="$route.path.includes('evaluationResults')"></router-view>
-  <div
-    v-else
-    style="
+  <div v-else 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 && scope.row.taskStatus == 4" @click="updateStatus(scope.row)" class="elIcon">
+            重新运行
+          </span>
+          <span v-if="!isEdit && ![2, 6, null].includes(scope.row.taskStatus) && scope.row.taskStatus != 4"
+            @click="toEvaluate(scope.row)" class="elIcon">
             评价结果
           </span>
-          <span v-else>-</span>
+          <!-- <span v-else>-</span> -->
         </template>
       </el-table-column>
     </tableList>
@@ -128,7 +81,7 @@ export default {
   name: 'simulationEvaluate',
   components: { searchLayout, tableList },
 
-  data() {
+  data () {
     return {
       isEdit: true, // 模式, 默认编辑模式 false 预览
       isUpdate: false, //  更新模式
@@ -161,8 +114,12 @@ export default {
         {
           label: '运行状态',
           prop: 'taskStatus',
-          formatter(row) {
+          formatter (row) {
             switch (Number(row.taskStatus)) {
+              case 0:
+                return '初始状态'
+              case 1:
+                return '初始状态'
               case 2:
                 return '手动终止'
               case 3:
@@ -181,7 +138,7 @@ export default {
         {
           label: '运行结果',
           prop: 'taskStatus',
-          formatter(row) {
+          formatter (row) {
             if ([3, 5, '3', '5'].includes(row.taskStatus)) {
               return '成功'
             } else {
@@ -214,7 +171,7 @@ export default {
       },
     }
   },
-  mounted() {
+  mounted () {
     this.isEdit = ['edit', 'add'].includes(this.$route.query.mode)
       ? true
       : false
@@ -232,7 +189,7 @@ export default {
   },
   methods: {
     // 获取任务详情信息
-    getTaskDetailById(id) {
+    getTaskDetailById (id) {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.queryMulationDetailById,
@@ -251,7 +208,7 @@ export default {
         }
       })
     },
-    deleteScene(id) {
+    deleteScene (id) {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.deleteMulationScene,
@@ -268,7 +225,7 @@ export default {
       })
     },
     // 提交
-    saveTask() {
+    saveTask () {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.saveMulationTask,
@@ -290,13 +247,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
@@ -318,7 +275,7 @@ export default {
       }
     },
     // 新增场景列表
-    addConfig() {
+    addConfig () {
       this.$axios({
         method: 'post',
         url: this.$api.multimode.addMulationSceneList,
@@ -337,7 +294,7 @@ export default {
       })
     },
     // 单列表选中
-    selectedCallBackB(row, type) {
+    selectedCallBackB (row, type) {
       // 选中
       if (type == 1) {
         const arr = this.selectSceneIds
@@ -351,7 +308,7 @@ export default {
       }
     },
     // 全选
-    selectedAllCallBackB(row) {
+    selectedAllCallBackB (row) {
       const arr = []
       row.forEach((item) => {
         arr.push(item.id)
@@ -359,7 +316,7 @@ export default {
       this.selectSceneIds = arr
     },
     // 创建仿真任务
-    createTask() {
+    createTask () {
       // 编辑,更新
       if (this.isUpdate) {
         this.$axios({
@@ -411,17 +368,38 @@ export default {
         }
       }
     },
-    cancelHandle() {
+    cancelHandle () {
       this.$router.back()
     },
     // 跳转场景评价
-    toEvaluate(row) {
+    toEvaluate (row) {
       this.$router.push({
         path: '/multimodeSimulation/simulationEvaluate/evaluationResults',
         query: { id: row.id },
       })
     },
-    navigatorEdit(id) {
+    // 重新运行状态
+    updateStatus (row) {
+      console.log('row', row.id)
+      this.$axios({
+        method: 'post',
+        url: this.$api.workManagement.getMultiSimulationSceneStatus,
+        data: {
+          projectId: this.$route.query.id,
+          sceneIdList: [row.id]
+        },
+      }).then((res) => {
+        if (res.code == 200) {
+          let timer = setTimeout(() => {
+            this.$refs['table'].loadData({
+              projectId: this.$route.query.id
+            })
+            clearTimeout(timer)
+          }, 3000);
+        }
+      })
+    },
+    navigatorEdit (id) {
       this.$router.push({
         name: 'multimodeSimulationEdit',
         query: {