2026-05-08 14:15:44 +08:00
|
|
|
<template>
|
|
|
|
|
<a-modal
|
2026-05-08 19:11:10 +08:00
|
|
|
:open="visible"
|
2026-05-08 14:15:44 +08:00
|
|
|
:title="title"
|
2026-05-08 19:11:10 +08:00
|
|
|
width="80vw"
|
2026-05-08 14:15:44 +08:00
|
|
|
:footer="null"
|
|
|
|
|
:closable="true"
|
|
|
|
|
@cancel="handleClose"
|
2026-05-08 19:11:10 +08:00
|
|
|
:destroyOnClose="true"
|
2026-05-08 14:15:44 +08:00
|
|
|
class="map-modal"
|
|
|
|
|
>
|
2026-05-08 19:11:10 +08:00
|
|
|
<a-tabs :active-key="currentActiveKey" @change="onTabChange">
|
2026-05-09 19:30:03 +08:00
|
|
|
<a-tab-pane v-for="tab in tabsConfig" :key="tab.key" :tab="tab.name">
|
2026-05-08 19:11:10 +08:00
|
|
|
<div class="content">
|
|
|
|
|
<!-- 基本信息组件 -->
|
2026-05-09 19:30:03 +08:00
|
|
|
<BasicInfo v-if="currentActiveKey === 'basicInfo'" :url="tab.url" />
|
2026-05-08 19:11:10 +08:00
|
|
|
<!-- 地图组件 -->
|
|
|
|
|
<!-- <MapView v-else-if="currentActiveKey === 'mapView'" :data="modalData" /> -->
|
|
|
|
|
<!-- 周边配套组件 -->
|
|
|
|
|
<!-- <SurroundingInfo
|
|
|
|
|
v-else-if="currentActiveKey === 'surrounding'"
|
|
|
|
|
:data="modalData"
|
|
|
|
|
/> -->
|
|
|
|
|
</div>
|
|
|
|
|
</a-tab-pane>
|
2026-05-09 19:30:03 +08:00
|
|
|
<template #rightExtra>
|
2026-05-11 17:45:09 +08:00
|
|
|
<a-tooltip :title="!isEngConfig ? '' : '该电站无专题配置'">
|
|
|
|
|
<a-button type="primary" :disabled="isEngConfig">
|
|
|
|
|
<i class="icon iconfont icon-topic mr-[5px]"></i>
|
|
|
|
|
电站专题
|
|
|
|
|
</a-button></a-tooltip
|
|
|
|
|
>
|
2026-05-09 19:30:03 +08:00
|
|
|
</template>
|
2026-05-08 19:11:10 +08:00
|
|
|
</a-tabs>
|
2026-05-08 14:15:44 +08:00
|
|
|
</a-modal>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2026-05-08 19:11:10 +08:00
|
|
|
import { ref, watch } from "vue";
|
2026-05-08 14:15:44 +08:00
|
|
|
// 导入预定义的 Tab 内容组件
|
2026-05-08 19:11:10 +08:00
|
|
|
import BasicInfo from "./components/BasicInfo.vue";
|
2026-05-09 19:30:03 +08:00
|
|
|
import { useModelStore } from "@/store/modules/model";
|
|
|
|
|
import { handleTabs } from "./setting.config";
|
|
|
|
|
|
|
|
|
|
const modelStore = useModelStore();
|
|
|
|
|
const tabsConfig = ref([]);
|
|
|
|
|
// 判断是否显示电站专题配置
|
|
|
|
|
const isEngConfig = ref(true);
|
2026-05-08 19:11:10 +08:00
|
|
|
// import MapView from './components/MapView.vue';
|
|
|
|
|
// import SurroundingInfo from './components/SurroundingInfo.vue';
|
2026-05-08 14:15:44 +08:00
|
|
|
|
|
|
|
|
// 定义 Tab 配置项接口
|
|
|
|
|
interface TabItem {
|
|
|
|
|
key: string;
|
|
|
|
|
title: string;
|
2026-05-08 19:11:10 +08:00
|
|
|
url: string;
|
2026-05-08 14:15:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 定义 Props
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
visible: boolean;
|
|
|
|
|
title?: string;
|
|
|
|
|
activeKey?: string; // 外部控制的当前激活 tab
|
|
|
|
|
data?: any; // 可选:传递给内部组件的数据
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
// 定义 Emits
|
2026-05-08 19:11:10 +08:00
|
|
|
// 添加 'update:activeKey' 以支持 v-model:active-key
|
2026-05-08 14:15:44 +08:00
|
|
|
const emit = defineEmits<{
|
2026-05-08 19:11:10 +08:00
|
|
|
(e: "update:visible", value: boolean): void;
|
|
|
|
|
(e: "change", key: string): void;
|
2026-05-08 14:15:44 +08:00
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
// 内部维护的 activeKey
|
2026-05-11 17:45:09 +08:00
|
|
|
const currentActiveKey = ref<string>("");
|
2026-05-08 14:15:44 +08:00
|
|
|
|
2026-05-08 19:11:10 +08:00
|
|
|
// 监听外部传入的 activeKey 变化,同步到内部状态
|
|
|
|
|
watch(
|
|
|
|
|
() => props.activeKey,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
if (newVal && newVal !== currentActiveKey.value) {
|
|
|
|
|
currentActiveKey.value = newVal;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true }
|
|
|
|
|
);
|
2026-05-09 19:30:03 +08:00
|
|
|
watch(
|
|
|
|
|
() => modelStore.params,
|
|
|
|
|
(newVal) => {
|
2026-05-13 08:45:15 +08:00
|
|
|
console.log(newVal);
|
2026-05-09 19:30:03 +08:00
|
|
|
tabsConfig.value = handleTabs(newVal);
|
2026-05-11 17:45:09 +08:00
|
|
|
let value = tabsConfig.value.find((item: any) => item.default);
|
|
|
|
|
currentActiveKey.value = value?.key;
|
2026-05-09 19:30:03 +08:00
|
|
|
},
|
|
|
|
|
{ deep: true, immediate: true }
|
|
|
|
|
);
|
2026-05-08 19:11:10 +08:00
|
|
|
// 监听内部 tab 切换
|
|
|
|
|
const onTabChange = (key: string) => {
|
|
|
|
|
currentActiveKey.value = key;
|
|
|
|
|
// 通知父组件更新 activeKey (支持 v-model)
|
|
|
|
|
// 通知父组件发生了切换事件 (用于业务逻辑,如加载数据)
|
|
|
|
|
emit("change", key);
|
|
|
|
|
};
|
2026-05-08 14:15:44 +08:00
|
|
|
|
|
|
|
|
// 关闭弹窗
|
|
|
|
|
const handleClose = () => {
|
2026-05-08 19:11:10 +08:00
|
|
|
emit("update:visible", false);
|
2026-05-08 14:15:44 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 为了方便模板中使用,将 props.data 暴露给模板
|
|
|
|
|
const modalData = ref(props.data);
|
2026-05-08 19:11:10 +08:00
|
|
|
watch(
|
|
|
|
|
() => props.data,
|
|
|
|
|
(newVal) => {
|
|
|
|
|
modalData.value = newVal;
|
|
|
|
|
}
|
|
|
|
|
);
|
2026-05-08 14:15:44 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.map-modal {
|
2026-05-08 19:11:10 +08:00
|
|
|
.content {
|
|
|
|
|
min-height: 600px;
|
2026-05-08 14:15:44 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-05-08 19:11:10 +08:00
|
|
|
</style>
|