feat: 回车检测&restore添加标签

This commit is contained in:
2026-02-26 16:48:08 +08:00
parent 6ac21c278c
commit 13ba5dd939
8 changed files with 148 additions and 69 deletions

View File

@@ -4,12 +4,16 @@
<div class="btn" @click="versionTreeData.drawer = true">Version Tree</div>
</div>
<div class="content-wrapper">
<Agent :title="agentTitle" @update:sketchList="updateSketchList" />
<Agent ref="agentRef" :title="agentTitle" @update:sketchList="updateSketchList" />
<div class="preview-wrapper">
<Preview :type="previewType" :sketchList="sketchList" />
</div>
</div>
<VersionTreeIndex ref="VersionTreeIndexRef" v-model:versionTreeData="versionTreeData" />
<VersionTreeIndex
ref="VersionTreeIndexRef"
v-model:versionTreeData="versionTreeData"
@restore="handleRestore"
/>
</div>
</template>
@@ -21,12 +25,11 @@
import { useProjectStore } from '@/stores'
import { getProjectInfo } from '@/api/agent'
const agentTitle = ref('Retro Sofa Sketch')
const previewType = ref<'sketch' | 'report'>('sketch')
const VersionTreeIndexRef = ref()
const agentRef = ref()
const sketchList = ref([])
const updateSketchList = (newVal) => {
console.log('newVal', newVal)
@@ -35,21 +38,30 @@
}
const versionTreeData = ref({
drawer: false,
drawer: false
})
const handleRestore = () => {
console.log('-----------', agentRef.value.inputRef.addReportTag)
agentRef.value?.inputRef?.addReportTag('Restore')
}
const projectStore = useProjectStore()
watch(()=>projectStore.state.id, (newVal, oldVal) => {
if(newVal){
getProjectInfo({ id: newVal }).then(res => {
projectStore.setProject(res.project)
})
watch(
() => projectStore.state.id,
(newVal, oldVal) => {
if (newVal) {
getProjectInfo({ id: newVal }).then((res) => {
projectStore.setProject(res.project)
})
}
}
})
)
onMounted(()=>{
if(projectStore.state.id){
getProjectInfo({ id: projectStore.state.id }).then(res => {
onMounted(() => {
if (projectStore.state.id) {
getProjectInfo({ id: projectStore.state.id }).then((res) => {
projectStore.setProject(res.project)
})
}