feat: 审批通过按钮增加防重复点击,避免重复提示

This commit is contained in:
刘泉佳
2026-10-22 14:06:50 +08:00
parent 2f64abfc83
commit b9de34aa0e
4 changed files with 56 additions and 32 deletions
+13 -7
View File
@@ -270,6 +270,7 @@ export default {
rows: [],
selection: [],
loading: false,
approveLoading: false,
batchSyncing: false,
page: { current: 1, size: 10, total: 0 },
mkEnabled: false,
@@ -408,13 +409,17 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该开票申请?', '提示', { type: 'warning' });
const loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm('确认审批通过该开票申请?', '提示', { type: 'warning' });
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
if (res.data.data === false) {
@@ -424,7 +429,8 @@ export default {
}
this.loadTable();
} finally {
loading.close();
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
+13 -7
View File
@@ -255,6 +255,7 @@ export default {
rows: [],
selection: [],
loading: false,
approveLoading: false,
pushLoading: false,
page: { current: 1, size: 10, total: 0 },
mkEnabled: false,
@@ -365,13 +366,17 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该收票登记?', '提示', { type: 'warning' });
const loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm('确认审批通过该收票登记?', '提示', { type: 'warning' });
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
if (res.data.data === false) {
@@ -381,7 +386,8 @@ export default {
}
this.loadTable();
} finally {
loading.close();
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
+17 -11
View File
@@ -140,6 +140,7 @@ export default {
rows: [],
selection: [],
loading: false,
approveLoading: false,
syncLoading: false,
page: { currentPage: 1, pageSize: 10, pageSizes: [10, 20, 50, 100], total: 0 },
editor: { visible: false, id: null, readonly: false },
@@ -371,17 +372,21 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm(
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
'提示',
{ type: 'warning' }
);
const loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm(
`审核通过后${this.billLabel}生效,金额只能通过结算调整单处理,确认通过?`,
'提示',
{ type: 'warning' }
);
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
const res = await api.approve({ id: row.id });
// data=false 表示审批已通过但自动同步金蝶失败,msg 带具体原因
if (res.data.data === false) {
@@ -391,7 +396,8 @@ export default {
}
this.onLoad(this.page);
} finally {
loading.close();
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {
+13 -7
View File
@@ -334,6 +334,7 @@ export default {
ArrowDown,
ArrowUp,
loading: false,
approveLoading: false,
query: emptyQuery(),
searchFields: preSettlementSearchFields,
searchExpanded: false,
@@ -691,18 +692,23 @@ export default {
});
},
async handleApprove(row) {
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
const loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
// 防止重复点击:请求进行中忽略后续点击,避免重复审批和重复提示
if (this.approveLoading) return;
this.approveLoading = true;
let loading = null;
try {
await this.$confirm('确认审批通过该预付结算单?', '提示', { type: 'warning' });
loading = this.$loading({
lock: true,
text: '审批处理中,请稍候…',
background: 'rgba(255, 255, 255, 0.6)',
});
await approve({ id: row.id });
this.$message.success('审批通过');
this.loadTable();
} finally {
loading.close();
loading?.close();
this.approveLoading = false;
}
},
async handleReturn(row) {