Browse Source

fix: 企业地图与站点地图县区与驿站搜索条件关联

zhangying 9 months ago
parent
commit
f708db33f8
2 changed files with 18 additions and 9 deletions
  1. 12 2
      vue/src/views/dataMap/companyDataMap.vue
  2. 6 7
      vue/src/views/dataMap/siteDataMap.vue

+ 12 - 2
vue/src/views/dataMap/companyDataMap.vue

@@ -56,7 +56,7 @@
               :options="regionList"
               :field-names="{ label: 'name', value: 'code' }"
               placeholder="所属县区" size="small" style="width: 152px"
-              @change="onSearch"
+              @change="regionCodeChange"
             >
             </a-select>
             <a-select
@@ -796,10 +796,20 @@ function delMapInfo() {
   (map as any).closeInfoWindow();
 }
 
+function regionCodeChange() {
+  if (companySearchParam.regionCode) {
+    getSiteList({pageIndex: 1, pageSize: 9999, regionCode: companySearchParam.regionCode}).then((result: any) => {
+      siteList.value = result.list;
+    })
+  } else {
+    siteList.value = [];
+  }
+  onSearch();
+}
+
 onMounted(() => {
   initMap();
   getCompanyModelList();
-  getAllSites();
   getRegionList();
   (window as any).checkCompanyChangeFun = checkCompanyChange;
 })

+ 6 - 7
vue/src/views/dataMap/siteDataMap.vue

@@ -312,15 +312,15 @@ const getRegionList = async function () {
 const changeRegion = async function () {
   if (siteSearchParam.regionCode) {
     streetList.value = await getStreetCodeList(siteSearchParam.regionCode);
+    getSiteList({pageIndex: 1, pageSize: 9999, regionCode: siteSearchParam.regionCode}).then((result: any) => {
+      siteDicList.value = result.list;
+    })
+  } else {
+    siteDicList.value = [];
+    streetList.value = [];
   }
   onSearch();
 }
-// 查询驿站
-const getAllSites = () => {
-  getSiteList({pageIndex: 1, pageSize: 9999}).then((result: any) => {
-    siteDicList.value = result.list;
-  })
-}
 
 function setSiteMarker(setCenter: boolean) {
   delMapInfo();
@@ -501,7 +501,6 @@ onMounted(() => {
   initMap();
   getRegionList();
   onSearch();
-  getAllSites();
 })
 </script>