From 86b1deffffff44f59b4891fb90f4258d24fb7125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Sun, 27 Apr 2025 10:09:40 +0800 Subject: [PATCH] =?UTF-8?q?(intactorelligent-agent):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=99=BA=E8=83=BD=E4=BB=A3=E7=90=86=E7=BB=84=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=8F=90=E4=BA=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 提取公共 APIref调用逻辑,减少重复代码- 添加 API 调用成功 --- .../intelligent-agent/components/info/index.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/intelligent-agent/components/info/index.vue b/src/views/intelligent-agent/components/info/index.vue index 68bd6bc..e53d61a 100644 --- a/src/views/intelligent-agent/components/info/index.vue +++ b/src/views/intelligent-agent/components/info/index.vue @@ -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 => {