diff --git a/src/views/payment/invoice-application.vue b/src/views/payment/invoice-application.vue index 3d3294d..a447f77 100644 --- a/src/views/payment/invoice-application.vue +++ b/src/views/payment/invoice-application.vue @@ -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) { diff --git a/src/views/payment/invoice-receipt.vue b/src/views/payment/invoice-receipt.vue index c0cea3d..aed1115 100644 --- a/src/views/payment/invoice-receipt.vue +++ b/src/views/payment/invoice-receipt.vue @@ -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) { diff --git a/src/views/settlement/formal-settlement.vue b/src/views/settlement/formal-settlement.vue index b2c090f..3c7926c 100644 --- a/src/views/settlement/formal-settlement.vue +++ b/src/views/settlement/formal-settlement.vue @@ -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) { diff --git a/src/views/settlement/pre-settlement.vue b/src/views/settlement/pre-settlement.vue index d13597e..8648db4 100644 --- a/src/views/settlement/pre-settlement.vue +++ b/src/views/settlement/pre-settlement.vue @@ -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) {