feat(frontend): M3 AI建议中心默认未应用+类型过滤+Bot来源标签 (P0-②)

- 待批列表默认 status=unapplied(高危建议=人拍板入口)
- 新增 suggestion_type 过滤(全部/kpi_target/budget_adjust/action_plan)
- sourceLabel 补 bot: 'Bot建议'
This commit is contained in:
Hermes CI Fix
2026-09-03 18:08:30 +08:00
parent ea2baa098e
commit d89a5ab777
+11 -2
View File
@@ -3,6 +3,12 @@
<div class="page-head"> <div class="page-head">
<h3>🤖 AI决策建议中心</h3> <h3>🤖 AI决策建议中心</h3>
<div class="head-right"> <div class="head-right">
<el-radio-group v-model="typeFilter" size="small" @change="loadList">
<el-radio-button value="">全部类型</el-radio-button>
<el-radio-button value="kpi_target">改KPI目标</el-radio-button>
<el-radio-button value="budget_adjust">调预算</el-radio-button>
<el-radio-button value="action_plan">建行动方案</el-radio-button>
</el-radio-group>
<el-radio-group v-model="statusFilter" size="small" @change="loadList"> <el-radio-group v-model="statusFilter" size="small" @change="loadList">
<el-radio-button value="">全部</el-radio-button> <el-radio-button value="">全部</el-radio-button>
<el-radio-button value="unapplied">未应用</el-radio-button> <el-radio-button value="unapplied">未应用</el-radio-button>
@@ -112,7 +118,9 @@ import { ref, onMounted } from 'vue'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { aiSuggestionApi } from '../api/index' import { aiSuggestionApi } from '../api/index'
const statusFilter = ref('') // 待批列表默认"未应用"(高危建议=人拍板入口,应用过的历史不占首屏);类型过滤支持高危两类+行动方案
const statusFilter = ref('unapplied')
const typeFilter = ref('')
const items = ref<any[]>([]) const items = ref<any[]>([])
const loading = ref(false) const loading = ref(false)
const showApplyDialog = ref(false) const showApplyDialog = ref(false)
@@ -126,7 +134,7 @@ const sugTypeLabel = (t: string) => ({ kpi_target: '改KPI目标', budget_adjust
const sugTagType = (t: string) => ({ kpi_target: 'warning', budget_adjust: 'danger', action_plan: 'primary' }[t] || 'info') const sugTagType = (t: string) => ({ kpi_target: 'warning', budget_adjust: 'danger', action_plan: 'primary' }[t] || 'info')
const statusLabel = (s: string) => ({ unapplied: '未应用', applied: '已应用', dismissed: '已忽略' }[s] || s) const statusLabel = (s: string) => ({ unapplied: '未应用', applied: '已应用', dismissed: '已忽略' }[s] || s)
const statusTagType = (s: string) => ({ unapplied: 'info', applied: 'success', dismissed: 'info' }[s] || 'info') const statusTagType = (s: string) => ({ unapplied: 'info', applied: 'success', dismissed: 'info' }[s] || 'info')
const sourceLabel = (s: string) => ({ dashboard: '看板分析', kpi: 'KPI分析', budget: '预算分析', manual: '手动', rule: '规则' }[s] || s) const sourceLabel = (s: string) => ({ dashboard: '看板分析', kpi: 'KPI分析', budget: '预算分析', manual: '手动', rule: '规则', bot: 'Bot建议' }[s] || s)
const applyTargetLabel = (t: string) => ({ kpi: 'KPI', budget: '预算', action_plan: '行动方案', alert: '预警' }[t] || t) const applyTargetLabel = (t: string) => ({ kpi: 'KPI', budget: '预算', action_plan: '行动方案', alert: '预警' }[t] || t)
function fmtVal(v: any): string { function fmtVal(v: any): string {
@@ -139,6 +147,7 @@ async function loadList() {
try { try {
const params: any = {} const params: any = {}
if (statusFilter.value) params.status = statusFilter.value if (statusFilter.value) params.status = statusFilter.value
if (typeFilter.value) params.suggestion_type = typeFilter.value
const r: any = await aiSuggestionApi.list(params) const r: any = await aiSuggestionApi.list(params)
items.value = ((r as any)?.data || []).map((s: any) => ({ ...s, showDetail: false })) items.value = ((r as any)?.data || []).map((s: any) => ({ ...s, showDetail: false }))
} catch { items.value = [] } } catch { items.value = [] }