feat: 付款申请、开票申请、收票登记金蝶按钮增加防重复点击

This commit is contained in:
刘泉佳
2026-09-24 05:07:51 +08:00
parent 5c45e9b2c9
commit a5eeda6152
3 changed files with 52 additions and 20 deletions
+11 -3
View File
@@ -61,6 +61,7 @@
v-if="hasPermission('invoice_application_sync')" v-if="hasPermission('invoice_application_sync')"
type="primary" type="primary"
plain plain
:loading="batchSyncing"
@click="handleBatchSync" @click="handleBatchSync"
>批量同步</el-button >批量同步</el-button
> >
@@ -270,6 +271,7 @@ export default {
rows: [], rows: [],
selection: [], selection: [],
loading: false, loading: false,
batchSyncing: false,
page: { current: 1, size: 10, total: 0 }, page: { current: 1, size: 10, total: 0 },
flowDialog: { visible: false, loading: false, row: {}, records: [] }, flowDialog: { visible: false, loading: false, row: {}, records: [] },
}; };
@@ -399,14 +401,20 @@ export default {
this.loadTable(); this.loadTable();
}, },
async handleBatchSync() { async handleBatchSync() {
if (this.batchSyncing) return;
const rows = this.selection.filter(row => row.approvalStatus === 'approved'); const rows = this.selection.filter(row => row.approvalStatus === 'approved');
if (!rows.length) { if (!rows.length) {
this.$message.warning('请选择至少一条审批通过的开票申请'); this.$message.warning('请选择至少一条审批通过的开票申请');
return; return;
} }
await Promise.all(rows.map(row => api.syncKingdee(row.id))); this.batchSyncing = true;
this.$message.success(`已同步${rows.length}条开票申请`); try {
this.loadTable(); await Promise.all(rows.map(row => api.syncKingdee(row.id)));
this.$message.success(`已同步${rows.length}条开票申请`);
this.loadTable();
} finally {
this.batchSyncing = false;
}
}, },
async handleExport() { async handleExport() {
const data = this.unwrapData(await api.getList(1, 100000, this.query)); const data = this.unwrapData(await api.getList(1, 100000, this.query));
+11 -3
View File
@@ -70,6 +70,7 @@
v-if="hasPermission('invoice_receipt_sync')" v-if="hasPermission('invoice_receipt_sync')"
type="primary" type="primary"
plain plain
:loading="pushLoading"
@click="handlePushKingdee" @click="handlePushKingdee"
>批量同步</el-button >批量同步</el-button
> >
@@ -263,6 +264,7 @@ export default {
rows: [], rows: [],
selection: [], selection: [],
loading: false, loading: false,
pushLoading: false,
page: { current: 1, size: 10, total: 0 }, page: { current: 1, size: 10, total: 0 },
flowDialog: { visible: false, loading: false, row: {}, records: [] }, flowDialog: { visible: false, loading: false, row: {}, records: [] },
}; };
@@ -364,6 +366,7 @@ export default {
this.loadTable(); this.loadTable();
}, },
async handlePushKingdee() { async handlePushKingdee() {
if (this.pushLoading) return;
const rows = this.selection.filter(row => row.approvalStatus === 'approved'); const rows = this.selection.filter(row => row.approvalStatus === 'approved');
if (!rows.length) { if (!rows.length) {
this.$message.warning('请选择至少一条审批通过的收票登记'); this.$message.warning('请选择至少一条审批通过的收票登记');
@@ -372,9 +375,14 @@ export default {
await this.$confirm(`确认将选中的 ${rows.length} 条收票登记同步至金蝶?`, '提示', { await this.$confirm(`确认将选中的 ${rows.length} 条收票登记同步至金蝶?`, '提示', {
type: 'warning', type: 'warning',
}); });
const summary = this.unwrapData(await api.pushKingdee(rows.map(row => row.id))); this.pushLoading = true;
this.$alert(summary || '推送完成', '推送结果', { confirmButtonText: '知道了' }); try {
this.loadTable(); const summary = this.unwrapData(await api.pushKingdee(rows.map(row => row.id)));
this.$alert(summary || '推送完成', '推送结果', { confirmButtonText: '知道了' });
this.loadTable();
} finally {
this.pushLoading = false;
}
}, },
async handleExport() { async handleExport() {
const data = this.unwrapData(await api.getList(1, 100000, this.query)); const data = this.unwrapData(await api.getList(1, 100000, this.query));
+30 -14
View File
@@ -81,6 +81,7 @@
v-if="hasPermission('payment_application_sync')" v-if="hasPermission('payment_application_sync')"
type="primary" type="primary"
plain plain
:loading="syncLoading"
@click="handleSync" @click="handleSync"
>批量同步</el-button >批量同步</el-button
> >
@@ -88,6 +89,7 @@
v-if="hasPermission('payment_application_sync')" v-if="hasPermission('payment_application_sync')"
type="primary" type="primary"
plain plain
:loading="resultSyncing"
@click="handleSyncResult" @click="handleSyncResult"
>同步付款结果</el-button >同步付款结果</el-button
> >
@@ -271,6 +273,8 @@ export default {
rows: [], rows: [],
selection: [], selection: [],
loading: false, loading: false,
syncLoading: false,
resultSyncing: false,
page: { current: 1, size: 10, total: 0 }, page: { current: 1, size: 10, total: 0 },
flowDialog: { visible: false, row: {} }, flowDialog: { visible: false, row: {} },
}; };
@@ -405,28 +409,40 @@ export default {
this.loadTable(); this.loadTable();
}, },
async handleSync() { async handleSync() {
if (this.syncLoading) return;
const rows = this.selection.filter(row => row.approvalStatus === 'approved'); const rows = this.selection.filter(row => row.approvalStatus === 'approved');
if (!rows.length) { if (!rows.length) {
this.$message.warning('请选择至少一条审批通过的付款申请'); this.$message.warning('请选择至少一条审批通过的付款申请');
return; return;
} }
const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || []; this.syncLoading = true;
const failedList = data.filter(item => String(item).includes('同步失败')); try {
if (failedList.length) { const data = this.unwrapData(await api.syncKingdeeBatch(rows.map(row => row.id))) || [];
this.$message({ const failedList = data.filter(item => String(item).includes('同步失败'));
type: 'warning', if (failedList.length) {
message: `同步完成:成功${data.length - failedList.length}条,失败${failedList.length}条。${failedList.join('')}`, this.$message({
duration: 8000, type: 'warning',
}); message: `同步完成:成功${data.length - failedList.length}条,失败${failedList.length}条。${failedList.join('')}`,
} else { duration: 8000,
this.$message.success(`已同步${data.length}条付款申请`); });
} else {
this.$message.success(`已同步${data.length}条付款申请`);
}
this.loadTable();
} finally {
this.syncLoading = false;
} }
this.loadTable();
}, },
async handleSyncResult() { async handleSyncResult() {
const data = this.unwrapData(await api.syncKingdeeResult()); if (this.resultSyncing) return;
this.$message.success(data || '金蝶付款结果回写完成'); this.resultSyncing = true;
this.loadTable(); try {
const data = this.unwrapData(await api.syncKingdeeResult());
this.$message.success(data || '金蝶付款结果回写完成');
this.loadTable();
} finally {
this.resultSyncing = false;
}
}, },
handleExport() { handleExport() {
const headers = this.columns.map(item => item.label); const headers = this.columns.map(item => item.label);