工作流动画效果
This commit is contained in:
@@ -70,7 +70,7 @@
|
||||
{{ formatDate(row.created_at) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="300" fixed="right">
|
||||
<el-table-column label="操作" width="350" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" @click="handleEdit(row)">
|
||||
<el-icon><Edit /></el-icon>
|
||||
@@ -80,6 +80,10 @@
|
||||
<el-icon><Setting /></el-icon>
|
||||
设计
|
||||
</el-button>
|
||||
<el-button link type="info" @click="handleDuplicate(row)">
|
||||
<el-icon><CopyDocument /></el-icon>
|
||||
复制
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.status === 'draft' || row.status === 'stopped'"
|
||||
link
|
||||
@@ -177,7 +181,8 @@ import {
|
||||
Delete,
|
||||
Setting,
|
||||
VideoPlay,
|
||||
VideoPause
|
||||
VideoPause,
|
||||
CopyDocument
|
||||
} from '@element-plus/icons-vue'
|
||||
import { useAgentStore } from '@/stores/agent'
|
||||
import type { Agent } from '@/stores/agent'
|
||||
@@ -374,6 +379,34 @@ const handleStop = async (agent: Agent) => {
|
||||
}
|
||||
}
|
||||
|
||||
// 复制
|
||||
const handleDuplicate = async (agent: Agent) => {
|
||||
try {
|
||||
const { value } = await ElMessageBox.prompt(
|
||||
`请输入新Agent的名称(留空将自动生成)`,
|
||||
'复制Agent',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPlaceholder: `留空将使用: ${agent.name} (副本)`,
|
||||
inputValidator: (val: string) => {
|
||||
if (val && val.length > 100) {
|
||||
return '名称长度不能超过100个字符'
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
)
|
||||
await agentStore.duplicateAgent(agent.id, value || undefined)
|
||||
ElMessage.success('复制成功')
|
||||
await loadAgents()
|
||||
} catch (error: any) {
|
||||
if (error !== 'cancel') {
|
||||
ElMessage.error(error.response?.data?.detail || '复制失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 删除
|
||||
const handleDelete = async (agent: Agent) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user