(intactorelligent-agent): 优化智能代理组件的表单提交逻辑

- 提取公共 APIref调用逻辑,减少重复代码- 添加 API 调用成功
This commit is contained in:
陈昱达
2025-04-27 10:09:40 +08:00
parent 156484e75f
commit 86b1deffff

View File

@@ -25,12 +25,15 @@ export default {
* 提交表单
*/
async handleSubmit() {
let api = this.dialog.type === 'edit' ? agentEdit : agentAdd
// 更新表单之后重新获取列表,然后退出 dialog
;(await this.dialog.type) === 'edit'
? agentEdit(this.dialog.agent)
: agentAdd(this.dialog.agent)
this.fetchAgentList()
this.dialog.visible = false
api(this.dialog.agent).then(res => {
if (res) {
this.fetchAgentList()
this.dialog.visible = false
}
})
},
validateForm() {
this.$refs.form.validate(valid => {