This commit is contained in:
du.meimei
2025-04-23 16:50:11 +08:00
parent ef3de4ea38
commit 5014e1fc74
4 changed files with 29 additions and 30 deletions

View File

@@ -31,7 +31,7 @@ function agentDetail(id) {
* @param {Object} data - 请求参数, 默认为空对象
* @returns {Promise} - 返回 Promise 对象
*/
const agentAdd = (data) => {
const agentAdd = data => {
if (!data) {
console.warn('need data', data)
return
@@ -48,7 +48,7 @@ const agentAdd = (data) => {
* @param {Array} data - 请求参数, 默认为空对象
* @returns {Promise} - 返回 Promise 对象
*/
const agentDelete = (data) => {
const agentDelete = data => {
if (!data || !data.length) {
console.warn('need data', data)
return
@@ -65,7 +65,7 @@ const agentDelete = (data) => {
* @param {Object} data - 请求参数, 默认为空对象
* @returns {Promise} - 返回 Promise 对象
*/
const agentEdit = (data) => {
const agentEdit = data => {
if (!data || !data.id) {
console.warn('need data', data)
return

View File

@@ -231,7 +231,8 @@ export default [
}
}
]
}, {
},
{
path: '/intelligentAgent',
name: 'intelligentAgent',
component: layout,

View File

@@ -18,7 +18,7 @@ export default {
*/
async handleSubmit() {
// 更新表单之后重新获取列表,然后退出 dialog
await this.dialog.type === 'edit' ? agentEdit(this.dialog.agent) : agentAdd(this.dialog.agent)
;(await this.dialog.type) === 'edit' ? agentEdit(this.dialog.agent) : agentAdd(this.dialog.agent)
this.fetchAgentList()
this.dialog.visible = false
},
@@ -29,7 +29,6 @@ export default {
}
}
}
</script>
<template>

View File

@@ -24,7 +24,7 @@ export default {
title: '',
agent: void 0,
component: 'info',
type: "edit"
type: 'edit'
}
}
},
@@ -48,8 +48,8 @@ export default {
async handleEditAgent(id) {
const { content } = await agentDetail(id)
this.dialog.agent = content.content
this.dialog.type = "edit"
this.dialog.title = "编辑智能体"
this.dialog.type = 'edit'
this.dialog.title = '编辑智能体'
// 获取数据之后打开内容详情
this.dialog.visible = true
},
@@ -65,13 +65,12 @@ export default {
* 创建智能体
*/
async createdIntelligentAgent() {
this.dialog.type = "add"
this.dialog.type = 'add'
// 重置状态,防止其他状态影响导致表单内容异常
this.dialog.agent = { name: '', description: '' }
this.dialog.title = "创建智能体"
this.dialog.title = '创建智能体'
this.dialog.visible = true
},
}
},
created() {
this.fetchAgentList()
@@ -81,21 +80,24 @@ export default {
<template>
<div class="container">
<!-- header 头部 -->
<nav v-if="true">
<div class="flex align-items-c justify-content-b">
<el-input placeholder="输入智能体名称" clearable v-model="searchOption.nameLike" size="medium" class="underBorder"
@keydown.enter.native="searchOption.handleSearch">
<el-input
placeholder="输入智能体名称"
clearable
v-model="searchOption.nameLike"
size="medium"
class="underBorder"
@keydown.enter.native="searchOption.handleSearch"
>
<template slot="prepend">
<el-button slot="append" icon="el-icon-search"></el-button>
</template>
</el-input>
<el-button class="render-button line-button pv8 ph10" icon="el-icon-plus"
@click="createdIntelligentAgent()">创建智能体</el-button>
<el-button class="render-button line-button pv8 ph10" icon="el-icon-plus" @click="createdIntelligentAgent()">创建智能体</el-button>
</div>
<h3>智能体</h3>
</nav>
<!-- 智能体的列表 -->
@@ -112,10 +114,10 @@ export default {
</section>
<el-row type="flex" justify="end">
<el-button class="default render-button" size="small" icon="el-icon-delete"
@click.stop="handleDeleteAgent(listItem.id)">删除</el-button>
<el-button class="render-button line-button" size="small" icon="el-icon-edit"
@click.stop="handleEditAgent(listItem.id)" type="primary">修改</el-button>
<el-button class="default render-button" size="small" icon="el-icon-delete" @click.stop="handleDeleteAgent(listItem.id)">删除</el-button>
<el-button class="render-button line-button" size="small" icon="el-icon-edit" @click.stop="handleEditAgent(listItem.id)" type="primary"
>修改</el-button
>
</el-row>
</el-card>
</el-col>
@@ -139,8 +141,6 @@ export default {
}
.agent-item {
& > .el-col {
margin: 7px auto;
}
@@ -160,7 +160,6 @@ export default {
}
.dataset-desc {
font-weight: 400;
font-size: 13px;
color: #666666;