可快速切换面板

This commit is contained in:
2026-06-11 14:26:27 +08:00
parent 0561e126cd
commit fba3a14367
2 changed files with 350 additions and 1 deletions
@@ -88,7 +88,7 @@
</p>
</NCard>
<!-- 当前阶段产物 AI 对话三阶段显示 -->
<!-- 当前阶段产物 AI 对话三阶段显示保留编辑功能 -->
<ArtifactPanel
v-if="chatPhase"
ref="artifactPanelRef"
@@ -98,6 +98,17 @@
:readonly="data.requirement.status !== 'open'"
/>
<!-- 全阶段产物与会话历史新增 -->
<RequirementHistoryPanel
v-if="data"
ref="historyPanelRef"
:slug="slug"
:number="number"
:requirement-id="data.requirement.id"
:workspace-slug="workspaceSlug"
:current-phase="data.requirement.phase"
/>
<!-- Workspace card -->
<NCard title="工作区">
<NSelect
@@ -204,6 +215,7 @@ import ArtifactPanel from './components/ArtifactPanel.vue'
import RequirementChatPanel from './components/RequirementChatPanel.vue'
import RequirementAcpPanel from './components/RequirementAcpPanel.vue'
import RequirementSummaryPanel from './components/RequirementSummaryPanel.vue'
import RequirementHistoryPanel from './components/RequirementHistoryPanel.vue'
import type { Artifact, ArtifactPhase, Phase, RequirementDetail } from '@/api/projects'
const PHASES: Phase[] = ['planning', 'prototyping', 'auditing', 'implementing', 'reviewing', 'done']
@@ -232,12 +244,18 @@ const loading = ref(false)
const toggling = ref(false)
const data = ref<RequirementDetail | null>(null)
const artifactPanelRef = ref<InstanceType<typeof ArtifactPanel> | null>(null)
const historyPanelRef = ref<InstanceType<typeof RequirementHistoryPanel> | null>(null)
const prevArtifact = ref<Artifact | null>(null)
const workspaceOptions = computed(() =>
wsStore.list.map((w) => ({ label: `${w.name} (${w.slug})`, value: w.id })),
)
const workspaceSlug = computed(() => {
if (!data.value?.requirement.workspace_id) return null
return wsStore.list.find((w) => w.id === data.value!.requirement.workspace_id)?.slug ?? null
})
// 当前阶段属于 AI 对话三阶段时返回该阶段,否则 null。
const chatPhase = computed<ArtifactPhase | null>(() => {
const p = data.value?.requirement.phase
@@ -271,6 +289,7 @@ watch(chatPhase, loadPrevArtifact)
function onArtifactSaved() {
artifactPanelRef.value?.refresh()
historyPanelRef.value?.refresh()
}
async function onWorkspaceChange(v: string | null) {