This commit is contained in:
lzp
2026-03-31 13:29:48 +08:00
10 changed files with 264 additions and 117 deletions

View File

@@ -236,15 +236,21 @@
MyEvent.emit('quote', url)
}
const handleClickDelete = (item: string | Object) => {
deleteSketchFlowCanvas({
id: Object.keys(item)[0],
versionNodeId: projectStore.state.nodeId
}).then((res) => {
if (res) {
ElMessage.success(t('agent.deleteSuccess'))
emits('deleteSketch', Object.keys(item)[0])
}
const handleClickDelete = (item: { id: string; url: string }) => {
ElMessageBox.confirm(t('agent.deleteSketchTip'), t('agent.confirm'), {
confirmButtonText: t('agent.confirm'),
cancelButtonText: t('agent.cancel'),
type: 'warning'
}).then(() => {
deleteSketchFlowCanvas({
id: item.id,
versionNodeId: projectStore.state.nodeId
}).then((res) => {
if (res) {
ElMessage.success(t('agent.deleteSuccess'))
emits('deleteSketch', item.id)
}
})
})
}

View File

@@ -57,13 +57,15 @@
// VersionTreeIndexRef.value.getVersionTree()
}
const handleDeleteSketch = (deletedId: string) => {
sketchList.value = sketchList.value.filter((item) => {
if (typeof item === 'object') {
return Object.keys(item)[0] !== deletedId
}
return true
})
const handleDeleteSketch = (id) => {
sketchList.value = sketchList.value
.map((sketchItem) => {
if (sketchItem.hasOwnProperty(id)) {
delete sketchItem[id]
}
return sketchItem
})
.filter((sketchItem) => Object.keys(sketchItem).length > 0)
}
const handleSetTitle = (title: string) => {
@@ -93,7 +95,7 @@
const handleGetProjectInfoAndHistory = () => {
handleOpenSketch()
getProjectInfo({ id: route.params.id }).then((res) => {
if(!res) {
if (!res) {
router.push({ name: 'mainInput' })
ElMessage.warning(t('Home.notFound'))
return