guonan
2025-05-28 86f2633b4c70675bd90e79c9bdaf8a1eb8f95938
src/views/left/KGSim.vue
@@ -10,12 +10,13 @@
        popper-class="mySelectStyle"
        filterable
        :filter-method="filterOptions"
        @change="handleSelectChange"
      >
        <el-option
          v-for="item in filteredOptions"
          :key="item.value"
          :label="item.label"
          :value="item.value"
          :value="item"
        />
      </el-select>
    </div>
@@ -35,7 +36,8 @@
        <el-radio label="预测模拟">预测模拟</el-radio>
      </el-radio-group>
      <div v-if="selectedSimulation === '历史模拟'">
        <HistorySimulation :selectedArea="selectedArea" />
        <!-- <HistorySimulation :selectedArea="selectedArea" /> -->
        <CitySim :selectedArea="selectedArea" />
      </div>
      <div v-if="selectedSimulation === '实时模拟'">
        <RealTimeSimulation :selectedArea="selectedArea" />
@@ -48,25 +50,38 @@
</template>
<script setup>
import { ref, computed } from "vue";
import { ref, computed, onMounted, reactive } from "vue";
import HistorySimulation from "./KGSimOption/HistorySimulation.vue";
import CitySim from './CitySim.vue'
import PredictiveSimulation from "./KGSimOption/PredictiveSimulation.vue";
import RealTimeSimulation from "./KGSimOption/RealTimeSimulation.vue";
import { getRegionData } from "@/api/trApi";
import { EventBus } from "@/eventBus"; // 引入事件总线
const selectedSimulation = ref("历史模拟");
const selectedArea = ref("孙胡沟");
const earesOptions = [
  { value: "孙胡沟", label: "孙胡沟" },
  { value: "鱼水洞后沟", label: "鱼水洞后沟" },
  { value: "于家西沟", label: "于家西沟" },
  { value: "北河沟", label: "北河沟" },
  { value: "龙泉峪村", label: "龙泉峪村" },
];
const selectedArea = ref(); // 选中的区域
// 重点沟数据
const importGOptions = reactive([]);
onMounted(() => {
  // 获取重点沟数据
  getRegionData({ type: 3 }).then((res) => {
    importGOptions.splice(
      0,
      importGOptions.length,
      ...res.data.map((item) => ({
        id: item.id,
        value: item.geom,
        label: item.name,
      }))
    );
  });
});
// 动态过滤选项
const searchQuery = ref("");
const filteredOptions = computed(() => {
  return earesOptions.filter((option) =>
  return importGOptions.filter((option) =>
    option.label.toLowerCase().includes(searchQuery.value.toLowerCase())
  );
});
@@ -74,6 +89,16 @@
// 自定义过滤方法
const filterOptions = (query) => {
  searchQuery.value = query;
};
// 处理选项选择事件
const handleSelectChange = (value) => {
  EventBus.emit("select-geom", { geom: value.value, flyHeight: 8000 });
  console.log("选中的值:", value); // 打印选中的值
  console.log(
    "当前选中的完整数据:",
    importGOptions.find((item) => item.value === value)
  ); // 打印完整的选中数据
};
const handleStart = () => {
@@ -86,11 +111,11 @@
</script>
<style scoped>
</style>
<style scoped>
.simulation-module {
  color: #61f7d4;
  font-size: 14px;
  height: 100%;
  background: url("@/assets/img/screen/leftbg.png");
}
.simulation-area {
@@ -126,15 +151,4 @@
:deep(.el-input__inner) {
  color: #fff; /* 让文字颜色跟随父级 */
}
/* .mySelectStyle {
    .el-select-dropdown__item:hover {
        color: #009688 !important;
    }
    .el-select-dropdown__item {
      color: #fff !important;
    }
    .el-select-dropdown__item.selected {
        color: #009688 !important;
    }
} */
</style>