feat: 正式结算、客商档案金蝶推送按钮增加防重复点击

This commit is contained in:
刘泉佳
2026-09-24 05:08:01 +08:00
parent a5eeda6152
commit ec56ee07be
3 changed files with 43 additions and 22 deletions
@@ -21,6 +21,7 @@
type="primary" type="primary"
plain plain
:disabled="selection.length !== 1" :disabled="selection.length !== 1"
:loading="syncLoading"
@click="$emit('sync')" @click="$emit('sync')"
>同步金蝶</el-button >同步金蝶</el-button
> >
@@ -132,6 +133,7 @@ export default {
rows: { type: Array, default: () => [] }, rows: { type: Array, default: () => [] },
columns: { type: Array, default: () => [] }, columns: { type: Array, default: () => [] },
loading: { type: Boolean, default: false }, loading: { type: Boolean, default: false },
syncLoading: { type: Boolean, default: false },
page: { type: Object, required: true }, page: { type: Object, required: true },
hasPermission: { type: Function, required: true }, hasPermission: { type: Function, required: true },
}, },
+13 -4
View File
@@ -64,6 +64,7 @@
:loading="loading" :loading="loading"
:page="page" :page="page"
:has-permission="hasPermissionFn" :has-permission="hasPermissionFn"
:sync-loading="syncLoading"
@create="openCreate" @create="openCreate"
@payment="openPaymentDialog" @payment="openPaymentDialog"
@sync="handleSync" @sync="handleSync"
@@ -82,6 +83,7 @@
:loading="loading" :loading="loading"
:page="page" :page="page"
:has-permission="hasPermissionFn" :has-permission="hasPermissionFn"
:sync-loading="syncLoading"
@create="openCreate" @create="openCreate"
@payment="openPaymentDialog" @payment="openPaymentDialog"
@sync="handleSync" @sync="handleSync"
@@ -215,6 +217,7 @@ export default {
rows: [], rows: [],
selection: [], selection: [],
loading: false, loading: false,
syncLoading: false,
page: { current: 1, size: 10, total: 0 }, page: { current: 1, size: 10, total: 0 },
editor: { visible: false, id: null, readonly: false }, editor: { visible: false, id: null, readonly: false },
paymentDialog: { paymentDialog: {
@@ -381,12 +384,18 @@ export default {
return this.selection[0]; return this.selection[0];
}, },
async handleSync() { async handleSync() {
if (this.syncLoading) return;
const row = this.selectedOne('同步金蝶'); const row = this.selectedOne('同步金蝶');
if (!row) return; if (!row) return;
const response = await api.syncKingdee(row.id); this.syncLoading = true;
const data = this.unwrapData(response); try {
this.$message.success(`同步成功,金蝶单据号:${data}`); const response = await api.syncKingdee(row.id);
this.loadTable(); const data = this.unwrapData(response);
this.$message.success(`同步成功,金蝶单据号:${data}`);
this.loadTable();
} finally {
this.syncLoading = false;
}
}, },
async openPaymentDialog() { async openPaymentDialog() {
if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单'); if (!this.selection.length) return this.$message.warning('请至少选择一条正式结算单');
+28 -18
View File
@@ -188,6 +188,7 @@
</el-link> </el-link>
<el-link <el-link
type="primary" type="primary"
:disabled="kingdeeSyncingId === row.id"
v-if=" v-if="
hasPermission('customer_archive_sync') && hasPermission('customer_archive_sync') &&
row.approvalStatus === 'approved' && row.approvalStatus === 'approved' &&
@@ -195,7 +196,7 @@
" "
@click="handleSyncKingdee(row)" @click="handleSyncKingdee(row)"
> >
同步金蝶 {{ kingdeeSyncingId === row.id ? '推送中…' : '同步金蝶' }}
</el-link> </el-link>
<el-link <el-link
type="danger" type="danger"
@@ -1669,6 +1670,7 @@ export default {
archiveForm: this.emptyArchive(), archiveForm: this.emptyArchive(),
kingdeeBlocked: false, kingdeeBlocked: false,
kingdeeQueryTimer: null, kingdeeQueryTimer: null,
kingdeeSyncingId: null,
currentScore: { details: [] }, currentScore: { details: [] },
scoreRecordIndex: -1, scoreRecordIndex: -1,
scoreAttachmentFiles: [], scoreAttachmentFiles: [],
@@ -5102,24 +5104,32 @@ export default {
this.$message({ type: 'success', message: '审核通过!' }); this.$message({ type: 'success', message: '审核通过!' });
}); });
}, },
handleSyncKingdee(row) { async handleSyncKingdee(row) {
this.$confirm('是否确认推送金蝶?', '提示', { if (this.kingdeeSyncingId) return;
confirmButtonText: '确定', try {
cancelButtonText: '取消', await this.$confirm('是否确认推送金蝶?', '提示', {
type: 'warning', confirmButtonText: '确定',
}) cancelButtonText: '取消',
.then(() => syncKingdee(row.id)) type: 'warning',
.then(res => {
const archive = res?.data?.data || {};
if (archive.kingdeeStatus === 'synced') {
this.$message.success('推送成功,金蝶客户编码与客商编号一致');
} else if (archive.kingdeeStatus === 'exist') {
this.$message.info('金蝶已有该客商档案,无需推送');
} else {
this.$message.warning(`推送失败:${archive.kingdeeFailReason || '未知原因'}`);
}
this.onLoad(this.page);
}); });
} catch (exception) {
return;
}
this.kingdeeSyncingId = row.id;
try {
const res = await syncKingdee(row.id);
const archive = res?.data?.data || {};
if (archive.kingdeeStatus === 'synced') {
this.$message.success('推送成功,金蝶客户编码与客商编号一致');
} else if (archive.kingdeeStatus === 'exist') {
this.$message.info('金蝶已有该客商档案,无需推送');
} else {
this.$message.warning(`推送失败:${archive.kingdeeFailReason || '未知原因'}`);
}
this.onLoad(this.page);
} finally {
this.kingdeeSyncingId = null;
}
}, },
handleReject(row) { handleReject(row) {
this.$confirm('是否确认审核不通过?', '提示', { this.$confirm('是否确认审核不通过?', '提示', {