feat(cma): alignment mode system-level hint + double confirm (project-20260918-alignment-config-hint)

Frontend only: KPIAlignment.vue adds system-level notice and ElMessageBox confirm before save. No backend/storage change.
This commit is contained in:
Hermes CI Fix
2026-09-18 18:32:22 +08:00
parent ad953ac759
commit 14ab6d211c
+11 -1
View File
@@ -15,6 +15,8 @@
<!-- 模式选择器 -->
<div v-if="showSelector" class="align-setup">
<el-alert v-if="!alignConfigured" title="系统尚未配置KPI对齐模式" type="warning" :closable="false" show-icon class="section-gap" />
<el-alert type="info" :closable="false" show-icon title="系统级设置,影响全部账套"
description="对齐模式保存在系统级配置中,切换后将同时作用于全部账套。" style="margin-bottom:12px;" />
<div style="display:grid;grid-template-columns:1fr 1fr 1fr;gap:12px;">
<el-card v-for="mode in alignModes" :key="mode.key"
:class="{ 'mode-card': true, 'selected-mode': selectedMode === mode.key }"
@@ -136,7 +138,7 @@
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
// 统一走 api/index.ts 的 axios 实例(拦截器自动带 Bearer / 401 跳登录)
import { alignmentApi, mapApi } from '../api/index'
@@ -286,6 +288,14 @@ async function loadConfig() {
async function saveAlignConfig() {
if (!selectedMode.value) return
// 系统级设置二次确认:对齐模式存于全局配置(role_permissions 无 entity_id),切换影响全部账套
try {
await ElMessageBox.confirm(
`对齐模式为系统级设置,切换后将立即作用于全部账套。确认切换为「${selectedModeName.value}」?`,
'系统级设置二次确认',
{ type: 'warning', confirmButtonText: '确认切换', cancelButtonText: '取消' }
)
} catch { return }
saving.value = true
try {
// 修复:原 `'Bearer ' + token` 模板字面量 bug(header 值被写死成字面量 → 必 401)