Browse Source

换数据

username 3 years ago
parent
commit
919998b4cc

+ 4 - 0
README.md

@@ -6,6 +6,10 @@ npm install
 
 npm install --registry=https://registry.npm.taobao.org
 
+
+# 安装proj4 2.7.5",
+cnpm install proj4@2.7.5
+
 # 安装vue-json-excel
 cnpm install vue-json-excel
 

+ 90 - 89
package.json

@@ -1,90 +1,91 @@
 {
-  "name": "admin",
-  "version": "1.0.0",
-  "description": "Element UI & axios & iconfont & permission control & lint",
-  "scripts": {
-    "dev": "vue-cli-service serve --max-old-space-size=2048",
-    "build:prod": "vue-cli-service build",
-    "build:stage": "vue-cli-service build --mode staging",
-    "preview": "node build/index.js --preview",
-    "lint": "eslint --ext .js,.vue src"
-  },
-  "dependencies": {
-    "@supermap/iclient-ol": "^10.1.2",
-    "axios": "0.18.1",
-    "core-js": "^2.6.11",
-    "echarts": "^4.9.0",
-    "element-resize-detector": "^1.2.3",
-    "element-ui": "2.13.0",
-    "file-saver": "^2.0.5",
-    "hls.js": "^1.0.2",
-    "html2canvas": "^1.0.0-rc.7",
-    "jquery": "^3.5.1",
-    "js-cookie": "2.2.0",
-    "jspdf": "^2.3.1",
-    "kscreenshot": "^1.2.3",
-    "mxgraph": "^4.2.2",
-    "normalize.css": "7.0.0",
-    "nprogress": "0.2.0",
-    "ol": "^6.6.0",
-    "ol-plot": "^3.0.0",
-    "path-to-regexp": "2.4.0",
-    "q": "^1.5.1",
-    "qs": "^6.9.0",
-    "sha1-hex": "^1.0.0",
-    "viewerjs": "^1.9.0",
-    "vue": "2.6.10",
-    "vue-baidu-map": "^0.21.22",
-    "vue-json-excel": "^0.3.0",
-    "vue-pdf": "^4.3.0",
-    "vue-router": "3.0.6",
-    "vue-worker": "^1.2.1",
-    "vuedraggable": "^2.24.3",
-    "vuex": "3.1.0",
-    "vuex-persistedstate": "^3.0.1",
-    "xlsx": "^0.17.3"
-  },
-  "devDependencies": {
-    "@babel/core": "7.0.0",
-    "@babel/register": "7.0.0",
-    "@types/file-saver": "^2.0.3",
-    "@vue/cli-plugin-babel": "3.6.0",
-    "@vue/cli-plugin-eslint": "^3.9.1",
-    "@vue/cli-plugin-unit-jest": "3.6.3",
-    "@vue/cli-service": "3.6.0",
-    "@vue/test-utils": "1.0.0-beta.29",
-    "autoprefixer": "^9.5.1",
-    "babel-core": "7.0.0-bridge.0",
-    "babel-eslint": "10.0.1",
-    "babel-jest": "23.6.0",
-    "babel-plugin-transform-remove-strict-mode": "^0.0.2",
-    "chalk": "2.4.2",
-    "compression-webpack-plugin": "^4.0.0",
-    "connect": "3.6.6",
-    "element-resize-detector": "^1.2.1",
-    "element-theme-chalk": "^2.13.2",
-    "eslint": "5.15.3",
-    "eslint-plugin-vue": "5.2.2",
-    "html-webpack-plugin": "3.2.0",
-    "image-webpack-loader": "^6.0.0",
-    "mockjs": "1.0.1-beta3",
-    "node-sass": "^4.9.0",
-    "runjs": "^4.3.2",
-    "sass-loader": "^7.1.0",
-    "script-ext-html-webpack-plugin": "2.1.3",
-    "script-loader": "0.7.2",
-    "serve-static": "^1.13.2",
-    "svg-sprite-loader": "4.1.3",
-    "svgo": "1.2.2",
-    "vue-baidu-map": "^0.21.22",
-    "vue-template-compiler": "2.6.10"
-  },
-  "engines": {
-    "node": ">=8.9",
-    "npm": ">= 3.0.0"
-  },
-  "browserslist": [
-    "> 1%",
-    "last 2 versions"
-  ]
-}
+    "name": "admin",
+    "version": "1.0.0",
+    "description": "Element UI & axios & iconfont & permission control & lint",
+    "scripts": {
+        "dev": "vue-cli-service serve --max-old-space-size=2048",
+        "build:prod": "vue-cli-service build",
+        "build:stage": "vue-cli-service build --mode staging",
+        "preview": "node build/index.js --preview",
+        "lint": "eslint --ext .js,.vue src"
+    },
+    "dependencies": {
+        "@supermap/iclient-ol": "^10.1.2",
+        "axios": "0.18.1",
+        "core-js": "^2.6.11",
+        "echarts": "^4.9.0",
+        "element-resize-detector": "^1.2.3",
+        "element-ui": "2.13.0",
+        "file-saver": "^2.0.5",
+        "hls.js": "^1.0.2",
+        "html2canvas": "^1.0.0-rc.7",
+        "jquery": "^3.5.1",
+        "js-cookie": "2.2.0",
+        "jspdf": "^2.3.1",
+        "kscreenshot": "^1.2.3",
+        "mxgraph": "^4.2.2",
+        "normalize.css": "7.0.0",
+        "nprogress": "0.2.0",
+        "ol": "^6.6.0",
+        "ol-plot": "^3.0.0",
+        "proj4": "^2.7.5",
+        "path-to-regexp": "2.4.0",
+        "q": "^1.5.1",
+        "qs": "^6.9.0",
+        "sha1-hex": "^1.0.0",
+        "viewerjs": "^1.9.0",
+        "vue": "2.6.10",
+        "vue-baidu-map": "^0.21.22",
+        "vue-json-excel": "^0.3.0",
+        "vue-pdf": "^4.3.0",
+        "vue-router": "3.0.6",
+        "vue-worker": "^1.2.1",
+        "vuedraggable": "^2.24.3",
+        "vuex": "3.1.0",
+        "vuex-persistedstate": "^3.0.1",
+        "xlsx": "^0.17.3"
+    },
+    "devDependencies": {
+        "@babel/core": "7.0.0",
+        "@babel/register": "7.0.0",
+        "@types/file-saver": "^2.0.3",
+        "@vue/cli-plugin-babel": "3.6.0",
+        "@vue/cli-plugin-eslint": "^3.9.1",
+        "@vue/cli-plugin-unit-jest": "3.6.3",
+        "@vue/cli-service": "3.6.0",
+        "@vue/test-utils": "1.0.0-beta.29",
+        "autoprefixer": "^9.5.1",
+        "babel-core": "7.0.0-bridge.0",
+        "babel-eslint": "10.0.1",
+        "babel-jest": "23.6.0",
+        "babel-plugin-transform-remove-strict-mode": "^0.0.2",
+        "chalk": "2.4.2",
+        "compression-webpack-plugin": "^4.0.0",
+        "connect": "3.6.6",
+        "element-resize-detector": "^1.2.1",
+        "element-theme-chalk": "^2.13.2",
+        "eslint": "5.15.3",
+        "eslint-plugin-vue": "5.2.2",
+        "html-webpack-plugin": "3.2.0",
+        "image-webpack-loader": "^6.0.0",
+        "mockjs": "1.0.1-beta3",
+        "node-sass": "^4.9.0",
+        "runjs": "^4.3.2",
+        "sass-loader": "^7.1.0",
+        "script-ext-html-webpack-plugin": "2.1.3",
+        "script-loader": "0.7.2",
+        "serve-static": "^1.13.2",
+        "svg-sprite-loader": "4.1.3",
+        "svgo": "1.2.2",
+        "vue-baidu-map": "^0.21.22",
+        "vue-template-compiler": "2.6.10"
+    },
+    "engines": {
+        "node": ">=8.9",
+        "npm": ">= 3.0.0"
+    },
+    "browserslist": [
+        "> 1%",
+        "last 2 versions"
+    ]
+}

+ 26 - 7
src/views/MapView/index.vue

@@ -106,7 +106,6 @@ import { Polygon, Point, LineString, MultiLineString } from 'ol/geom';
 import { Image as ImageLayer, Vector as VectorLayer, Tile as TileLayer } from 'ol/layer';
 import { OSM, XYZ, ImageWMS, Vector as VectorSource } from 'ol/source';
 import { Style, Fill, Stroke, Icon, Text, Circle } from 'ol/style';
-import { get as getProjection, fromLonLat } from 'ol/proj';
 import { createStringXY } from 'ol/coordinate';
 import { unByKey } from 'ol/Observable';
 import { OverviewMap, ScaleLine, defaults, MousePosition, FullScreen, Zoom } from 'ol/control';
@@ -119,9 +118,12 @@ import { format } from 'ol/coordinate';
 import { bbox as bboxStrategy } from 'ol/loadingstrategy';
 import GeoJSON from 'ol/format/GeoJSON';
 import { getVectorContext } from 'ol/render';
-import { transform } from 'ol/proj';
 import * as turf from '@turf/turf'
 import { Logo, TileSuperMapRest, SuperMap, FeatureService } from '@supermap/iclient-ol';
+// 投影
+import { Projection, addProjection, get as getProjection, fromLonLat, transform } from 'ol/proj';
+import { register as olRegisterProj } from 'ol/proj/proj4';
+import proj4 from 'proj4'
 
 // 基础工具
 import MapZoom from '@/views/MapView/mapViewTools/mapZoom';
@@ -172,6 +174,7 @@ export default {
   data() {
     return {
       config: null,
+      projection: null,
       map: null,
       layers: [],
       monitorLayer: null, // 监测专题图层
@@ -247,8 +250,11 @@ export default {
     loadCss(esriConfig.baseCssUrl); // 本地css资源
     const _this = this;
     this.$nextTick(function () {
+      _this.getProj() // 定义坐标系cgcs2000
       _this.initMap();
+      _this.addIserverLayers()
       _this.creatSceneView()
+
     });
     this.config = mapConfig;
     this.getPipeFields()
@@ -263,6 +269,17 @@ export default {
     handelClose() {
       this.show = false;
     },
+    getProj() {
+      proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
+      olRegisterProj(proj4);
+      this.projection = new Projection({
+        code: "EPSG:4490",
+        extent: [-180, -90, 180, 90],
+        worldExtent: [-180, -90, 180, 90],
+        units: "degrees"
+      });
+      addProjection(this.projection);
+    },
     initMap() {
       this.getMap(this.config);
       this.getMapTools(this.config);
@@ -298,8 +315,8 @@ export default {
         let pipelineDataServer = mapConfig.iServerUrl.pipelineDataServer // 管线数据服务
         await this.clickQuery(event.coordinate, pipelineDataServer)
       })
-
-
+    },
+    addIserverLayers() {
       // 加载公房宗地图层
       this.loadiServerLayers(this.config.iServerUrl.publicHouseLayers)
       // 加载基础GIS图层
@@ -323,7 +340,7 @@ export default {
                 crossOrigin: 'anonymous', // 支持跨域
                 url: element.url
               }),
-              type:element.type,
+              type: element.type,
               isGroup: element.isGroup,
               name: element.name
             })
@@ -366,7 +383,8 @@ export default {
       if (options.view) {
         this.view = new View({
           center: options.view.center,
-          projection: getProjection(options.view.projection),
+          // projection: this.projection,
+          projection: "EPSG:4326",
           zoom: options.view.zoom,
           maxZoom: 23,
           constrainResolution: true
@@ -458,7 +476,8 @@ export default {
         target: 'overview',
         layers: this.viewTileLayers,
         view: new View({
-          projection: 'EPSG:4326',
+          // projection: this.projection,
+          projection: "EPSG:4326",
           center: [104.053277, 30.658171],
           zoom: 11,
           maxZoom: 11,

+ 3 - 3
src/views/MapView/map.config.js

@@ -365,9 +365,9 @@ export const mapConfig = {
     view: {
         // center: [105.585807, 30.531344],
         // center: [104.644744, 30.120596],
-        // center: [104.753893, 31.513961],
-        center: [103.5789705, 29.73896083],
-        projection: 'EPSG:4326',
+        center: [104.753586, 31.521350],
+        // center: [103.5789705, 29.73896083],
+        projection: 'EPSG:4490',
         zoom: 14
     },
 }

+ 1 - 1
src/views/kxcSystem/pipelineSystem/statisticalAnalysis/pipeLineStatistical/index.vue

@@ -17,7 +17,7 @@
                   <div class="selectQueryType">
                     <el-radio v-model="selectType" label="1" style="margin:4px 0;width:100%;">全部</el-radio>
                     <!-- <el-radio v-model="selectType" label="2" style="margin:4px 0;width:100%;">地图范围</el-radio> -->
-                    <el-radio v-model="selectType" label="3" style="margin:4px 0;width:100%;">地图联动</el-radio>
+                    <!-- <el-radio v-model="selectType" label="3" style="margin:4px 0;width:100%;">地图联动</el-radio> -->
                     <!-- <el-radio v-model="selectType" label="4" style="margin:4px 0;width:100%;">选择范围</el-radio> -->
                     <el-radio v-model="selectType" label="5" style="margin:4px 0;width:100%;">绘制范围</el-radio>
                   </div>