✨ immediate-enabled关闭时隐藏项目/合同推送合规入口
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,6 +2,43 @@ import request from '@/axios';
|
||||
|
||||
const baseUrl = '/blade-transport/hcs';
|
||||
|
||||
/** 进程内缓存,避免列表页重复请求推送开关 */
|
||||
let immediateEnabledCache = null;
|
||||
let immediateEnabledPromise = null;
|
||||
|
||||
/**
|
||||
* 查询 HCS 即时推送开关(thirdParty.hcs.push.immediate-enabled)。
|
||||
* 关闭时项目管理/合同管理隐藏「推送合规」「批量推送合规」。
|
||||
*/
|
||||
export const getPushConfig = () =>
|
||||
request({
|
||||
url: `${baseUrl}/push-config`,
|
||||
method: 'get',
|
||||
});
|
||||
|
||||
export const loadHcsImmediateEnabled = () => {
|
||||
if (immediateEnabledCache !== null) {
|
||||
return Promise.resolve(immediateEnabledCache);
|
||||
}
|
||||
if (immediateEnabledPromise) {
|
||||
return immediateEnabledPromise;
|
||||
}
|
||||
immediateEnabledPromise = getPushConfig()
|
||||
.then(res => {
|
||||
const data = res?.data?.data ?? res?.data ?? {};
|
||||
immediateEnabledCache = data.immediateEnabled === true || data.immediateEnabled === 'true';
|
||||
return immediateEnabledCache;
|
||||
})
|
||||
.catch(() => {
|
||||
immediateEnabledCache = false;
|
||||
return false;
|
||||
})
|
||||
.finally(() => {
|
||||
immediateEnabledPromise = null;
|
||||
});
|
||||
return immediateEnabledPromise;
|
||||
};
|
||||
|
||||
// 合规推送涉及 HCS 远程多次调用(风险校验+附件转传+起草),可达 20s+,覆盖全局 10s 超时
|
||||
export const repush = (bizType, id) =>
|
||||
request({
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
批量导出
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="hcsImmediateEnabled"
|
||||
type="warning"
|
||||
plain
|
||||
:loading="hcsRepushingId === 'batch'"
|
||||
@@ -112,7 +113,11 @@
|
||||
>
|
||||
{{ operation.label }}
|
||||
</el-link>
|
||||
<el-link v-if="canHcsRepush(row)" type="warning" @click="handleHcsRepush(row)">
|
||||
<el-link
|
||||
v-if="hcsImmediateEnabled && canHcsRepush(row)"
|
||||
type="warning"
|
||||
@click="handleHcsRepush(row)"
|
||||
>
|
||||
{{ hcsRepushingId === row.id ? '推送中…' : '推送合规' }}
|
||||
</el-link>
|
||||
<el-link v-if="canDelete(row)" type="danger" @click="removeRow(row)">删除</el-link>
|
||||
@@ -1090,7 +1095,12 @@ import 'nprogress/nprogress.css';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import * as api from '@/api/business/contract-manage';
|
||||
import { createFromContract } from '@/api/business/contract-change';
|
||||
import { repush as hcsRepush, repushBatch as hcsRepushBatch, getRisk } from '@/api/business/hcs';
|
||||
import {
|
||||
getRisk,
|
||||
loadHcsImmediateEnabled,
|
||||
repush as hcsRepush,
|
||||
repushBatch as hcsRepushBatch,
|
||||
} from '@/api/business/hcs';
|
||||
import { Position } from '@element-plus/icons-vue';
|
||||
import { getMkPublicDetail } from '@/api/mk-process';
|
||||
import { getList as getProjectList } from '@/api/business/project-apply';
|
||||
@@ -1427,8 +1437,9 @@ export default {
|
||||
billCycleTypeOptions: ['固定截单日', '自然月', '自定义多周期'],
|
||||
detailLoading: false,
|
||||
detailRow: {},
|
||||
// 合规(HCS)推送/对账状态
|
||||
// 合规(HCS)推送/对账状态;受 thirdParty.hcs.push.immediate-enabled 控制显隐
|
||||
hcsRepushingId: null,
|
||||
hcsImmediateEnabled: false,
|
||||
detailContractFileRows: [],
|
||||
detailAttachmentRows: [],
|
||||
detailBillingPlanRows: [],
|
||||
@@ -1699,6 +1710,13 @@ export default {
|
||||
.catch(() => {
|
||||
this.mkEnabled = false;
|
||||
});
|
||||
loadHcsImmediateEnabled()
|
||||
.then(enabled => {
|
||||
this.hcsImmediateEnabled = !!enabled;
|
||||
})
|
||||
.catch(() => {
|
||||
this.hcsImmediateEnabled = false;
|
||||
});
|
||||
}
|
||||
if (this.isFormPage) this.initFormPage();
|
||||
if (this.isDetailPage) this.initDetailPage();
|
||||
@@ -1761,6 +1779,7 @@ export default {
|
||||
},
|
||||
canHcsRepush(row) {
|
||||
return (
|
||||
this.hcsImmediateEnabled &&
|
||||
['approved', 'change_approved'].includes(row.approvalStatus) &&
|
||||
row.hcsSyncStatus !== 'synced'
|
||||
);
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
v-if="!readonlyScope"
|
||||
v-if="!readonlyScope && hcsImmediateEnabled"
|
||||
:loading="hcsRepushingId === 'batch'"
|
||||
@click="handleHcsBatchRepush"
|
||||
>
|
||||
@@ -154,7 +154,7 @@
|
||||
{{ operation.label }}
|
||||
</el-link>
|
||||
<el-link
|
||||
v-if="canHcsRepush(row)"
|
||||
v-if="hcsImmediateEnabled && canHcsRepush(row)"
|
||||
type="warning"
|
||||
@click="handleHcsRepush(row)"
|
||||
>
|
||||
@@ -984,7 +984,11 @@
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { defineAsyncComponent } from 'vue';
|
||||
import * as api from '@/api/business/project-apply';
|
||||
import { repush as hcsRepush, repushBatch as hcsRepushBatch } from '@/api/business/hcs';
|
||||
import {
|
||||
loadHcsImmediateEnabled,
|
||||
repush as hcsRepush,
|
||||
repushBatch as hcsRepushBatch,
|
||||
} from '@/api/business/hcs';
|
||||
import { Position } from '@element-plus/icons-vue';
|
||||
import { getMkPublicDetail } from '@/api/mk-process';
|
||||
import {
|
||||
@@ -1196,8 +1200,9 @@ export default {
|
||||
{ label: '高风险', value: 'high', statKey: 'high' },
|
||||
{ label: '中风险', value: 'medium', statKey: 'medium' },
|
||||
],
|
||||
// 合规(HCS)推送状态
|
||||
// 合规(HCS)推送状态;受 thirdParty.hcs.push.immediate-enabled 控制显隐
|
||||
hcsRepushingId: null,
|
||||
hcsImmediateEnabled: false,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 20, 50, 100],
|
||||
@@ -1556,6 +1561,13 @@ export default {
|
||||
.catch(() => {
|
||||
this.mkEnabled = false;
|
||||
});
|
||||
loadHcsImmediateEnabled()
|
||||
.then(enabled => {
|
||||
this.hcsImmediateEnabled = !!enabled;
|
||||
})
|
||||
.catch(() => {
|
||||
this.hcsImmediateEnabled = false;
|
||||
});
|
||||
this.loadDeptOptions();
|
||||
this.loadCargoTypeOptions();
|
||||
this.loadTransportTypeOptions();
|
||||
@@ -1790,6 +1802,7 @@ export default {
|
||||
},
|
||||
canHcsRepush(row) {
|
||||
return (
|
||||
this.hcsImmediateEnabled &&
|
||||
!this.readonlyScope &&
|
||||
['approved', 'change_approved'].includes(row.approvalStatus) &&
|
||||
row.hcsSyncStatus !== 'synced'
|
||||
|
||||
Reference in New Issue
Block a user