username 3 лет назад
Родитель
Сommit
172c0594dd

+ 52 - 152
src/views/MapView/index.vue

@@ -317,6 +317,8 @@ export default {
       })
     },
     addIserverLayers() {
+      // 加载底图
+      this.loadiServerLayers(this.config.iServerUrl.baseMapLayers)
       // 加载公房宗地图层
       this.loadiServerLayers(this.config.iServerUrl.publicHouseLayers)
       // 加载基础GIS图层
@@ -329,125 +331,67 @@ export default {
      **/
     getMap(options) {
       if (!options) return;
-      // 获取图层
-      if (options.layers) {
-        options.layers.forEach(element => {
-          this.layers.push(
-            new TileLayer({
-              visible: element.visible,
-              title: element.name,
-              source: new XYZ({
-                crossOrigin: 'anonymous', // 支持跨域
-                url: element.url
-              }),
-              type: element.type,
-              isGroup: element.isGroup,
-              name: element.name
-            })
-          );
-        });
+      // 获取鹰眼图层
+      let viewTileLayer = options.iServerUrl.baseMapLayers.filter(item => {
+        return item.name == '电子地图'
+      });
+      if (viewTileLayer.length > 0) {
         this.viewTileLayers = [
           new TileLayer({
-            source: new OSM({
-              url: options.layers[0].url
-            })
-          }),
-          new TileLayer({
-            source: new OSM({
-              url: options.layers[3].url
+            source: new TileSuperMapRest({
+              url: viewTileLayer[0].url,
+              crossOrigin: 'anonymous'
             })
           })
-        ];
+        ]
       }
 
-      // if (options.image && options.image.layers) {
-      //   const version = options.image.params.VERSION;
-      //   options.image.layers.forEach(item => {
-      //     this.layers.push(
-      //       new ImageLayer({
-      //         source: new ImageWMS({
-      //           url: options.image.url,
-      //           params: {
-      //             LAYERS: item.layerName,
-      //             VERSION: version
-      //           },
-      //           crossOrigin: 'anonymous'
-      //         }),
-      //         name: item.name,
-      //         visible: item.visible
-      //       })
-      //     );
-      //   });
-      // }
-
-      if (options.view) {
-        this.view = new View({
-          center: options.view.center,
-          // projection: this.projection,
-          projection: "EPSG:4326",
-          zoom: options.view.zoom,
-          maxZoom: 23,
-          constrainResolution: true
-        });
-        this.params.mapView = this.view;
-      }
+      this.view = new View({
+        center: [104.753586, 31.521350],
+        // projection: this.projection,
+        projection: "EPSG:4326",
+        zoom: 15,
+        maxZoom: 23,
+        minZoom: 13,
+        constrainResolution: true
+      });
+      this.params.mapView = this.view;
     },
     /**
      * 获取地图工具
      **/
     getMapTools(options) {
       const arrControls = [];
-      if (!options.maptools) return;
-
-      if (
-        options.maptools.ScaleLine &&
-        options.maptools.ScaleLine.isExistence
-      ) {
-        // 添加比例尺
-        arrControls.push(
-          new ScaleLine({
-            units: 'metric',
-            target: this.$refs['tofly-map-ScaleLine']
-          })
-        );
-      }
-
-      if (
-        options.maptools.MousePosition &&
-        options.maptools.MousePosition.isExistence
-      ) {
-        // 添加鼠标位置
-        arrControls.push(
-          new MousePosition({
-            coordinateFormat: coordinate => {
-              return format(coordinate, '经度:{x}  纬度:{y}', 6);
-            }, // 保留6位小数位
-            target: this.$refs['tofly-map-MousePosition']
-          })
-        );
-      }
 
-      if (
-        options.maptools.OverviewMap &&
-        options.maptools.OverviewMap.isExistence
-      ) {
-        if (this.viewTileLayers.length > 0) {
-          // 添加一个鹰眼控件
-          arrControls.push(
-            new OverviewMap({
-              // className: "ol-overviewmap ol-custom-overviewmap tofly-overviewmap", //鹰眼控件样式
-              target: this.$refs['tofly-map-OverviewMap'],
-              // 在鹰眼中加载相同坐标系下不同数据源的图层
-              layers: this.viewTileLayers,
-              collapseLabel: '', // 鹰眼控件展开时功能按钮上的标识
-              label: '', // 鹰眼控件折叠时功能按钮上的标识
-              collapsed: options.maptools.OverviewMap.collapsed, // 初始为展开方式
-              tipLabel: '鹰眼'
-              // className:"ol-overviewmap iconfont iconyy"
-            })
-          );
-        }
-      }
+      // 添加比例尺
+      arrControls.push(
+        new ScaleLine({
+          units: 'metric',
+          target: this.$refs['tofly-map-ScaleLine']
+        })
+      );
+
+      // 添加鼠标位置
+      arrControls.push(
+        new MousePosition({
+          coordinateFormat: coordinate => {
+            return format(coordinate, '经度:{x}  纬度:{y}', 6);
+          }, // 保留6位小数位
+          target: this.$refs['tofly-map-MousePosition']
+        })
+      );
+
+      // 添加一个鹰眼控件
+      arrControls.push(
+        new OverviewMap({
+          target: this.$refs['tofly-map-OverviewMap'],
+          layers: this.viewTileLayers,
+          collapseLabel: '',
+          label: '',
+          collapsed: false,
+          tipLabel: '鹰眼'
+        })
+      );
 
       if (arrControls && arrControls.length > 0) {
         this.controls = defaults({
@@ -462,56 +406,12 @@ export default {
      */
     ResetMap() {
       // 重置中心点位置为初始化位置
-      this.view.setZoom(this.config.view.zoom);
+      this.view.setZoom(15);
       this.view.animate({
-        center: this.config.view.center,
+        center: [104.753586, 31.521350],
         duration: 600
       });
     },
-    /**
-     * 鹰眼
-     */
-    initOverviewMap() {
-      var overview = new Map({
-        target: 'overview',
-        layers: this.viewTileLayers,
-        view: new View({
-          // projection: this.projection,
-          projection: "EPSG:4326",
-          center: [104.053277, 30.658171],
-          zoom: 11,
-          maxZoom: 11,
-          minZoom: 11
-        })
-      });
-
-      var extent = this.map.getView().calculateExtent(this.map.getSize());
-      var coor = [
-        [
-          [extent[0], extent[1]],
-          [extent[2], extent[1]],
-          [extent[2], extent[3]],
-          [extent[0], extent[3]],
-          [extent[0], extent[1]]
-        ]
-      ];
-      var polygonFeature = new Feature(new Polygon(coor));
-      var vectorSource = new Vector({
-        features: [polygonFeature]
-      });
-
-      var vectorLayer = new Vector({
-        source: vectorSource,
-        style: new Style({
-          fill: new Fill({ color: 'rgba(160,160,160,0.2)' }),
-          stroke: new Stroke({
-            color: 'white',
-            width: 2
-          })
-        })
-      });
-      overview.addLayer(vectorLayer);
-    },
     /**
      * 加载iserver服务图层
      */

+ 20 - 2
src/views/MapView/map.config.js

@@ -33,6 +33,19 @@ export const mapConfig = {
     ],
     // iSever发布的服务地址
     iServerUrl: {
+        baseMapLayers: [{
+                name: '电子地图',
+                url: 'http://117.174.10.73:8090/iserver/services/map-base/rest/maps/kxc_vec',
+                type: '0',
+                visible: true // 是否显示
+            },
+            {
+                name: '卫星影像',
+                url: 'http://117.174.10.73:8090/iserver/services/map-base/rest/maps/kxc_img',
+                type: '0',
+                visible: false // 是否显示
+            }
+        ],
         // 基础地理信息子系统图层
         basicGISLayers: [{
                 name: '省道',
@@ -368,7 +381,7 @@ export const mapConfig = {
         center: [104.753586, 31.521350],
         // center: [103.5789705, 29.73896083],
         projection: 'EPSG:4490',
-        zoom: 14
+        zoom: 15
     },
 }
 
@@ -381,6 +394,8 @@ export const tiandituWebSevice = {
 export function buildMapConfig(sourcList) {
     console.log('服务服务了', sourcList)
     let iServerUrl = {
+        // 底图
+        baseMapLayers: [],
         // 基础地理信息子系统图层
         basicGISLayers: [],
         // 综合管线子系统图层
@@ -411,12 +426,15 @@ export function buildMapConfig(sourcList) {
             let layer = {
                 name: item.name,
                 url: iServerBaseUrl + item.cval,
-                legendUrl: iServerBaseUrl + item.legendVal,
+                legendUrl: item.legendVal ? iServerBaseUrl + item.legendVal : '',
                 type: item.systemName,
                 isGroup: true,
                 visible: true
             }
             switch (item.systemName) {
+                case '0': // 底图图层
+                    iServerUrl['baseMapLayers'].push(layer)
+                    break;
                 case '1': // 基础GIS的显示图层
                     iServerUrl['basicGISLayers'].push(layer)
                     break;

+ 1 - 21
src/views/MapView/mapViewTools/layerControl.vue

@@ -6,11 +6,6 @@
         <i class="el-icon-arrow-down el-icon--right" />
       </span>
       <el-dropdown-menu slot="dropdown">
-        <!-- <div v-for="(item,index) in layers" :key="index" class="check">
-          <el-checkbox :checked="item.visible" @change="checked => _onChecked(checked,item)">
-            <div v-html="item.name" />
-          </el-checkbox>
-        </div>-->
         <el-tree ref="tree" :data="treedata" show-checkbox node-key="id" default-expand-all :default-checked-keys="treeCheckedKey" style="min-width: 170px;"
                  :props="defaultProps" @node-click="handleNodeClick" @check="checkGroupNode" />
       </el-dropdown-menu>
@@ -55,7 +50,6 @@ export default {
         children: 'children',
         label: 'label'
       },
-      // treeCheckedKey: ['ESTUARY_BASE_INFO', 'DRAINAGE_USER_BASE_INFO', 'STP_BASE_INFO', 'PUMP_STATION_BASE_INFO', 'BILLBOARD_BASE_INFO', 'MONITOR_SITE_BASE_INFO']
       treeCheckedKey: []
     };
   },
@@ -76,7 +70,6 @@ export default {
           const pLayers = this.map.getLayers().getArray();
           console.log('图层', pLayers);
           pLayers.forEach(item => {
-            // console.log('地图:', item.get('type'), ' 用户:', ' 隐藏:' + item.ol_uid)
             if (item.get('type') == '0') {
               this.treedata[0].children.push({
                 id: item.ol_uid,
@@ -125,7 +118,6 @@ export default {
     },
 
     checkGroupNode: function (a, b) {
-      console.log('测试:' + a);
       var isNum = b.checkedKeys.indexOf(a.id);
       var _checked = isNum >= 0;
       var _maptoolLable = a.label;
@@ -150,24 +142,12 @@ export default {
           const layerName = layer.values_.name;
           const layerType = layer.values_.typeCode;
 
-          console.log('layderName:' + layerName + ' ' + layerType);
           if (layerName === _maptoolLable || layerType === _maptoolid) {
             layer.setVisible(_checked);
           }
         }
       }
-    },
-    _onChecked(checked, param) {
-      const name = param.name;
-      const layers = this.map.getLayers();
-      for (var i = 0; i < layers.getLength(); i++) {
-        const layer = layers.array_[i];
-        const layerName = layer.values_.name;
-        if (layerName === name) {
-          layer.setVisible(checked);
-        }
-      }
-    },
+    }
   }
 };
 </script>

+ 5 - 1
src/views/kxcSystem/pipelineSystem/facilitiesQuery/widget.vue

@@ -179,6 +179,7 @@ export default {
     this.initData()
   },
   destroyed() {
+    if (this.draw) this.data.that.map.removeInteraction(this.draw)
     this.data.that.map.removeLayer(this.vectorLayer)
     this.$store.dispatch('map/delHalfPanels', 'facilitiesQueryResult');
   },
@@ -206,7 +207,10 @@ export default {
     // 监听面板是否被改变
     '$store.state.map.P_editableTabsValue': function (val, oldVal) {
       if (val == 'facilitiesQuery') this.vectorLayer.setVisible(true)
-      else this.vectorLayer.setVisible(false)
+      else {
+        if (this.draw) this.data.that.map.removeInteraction(this.draw)
+        this.vectorLayer.setVisible(false)
+        }
     }
   },
   methods: {

+ 3 - 4
src/views/kxcSystem/pipelineSystem/specialtyAnalysis/burstAnalysis/widget.vue

@@ -303,10 +303,8 @@ export default {
      * 服务错误提示
      */
     processFailed(res) {
-      console.log(res)
-      this.$message.error('发生错误,', res);
+      this.$message.error(`分析失败,${res.error.errorMsg}`);
       this.doLoading = false // 关闭执行状态
-      // alert('fail')
     },
     /**
      * 爆管分析
@@ -321,7 +319,8 @@ export default {
 
       var burstPipelineAnalystService = new SuperMap.BurstPipelineAnalystService(this.selectPipeConfig.netWorkServiceurl, {
         eventListeners: {
-          "processCompleted": this.BurstPipelineAnalyst_processCompleted
+          "processCompleted": this.BurstPipelineAnalyst_processCompleted,
+          "processFailed": this.processFailed
         }
       });
       burstPipelineAnalystService.processAsync(parameter);

+ 4 - 3
src/views/kxcSystem/pipelineSystem/specialtyAnalysis/connectivityAnalysis/widget.vue

@@ -216,7 +216,7 @@ export default {
      * 分析连通性,获取与之连通的管道
      */
     getConnectivityPipe() {
-      if (!this.selectPipeConfig) {
+      if (!this.selectPipeConfig || !this.selectEdge) {
         this.$message.error(`未选择分析管线!`);
         return
       }
@@ -325,8 +325,9 @@ export default {
     /**
      * 失败报错
      */
-    processFailed() {
-      alert('error')
+    processFailed(res) {
+      this.$message.error(`分析失败,${res.error.errorMsg}`);
+      this.doLoading = false // 关闭执行状态
     },
     /**
      * 获取字段,Excel导出时使用

+ 1 - 0
src/views/kxcSystem/pipelineSystem/specialtyAnalysis/parallelSectionAnalysis/widget.vue

@@ -110,6 +110,7 @@ export default {
         this.vectorLayer.setVisible(true)
       }
       else {
+        this.selectFlag = false
         this.vectorLayer.setVisible(false)
         this.doLoading = false
       }