派生自 wuyushui/SewerAndRainNetwork

wangqi
2021-04-07 5f5d84a5528d773bc576af65c5951b43976c2075
Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop
1个文件已添加
6个文件已修改
233 ■■■■ 已修改文件
src/components/LayerController/modules/LcServiceLayerFilter.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/BasemapHelper.js 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/map.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/AjaxUtils.js 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/axios.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/Temp.vue 183 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/modules/LcServiceLayerFilter.vue
@@ -103,7 +103,7 @@
        font-size: 13px;
        position: absolute;
        left: 270px;
        left: 2.5rem;
        z-index: 1000;
        height: 220px;
        top: 0;
src/components/helpers/BasemapHelper.js
@@ -1,7 +1,6 @@
/* eslint-disable no-debugger */
import AjaxUtils from '@/utils/AjaxUtils'
import * as utils from '../../utils/utils'
/**
 * 底图管理助手,负责底图创建及开关
 */
@@ -20,7 +19,7 @@
     * @param map
     * @param defBasemapName 初始化完成后,默认显示的图层
     */
    initBasemap = (config, isIntranet) => {
    initBasemap =async (config, isIntranet) => {
      if (isIntranet) { // 内网
        this._getToken(config) // 获取token后,并按配置加载地图
      } else { // 外网
@@ -104,11 +103,10 @@
    // 内网地图创建部分
    // 获取内网地图token,并加载到地图中
    _getToken = (config) => {
    _getToken = async (config) => {
      const params = config.TokenConfig
      AjaxUtils.GetDataAsynByUrl(params.url, params.option, (token) => {
      const token = await AjaxUtils.GetDataAsynByUrl(params.url, params.option)
        this._showTDT(token, config)
      })
    }
    // 内网地图加载,并加载到地图
@@ -116,8 +114,8 @@
      const intranetBasemaps = config.mapConfig.IntranetBaseMaps
      for (let i = 0, len = intranetBasemaps.length; i < len; ++i) {
        const basemapConfig = intranetBasemaps[i]
        const basemapLayer = this.L.tileLayer(basemapConfig.map.url, basemapConfig.map.option)
        const basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url, basemapConfig.annotation.option)
        const basemapLayer = this.L.tileLayer(basemapConfig.map.url + '&token=' + token, basemapConfig.map.option)
        const basemapAnnotationLayer = this.L.tileLayer(basemapConfig.annotation.url + '&token=' + token, basemapConfig.annotation.option)
        const basemap = {
          code: basemapConfig.code,
src/router/index.js
@@ -29,9 +29,11 @@
    next() // 跳转
  } else if (token && to.name === LOGIN_PAGE_ROUTE_NAME) {
    // 已登录且要跳转的页面是登录页
    next({
      name: homeRouterName // 跳转到homeName页
    })
    // next({
    //   name: homeRouterName // 跳转到homeName页
    // })
    console.log(homeRouterName)
    next()
  } else if (!token) {
    next({
      name: LOGIN_PAGE_ROUTE_NAME // 跳转到登录页
src/router/map.js
@@ -9,10 +9,12 @@
 * }
 */
const MapTemplate = (r) => require.ensure([], () => r(require('../views/MapTemplate')), 'frame')
const Temp = (r) => require.ensure([], () => r(require('../views/Temp')), 'frame')
const Login = (r) => require.ensure([], () => r(require('../views/Login')), 'frame')
const routes = [
  { path: '/mapTemplate', name: 'MapTemplate', meta: { statusBgc: 0 }, component: MapTemplate },
  { path: '/Login', name: 'Login', meta: { statusBgc: 0 }, component: Login }
  { path: '/Login', name: 'Login', meta: { statusBgc: 0 }, component: Login },
  { path: '/temp', name: 'Login', meta: { statusBgc: 0 }, component: Temp }
]
// 所有上面定义的路由都要写在下面的routes里
src/utils/AjaxUtils.js
@@ -44,31 +44,15 @@
const GetDataAsynByUrl = async (oUrl, pData) => {
  const pUrl = encodeURI(oUrl)
  const res = await axios({
    method: 'get',
    url: pUrl,
    data: pData
  const res = await axios.get(pUrl, {
    params: 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)
  //   }
  // })
  return res.data
}
function postDataAsynByUrl (pUrl, pData, pBackFun) {
  $.ajax({
src/utils/axios.js
@@ -83,7 +83,7 @@
// 创建axios实例
const Service = axios.create({
  timeout: 5000
  timeout: 1000 * 30
})
const CancelToken = axios.CancelToken
src/views/Temp.vue
New file
@@ -0,0 +1,183 @@
<template>
  <div class="full-screen">
    <popup ref="popup" @callPopup="callPopup"></popup>
    <div id="map" ref="rootmap">
    </div>
    <sgis-layer-controller></sgis-layer-controller>
    <monitor-panel></monitor-panel>
    <!--        <top-enterprise-panel></top-enterprise-panel>-->
    <tool-box-panel ref="toolBox"></tool-box-panel>
    <!--    <menu-special></menu-special>-->
    <legend-panel></legend-panel>
    <summary-sheets></summary-sheets>
    <enterprise></enterprise>
    <!--    <el-button id="map-btn" el-icon-c-scale-to-original icon="el-icon-c-scale-to-original" circle @click="isShowHidden"></el-button>-->
    <!--    <el-button type="primary" @click="ChangeState" class="solid-waste">固废</el-button>-->
    <!--    <el-button type="primary" @click="ChangeWaterState" class="Waste-water">废水</el-button>-->
    <!--    <el-button type="primary" @click="AddGasHelper" class="flue-gas">废气</el-button>-->
    <PublicBounced ref="PublicBounced"></PublicBounced>
  </div>
</template>
<script>
import 'leaflet/dist/leaflet.css'
import Sgis from '@src/Sgis'
// import mapConfig from '@/conf/MapConfig'
import SgisLayerController from '@components/LayerController/LayerController'
import MonitorPanel from '@components/panel/RightSearchPanel'
// import TopEnterprisePanel from '@components/panel/TopEnterprisePanel'
import summarySheets from '@components/table/summarySheets.vue'
import ToolBoxPanel from '@components/panel/ToolBoxPanel'
import Popup from '@views/popup/Popup'
// import MenuSpecial from '@components/panel/MenuTopic'
import LegendPanel from '@components/panel/LegendPanel'
import Enterprise from '../components/table/enterprise'
// // 公共展示数据
import PublicBounced from '@components/BaseNav/PublicBounced/PublicBounced'
import LayerFactory from '@components/LayerController/service/LayerFactory'
export default {
  name: 'Temp',
  components: {
    Enterprise,
    LegendPanel,
    // MenuSpecial,
    ToolBoxPanel,
    // TopEnterprisePanel,
    SgisLayerController,
    MonitorPanel,
    Popup,
    summarySheets,
    PublicBounced
  },
  data () {
    return {
      map: null,
      lcServiceLayerVisible: false,
      basemapHelper: {},
      serviceLayerHelper: {},
      vectorLayerHelper: {},
      toolBoxVisible: false
    }
  },
  computed: {
    config () {
      return this.$store.state.map.config
    }
  },
  beforeMount () {
    this.$nextTick(() => {
      this.init()
    })
  },
  methods: {
    saveMapStatus () {
      window.serviceLayerHelper = this.serviceLayerHelper
      this.$store.commit('setMapObj', this.map)
      this.$store.commit('setBasemapHelper', this.basemapHelper)
      // this.$store.commit('setServiceLayerHelper', this.serviceLayerHelper)
      this.$store.commit('setVectorLayerHelper', this.vectorLayerHelper)
      this.lcServiceLayerVisible = true
    },
    init () {
      const mapcontainer = this.$refs.rootmap
      this.map = Sgis.initMap(mapcontainer)
      this.$refs.toolBox.map = this.map
      window.popupComp = this.$refs.popup
      var layerFactory = new LayerFactory({
        L: window.L,
        map: this.map
      })
      layerFactory.init(this.$store.state.map.serviceLayers.LayerSewersLine)
      window.layerFactory = layerFactory
      this.basemapHelper = Sgis.initBasemapsHelper(this.map) // 初始化基础底图助手
      this.basemapHelper.initBasemap(this.config, true) // 第二个参数,表示是否内网底图
      // this.vectorLayerHelper = Sgis.initVectorLayersHelper(this.map) // 初始化动态要素图层助手
      // this.vectorLayerHelper.initVectorLayers(this.config)
      // this.AddGasHelper()
      // this.ChangeWaterState()
      this.saveMapStatus()
      // this.setMapObj(this.mapObj)
      // this.setBasemapHelper(this.basemapHelper)
      // this.setServiceLayerHelper(this.serviceLayerHelper)
      // this.setVectorLayerHelper(this.vectorLayerHelper)
    },
    onLayerClick () {
      this.$refs.popup.setShow()
    },
    callPopup (val) {
      console.log(val)
    }
  }
}
</script>
<style lang="less">
.flue-gas {
  position: fixed;
  top: 88px;
  left: 180px;
  z-index: 500;
}
.solid-waste {
  position: absolute;
  top: 88px;
  left: 88px;
  z-index: 999;
}
.Waste-water {
  position: absolute;
  top: 88px;
  left: 280px;
  z-index: 999;
}
.full-screen {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  position: absolute;
  #map {
    height: 100%;
    width: 100%;
  }
  .barline {
    //width: 100%;
    //height: 1px;
    //background-color: #0661AE;
    border-top: 1px solid #0661AE;
  }
  #map-btn {
    position: fixed;
    top: 20px;
    left: 100px;
    z-index: 9999;
  }
  .leaflet-custom-icon {
    background: white;
  }
  .leaflet-marker-icon {
    background: none;
  }
  #migic {
    width: 48px;
    height: 48px;
    margin: -18px -20px;
    z-index: 999;
  }
}
</style>