diff --git a/src/views/payment/invoice-application.vue b/src/views/payment/invoice-application.vue index b701546..98ba1fc 100644 --- a/src/views/payment/invoice-application.vue +++ b/src/views/payment/invoice-application.vue @@ -61,6 +61,7 @@ v-if="hasPermission('invoice_application_sync')" type="primary" plain + :loading="batchSyncing" @click="handleBatchSync" >批量同步 @@ -270,6 +271,7 @@ export default { rows: [], selection: [], loading: false, + batchSyncing: false, page: { current: 1, size: 10, total: 0 }, flowDialog: { visible: false, loading: false, row: {}, records: [] }, }; @@ -399,14 +401,20 @@ export default { this.loadTable(); }, async handleBatchSync() { + if (this.batchSyncing) return; const rows = this.selection.filter(row => row.approvalStatus === 'approved'); if (!rows.length) { this.$message.warning('请选择至少一条审批通过的开票申请'); return; } - await Promise.all(rows.map(row => api.syncKingdee(row.id))); - this.$message.success(`已同步${rows.length}条开票申请`); - this.loadTable(); + this.batchSyncing = true; + try { + await Promise.all(rows.map(row => api.syncKingdee(row.id))); + this.$message.success(`已同步${rows.length}条开票申请`); + this.loadTable(); + } finally { + this.batchSyncing = false; + } }, async handleExport() { const data = this.unwrapData(await api.getList(1, 100000, this.query)); diff --git a/src/views/payment/invoice-receipt.vue b/src/views/payment/invoice-receipt.vue index a0774f6..56cb577 100644 --- a/src/views/payment/invoice-receipt.vue +++ b/src/views/payment/invoice-receipt.vue @@ -70,6 +70,7 @@ v-if="hasPermission('invoice_receipt_sync')" type="primary" plain + :loading="pushLoading" @click="handlePushKingdee" >批量同步 @@ -263,6 +264,7 @@ export default { rows: [], selection: [], loading: false, + pushLoading: false, page: { current: 1, size: 10, total: 0 }, flowDialog: { visible: false, loading: false, row: {}, records: [] }, }; @@ -364,6 +366,7 @@ export default { this.loadTable(); }, async handlePushKingdee() { + if (this.pushLoading) return; const rows = this.selection.filter(row => row.approvalStatus === 'approved'); if (!rows.length) { this.$message.warning('请选择至少一条审批通过的收票登记'); @@ -372,9 +375,14 @@ export default { await this.$confirm(`确认将选中的 ${rows.length} 条收票登记同步至金蝶?`, '提示', { type: 'warning', }); - const summary = this.unwrapData(await api.pushKingdee(rows.map(row => row.id))); - this.$alert(summary || '推送完成', '推送结果', { confirmButtonText: '知道了' }); - this.loadTable(); + this.pushLoading = true; + try { + const summary = this.unwrapData(await api.pushKingdee(rows.map(row => row.id))); + this.$alert(summary || '推送完成', '推送结果', { confirmButtonText: '知道了' }); + this.loadTable(); + } finally { + this.pushLoading = false; + } }, async handleExport() { const data = this.unwrapData(await api.getList(1, 100000, this.query)); diff --git a/src/views/payment/payment-application.vue b/src/views/payment/payment-application.vue index 4bdb19d..b90a5fe 100644 --- a/src/views/payment/payment-application.vue +++ b/src/views/payment/payment-application.vue @@ -81,6 +81,7 @@ v-if="hasPermission('payment_application_sync')" type="primary" plain + :loading="syncLoading" @click="handleSync" >批量同步 @@ -88,6 +89,7 @@ v-if="hasPermission('payment_application_sync')" type="primary" plain + :loading="resultSyncing" @click="handleSyncResult" >同步付款结果 @@ -271,6 +273,8 @@ export default { rows: [], selection: [], loading: false, + syncLoading: false, + resultSyncing: false, page: { current: 1, size: 10, total: 0 }, flowDialog: { visible: false, row: {} }, }; @@ -405,28 +409,40 @@ export default { this.loadTable(); }, async handleSync() { + if (this.syncLoading) return; const rows = this.selection.filter(row => row.approvalStatus === 'approved'); if (!rows.length) { this.$message.warning('请选择至少一条审批通过的付款申请'); return; } - const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || []; - const failedList = data.filter(item => String(item).includes('同步失败')); - if (failedList.length) { - this.$message({ - type: 'warning', - message: `同步完成:成功${data.length - failedList.length}条,失败${failedList.length}条。${failedList.join(';')}`, - duration: 8000, - }); - } else { - this.$message.success(`已同步${data.length}条付款申请`); + this.syncLoading = true; + try { + const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || []; + const failedList = data.filter(item => String(item).includes('同步失败')); + if (failedList.length) { + this.$message({ + type: 'warning', + message: `同步完成:成功${data.length - failedList.length}条,失败${failedList.length}条。${failedList.join(';')}`, + duration: 8000, + }); + } else { + this.$message.success(`已同步${data.length}条付款申请`); + } + this.loadTable(); + } finally { + this.syncLoading = false; } - this.loadTable(); }, async handleSyncResult() { - const data = this.unwrapData(await api.syncKingdeeResult()); - this.$message.success(data || '金蝶付款结果回写完成'); - this.loadTable(); + if (this.resultSyncing) return; + this.resultSyncing = true; + try { + const data = this.unwrapData(await api.syncKingdeeResult()); + this.$message.success(data || '金蝶付款结果回写完成'); + this.loadTable(); + } finally { + this.resultSyncing = false; + } }, handleExport() { const headers = this.columns.map(item => item.label);