Преглед изворни кода

```
feat(go-flow): 自动加载首个经营板块的二级分类

当获取到一级经营板块列表后,自动加载第一个板块对应的二级分类(经营种类)数据,
提升用户操作体验,减少手动点击步骤。
```

zhuli пре 2 недеља
родитељ
комит
45bbc3f5bf
1 измењених фајлова са 15 додато и 0 уклоњено
  1. 15 0
      src/views/home/components/go-flow.vue

+ 15 - 0
src/views/home/components/go-flow.vue

@@ -733,6 +733,21 @@ const getBusinessSectionList = async () => {
     const res: any = await getFirstLevelList({});
     if (res && res.code === 200 && res.data) {
       businessSectionList.value = res.data;
+      // 如果有数据,自动加载第一个经营板块的二级分类(经营种类)
+      if (res.data && res.data.length > 0) {
+        const firstSection = res.data[0];
+        const firstDictId = firstSection.dictId || firstSection.id;
+        if (firstDictId) {
+          try {
+            const secondRes: any = await getSecondLevelList({ parentDictId: String(firstDictId) });
+            if (secondRes && (secondRes.code === 200 || secondRes.code === "200") && secondRes.data) {
+              secondLevelList.value = secondRes.data;
+            }
+          } catch (error) {
+            console.error("获取二级分类失败:", error);
+          }
+        }
+      }
     }
   } catch (error) {
     console.error("获取一级分类失败:", error);