后端架构更新
This commit is contained in:
@@ -518,7 +518,7 @@ function shouldShowProgress(item: DeleteBrandResultItem) {
|
||||
|
||||
function normalizeDeleteBrandItems(items: DeleteBrandResultItem[]) {
|
||||
return items.map((item) => {
|
||||
if (item.matchStatus === 'MATCHED') {
|
||||
if (item.matched || item.matchStatus === 'MATCHED' || item.matchStatus === 'INDEX_STALE') {
|
||||
return {
|
||||
...item,
|
||||
_pushed: false,
|
||||
@@ -537,6 +537,9 @@ function normalizeDeleteBrandItems(items: DeleteBrandResultItem[]) {
|
||||
}
|
||||
|
||||
function formatMatchResult(item: DeleteBrandResultItem) {
|
||||
if (item.matched && item.matchStatus === 'INDEX_STALE') {
|
||||
return item.matchMessage || `已匹配 ${item.shopId || ''}(索引过期)`.trim()
|
||||
}
|
||||
if (item.matchStatus === 'MATCHED') {
|
||||
return `已匹配 ${item.shopId || ''}`.trim()
|
||||
}
|
||||
@@ -546,7 +549,7 @@ function formatMatchResult(item: DeleteBrandResultItem) {
|
||||
if (item.matchStatus === 'CONFLICT') {
|
||||
return '存在多个同名店铺,请人工确认'
|
||||
}
|
||||
if (item.matchStatus === 'PENDING' || item.matchStatus === 'INDEX_STALE') {
|
||||
if (item.matchStatus === 'PENDING') {
|
||||
return '店铺索引暂未就绪'
|
||||
}
|
||||
if (item.matchStatus) {
|
||||
@@ -781,11 +784,8 @@ function getQueueStatus(item: DeleteBrandResultItem) {
|
||||
|
||||
function canDownloadTaskResult(item: DeleteBrandResultItem) {
|
||||
if (item.downloadUrl) return true
|
||||
|
||||
const taskId = item.taskId
|
||||
if (!taskId) return { success: false, retryable: false }
|
||||
const status = taskDetails.value[taskId]?.task?.status
|
||||
return status === 'SUCCESS'
|
||||
if (item.fileReady) return true
|
||||
return false
|
||||
}
|
||||
|
||||
function mergeTaskDetailItemsIntoSession(detail: DeleteBrandTaskDetailVo) {
|
||||
@@ -1048,12 +1048,17 @@ async function submitRun() {
|
||||
})),
|
||||
})
|
||||
const normalizedItems = normalizeDeleteBrandItems(result.items || [])
|
||||
const hasMatchedItems = normalizedItems.some((item) => item.matchStatus === 'MATCHED')
|
||||
const hasPendingItems = normalizedItems.some((item) => item.matchStatus && item.matchStatus !== 'MATCHED')
|
||||
const hasRunnableItems = normalizedItems.some((item) =>
|
||||
item.matchStatus === 'MATCHED' || item.matchStatus === 'INDEX_STALE' || item.matched
|
||||
)
|
||||
const hasStaleMatchedItems = normalizedItems.some((item) => item.matchStatus === 'INDEX_STALE' && item.matched)
|
||||
const hasBlockedItems = normalizedItems.some((item) =>
|
||||
!item.matched && item.matchStatus !== 'MATCHED' && item.matchStatus !== 'INDEX_STALE'
|
||||
)
|
||||
|
||||
queuePushResult.value = hasMatchedItems
|
||||
queuePushResult.value = hasRunnableItems
|
||||
? '解析完成,可在左侧点击“推送到 Python 队列”开始串行处理'
|
||||
: '解析完成,当前没有可推送的已匹配文件'
|
||||
: '解析完成,当前没有可推送的文件'
|
||||
queuePayloadText.value = ''
|
||||
|
||||
if (normalizedItems.length && normalizedItems[0].taskId) {
|
||||
@@ -1061,12 +1066,14 @@ async function submitRun() {
|
||||
}
|
||||
syncResultState()
|
||||
|
||||
if (hasPendingItems) {
|
||||
if (hasBlockedItems) {
|
||||
ElMessage.warning('部分文件尚未命中可用店铺索引,已保留状态信息,请等待后台刷新后重试。')
|
||||
} else if (hasMatchedItems) {
|
||||
} else if (hasStaleMatchedItems) {
|
||||
ElMessage.warning('部分文件命中的是过期索引,仍可推送到 Python 队列;后台刷新后会自动重新匹配。')
|
||||
} else if (hasRunnableItems) {
|
||||
ElMessage.success('删除品牌解析完成,请在左侧推送到 Python 队列')
|
||||
} else {
|
||||
ElMessage.warning('当前没有可推送的已匹配文件,请先等待店铺索引刷新。')
|
||||
ElMessage.warning('当前没有可推送的文件,请先等待店铺索引刷新。')
|
||||
}
|
||||
|
||||
// 更新历史记录,以展示那些未进入队列的失败项
|
||||
@@ -1207,7 +1214,7 @@ function getItemKey(item: DeleteBrandResultItem) {
|
||||
}
|
||||
|
||||
function canPushToQueue(item: DeleteBrandResultItem) {
|
||||
return Boolean(item.taskId && (item.matchStatus === 'MATCHED' || item.matched))
|
||||
return Boolean(item.taskId && (item.matchStatus === 'MATCHED' || item.matchStatus === 'INDEX_STALE' || item.matched))
|
||||
}
|
||||
|
||||
function findNextAutoRunnableItem() {
|
||||
@@ -1284,7 +1291,7 @@ async function runItem(item: DeleteBrandResultItem, options?: { auto?: boolean }
|
||||
async function pushToPythonQueue() {
|
||||
const nextItem = findNextAutoRunnableItem()
|
||||
if (!nextItem) {
|
||||
ElMessage.warning('当前没有可推送的已匹配文件')
|
||||
ElMessage.warning('当前没有可推送的文件')
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user