diff --git a/src/api/channel/salesProduct.ts b/src/api/channel/salesProduct.ts
index 1101809..332a110 100644
--- a/src/api/channel/salesProduct.ts
+++ b/src/api/channel/salesProduct.ts
@@ -216,12 +216,16 @@ export async function getSalesProductPublishSyncStatus(params: {
onlineContentHash?: string | null
approvalPending?: boolean
ApprovalPending?: boolean
+ approvalFailed?: boolean
+ ApprovalFailed?: boolean
approvalInstanceId?: number | null
ApprovalInstanceId?: number | null
approvalInstanceNo?: string | null
ApprovalInstanceNo?: string | null
approvalStatusName?: string | null
ApprovalStatusName?: string | null
+ approvalComment?: string | null
+ ApprovalComment?: string | null
}>(res.data)
}
diff --git a/src/api/system/approval.ts b/src/api/system/approval.ts
index 4a89a83..7931018 100644
--- a/src/api/system/approval.ts
+++ b/src/api/system/approval.ts
@@ -290,6 +290,16 @@ export async function withdrawApproval(body: {
}
}
+/** 终审后业务执行失败 / 历史空跑:重试 Handler(落发布、入账等) */
+export async function retryApprovalExecute(id: number) {
+ try {
+ const res = await axiosInstance.post(omsUrl('/system/approval/engine/retry-execute'), { id })
+ assertBusinessOk(res.data)
+ } catch (e) {
+ throw new Error(extractOmsRequestError(e))
+ }
+}
+
export async function simulateApprovalSubmit(body: {
operationCode?: string
bizKey?: string
diff --git a/src/components/ApprovalDetailDrawer/index.vue b/src/components/ApprovalDetailDrawer/index.vue
index 94a3f13..2cc45e4 100644
--- a/src/components/ApprovalDetailDrawer/index.vue
+++ b/src/components/ApprovalDetailDrawer/index.vue
@@ -164,6 +164,15 @@
{{ t('system.approval.inbox.withdraw') }}
+
+ {{ t('system.approval.inbox.retryExecute') }}
+
{
+ const status = detail.value?.status
+ if (status !== 6 && status !== 7) return false
+ return (
+ hasPermission('System.ApprovalTask.Approve') ||
+ hasPermission('System.ApprovalDefinition.Enable')
+ )
+})
+
const showFooter = computed(
() =>
!!(
@@ -249,7 +269,8 @@ const showFooter = computed(
((detail.value.canApprove &&
(hasPermission('System.ApprovalTask.Approve') ||
hasPermission('System.ApprovalTask.Reject'))) ||
- detail.value.canWithdraw)
+ detail.value.canWithdraw ||
+ canRetryExecute.value)
),
)
@@ -604,6 +625,29 @@ async function doApprove() {
})
}
+function doRetryExecute() {
+ const row = detail.value
+ if (!row?.id) return
+ Modal.warning({
+ title: t('system.approval.inbox.retryExecute'),
+ content: t('system.approval.inbox.retryExecuteConfirm', { no: row.instanceNo }),
+ hideCancel: false,
+ onOk: async () => {
+ actionLoading.value = true
+ try {
+ await retryApprovalExecute(row.id)
+ Message.success(t('common.success'))
+ emit('changed')
+ await loadDetail(row.id)
+ } catch (e: unknown) {
+ Message.error((e as Error)?.message || t('common.failed'))
+ } finally {
+ actionLoading.value = false
+ }
+ },
+ })
+}
+
function openReject() {
rejectComment.value = ''
rejectVisible.value = true
diff --git a/src/locale/en-US.ts b/src/locale/en-US.ts
index 79fa9f0..f59cccc 100644
--- a/src/locale/en-US.ts
+++ b/src/locale/en-US.ts
@@ -1501,6 +1501,9 @@ export default {
'system.approval.inbox.approve': 'Approve',
'system.approval.inbox.reject': 'Reject',
'system.approval.inbox.withdraw': 'Withdraw',
+ 'system.approval.inbox.retryExecute': 'Retry business execute',
+ 'system.approval.inbox.retryExecuteConfirm':
+ 'Retry execute for {no}? This re-runs the frozen payload (e.g. price publish).',
'system.approval.inbox.payload': 'Payload',
'system.approval.inbox.basicInfo': 'Basics',
'system.approval.inbox.bizSummary': 'Business content',
@@ -5422,6 +5425,8 @@ export default {
'channel.salesProducts.actions.publishRules': 'Publish rules',
'channel.salesProducts.actions.publishPrice': 'Publish prices',
'channel.salesProducts.actions.viewPriceApproval': 'View approval',
+ 'channel.salesProducts.actions.resubmitPriceApproval': 'Resubmit approval',
+ 'channel.salesProducts.actions.retryPriceApprovalExecute': 'Retry business execute',
'channel.salesProducts.actions.add': 'Add',
'channel.salesProducts.actions.edit': 'Edit',
'channel.salesProducts.actions.delete': 'Delete',
@@ -5516,6 +5521,7 @@ export default {
'channel.salesProducts.publish.legend.same': 'Unchanged',
'channel.salesProducts.publish.badge.pending': 'Pending publish',
'channel.salesProducts.publish.badge.pendingApproval': 'Pending approval',
+ 'channel.salesProducts.publish.badge.failed': 'Approval failed',
'channel.salesProducts.publish.badge.synced': 'Published',
'channel.salesProducts.publish.badge.checking': 'Checking…',
'channel.salesProducts.publish.approvalNo': 'Approval No. {no}',
diff --git a/src/locale/zh-CN.ts b/src/locale/zh-CN.ts
index 138a8b5..f30b1a0 100644
--- a/src/locale/zh-CN.ts
+++ b/src/locale/zh-CN.ts
@@ -1492,6 +1492,8 @@ export default {
'system.approval.inbox.approve': '通过',
'system.approval.inbox.reject': '驳回',
'system.approval.inbox.withdraw': '撤回',
+ 'system.approval.inbox.retryExecute': '重试业务执行',
+ 'system.approval.inbox.retryExecuteConfirm': '确认重试执行审批单 {no}?将按冻结载荷重新落业务(如价格发布)。',
'system.approval.inbox.payload': '业务载荷',
'system.approval.inbox.basicInfo': '基本信息',
'system.approval.inbox.bizSummary': '业务内容',
@@ -5445,6 +5447,8 @@ export default {
'channel.salesProducts.actions.publishRules': '发布规则',
'channel.salesProducts.actions.publishPrice': '价格发布',
'channel.salesProducts.actions.viewPriceApproval': '查看审批',
+ 'channel.salesProducts.actions.resubmitPriceApproval': '重新提交审批',
+ 'channel.salesProducts.actions.retryPriceApprovalExecute': '重试业务执行',
'channel.salesProducts.actions.add': '新增',
'channel.salesProducts.actions.edit': '编辑',
'channel.salesProducts.actions.delete': '删除',
@@ -5539,6 +5543,7 @@ export default {
'channel.salesProducts.publish.legend.same': '不变',
'channel.salesProducts.publish.badge.pending': '待发布',
'channel.salesProducts.publish.badge.pendingApproval': '待审批',
+ 'channel.salesProducts.publish.badge.failed': '审批失败',
'channel.salesProducts.publish.badge.synced': '已发布',
'channel.salesProducts.publish.badge.checking': '检测中…',
'channel.salesProducts.publish.approvalNo': '审批号 {no}',
diff --git a/src/views/channel/salesProducts/index.vue b/src/views/channel/salesProducts/index.vue
index fe12d57..8e5c2b5 100644
--- a/src/views/channel/salesProducts/index.vue
+++ b/src/views/channel/salesProducts/index.vue
@@ -53,6 +53,7 @@
import type { PricePublishAiAdoptPayload } from './components/PricePublishAiAssistDrawer.vue';
import BillingSimulateDrawer from './components/BillingSimulateDrawer.vue';
import ApprovalDetailDrawer from '@/components/ApprovalDetailDrawer/index.vue';
+ import { retryApprovalExecute } from '@/api/system/approval';
import { buildPricePublishAiSkipReport, type PricePublishRiskLevel } from './pricePublishAiSkill';
import { pickResolvedAudit } from '@/utils/auditFields';
import { useUserStore } from '@/store';
@@ -1453,15 +1454,23 @@
return detail?.content ?? detail?.Content ?? null;
}
- /** 同步态:待发布 / 待审批(+审批号) / 已发布 */
+ /** 同步态:待发布 / 待审批 / 失败可重提 / 已发布 */
+ function clearPriceApprovalSyncState() {
+ priceApprovalPending.value = false;
+ priceApprovalFailed.value = false;
+ priceApprovalExecuteFailed.value = false;
+ priceApprovalInstanceId.value = null;
+ priceApprovalInstanceNo.value = '';
+ priceApprovalStatusName.value = '';
+ priceApprovalComment.value = '';
+ }
+
async function refreshPricePublishSyncStatus(productId?: number) {
const pid = productId ?? selectedProduct.value;
if (pid == null) {
pricePublishChecking.value = false;
pricePublishPending.value = null;
- priceApprovalPending.value = false;
- priceApprovalInstanceId.value = null;
- priceApprovalInstanceNo.value = '';
+ clearPriceApprovalSyncState();
return;
}
const seq = priceTabLoadSeq;
@@ -1477,7 +1486,17 @@
const approvalPending = Boolean(
status?.approvalPending ?? status?.ApprovalPending,
);
+ const approvalFailed = Boolean(
+ status?.approvalFailed ?? status?.ApprovalFailed,
+ );
priceApprovalPending.value = approvalPending;
+ priceApprovalFailed.value = approvalFailed && !approvalPending;
+ const statusName = String(
+ status?.approvalStatusName ?? status?.ApprovalStatusName ?? '',
+ ).trim();
+ priceApprovalStatusName.value = statusName;
+ priceApprovalExecuteFailed.value =
+ priceApprovalFailed.value && statusName === '执行失败';
const instanceId =
status?.approvalInstanceId ?? status?.ApprovalInstanceId ?? null;
priceApprovalInstanceId.value =
@@ -1485,12 +1504,13 @@
priceApprovalInstanceNo.value = String(
status?.approvalInstanceNo ?? status?.ApprovalInstanceNo ?? '',
).trim();
+ priceApprovalComment.value = String(
+ status?.approvalComment ?? status?.ApprovalComment ?? '',
+ ).trim();
} catch {
if (seq === priceTabLoadSeq) {
pricePublishPending.value = null;
- priceApprovalPending.value = false;
- priceApprovalInstanceId.value = null;
- priceApprovalInstanceNo.value = '';
+ clearPriceApprovalSyncState();
}
} finally {
if (seq === priceTabLoadSeq) pricePublishChecking.value = false;
@@ -1498,6 +1518,7 @@
}
const priceApprovalDrawerVisible = ref(false);
+ const priceApprovalRetryLoading = ref(false);
function openPriceApprovalDrawer() {
if (!priceApprovalInstanceId.value) {
@@ -1507,11 +1528,35 @@
priceApprovalDrawerVisible.value = true;
}
+ async function retryPriceApprovalExecute() {
+ const id = priceApprovalInstanceId.value;
+ if (!id) {
+ Message.warning(t('channel.salesProducts.publish.approvalDetailMissing'));
+ return;
+ }
+ priceApprovalRetryLoading.value = true;
+ try {
+ await retryApprovalExecute(id);
+ Message.success(t('common.success'));
+ const pid = selectedProduct.value;
+ if (pid != null) {
+ await refreshPricePublishSyncStatus(pid);
+ await loadPriceTabData(pid, { force: true });
+ await loadRecordsTabData(pid, true);
+ }
+ } catch (e: unknown) {
+ Message.error((e as Error)?.message || t('common.failed'));
+ } finally {
+ priceApprovalRetryLoading.value = false;
+ }
+ }
+
async function onPriceApprovalChanged() {
const pid = selectedProduct.value;
if (pid == null) return;
await refreshPricePublishSyncStatus(pid);
await loadPriceTabData(pid, { force: true });
+ await loadRecordsTabData(pid, true);
}
let recordsTabLoadedProductId: number | null = null;
@@ -1672,18 +1717,14 @@
priceTabLoadedProductId = null;
pricePublishPending.value = null;
pricePublishChecking.value = false;
- priceApprovalPending.value = false;
- priceApprovalInstanceId.value = null;
- priceApprovalInstanceNo.value = '';
+ clearPriceApprovalSyncState();
effectiveVersion.value = '--';
effectiveTime.value = '--';
} else if (activeTab.value === 'price') {
// 切到卖价 tab / 换产品:先清空徽章,等 sync-status 回来再显示
pricePublishPending.value = null;
pricePublishChecking.value = false;
- priceApprovalPending.value = false;
- priceApprovalInstanceId.value = null;
- priceApprovalInstanceNo.value = '';
+ clearPriceApprovalSyncState();
}
if (productChanged && activeTab.value !== 'rules') {
rulesTabLoadedProductId = null;
@@ -1951,8 +1992,18 @@
const pricePublishPending = ref(null);
const pricePublishChecking = ref(false);
const priceApprovalPending = ref(false);
+ const priceApprovalFailed = ref(false);
+ const priceApprovalExecuteFailed = ref(false);
const priceApprovalInstanceId = ref(null);
const priceApprovalInstanceNo = ref('');
+ const priceApprovalStatusName = ref('');
+ const priceApprovalComment = ref('');
+ const priceApprovalFailedBadgeText = computed(() => {
+ const name = priceApprovalStatusName.value || t('channel.salesProducts.publish.badge.failed');
+ return priceApprovalInstanceNo.value
+ ? `${name} · ${priceApprovalInstanceNo.value}`
+ : name;
+ });
const publishDiffStatus = computed(() => {
if (!publishHasOnlineSnapshot.value) return 'first';
@@ -4581,14 +4632,44 @@