feat(plants): 新增电厂选择底部停靠栏

重构选厂页面布局,替换原有认证信息展示区域,新增已选电厂信息展示和进入功能,优化用户选厂操作流程。
This commit is contained in:
zhangzhenbing committed 2026-11-16 16:59:47 +08:00
1 parent 06373a35a2
commit 694b7632ed
2 files changed
+92 -27

No files matched your search

+2 -2
View File
@@ -18,7 +18,7 @@ const PRESENTATION_IDS = ["csg-jj", "sg-jj"];
export const MOCK_PLANTS = [
{
id: "csg-jj",
name: "南网讲解",
name: "南网案例",
operator: "南网",
region: "讲解",
code: "NJ",
@@ -30,7 +30,7 @@ export const MOCK_PLANTS = [
},
{
id: "sg-jj",
name: "国网讲解",
name: "国网案例",
operator: "国网",
region: "讲解",
code: "GJ",
+90 -25
View File
@@ -45,21 +45,10 @@
<main class="portal-main">
<section class="portal-heading reveal-item">
<div>
<div class="portal-kicker">
<svg class="icon" aria-hidden="true"><use href="#i-zap" /></svg>
电厂统一接入
</div>
<h1>选择虚拟电厂</h1>
<p>您的账号已获得多个平台的访问权限,选择一个电厂开始工作。</p>
</div>
<div class="auth-success">
<svg class="icon" aria-hidden="true"><use href="#i-check-circle" /></svg>
<span>
统一认证已通过
<small>{{ authSummary }}</small>
</span>
</div>
</section>
<section class="plant-toolbar reveal-item">
@@ -89,7 +78,7 @@
<section class="plants-section">
<div class="section-meta">
<span>{{ resultCount }}</span>
<span></span>
<span>
<svg class="icon" aria-hidden="true"><use href="#i-shield-check" /></svg>
权限由统一账户同步
@@ -181,6 +170,29 @@
</button>
</div>
</section>
<!-- 底部选择停靠栏 -->
<section class="selection-dock" aria-label="当前选厂结果">
<div class="selection-info">
<span class="selection-symbol">
<svg class="icon" aria-hidden="true"><use href="#i-zap" /></svg>
</span>
<div>
<small>当前选择</small>
<strong>{{ selectedPlant ? selectedPlant.name : "尚未选择虚拟电厂" }}</strong>
</div>
</div>
<button
class="button button-primary"
type="button"
:disabled="!selectedPlant || entering"
@click="handleEnterPlant"
>
<span class="button-label">{{ entering ? "正在接入" : "进入虚拟电厂" }}</span>
<svg class="icon button-arrow" aria-hidden="true"><use href="#i-arrow-right" /></svg>
<span class="button-spinner" aria-hidden="true"></span>
</button>
</section>
</main>
<footer class="portal-footer">
@@ -249,6 +261,7 @@ const loadError = ref("");
const menuOpen = ref(false);
const helpVisible = ref(false);
const helpCloseButton = ref(null);
const entering = ref(false);
const operatorOptions = OPERATOR_OPTIONS;
const username = computed(() => userStore.username || "未登录用户");
@@ -265,16 +278,7 @@ const filteredPlants = computed(() => {
});
});
const resultCount = computed(() => {
if (loading.value) return "正在获取授权平台";
if (loadError.value) return "加载失败";
return `共 ${filteredPlants.value.length} 个可访问平台`;
});
const authSummary = computed(() => {
if (loading.value || loadError.value) return "平台权限同步中";
return `${plants.value.length} 个平台已授权`;
});
const selectedPlant = computed(() => plants.value.find((plant) => plant.id === selectedId.value));
watch(helpVisible, (visible) => {
document.body.classList.toggle("modal-open", visible);
@@ -309,13 +313,19 @@ function closeHelp() {
function selectPlant(id) {
selectedId.value = id;
setSelectedPlant(id);
const plant = plants.value.find((item) => item.id === id);
if (!plant) return;
}
function handleEnterPlant() {
if (!selectedPlant.value || entering.value) return;
entering.value = true;
const plant = selectedPlant.value;
if (plant.entryUrl) {
window.open(plant.entryUrl, "_blank", "noopener,noreferrer");
ElMessage.success(`${plant.name} 接入成功`);
} else {
ElMessage.warning("暂未授权");
ElMessage.warning("暂未授权该平台");
}
entering.value = false;
}
function resetFilters() {
@@ -1158,6 +1168,61 @@ button:disabled {
width: 74%;
}
/* 底部选择停靠栏 */
.selection-dock {
position: sticky;
z-index: 20;
bottom: 20px;
margin-top: 24px;
padding: 18px 20px 18px 24px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: var(--radius-lg);
color: #ffffff;
background: #123f47;
box-shadow: 0 16px 40px rgba(17, 57, 65, 0.18);
}
.selection-info {
display: flex;
align-items: center;
gap: 14px;
}
.selection-symbol {
width: 42px;
height: 42px;
display: grid;
place-items: center;
border: 1px solid rgba(117, 214, 197, 0.18);
border-radius: var(--radius-md);
color: var(--mint);
background: rgba(117, 214, 197, 0.08);
}
.selection-info > div {
display: flex;
flex-direction: column;
}
.selection-info small {
color: rgba(255, 255, 255, 0.54);
font-size: 10px;
}
.selection-info strong {
margin-top: 2px;
font-size: 15px;
font-weight: 600;
}
.selection-dock .button {
min-width: 196px;
}
.portal-footer {
width: min(100% - 48px, 1200px);
margin: 0 auto;