修复: 前端UX一致性(Dashboard状态映射/状态徽章全局/Knowledge下一条与失败反馈/Ideas筛选与错误条/ConfirmDialog安全/快捷菜单状态机/分页越界) + 后端校验(queue/count-list一致/软删拒改/父聚合/promote CAS/MCP状态机收口/update白名单剔除id/created_at) + 销账

This commit is contained in:
lxy
2026-08-09 21:35:58 +08:00
parent 8bc5380ecb
commit fbd8fae44b
30 changed files with 829 additions and 138 deletions
+13 -6
View File
@@ -12,8 +12,11 @@ export function createIdeasStore() {
* F-260621-02:status/keyword/order_by 下沉后端 WHERE,取代前端 computed filter。
* - 传 `query` → 多条件查询(状态/关键词/排序/分页)。
* - 不传 → 全量(created_at DESC,等价旧行为)。
*
* WK-7:成功时清 state.error(load 后不残留旧错误),失败由 runWithCatch 置 error。
*/
async function loadIdeas(query?: IdeaQuery) {
state.error = null
await runWithCatch(state, t('ideas.err.loadFailed'), async () => {
state.ideas = await ideaApi.list(query)
})
@@ -36,11 +39,14 @@ export function createIdeasStore() {
}
}
async function deleteIdea(id: string) {
await runWithCatch(state, t('ideas.err.deleteFailed'), async () => {
async function deleteIdea(id: string): Promise<boolean> {
// WK-7:返成功布尔(失败时 runWithCatch 已置 state.error),调用方据此保留选中态
const ok = await runWithCatch(state, t('ideas.err.deleteFailed'), async () => {
await ideaApi.delete(id)
state.ideas = state.ideas.filter(i => i.id !== id)
return true
})
return ok === true
}
async function evaluateIdea(id: string) {
@@ -51,15 +57,16 @@ export function createIdeasStore() {
}
async function promoteIdea(id: string) {
const res = await ideaApi.promote(id)
await loadIdeas() // 后端已回写 status=promoted/promoted_to,刷新列表
return res
// WK-4:不再内部全量 loadIdeas(会把 store.ideas 冲成全集、冲掉当前筛选视图)。
// 由视图(Ideas.vue promoteToProject)操作后按当前 buildIdeaQuery() 主动重载。
return await ideaApi.promote(id)
}
async function relateIdeas(subjectId: string, targetIds: string[]) {
await runWithCatch(state, t('ideas.err.relateFailed'), async () => {
await ideaApi.relateIdeas(subjectId, targetIds)
await loadIdeas() // 后端已原子更新全部受影响灵感,刷新列表保持 store 一致
// WK-4:后端原子更新受影响灵感,原全量 loadIdeas 会冲掉当前筛选视图;
// 改由视图(Ideas.vue onUpdateRelated)按当前 query 重载。
})
}