Quellcode durchsuchen

完善分组列表联动查询逻辑

lm vor 1 Monat
Ursprung
Commit
4ece9e0708
1 geänderte Dateien mit 64 neuen und 56 gelöschten Zeilen
  1. 64 56
      src/views/userPrivilegeManagement/groupList/index.vue

+ 64 - 56
src/views/userPrivilegeManagement/groupList/index.vue

@@ -34,7 +34,7 @@
         :visible="dialogVisible"
         @confirm="HandleDialogConfirm"
         @close="HandleDialogClose">
-        请确认是否确认删除{{ currentDeleteRow.groupName }}  {{currentDeleteRow.userName}}  {{currentDeleteRow.cityName}}{{currentDeleteRow.provinceName}}的权限?
+        请确认是否确认删除{{ currentDeleteRow.groupName }}  {{currentDeleteRow.userName}}  {{currentDeleteRow.provinceName}}{{currentDeleteRow.cityName}}的权限?
     </Dialog>
 
 </template>
@@ -53,7 +53,6 @@ import {tableColumns} from './table'
 import { getCityGroupPeopleListApi,deleteCityGroupPeopleApi,
     getGroupDataApi,getGroupListApi,
  } from '@/api/groupManage';
-import jsPDF from 'jspdf';
 
 
  /**
@@ -119,7 +118,23 @@ const provinceList = computed(()=>{
 // 城市列表
 const cityList = computed(()=>{
     if(searchParams.value.province === 'all'){
-        return [ { label:'全部地区', value:'all'} ]
+        let  provinceCityList =  allProvinceUserConfig.value.map(item=>{
+            let cities = item?.cityData?.map(city=>{
+                return {
+                    label:city.cityName,
+                    value:city.cityId,
+                    userList:city.userData
+                }
+            }) || []
+            return cities
+        }).flat()
+        return [
+            {
+                label:'全部地区',
+                value:'all'
+            },
+            ...provinceCityList
+        ]
     }else{
         let  provinceCityList =  (allProvinceUserConfig.value.find(item=>item.provinceId === searchParams.value.province)?.cityData || []).map(city=>{
             return {
@@ -137,63 +152,54 @@ const cityList = computed(()=>{
         ]
     }
 })
-// 与 城市 有关 用户列表  __省份选全部的时候的用户展示还需要——添加——待完成
+// 与 城市  和分组 有关 的用户列表
 const userList = computed(()=>{
-    // 与城市和省份都有关
     if(searchParams.value.city === 'all'){  //所有城市
-        // 判断省份
-        if(searchParams.value.province === 'all'){ //所有省份
-            return [{ label:'全部组员', value:'all' }]
-        }else{   //指定省份
-            // 获取当前省份 所有城市
-            // 指定组下的人员
-            if(searchParams.value.group == 'all'){
-                let userOption = [
-                    {
-                        label:'全部组员',
-                        value:'all'
-                    },  
-                    ...(cityList.value.slice(1).map(city=>{
-                        return Object.values(city.userList)
-                    }).flat(Infinity).map(item=>{
-                        return {
-                            label:item.userName,
-                            value:item.userId
-                        }
-                    }))
-                ].map(item=>{
-                    return JSON.stringify(item)
-                })
-                return [...(new Set(userOption))].map(item=>{
-                    return JSON.parse(item)
-                })
+        // 所有组下的人员
+        if(searchParams.value.group == 'all'){
+            let userOption = [
+                {
+                    label:'全部组员',
+                    value:'all'
+                },  
+                ...(cityList.value.slice(1).map(city=>{
+                    return Object.values(city.userList)
+                }).flat(Infinity).map(item=>{
+                    return {
+                        label:item.userName,
+                        value:item.userId
+                    }
+                }))
+            ].map(item=>{
+                return JSON.stringify(item)
+            })
+            return [...(new Set(userOption))].map(item=>{
+                return JSON.parse(item)
+            })
 
-            }else{
-                // 获取当前省份 所有城市
-                // 所有人员,
-                let userOption = [
-                    {
-                        label:'全部组员',
-                        value:'all'
-                    },
-                    ...(cityList.value.slice(1).map(city=>{
-                        return city.userList[searchParams.value.group]
-                    }).flat(Infinity).map(item=>{
-                        return {
-                            label:item.userName,
-                            value:item.userId
-                        }
-                    }))
-                ].map(item=>{
-                    return JSON.stringify(item)
-                })
-                return [...(new Set(userOption))].map(item=>{
-                    return JSON.parse(item)
-                })
-            }
+        }else{
+            // 指定组下的人员,
+            let userOption = [
+                {
+                    label:'全部组员',
+                    value:'all'
+                },
+                ...(cityList.value.slice(1).map(city=>{
+                    return city.userList[searchParams.value.group]
+                }).flat(Infinity).map(item=>{
+                    return {
+                        label:item.userName,
+                        value:item.userId
+                    }
+                }))
+            ].map(item=>{
+                return JSON.stringify(item)
+            })
+            return [...(new Set(userOption))].map(item=>{
+                return JSON.parse(item)
+            })
         }
-    }else{
-        // 既和城市有关,也和分组有关
+    }else{  //指定城市
         if(searchParams.value.group == 'all'){
             let cityPeopleDispatch = cityList.value.find(item=>item.value === searchParams.value.city)?.userList
             let cityPeople = Object.values(cityPeopleDispatch).flat(Infinity)?.map(item=>{
@@ -276,7 +282,9 @@ const HandleSearchChange = async (params,key)=>{
             searchParams.value.member = 'all'
             break
         case 'city':
+        case 'group':
             searchParams.value.member = 'all'
+            break
     }
     await GetCityGroupPeopleList()
 }