Bladeren bron

重点村、易灾村

Hwf 1 maand geleden
bovenliggende
commit
43a449614e

+ 26 - 0
src/api/globalMap/spatialAnalysis.ts

@@ -607,6 +607,32 @@ export const getPointInfoFloodControlHydropowerStation = (id: string) => {
   });
 };
 
+// 雨窝点重点村
+export const getPointInfoRainPitsNestVillages = (id: string) => {
+  return request({
+    url: '/api/gateway/v2/get_point_info_rain_pits_nest_villages',
+    method: 'post',
+    data: {
+      query: {
+        id: id
+      }
+    }
+  });
+};
+
+// 重点易灾村
+export const getPointInfoDisasterProneVillages = (id: string) => {
+  return request({
+    url: '/api/gateway/v2/get_point_info_disaster_prone_villages',
+    method: 'post',
+    data: {
+      query: {
+        id: id
+      }
+    }
+  });
+};
+
 // 视频详情
 export const getVideoInfo = (video_code: string) => {
   return request({

+ 1 - 0
src/components/Map/YztMap/index.vue

@@ -55,6 +55,7 @@ watch(
 );
 const mapList = reactive({
   satellite2: [
+    { layer: 'map', layerType: 'WMTS', code: 'YZT1708679726700', zIndex: '-100', visible: true },
     { layer: 'map', layerType: 'WFS', code: 'YZT1712111943104', zIndex: '-99', visible: true },
     { layer: 'annotation', layerType: 'WMTS', code: 'YZT1695608158269', zIndex: '-98', visible: true }
   ],

+ 9 - 3
src/components/Map/data.ts

@@ -44,7 +44,9 @@ import {
   getPointInfoLargeCoastalDikes,
   getPointInfoLargeSluices,
   getPointInfoMediumSluices,
-  getPointInfoFloodControlHydropowerStation
+  getPointInfoFloodControlHydropowerStation,
+  getPointInfoRainPitsNestVillages,
+  getPointInfoDisasterProneVillages
 } from '@/api/globalMap/spatialAnalysis';
 import { getRescueTeamsInfo } from '@/api/globalMap/rescueTeam';
 
@@ -99,7 +101,9 @@ export const methodList = {
   '53': getPointInfoLargeCoastalDikes,
   '54': getPointInfoLargeSluices,
   '55': getPointInfoMediumSluices,
-  '56': getPointInfoFloodControlHydropowerStation
+  '56': getPointInfoFloodControlHydropowerStation,
+  '57': getPointInfoRainPitsNestVillages,
+  '58': getPointInfoDisasterProneVillages
 };
 export const titleList = {
   'video': '视频',
@@ -153,5 +157,7 @@ export const titleList = {
   '53': '万亩以上海堤',
   '54': '大型水闸',
   '55': '中型水闸',
-  '56': '防汛任务电站'
+  '56': '防汛任务电站',
+  '57': '雨窝点重点村',
+  '58': '重点易灾村'
 };

+ 32 - 13
src/utils/olMap/olMap.ts

@@ -270,9 +270,7 @@ export class olMap {
         const xmlDoc = parser.parseFromString(res.data, 'text/xml');
         const featureType = xmlDoc.getElementsByTagName('FeatureType')[0];
         const layerParam = {
-          layerName: featureType.getElementsByTagName('Title')[0].textContent,
-          typeName: featureType.getElementsByTagName('Name')[0].textContent,
-          srsName: featureType.getElementsByTagName('SRS')[0].textContent
+          typeName: featureType.getElementsByTagName('Name')[0].textContent
         };
         this.createWfsLayer(options, layerParam);
       }
@@ -308,7 +306,6 @@ export class olMap {
         // 添加自定义 Headers
         const headers = globalHeaders();
         xhr.setRequestHeader('Authorization', headers.Authorization);
-        xhr.setRequestHeader('clientid', headers.clientid);
 
         xhr.responseType = 'arraybuffer'; // 确保支持图片二进制数据
         xhr.onload = function () {
@@ -340,20 +337,42 @@ export class olMap {
   createWfsLayer(options, layerParam) {
     const source = new VectorSource({
       format: new GeoJSON(),
-      url: `${commonUrl}${options.code}?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&typeName=流域:GEO_BAS_POLYGON&outputFormat=application/json& srsName=EPSG:4490`
+      loader: function (extent, resolution, projection) {
+        // 构建带认证头的请求参数
+        const url =
+          `${commonUrl}${options.code}?` +
+          `REQUEST=GetFeature` +
+          `&typeName=${encodeURIComponent(layerParam.typeName)}` +
+          `&outputFormat=application/json`;
+        const headers = globalHeaders();
+        fetch(url, {
+          headers: {
+            'Authorization': headers.Authorization
+          }
+        })
+          .then((response) => {
+            if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
+            return response.json();
+          })
+          .then((json) => {
+            const features = new GeoJSON().readFeatures(json, {
+              dataProjection: layerParam.srsName,
+              featureProjection: projection
+            });
+            this.addFeatures(features);
+          })
+          .catch(error => console.error('WFS加载失败:', error));
+      }
     });
 
     const vectorLayer = new VectorLayer({
       source: source,
       style: new Style({
-        fill: new Fill({
-          color: 'rgba(255, 255, 255, 0.6)'
-        }),
-        stroke: new Stroke({
-          color: '#319FD3',
-          width: 1
-        })
-      })
+        // 必须设置样式才能显示
+        fill: new Fill({ color: 'rgba(0,0,0, 0)' }),
+        stroke: new Stroke({ color: 'rgba(0,0,0, 1)', width: 1 })
+      }),
+      zIndex: options.zIndex ? options.zIndex : -99
     });
 
     this.map.addLayer(vectorLayer);

+ 16 - 0
src/views/globalMap/data/mapData.ts

@@ -1179,5 +1179,21 @@ export const pointDetailTemplate = {
     safety_production_body: '安全生产责任主体',
     longitude: '经度',
     latitude: '纬度'
+  },
+  '57': {
+    village_name: '村名',
+    county: '县(市、区)',
+    town: '所属镇',
+    longitude: '经度',
+    latitude: '纬度'
+  },
+  '58': {
+    village: '村名',
+    city: '市',
+    county: '县(市、区)',
+    town: '镇(街道)',
+    disaster_type: '易发灾害',
+    longitude: '经度',
+    latitude: '纬度'
   }
 };