派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-03-09 55799a2edbfc4bc6fce4f4c2350e5b9bb7214ed7
修复ie下不能显示的问题
8个文件已修改
118 ■■■■■ 已修改文件
.eslintrc.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/mapUrl.js 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/ServiceLayerHelper.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/routes.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/AjaxUtils.js 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.eslintrc.js
@@ -1,7 +1,8 @@
module.exports = {
  root: true,
  env: {
    node: true
    node: true,
    amd: true
  },
  extends: [
    'plugin:vue/essential',
package.json
@@ -20,7 +20,7 @@
    "element-ui": "^2.14.1",
    "jquery": "^3.5.1",
    "js-cookie": "^2.2.0",
    "leaflet": "^1.6.0",
    "leaflet": "^1.7.1",
    "leaflet-canvas-markers": "^1.0.6",
    "leaflet.markercluster": "^1.4.1",
    "lodash": "^4.17.10",
@@ -40,17 +40,18 @@
    "@vue/eslint-config-standard": "^5.1.2",
    "babel-eslint": "^10.1.0",
    "babel-loader": "^8.2.2",
    "babel-polyfill": "^6.26.0",
    "cache-loader": "^4.1.0",
    "css-loader": "^5.0.1",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "eslint-plugin-import": "^2.20.2",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-standard": "^4.0.0",
    "mockjs": "^1.1.0",
    "eslint-plugin-vue": "^6.2.2",
    "less": "^3.13.0",
    "less-loader": "^7.1.0",
    "mockjs": "^1.1.0",
    "vue-loader": "^15.9.5",
    "vue-template-compiler": "^2.6.11"
  },
src/api/index.js
@@ -2,6 +2,6 @@
import * as mapUrl from './mapUrl'
export default {
    mapApi,
    mapUrl
  mapApi,
  mapUrl
}
src/api/mapUrl.js
@@ -1,10 +1,10 @@
/**
 * 该文件配置接口的URL地址
 */
class ApiURLs{
    constructor(){
        this.APIURL_HELLOWORLD = 'http://www.baidu.com'
    }
 * 该文件配置接口的URL地址
 */
class ApiURLs {
  constructor () {
    this.APIURL_HELLOWORLD = 'http://www.baidu.com'
  }
}
export default new ApiURLs()
src/components/helpers/ServiceLayerHelper.js
@@ -116,18 +116,21 @@
     * @param url
     * @param item
     */
  loadGeojsonLayer (url, item) {
  async loadGeojsonLayer (url, item) {
    var matches = this.regex.exec(url)
    var matchValue = item[matches[1]]
    var code = item.code
    var newUrl = url.replace(this.regex, matchValue)
    var that = this
    if (!that.layerArray[code]) {
      AjaxUtils.GetDataAsynByUrl(newUrl, {}, function (res) {
        store.commit('addSewersDatas', res)
        var layer = that.loadGeojson(res, item)
        that.layerArray[code] = layer
      })
      const res = await AjaxUtils.GetDataAsynByUrl(newUrl, {})
      if (res.data instanceof Object && Object.prototype.hasOwnProperty.call(res.data, 'features')) {
        store.commit('addSewersDatas', res.data)
        if (newUrl.indexOf('管网') !== -1 || newUrl.indexOf('四通') !== -1) {
          var layer = that.loadGeojson(res.data, item)
          that.layerArray[code] = layer
        }
      }
    } else {
      that.layerArray[code].addTo(that.map)
    }
@@ -140,6 +143,7 @@
  loadGeojson (res, opt) {
    var that = this
    var icon = opt.icon
    const layergroup = that.L.featureGroup().addTo(that.map)
    const geojson = that.L.geoJSON(res.features, {
      style: function (feature) {
        return {
@@ -215,7 +219,8 @@
            }
          })
        }
      }).addTo(that.map)
      // }).addTo(that.map)
      }).addTo(layergroup)
    store.commit('addSewersDatas', geojson)
    if (Object.prototype.hasOwnProperty.call(res, 'features') && res.features.length > 0 && (res.features[0].geometry.type === 'LineString' || res.features[0].geometry.type === 'MultiLineString')) {
      geojson.bringToBack()
src/main.js
@@ -1,4 +1,4 @@
// import 'babel-polyfill'
import 'babel-polyfill'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
@@ -11,8 +11,9 @@
import 'leaflet/dist/leaflet.css'
import L from 'leaflet'
import 'leaflet.markercluster'
import 'leaflet-canvas-markers'
// import 'leaflet-canvas-markers'
import './components/plugin/Leaflet.GridLayer.FadeOut'
import './components/plugin/leaflet-canvas-markers'
Vue.config.productionTip = false
Vue.use(ElementUI)
src/router/routes.js
@@ -26,6 +26,13 @@
    meta: {
      title: '基础数据维护'
    }
  }, {
    path: '/mapTemplate',
    name: 'mapTemplate',
    component: MapTemplate,
    meta: {
      title: '基础地图'
    }
  }]
}]
export const routes = [...mainRoutes, ...mapRoutes]
src/utils/AjaxUtils.js
@@ -1,5 +1,5 @@
import $ from 'jquery'
import axios from 'axios'
/**
 * 对jquery的封装ajax的传数据方法
 * @param pUrl    请求的url
@@ -28,36 +28,47 @@
 * @param pData   参数
 * @param pBackFun 成功回调
 */
function get4JsonDataByUrl (pUrl, pData, pBackFun) {
  $.ajax({
    type: 'get',
function get4JsonDataByUrl (oUrl, pData, pBackFun) {
  const pUrl = encodeURI(oUrl)
  axios({
    method: 'get',
    url: pUrl,
    dataType: 'json',
    data: pData,
    async: true,
    success: function (datas, nnn) {
      pBackFun(datas)
    },
    error: function (err, nnnn) {
      console.error('数据获取失败', err, pUrl)
    }
    data: pData
  }).then(function (response) {
    pBackFun(response)
  })
    .catch(function (error) {
      console.error('数据获取失败', error)
    })
}
function GetDataAsynByUrl (pUrl, pData, pBackFun) {
  $.ajax({
    type: 'GET',
const GetDataAsynByUrl = async (oUrl, pData) => {
  const pUrl = encodeURI(oUrl)
  const res = await axios({
    method: 'get',
    url: pUrl,
    data: pData,
    timeout: 600000,
    async: true,
    success: function (datas, nnn) {
      pBackFun(datas)
    },
    error: function (e, nnnn) {
      console.error('数据获取失败', pUrl)
    }
    data: pData
  }).then((response) => {
    return (response)
  })
    .catch((error) => {
      console.error('数据获取失败', error)
    })
  return res
  // $.ajax({
  //   type: 'GET',
  //   url: pUrl,
  //   data: pData,
  //   timeout: 600000,
  //   async: true,
  //   success: function (datas, nnn) {
  //     pBackFun(datas)
  //   },
  //   error: function (e, nnnn) {
  //     console.error('数据获取失败', pUrl)
  //   }
  // })
}
function postDataAsynByUrl (pUrl, pData, pBackFun) {
  $.ajax({