feat: 付款/收款结算单查看页面新增同步金蝶按钮,单张推送并提示结果与异常原因
This commit is contained in:
@@ -708,7 +708,9 @@
|
|||||||
:rows="changeRecordDetailRows"
|
:rows="changeRecordDetailRows"
|
||||||
/>
|
/>
|
||||||
<template v-if="!pageMode" #footer>
|
<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 @click="visible = false">取消</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="editable"
|
v-if="editable"
|
||||||
@@ -724,7 +726,9 @@
|
|||||||
>
|
>
|
||||||
</template>
|
</template>
|
||||||
<div v-if="pageMode && !publicMode" class="formal-editor__page-actions">
|
<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 @click="visible = false">取消</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="editable"
|
v-if="editable"
|
||||||
@@ -1051,6 +1055,7 @@ import {
|
|||||||
claimInvoices as claimInvoicesApi,
|
claimInvoices as claimInvoicesApi,
|
||||||
queryInvoicePool,
|
queryInvoicePool,
|
||||||
save,
|
save,
|
||||||
|
syncKingdee,
|
||||||
} from '@/api/settlement/formalSettlement';
|
} from '@/api/settlement/formalSettlement';
|
||||||
import {
|
import {
|
||||||
getDetail as getPreSettlementDetail,
|
getDetail as getPreSettlementDetail,
|
||||||
@@ -1128,6 +1133,7 @@ export default {
|
|||||||
loading: false,
|
loading: false,
|
||||||
draftSaving: false,
|
draftSaving: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
|
syncLoading: false,
|
||||||
form: createFormalSettlementForm(),
|
form: createFormalSettlementForm(),
|
||||||
sources: [],
|
sources: [],
|
||||||
details: [],
|
details: [],
|
||||||
@@ -1271,6 +1277,16 @@ export default {
|
|||||||
editable() {
|
editable() {
|
||||||
return !this.readonly;
|
return !this.readonly;
|
||||||
},
|
},
|
||||||
|
// 查看页面「同步」按钮:仅已审批且未同步金蝶(含推送失败)的单据显示,口径与后端推送闸门一致
|
||||||
|
canSync() {
|
||||||
|
return (
|
||||||
|
this.readonly &&
|
||||||
|
!this.publicMode &&
|
||||||
|
this.hasPermission('sync') &&
|
||||||
|
this.form.approvalStatus === 'approved' &&
|
||||||
|
this.form.kingdeeSyncStatus !== 'synced'
|
||||||
|
);
|
||||||
|
},
|
||||||
isAdmin() {
|
isAdmin() {
|
||||||
return isAdministrator(this.userInfo);
|
return isAdministrator(this.userInfo);
|
||||||
},
|
},
|
||||||
@@ -2887,8 +2903,30 @@ export default {
|
|||||||
remark: this.form.remark,
|
remark: this.form.remark,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleSyncPlaceholder() {
|
// 查看页面单张推送金蝶(A102-2/A302-2):结果与异常原因弹框展示,成败后均刷新详情与列表
|
||||||
this.$message.info('开发中');
|
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() {
|
async handleDraftSave() {
|
||||||
// 保存草稿:不做表单校验,直接落草稿并返回列表刷新
|
// 保存草稿:不做表单校验,直接落草稿并返回列表刷新
|
||||||
|
|||||||
Reference in New Issue
Block a user