feat: 付款/收款结算单查看页面新增同步金蝶按钮,单张推送并提示结果与异常原因

This commit is contained in:
刘泉佳
2026-10-30 12:21:16 +08:00
parent 025cba317d
commit 70801096dd
@@ -708,7 +708,9 @@
:rows="changeRecordDetailRows"
/>
<template v-if="!pageMode" #footer>
<el-button v-if="editable" @click="handleSyncPlaceholder">同步</el-button>
<el-button v-if="canSync" type="primary" plain :loading="syncLoading" @click="handleSync"
>同步</el-button
>
<el-button @click="visible = false">取消</el-button>
<el-button
v-if="editable"
@@ -724,7 +726,9 @@
>
</template>
<div v-if="pageMode && !publicMode" class="formal-editor__page-actions">
<el-button v-if="editable" @click="handleSyncPlaceholder">同步</el-button>
<el-button v-if="canSync" type="primary" plain :loading="syncLoading" @click="handleSync"
>同步</el-button
>
<el-button @click="visible = false">取消</el-button>
<el-button
v-if="editable"
@@ -1051,6 +1055,7 @@ import {
claimInvoices as claimInvoicesApi,
queryInvoicePool,
save,
syncKingdee,
} from '@/api/settlement/formalSettlement';
import {
getDetail as getPreSettlementDetail,
@@ -1128,6 +1133,7 @@ export default {
loading: false,
draftSaving: false,
saving: false,
syncLoading: false,
form: createFormalSettlementForm(),
sources: [],
details: [],
@@ -1271,6 +1277,16 @@ export default {
editable() {
return !this.readonly;
},
// 查看页面「同步」按钮:仅已审批且未同步金蝶(含推送失败)的单据显示,口径与后端推送闸门一致
canSync() {
return (
this.readonly &&
!this.publicMode &&
this.hasPermission('sync') &&
this.form.approvalStatus === 'approved' &&
this.form.kingdeeSyncStatus !== 'synced'
);
},
isAdmin() {
return isAdministrator(this.userInfo);
},
@@ -2887,8 +2903,30 @@ export default {
remark: this.form.remark,
};
},
handleSyncPlaceholder() {
this.$message.info('开发中');
// 查看页面单张推送金蝶(A102-2/A302-2):结果与异常原因弹框展示,成败后均刷新详情与列表
async handleSync() {
if (this.syncLoading) return;
this.syncLoading = true;
try {
const res = await syncKingdee(this.form.id, { meta: { suppressErrorMessage: true } });
await this.loadFormalDetail(this.recordId);
this.$emit('success');
let message = `同步成功:${this.unwrapData(res) || '-'}`;
if (['pending', 'partial'].includes(this.form.attachmentSyncStatus)) {
message += '\n该单附件未全部上传,可重推补传';
}
await this.$alert(message, '同步结果', { type: 'success', confirmButtonText: '知道了' });
} catch (error) {
const reason = String(error?.message || error || '未知错误').trim() || '未知错误';
await this.loadFormalDetail(this.recordId);
this.$emit('success');
await this.$alert(`同步失败,${reason}`, '同步结果', {
type: 'error',
confirmButtonText: '知道了',
});
} finally {
this.syncLoading = false;
}
},
async handleDraftSave() {
// 保存草稿:不做表单校验,直接落草稿并返回列表刷新