Explorar el Código

feat:多仿真场景列表批量复制

linchengzhe hace 1 año
padre
commit
233a957ab6
Se han modificado 2 ficheros con 58 adiciones y 4 borrados
  1. 1 0
      src/api/multimode.js
  2. 57 4
      src/views/multimodeSimulation/simulationEdit.vue

+ 1 - 0
src/api/multimode.js

@@ -12,6 +12,7 @@ export default{
   createMulationTask:basePart + '/simulationProject/addMultiSimulationProject', // 创建仿真任务
   addMulationSceneList:basePart + '/simulationProject/addMultiSimulationScene', // 添加仿真场景列表数据
   deleteMulationScene :basePart + '/simulationProject/deleteMultiSimulationScene', // 删除多模式场景
+  copyMulationScene:basePart+'/simulationProject/copyMultiSimulationScene', // 复制场景列表
   saveMulationTask : basePart + '/simulationProject/submitMultiSimulationProjectDetail', // 提交多模式任务
   downloadMulation:basePart + '/simulationProject/downloadMultiSimulationProjectResult', // 多仿真任务下载
   queryMulationMapList:basePart + '/simulationMap/selectSimulationMapList', // 地图上传列表

+ 57 - 4
src/views/multimodeSimulation/simulationEdit.vue

@@ -92,14 +92,22 @@
       :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" @click="toEvaluate(scope.row)" class="elIcon">
             评价结果
           </span>
-          <span v-if="isEdit" @click="navigatorEdit(scope.row.id)" 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">
@@ -134,6 +142,7 @@ export default {
         projectMaxSeconds: '', // 最大仿真时间
         projectDescription: '', // 项目描述
       },
+      selectSceneIds: [], // 选中ids
       columns: [
         {
           label: '地图文件',
@@ -237,7 +246,7 @@ export default {
         if (res.code == 200) {
           this.$message.success('提交成功')
           this.$router.push({
-            path:'/multimodeSimulation'
+            path: '/multimodeSimulation',
           })
         } else {
           this.$message.error(res.message || '提交失败')
@@ -250,7 +259,28 @@ export default {
         ? this.$refs['table'].loadData(param)
         : this.$refs['table'].loadData()
     },
-    copyConfig() {},
+    // 复制场景列表
+    copyConfig() {
+      if (this.selectSceneIds.length <= 0) {
+        this.$message.warning('请选择要复制的列表')
+        return
+      } else {
+        this.$axios({
+          method: 'post',
+          url: this.$api.multimode.copyMulationScene,
+          data: {
+            sceneIdList: this.selectSceneIds,
+          },
+        }).then((res) => {
+          if (res.code == 200) {
+            this.$message.success('复制成功')
+            this.refreshList({ projectId: this.projectId })
+          } else {
+            this.$message.error(res.message || '复制失败')
+          }
+        })
+      }
+    },
     // 新增场景列表
     addConfig() {
       this.$axios({
@@ -261,14 +291,37 @@ export default {
         },
       }).then((res) => {
         if (res.code == 200) {
-        this.isEdit = true
+          this.isEdit = true
           this.$message.success('添加成功')
+          this.selectSceneIds = []
           this.refreshList({ projectId: this.projectId })
         } else {
           this.$message.error(res.message || '添加失败')
         }
       })
     },
+    // 单列表选中
+    selectedCallBackB(row, type) {
+      // 选中
+      if (type == 1) {
+        const arr = this.selectSceneIds
+        arr.push(row.id)
+        this.selectSceneIds = arr
+      } else {
+        // 取消选中
+        this.selectSceneIds = this.selectSceneIds.filter(
+          (item) => item !== row.id
+        )
+      }
+    },
+    // 全选
+    selectedAllCallBackB(row) {
+      const arr = []
+      row.forEach((item) => {
+        arr.push(item.id)
+      })
+      this.selectSceneIds = arr
+    },
     // 创建仿真任务
     createTask() {
       if (