guonan
2025-04-16 0face36fd79ce30127c80d131b1bc41106133f3b
src/views/left/Left.vue
@@ -12,6 +12,7 @@
        "
      >
        <el-button @click="handleClick">新建仿真方案</el-button>
        <!-- <el-button @click="deleteSelectedScheme">删除仿真方案</el-button> -->
        <el-button>删除仿真方案</el-button>
      </div>
      <!-- <div class="mock">
@@ -31,19 +32,20 @@
        @start="start"
        @end="end"
      /> -->
      <schemeCard @start="start" @end="end" />
      <schemeCard ref="schemeCardRef" @start="start" @end="end" />
    </div>
  </div>
  <div class="left" v-show="showAddIns">
    <simulation @start="start" @end="end"/>
    <simulation @start="start" @end="end" @back="handleBack" />
  </div>
</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,14 +301,16 @@
    y: 4492925.204,
  },
];
const simStore = useSimStore();
const showAddIns = ref(false);
let divPointList = [];
function handleClick() {
  // currentMock.value = mock.name;
  showAddIns.value = true;
}
function handleBack(value) {
  showAddIns.value = false; // 隐藏子组件
}
function initDevicePoint() {
  list.forEach((item) => {
    item.id = item.id + item.alias;
@@ -405,7 +409,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);
}
@@ -426,7 +453,6 @@
});
</script>
<style lang="less" scoped>
@import url("../../assets/css/left.css");
.mock {
  padding-top: 10px;
  padding-right: 10px;