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

View File

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

View File

@@ -18,7 +18,7 @@ export default {
*/ */
async handleSubmit() { async handleSubmit() {
// 更新表单之后重新获取列表,然后退出 dialog // 更新表单之后重新获取列表,然后退出 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.fetchAgentList()
this.dialog.visible = false this.dialog.visible = false
}, },
@@ -29,7 +29,6 @@ export default {
} }
} }
} }
</script> </script>
<template> <template>

View File

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