feat: v1.4.0 - 典型方案采纳、推荐方案列表、审计字段、导航优化
- 添加典型方案采纳功能 (POST /api/plans/<id>/adopt) - 添加推荐方案列表 (GET /api/students/<id>/recommended-plans) - PracticePlan 新增 created_by/updated_by/updated_at 审计字段 - 方案编辑/详情页导航优化 (bfcache 处理、pageshow 事件) - 方案列表支持删除功能 - 学员列表'暂无方案/问题'样式统一 - 更新文档:问题文件已废弃(迁移到数据库) - 更新部署脚本和验证清单
This commit is contained in:
@@ -174,8 +174,34 @@
|
||||
{{ super() }}
|
||||
<script>
|
||||
const API_BASE = '/api/goals';
|
||||
const GOAL_FILTER_KEY = 'goal_filters';
|
||||
let allGoals = []; // 缓存所有目标数据
|
||||
|
||||
// 保存筛选状态
|
||||
function saveGoalFilterState() {
|
||||
const state = {
|
||||
filterLevel: document.getElementById('filter-level').value,
|
||||
filterCategory: document.getElementById('filter-category').value,
|
||||
groupBy: document.getElementById('group-by').value
|
||||
};
|
||||
sessionStorage.setItem(GOAL_FILTER_KEY, JSON.stringify(state));
|
||||
}
|
||||
|
||||
// 恢复筛选状态
|
||||
function restoreGoalFilterState() {
|
||||
const saved = sessionStorage.getItem(GOAL_FILTER_KEY);
|
||||
if (!saved) return;
|
||||
try {
|
||||
const state = JSON.parse(saved);
|
||||
if (state.filterLevel) document.getElementById('filter-level').value = state.filterLevel;
|
||||
if (state.filterCategory) document.getElementById('filter-category').value = state.filterCategory;
|
||||
if (state.groupBy) document.getElementById('group-by').value = state.groupBy;
|
||||
saveGoalFilterState();
|
||||
} catch (e) {
|
||||
console.error('恢复目标筛选状态失败', e);
|
||||
}
|
||||
}
|
||||
|
||||
// 加载目标列表
|
||||
async function loadGoals() {
|
||||
const res = await fetch(API_BASE);
|
||||
@@ -188,11 +214,14 @@ async function loadGoals() {
|
||||
return {...g, children: children};
|
||||
}));
|
||||
|
||||
restoreGoalFilterState();
|
||||
applyFilters();
|
||||
}
|
||||
|
||||
// 应用筛选和分组
|
||||
function applyFilters() {
|
||||
saveGoalFilterState();
|
||||
|
||||
const filterLevel = document.getElementById('filter-level').value;
|
||||
const filterCategory = document.getElementById('filter-category').value;
|
||||
const groupBy = document.getElementById('group-by').value;
|
||||
|
||||
Reference in New Issue
Block a user