From 0d86514fe16e5e2e50baa4abac14efc51af0328d Mon Sep 17 00:00:00 2001
From: rain <1679827795@qq.com>
Date: Thu, 17 Apr 2025 11:13:40 +0800
Subject: [PATCH] 处理重复提交
---
src/views/tickets/ticket.vue | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/views/tickets/ticket.vue b/src/views/tickets/ticket.vue
index a2d1ccf..7fdc901 100644
--- a/src/views/tickets/ticket.vue
+++ b/src/views/tickets/ticket.vue
@@ -446,6 +446,7 @@
name: "TicketPage",
data() {
return {
+ submitLoading: false, // 新增loading状态
activeTab: "all",
// tabs 只保留静态结构,不做权限判断
tabs: [
@@ -965,6 +966,8 @@
},
async submitForm() {
+ if (this.submitLoading) return; // 防止重复提交
+ this.submitLoading = true;
try {
// 提交时需要完整验证
await this.$refs.form.validate();
@@ -1021,9 +1024,14 @@
this.$message.error(error.message || '工单创建失败,请稍后重试');
}
}
+ finally {
+ this.submitLoading = false;
+ }
},
async saveDraft() {
+ if (this.submitLoading) return; // 防止重复提交
+ this.submitLoading = true;
try {
const submitData = {
id: this.form.id,
@@ -1067,6 +1075,9 @@
} catch (error) {
this.$message.error(error.message || '保存草稿失败,请稍后重试');
}
+ finally {
+ this.submitLoading = false;
+ }
},
async handleLocationChange(val) {
--
Gitblit v1.9.3