diff --git a/src/views/supermarket/smHotelSyncLog/index.vue b/src/views/supermarket/smHotelSyncLog/index.vue
index 29290dea..c7a952cd 100644
--- a/src/views/supermarket/smHotelSyncLog/index.vue
+++ b/src/views/supermarket/smHotelSyncLog/index.vue
@@ -107,7 +107,7 @@
-
+
失败明细
+
+ 重试失败
+
(null)
const failDetailSyncType = ref("")
const failDetailHasCount = ref(false)
const retryFailedLoading = ref(false)
+const retryingLogId = ref(null)
+
+const isRetryableSyncType = (t?: string) =>
+ t === "DETAIL_PULL" || t === "PRICE_ROLL" || t === "DOWNSTREAM_PUSH"
const canRetryFailed = computed(
() =>
!!failDetailLogId.value &&
!!failDetailText.value &&
- (failDetailSyncType.value === "DETAIL_PULL" || failDetailSyncType.value === "PRICE_ROLL"),
+ isRetryableSyncType(failDetailSyncType.value),
)
+/** 列表行:已结束且有失败明细时可只重试失败酒店 */
+const canRetryFailedRow = (row: any) =>
+ !!row?.failDetail &&
+ isRetryableSyncType(row?.syncType) &&
+ row?.status !== "RUNNING" &&
+ row?.status !== "PAUSED"
+
const canPause = (row: any) =>
row?.status === "RUNNING" && (row.syncType === "DOWNSTREAM_PUSH" || row.syncType === "DETAIL_PULL")
@@ -391,28 +412,42 @@ const exportDownstreamGaps = (row: any) => {
downBlobFile(exportGapsBySyncLogId(row.id), {}, `下游推送完善清单_${row.id}.xlsx`)
}
+const retryConfirmText = (syncType?: string) => {
+ if (syncType === "PRICE_ROLL") {
+ return "将只重试本日志失败明细中的酒店滚价(同日),不会全量再跑。完善数据后若仍有失败,可对「新的重试日志」再点重试。"
+ }
+ if (syncType === "DOWNSTREAM_PUSH") {
+ return "将只重推本日志失败明细中的酒店到下游,不会全量再推。可:导出失败/完善清单 → 改数据 → 再点重试,直到失败清零。"
+ }
+ return "将只重试本日志失败明细中的酒店详情拉取,不会全量再跑。完善后仍失败可对重试日志继续重试。"
+}
+
+const submitRetryFailed = async (logId: string | number, syncType?: string) => {
+ const res: any = await retryFailedFromLog(logId)
+ const data = res?.data || {}
+ const newId = data.logId || data.id
+ if (!newId) {
+ useMessage().error(res?.msg || data.message || "提交重试失败")
+ return false
+ }
+ useMessage().success(res?.msg || `已提交失败重试(新日志 ${newId}),请在本页刷新查看`)
+ return true
+}
+
const onRetryFailed = async () => {
if (!failDetailLogId.value) return
try {
- await useMessageBox().confirm(
- failDetailSyncType.value === "PRICE_ROLL"
- ? "将只重试本日志失败明细中的酒店滚价(同日),确定?"
- : "将只重试本日志失败明细中的酒店详情拉取,确定?",
- )
+ await useMessageBox().confirm(retryConfirmText(failDetailSyncType.value))
} catch {
return
}
retryFailedLoading.value = true
try {
- const res: any = await retryFailedFromLog(failDetailLogId.value)
- const data = res?.data || {}
- if (!data.logId) {
- useMessage().error(res?.msg || data.message || "提交重试失败")
- return
+ const ok = await submitRetryFailed(failDetailLogId.value, failDetailSyncType.value)
+ if (ok) {
+ failDetailVisible.value = false
+ loadSyncLogs(1)
}
- failDetailVisible.value = false
- useMessage().success(res?.msg || "已提交失败重试,请在本页刷新查看进度")
- loadSyncLogs(1)
} catch (err: any) {
useMessage().error(err?.msg || err?.message || "提交重试失败")
} finally {
@@ -420,6 +455,24 @@ const onRetryFailed = async () => {
}
}
+const onRetryFailedRow = async (row: any) => {
+ if (!row?.id) return
+ try {
+ await useMessageBox().confirm(retryConfirmText(row.syncType))
+ } catch {
+ return
+ }
+ retryingLogId.value = row.id
+ try {
+ const ok = await submitRetryFailed(row.id, row.syncType)
+ if (ok) loadSyncLogs(1)
+ } catch (err: any) {
+ useMessage().error(err?.msg || err?.message || "提交重试失败")
+ } finally {
+ retryingLogId.value = null
+ }
+}
+
const handlePauseLog = async (row: any) => {
try {
await useMessageBox().confirm(