完成后端架构重构等
This commit is contained in:
@@ -358,6 +358,7 @@ const pendingQueue = ref<PatrolDeleteShopQueueItem[]>([]);
|
||||
const activeTaskId = ref<number | null>(null);
|
||||
const activeQueueItem = ref<PatrolDeleteShopQueueItem | null>(null);
|
||||
const queueWorkerRunning = ref(false);
|
||||
const autoQueueEnabled = ref(false);
|
||||
let historyPollTimer: number | null = null;
|
||||
|
||||
const matchedRunnableItems = computed(() =>
|
||||
@@ -774,6 +775,11 @@ async function runMatch() {
|
||||
const data = await matchPatrolDeleteShops(names);
|
||||
matchedItems.value = mergeMatchedItems(matchedItems.value, data.items || []);
|
||||
saveMatchedItems();
|
||||
if (autoQueueEnabled.value) {
|
||||
pendingQueue.value = mergeQueueItems(pendingQueue.value, matchedRunnableItems.value);
|
||||
saveQueueState();
|
||||
void processQueue();
|
||||
}
|
||||
ElMessage.success(`本次返回 ${data.items?.length || 0} 条匹配结果`);
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : "匹配失败");
|
||||
@@ -963,6 +969,7 @@ async function processQueue() {
|
||||
}
|
||||
|
||||
async function pushToPythonQueue() {
|
||||
autoQueueEnabled.value = true;
|
||||
const runnable = matchedRunnableItems.value;
|
||||
if (!runnable.length) {
|
||||
ElMessage.warning("请先匹配可用店铺");
|
||||
@@ -1016,6 +1023,7 @@ onMounted(async () => {
|
||||
await Promise.all([loadCandidates(), loadDashboard(), loadHistory()]);
|
||||
|
||||
if (activeTaskId.value || pendingQueue.value.length) {
|
||||
autoQueueEnabled.value = true;
|
||||
queuePushResult.value =
|
||||
activeTaskId.value != null
|
||||
? `检测到未完成队列,继续等待任务 ${activeTaskId.value} 完成并自动接续后续店铺`
|
||||
|
||||
Reference in New Issue
Block a user