wangjuncheng
2025-04-15 01b0b254f44dbde52ddeb1a82b7997f3f992a86d
src/views/left/Left.vue
@@ -12,7 +12,7 @@
        "
      >
        <el-button @click="handleClick">新建仿真方案</el-button>
        <el-button>删除仿真方案</el-button>
        <el-button @click="deleteSelectedScheme">删除仿真方案</el-button>
      </div>
      <!-- <div class="mock">
        <div
@@ -31,7 +31,7 @@
        @start="start"
        @end="end"
      /> -->
      <schemeCard @start="start" @end="end" />
      <schemeCard ref="schemeCardRef" @start="start" @end="end" />
    </div>
  </div>
  <div class="left" v-show="showAddIns">
@@ -40,10 +40,11 @@
</template>
<script setup>
import { ElMessageBox, ElMessage } from "element-plus";
import { ref, onMounted, onBeforeUnmount, defineEmits } from "vue";
import Simulation from "./Simulation.vue";
import schemeCard from "@/components/monifangzhen/schemeCard.vue";
import { useSimStore } from "@/store/simulation.js";
// import listInfo from "@/components/monifangzhen/listInfo.vue";
// import RiverLevel from "@/components/monifangzhen/RiverLevel.vue";
import { createPoint, removeEntities } from "@/utils/map";
@@ -299,7 +300,7 @@
    y: 4492925.204,
  },
];
const simStore = useSimStore();
const showAddIns = ref(false);
let divPointList = [];
function handleClick() {
@@ -407,7 +408,30 @@
  const entity = viewer.entities.add(model);
  // entities.push(entity)
}
const schemeCardRef = ref(null);
function deleteSelectedScheme() {
  const selectedId = schemeCardRef.value.getSelectedId();
  const selectedScheme = simStore.schemCard.find(item => item.id === selectedId);
  if (!selectedId) {
    ElMessage.warning("请先选择一个方案!");
    return;
  }
  ElMessageBox.confirm(
    `确定要删除  "${selectedScheme.name}" 方案吗?`,
    "删除确认",
    {
      confirmButtonText: "确定",
      cancelButtonText: "取消",
      type: "warning",
    }
  )
    .then(() => {
      simStore.removeSchemCardItem(selectedId);
      ElMessage.success(`方案 "${selectedScheme.name}" 删除成功!`);
    })
    .catch(() => {
    });
}
function start(form) {
  emits("start", form);
}