北京经济技术开发区经开区虚拟城市项目-【前端】-Web
Jin Lei
2023-11-11 5b5a5a7899a9444665235d96d8d7f2d50fed6a8c
src/components/map/viewer1.vue
@@ -1,10 +1,14 @@
<template>
  <div>
    <div id="sdkContainer1" style="height: 100%"></div>
    <layerTreeTwoScreenRight
      v-if="layerTreeTwoScreen"
      id="layerTreeTwoScreen111"
    />
    <div class="listBox" v-show="!isLand">
      <ul>
        <li v-for="(item, index) in arr" :key="index" @click="changeLeftMap($event, item, index)">
          {{ item }}
        </li>
      </ul>
    </div>
    <layerTreeTwoScreenRight v-if="layerTreeTwoScreen" id="layerTreeTwoScreen111" />
    <div class="tdInfo" v-if="showTDinfo">
      <div class="tdInfo_close" @click="tdInfoClose">×</div>
      <p v-if="dikuanxinxi" class="noInfo">暂无该地块信息</p>
@@ -41,12 +45,7 @@
        <div v-else class="title">
          <li>
            企业
            <el-tooltip
              class="item"
              effect="dark"
              content="点击查看企业信息"
              placement="bottom"
            >
            <el-tooltip class="item" effect="dark" content="点击查看企业信息" placement="bottom">
              <a @click="showYZCQY"> {{ qysl }}</a>
            </el-tooltip>
            家
@@ -54,83 +53,31 @@
        </div>
      </ul>
    </div>
    <el-dialog
      class="aboutDialog"
      title="企业信息"
      append-to-body
      width="60%"
      height="60%"
      style="overflow: auto"
      :visible.sync="QYbox"
      :before-close="dialogClose"
    >
    <el-dialog class="aboutDialog" title="企业信息" append-to-body width="60%" height="60%" style="overflow: auto"
      :visible.sync="QYbox" :before-close="dialogClose">
      <div class="el-dialog-div">
        <div class="inquire">
          <el-form
            size="medium"
            ref="queryForm"
            :model="queryForm"
            :inline="true"
          >
          <el-form size="medium" ref="queryForm" :model="queryForm" :inline="true">
            <el-form-item label="查询内容" prop="name">
              <el-input
                v-model="queryForm.content"
                placeholder="请输入查询内容"
              />
              <el-input v-model="queryForm.content" placeholder="请输入查询内容" />
            </el-form-item>
            <el-form-item>
              <el-button
                @click="queryInfo('queryForm')"
                icon="el-icon-search"
                class="primary"
                >查询</el-button
              >
              <el-button @click="queryInfo('queryForm')" icon="el-icon-search" class="primary">查询</el-button>
            </el-form-item>
          </el-form>
        </div>
        <el-table
          fit
          style="width: 100%"
          :data="tableData"
          highlight-current-row
        >
        <el-table fit style="width: 100%" :data="tableData" highlight-current-row>
          <el-table-column type="index" width="50"></el-table-column>
          <el-table-column
            property="企业名称"
            label="企业名称"
          ></el-table-column>
          <el-table-column
            property="企业类型"
            label="企业类型"
          ></el-table-column>
          <el-table-column
            property="成立时间"
            label="成立时间"
          ></el-table-column>
          <el-table-column
            property="所属行业"
            label="所属行业"
          ></el-table-column>
          <el-table-column property="企业名称" label="企业名称"></el-table-column>
          <el-table-column property="企业类型" label="企业类型"></el-table-column>
          <el-table-column property="成立时间" label="成立时间"></el-table-column>
          <el-table-column property="所属行业" label="所属行业"></el-table-column>
          <el-table-column property="法人" label="法人"></el-table-column>
          <el-table-column
            property="注册地址"
            label="注册地址"
          ></el-table-column>
          <el-table-column property="注册地址" label="注册地址"></el-table-column>
        </el-table>
        <div
          slot="footer"
          class="dialog-footer"
          style="text-align: center; margin-top: 5px"
        >
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page.sync="currentPage"
            :page-size="10"
            :pager-count="11"
            layout="total, pager"
            :total="searchNum"
          >
        <div slot="footer" class="dialog-footer" style="text-align: center; margin-top: 5px">
          <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page.sync="currentPage" :page-size="10" :pager-count="11" layout="total, pager" :total="searchNum">
          </el-pagination>
        </div>
      </div>
@@ -147,8 +94,7 @@
import Bus from "../tools/Bus";
let line, line1, handler, handler1, divPoint, divPoint1, dx;
let line, line1, handler, handler1, divPoint, divPoint1, dx, activeLi, nLayer, TDLayer;
export default {
  name: "viewer1",
  components: { layerTreeTwoScreenRight },
@@ -179,7 +125,13 @@
      currentPage: 1,
      pageSize: 10,
      searchNum: 0,
      arr: [
        2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
        2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
      ],
      tableData: [],
      queryForm: {
        type: "企业名称",
        content: "",
@@ -193,7 +145,7 @@
  },
  computed: {
    ...mapState(["viewer1Show", "layerTreeTwoScreen"]),
    ...mapState(["viewer1Show", "isLand", "layerTreeTwoScreen"]),
  },
  watch: {
    viewer1Show: {
@@ -214,6 +166,24 @@
        }, 2000);
      },
    },
    isLand(newvalue, oldvalue) {
      if (!newvalue) {
        if (TDLayer) {
          TDLayer.deleteObject();
          TDLayer = null;
        }
        if (line) {
          sgworld.Creator.DeleteObject(line);
        }
        if (line1) {
          sgworld1.Creator.DeleteObject(line1);
        }
      } else {
        if (!TDLayer) {
          this.loadTDGLLayer();
        }
      }
    }
  },
  mounted() {
    this.$nextTick(function () {
@@ -230,22 +200,6 @@
          },
        },
      };
      // let option = {
      //   url: SmartEarthRootUrl + "Workers/image/earth.jpg",
      //   fullscreenButton: true,
      //   licenseServer: "http://183.162.245.49:18080",
      //   minViewHeight: parseFloat(common.minviewheight),
      //   contextOptions: {
      //     failIfMajorPerformanceCaveat: false,
      //     webgl: {
      //       alpha: true,
      //       preserveDrawingBuffer: true
      //     }
      //   }
      // };
      //EPSG4326
      // Cesium.ExpandBySmartEarth.Ellipsoid.z = 6356752.3142451793;
      // 北京
      window.sgworld1 = new SmartEarth.EarthCtrl(
@@ -268,8 +222,119 @@
            true,
            ""
          );
          if (this.isLand) {
            this.loadTDGLLayer();
          }
          var p = {
            destination: sgworld.Navigate.getPosition(),
            orientation: {
              heading: sgworld.Viewer.camera.heading,
              pitch: sgworld.Viewer.camera.pitch,
              roll: sgworld.Viewer.camera.roll,
            },
          };
          sgworld1.Viewer.camera.setView(p);
          setTimeout(() => {
            window.loading && window.loading.close();
          }, 100);
          setTimeout(() => {
            window.APPLoading && window.APPLoading.close();
          }, 100);
        }
      );
      window.Viewer1 = sgworld1._Viewer;
      Viewer1.shadows = false;
      //深度检测
      sgworld1.Analysis.depthTestAgainstTerrain(true);
      //地下模式距离参数
      // Viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
      Viewer1.scene.globe.translucency.frontFaceAlpha = 0.5;
      Viewer1.scene.globe.undergroundColor = undefined;
      this.addEvent();
    });
    //关闭弹窗
    Bus.$on("closeLandInfoPop", (data) => {
      if (data) {
        this.showTDinfo = false;
      }
    });
  },
  methods: {
    setImageComparison(isStart) {
      this.isImage = isStart;
      if (!this.isImage) {
        this.destroyImageLayer();
      }
    },
    destroyImageLayer() {
      if (activeLi) {
        activeLi.classList.remove('active');
        activeLi = null;
      }
      if (nLayer) {
        Viewer1.imageryLayers.remove(nLayer, true);
        nLayer = null;
      }
    },
    changeLeftMap(event, item, index) {
      let liObj = event.currentTarget;
      if (activeLi) {
        activeLi.classList.remove('active');
        activeLi = null;
      }
      liObj.classList.add('active');
      activeLi = liObj;
      this.loadImageLayer(item);
    },
    loadImageLayer(year) {
      if (nLayer) {
        Viewer1.imageryLayers.remove(nLayer, true);
        nLayer = null;
      }
      nLayer = this.loadBJ54ImageLayer(year);
    },
    loadBJ54ImageLayer(year) {
      let url = "http://172.26.64.84/service/ImageEngine/picdis/abc";
      //let url = option.url;
      //let year = option.year;
      let paramUrl = `${url}?user=jjjskfq&password=Jjjskfq@2022&layer=Sate_${year}&style=&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fpng&TileMatrix={z}&TileCol={nx}&TileRow={ny}`;
      let minx = 113.168199 * Math.PI / 180.0;
      let miny = 39.230551 * Math.PI / 180.0;
      let maxx = 118.562362 * Math.PI / 180.0;
      let maxy = 41.294714 * Math.PI / 180.0;
      let rectangle = new Cesium.Rectangle(minx, miny, maxx, maxy);
      let tilingScheme = new Cesium.GeographicTilingScheme({
        rectangle: rectangle,
        numberOfLevelZeroTilesX: 2,
        numberOfLevelZeroTilesY: 1
      });
      var dx = {
        url: paramUrl,
        tilingScheme: tilingScheme,
        customTags: {
          nx: function (imageryProvider, x, y, level) {
            return (2 << (level - 1)) + x;
          },
          ny: function (imageryProvider, x, y, level) {
            return (2 << (level - 1)) + y;
          }
        }
      };
      var imageryProvider = new Cesium.UrlTemplateImageryProvider(dx);
      let imageLayer = new Cesium.ImageryLayer(imageryProvider, { alpha: 1, brightness: 1.0 });
      Viewer1.imageryLayers.add(imageLayer, 2);
      return imageLayer;
    },
    loadTDGLLayer() {
          let treeNode = URLInCode.tdglTmsCode;
          sgworld1.Creator.createImageryProvider(
      TDLayer = sgworld1.Creator.createImageryProvider(
            treeNode.name,
            "tms",
            {
@@ -292,57 +357,13 @@
            ""
          );
          var p = {
            destination: sgworld.Navigate.getPosition(),
            orientation: {
              heading: sgworld.Viewer.camera.heading,
              pitch: sgworld.Viewer.camera.pitch,
              roll: sgworld.Viewer.camera.roll,
            },
          };
          sgworld1.Viewer.camera.setView(p);
          setTimeout(() => {
            window.APPLoading && window.APPLoading.close();
          }, 1000);
        }
      );
      // 合肥
      // window.sgworld1 = new SmartEarth.SGWorld(
      //   "sdkContainer1",
      //   Cesium,
      //   option,
      //   null,
      //   function () {
      //     var p = {
      //       destination: sgworld.Navigate.getPosition(),
      //       orientation: {
      //         heading: sgworld.Viewer.camera.heading,
      //         pitch: sgworld.Viewer.camera.pitch,
      //         roll: sgworld.Viewer.camera.roll,
      //       },
      //     };
      //     sgworld1.Viewer.camera.setView(p);
      //     setTimeout(() => {
      //       window.APPLoading && window.APPLoading.close();
      //     }, 1000);
      //   }
      // );
      window.Viewer1 = sgworld1._Viewer;
      Viewer1.shadows = false;
      //深度检测
      sgworld1.Analysis.depthTestAgainstTerrain(true);
      //地下模式距离参数
      // Viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
      Viewer1.scene.globe.translucency.frontFaceAlpha = 0.5;
      Viewer1.scene.globe.undergroundColor = undefined;
    addEvent() {
      let type = 0;
      //点击左侧显示范围、详情
      handler1 = new Cesium.ScreenSpaceEventHandler(Viewer1.scene.canvas);
      handler1.setInputAction((event) => {
        if (this.isLand) {
        let that = this;
        this.clearInfoPanel();
        let p;
@@ -506,17 +527,10 @@
              }
            });
        }
        }
      }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
    });
    //关闭弹窗
    Bus.$on("closeLandInfoPop", (data) => {
      if (data) {
        this.showTDinfo = false;
      }
    });
  },
  methods: {
    dialogClose() {
      this.queryForm.content = "";
      this.queryForm.type = "企业名称";
@@ -1049,6 +1063,7 @@
  background-size: 100% 100%;
  margin: 0 auto;
}
.tdInfo .title li {
  margin-left: 32px;
  /* width: 78px; */
@@ -1060,6 +1075,7 @@
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.content1,
.content2,
.content3 {
@@ -1070,6 +1086,7 @@
  flex-direction: column;
  justify-content: space-between;
}
.content1 li,
.content2 li,
.content3 li {
@@ -1079,14 +1096,17 @@
  line-height: 26px;
  text-shadow: 0px 1px 6px rgba(3, 10, 26, 0.5);
}
.content1 {
  height: 136px;
  padding: 19px 0;
}
.content2 {
  height: 132px;
  padding: 21px 0;
}
.content3 {
  height: 116px;
  padding-top: 21px;
@@ -1218,8 +1238,7 @@
  background-color: rgba(0, 32, 70, 0.7) !important;
}
.aboutDialog .el-dialog-div .dialog-footer {
}
.aboutDialog .el-dialog-div .dialog-footer {}
.el-pagination {
  color: #fff;
@@ -1246,6 +1265,40 @@
  color: #fff;
}
.listBox {
  position: absolute;
  right: 20px;
  top: 100px;
}
.listBox .active {
  background: rgba(255, 166, 0, 0.808);
}
.listBox li {
  padding: 2px;
  margin-top: 1px;
  border-radius: 2px;
  color: white;
  background: rgba(14, 50, 143, 0.6);
  font-size: 14px;
  cursor: pointer;
}
/* 屏幕分辨率放大为 125 */
@media (-webkit-min-device-pixel-ratio: 1.25) {
  .listBox li {
    font-size: 12px;
  }
}
.listBox li:hover {
  background: rgba(255, 166, 0, 0.808);
}
::-webkit-scrollbar {
  /*滚动条整体样式*/
  width: 4px;