管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2023-04-15 44517cf9375441d8a84808ca52d7ce474d8e0b17
src/components/mapol.vue
@@ -3,12 +3,12 @@
    <div style="display: flex">
      <div
        @click="changeMenulayer"
        class="center CenDiv"
        :class="{ center1: centerFlag }"
        class="changeLayer"
      >
        <div
          title="底图切换"
          id="cenBg"
          v-bind:class="{ active: isActive, menuLayer: isMenuLayer }"
          class="mapBaseMap"
        ></div>
      </div>
@@ -17,6 +17,7 @@
        class="changeMapType"
      >
        <div
          title="2/3维切换"
          id="cenBg"
          :class="show2DMap ? 'mapTypeTwo' : 'mapTypeThree'"
        ></div>
@@ -95,23 +96,24 @@
  methods: {
    init2DMap() {
      var vectorLayer = new TileLayer({
        source: new XYZ({
          url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}",
        }),
      })
      var imageLayer = new TileLayer({
        source: new XYZ({
          url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}",
        }),
      })
      // var vectorLayer = new TileLayer({
      //   source: new XYZ({
      //     url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}",
      //   }),
      // })
      // var imageLayer = new TileLayer({
      //   source: new XYZ({
      //     url: "http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=6&x={x}&y={y}&z={z}",
      //   }),
      // })
      window.map = new Map({
        target: "mapol",
        layers: [imageLayer, vectorLayer],
        layers: [],
        view: new View({
          center: [105.02, 34.9],
          zoom: 4,
          projection: "EPSG:4326",
          minZoom: 5,
        }),
        controls: defaultControls().extend([
          new FullScreen(),
@@ -119,6 +121,23 @@
        ]),
        interactions: defaultInteractions().extend([new DragRotateAndZoom()]),
      })
      var base_ulr = window.sceneConfig.baseUrl;
      if (base_ulr.indexOf('{host}') > -1) {
        base_ulr = base_ulr.replace("{host}", iisHost)
      }
      window.olBaseMapLayer = new TileLayer({
        title: "高德地图",
        source: new XYZ({
          url: base_ulr,
          wrapX: false
        })
      });
      window.map.addLayer(window.olBaseMapLayer);
      // var scaleLine = new  ScaleLine({
      //   units: "metric"
      // });
@@ -133,7 +152,7 @@
    //二维/三维地图切换
    changeMapType() {
      //
      //
      this.show2DMap = !this.show2DMap;
      //二维
      if (this.show2DMap) {
@@ -147,9 +166,10 @@
    },
    changeMenulayer() {
      this.isActive = !this.isActive
      this.isMenuLayer = !this.isMenuLayer
      this.setLayerVisible()
      this.$bus.$emit("setChangeBaseMapLayer", true)
      // this.isActive = !this.isActive
      // this.isMenuLayer = !this.isMenuLayer
      // this.setLayerVisible()
    },
    setLayerVisible() {
      if (this.isActive == true) {
@@ -228,8 +248,8 @@
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 3px 3px 6px #666;
  border: 1px solid rgba(204, 204, 204, 0.76);
  // box-shadow: 3px 3px 6px #666;
  // border: 1px solid rgba(204, 204, 204, 0.76);
  border-radius: 5px;
  cursor: pointer;
}
@@ -247,9 +267,9 @@
  flex-direction: column;
  justify-content: space-between;
}
.CenDiv:hover {
  border: 1px solid #409eff;
}
// .CenDiv:hover {
//   border: 1px solid #409eff;
// }
.active {
  width: 100%;
  height: 100%;
@@ -325,36 +345,70 @@
.sindagis-map-compass .right:hover {
  background: url("../assets/img/compass.png") -89px -5px / 266px no-repeat;
}
.mapBaseMap {
  width: 100%;
  height: 100%;
  //margin-left: 10px;
  background-image: url("../assets/img/basemap.png");
  //background-image: url("../assets/img/synthesis/底图.png");
  background-repeat: no-repeat;
  background-size: contain;
}
.changeMapType {
  position: absolute;
  bottom: 1%;
  left: calc(1% + 75px);
  height: 40px;
  width: 60px;
  bottom: 52px;
  right: 46px;
  height: 30px;
  width: 30px;
  z-index: 101;
  display: flex;
  justify-content: center;
  align-items: center;
  // box-shadow: 3px 3px 6px #666;
  border-radius: 5px;
  // background: #fff;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.5);
  //position: absolute;
  //bottom: 1%;
  //left: calc(1% + 75px);
  //height: 40px;
  //width: 60px;
  //z-index: 101;
  //display: flex;
  //justify-content: center;
  //align-items: center;
  //// box-shadow: 3px 3px 6px #666;
  //border-radius: 5px;
  //// background: #fff;
  //cursor: pointer;
}
.mapTypeTwo {
  width: 100%;
  height: 100%;
  margin-left: 10px;
  background-image: url("../assets/img/synthesis/3D.png");
  //margin-left: 10px;
  background-image: url("../assets/img/3D.png");
  //background-image: url("../assets/img/synthesis/3D.png");
  background-repeat: no-repeat;
  background-size: contain;
}
.mapTypeThree {
  width: 100%;
  height: 100%;
  margin-left: 10px;
  background-image: url("../assets/img/synthesis/2D 拷贝 2.png");
  //margin-left: 10px;
  background-image: url("../assets/img/2D.png");
  //background-image: url("../assets/img/synthesis/2D 拷贝 2.png");
  background-repeat: no-repeat;
  background-size: contain;
}
.changeLayer {
  position: absolute;
  bottom: 84px;
  right: 46px;
  height: 30px;
  width: 30px;
  z-index: 101;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.5);
}
</style>