mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 17:49:20 +08:00
fix(order-import): 修复模板自动选中时序问题
1. handleNext 改为 async,确保 fieldDefs 加载完成后才加载模板 2. handleSelectTemplate 添加 fieldDefs 非空检查,防止时序问题导致映射失败 3. handleSelectStatusTemplate 添加 uniqueStatusValues 非空检查
This commit is contained in:
+14
-3
@@ -425,6 +425,11 @@ const handleSelectTemplate = async (value: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果 fieldDefs 尚未加载,不应用模板(防止时序问题)
|
||||||
|
if (fieldDefs.value.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const template = mappingTemplates.value.find((t) => t.id === templateId);
|
const template = mappingTemplates.value.find((t) => t.id === templateId);
|
||||||
if (!template) {
|
if (!template) {
|
||||||
return;
|
return;
|
||||||
@@ -551,6 +556,11 @@ const handleSelectStatusTemplate = async (value: any) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果没有订单状态值,不应用模板
|
||||||
|
if (uniqueStatusValues.value.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const template = statusMappingTemplates.value.find(
|
const template = statusMappingTemplates.value.find(
|
||||||
(t) => t.id === templateId,
|
(t) => t.id === templateId,
|
||||||
);
|
);
|
||||||
@@ -852,7 +862,7 @@ const parseOrderStatuses = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 下一步
|
// 下一步
|
||||||
const handleNext = () => {
|
const handleNext = async () => {
|
||||||
switch (currentStep.value) {
|
switch (currentStep.value) {
|
||||||
case 0: {
|
case 0: {
|
||||||
if (!selectedShopId.value) {
|
if (!selectedShopId.value) {
|
||||||
@@ -860,12 +870,13 @@ const handleNext = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentStep.value = 1;
|
currentStep.value = 1;
|
||||||
|
// 确保字段定义加载完成后,再加载模板(模板自动选中依赖 fieldDefs)
|
||||||
if (fieldDefs.value.length === 0) {
|
if (fieldDefs.value.length === 0) {
|
||||||
fetchFieldDefs();
|
await fetchFieldDefs();
|
||||||
}
|
}
|
||||||
// 加载映射模板列表
|
// 加载映射模板列表
|
||||||
if (mappingTemplates.value.length === 0) {
|
if (mappingTemplates.value.length === 0) {
|
||||||
fetchMappingTemplates();
|
await fetchMappingTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user