gemercheung 5 ماه پیش
والد
کامیت
cef6152a0d
2فایلهای تغییر یافته به همراه5 افزوده شده و 4 حذف شده
  1. 1 1
      src/request/organization.ts
  2. 4 3
      src/view/organization-edit.vue

+ 1 - 1
src/request/organization.ts

@@ -98,7 +98,7 @@ export const getCities = (provinceCode: string) => {
 }
 
 export const getAreas = (provinceCode: string, cityCode: string, zx?: boolean) => {
-    const url = zx ? URL.getAreas + `?provinceCode=${provinceCode}&cityCode=${cityCode}` : URL.getAreas + `?provinceCode=${provinceCode}&cityCode=${cityCode}`
+    const url = zx ? URL.getAreas + `?provinceCode=${provinceCode}&cityCode=${cityCode}&zx=true` : URL.getAreas + `?provinceCode=${provinceCode}&cityCode=${cityCode}`
     return sendFetch<ResResult>(url, {
         method: "get",
     });

+ 4 - 3
src/view/organization-edit.vue

@@ -124,9 +124,10 @@ const loadData = async (level, node) => {
       return resP;
     case 1:
       let cities
-      console.log('当前城市', node.zx)
+
       if (node.zx) {
-        const areas = await getAreas(node.province, node.city);
+        console.log('当前城市zx', node)
+        const areas = await getAreas(node.province, node.city, true);
         console.log('areas', areas)
         cities = Array.from(areas as any as CascaderOption[]).map(a => {
           a.leaf = true
@@ -140,7 +141,7 @@ const loadData = async (level, node) => {
       return cities
     // break;
     case 2: // 加载区县
-      const areas = await getAreas(node.province, node.city)
+      const areas = await getAreas(node.province, node.city, node.zx)
       console.log('areas', areas)
       return Array.from(areas as any as CascaderOption[]).map(a => {
         a.leaf = true