管道基础大数据平台系统开发-【前端】-新系統界面
TreeWish
2023-02-28 234409bb4a612c5b69b78b1e844492f0a7122521
src/components/Screen/bottom.vue
@@ -20,19 +20,22 @@
            <span slot="reference">{{ item.menuName }}</span>
            <div class="popover-content">
              <div class="popover-content__header">项目信息</div>
              <div class="popover-content__list">
              <div class="popover-content__search">
                <el-input
                  v-if="item.children.length > 4"
                  size="mini"
                  placeholder="请输入内容"
                  v-model="searchName"
                  @change="handleSearchChange(item)"
                >
                  <el-button slot="append" icon="el-icon-search"></el-button>
                </el-input>
              </div>
              <div class="popover-content__list">
                <div
                  class="popover-content__list__item"
                  v-for="child in item.children"
                  :key="child.id"
                  v-for="(child, i) in currMenuList"
                  :key="child.id + i"
                  :class="currProject == child.name ? 'active' : ''"
                  @click="handlePopoverClick(child)"
                  :title="child.name"
@@ -43,9 +46,18 @@
            </div>
          </el-popover>
        </div>
        <div
          class="bottombtn"
          :class="showTree ? 'active' : ''"
          @click="handleTree"
        >
          图层管理
        </div>
      </div>
      <div class="bottom13">
        <img :src="yxImg" @click="ChangeBaseLayer" />
        <img :src="yxImg" @click="ChangeBaseLayer('yx')" title="影像图" />
        <img :src="xrImg" @click="ChangeBaseLayer('xr')" title="晕渲图" />
      </div>
    </div>
    <div class="bottom2">
@@ -54,18 +66,30 @@
  </div>
</template>
<script>
let yunxuanLayer = null
import PipeLine from "@/assets/json/pipeline.json"
import {
  countProjectTour,
  countProjectDisplay,
  countProjectLocation,
  selectProjectFileList,
} from "@/api/screen.js"
import { wktToGeoJSON } from "@terraformer/wkt"
export default {
  data() {
    return {
      YXState: true,
      XRState: true,
      yunxuanLayer: null, //全球眩晕图
      yxImg: require("../../assets/img/Screen/yximg.png"),
      currMenu: "项目展示",
      currProject: "全球管网图",
      xrImg: require("../../assets/img/Screen/bdimg.png"),
      currMenu: "专题展示",
      currProject: "",
      searchName: "",
      menuList: [
        {
          menuName: "项目展示",
          menuName: "专题展示",
          children: [
            {
              name: "全国管网图",
@@ -86,7 +110,7 @@
          ],
        },
        {
          menuName: "工程展示",
          menuName: "项目展示",
          children: [
            {
              name: "中俄东线管道工程",
@@ -144,23 +168,68 @@
          ],
        },
      ],
      showTree: false,
    }
  },
  computed: {
    currMenuList() {
      const menu = this.menuList.find(item => item.menuName == this.currMenu)
      const filterChildren = []
      const value = this.searchName
      menu.children.forEach(item => {
        if (item.name && item.name.includes(value)) {
          filterChildren.push(item)
        }
      })
      return filterChildren
    },
  },
  created() {
    this.getCountProjectDisplay()
    this.getCountProjectTour()
  },
  methods: {
    ChangeBaseLayer() {
      if (this.YXState) {
        this.yxImg = require("../../assets/img/Screen/bdimg.png")
        //加载百度影像
        Viewer.imageryLayers._layers[1].show = true
        Viewer.imageryLayers._layers[2].show = false
        Viewer.imageryLayers._layers[3].show = false
      } else {
        this.yxImg = require("../../assets/img/Screen/yximg.png")
        Viewer.imageryLayers._layers[1].show = false
        Viewer.imageryLayers._layers[2].show = true
        Viewer.imageryLayers._layers[3].show = true
    ChangeBaseLayer(parm) {
      if (parm == "yx") {
        if (this.YXState) {
          //this.yxImg = require("../../assets/img/Screen/bdimg.png")
          //加载百度影像
          Viewer.imageryLayers._layers[1].show = true
          Viewer.imageryLayers._layers[2].show = false
          Viewer.imageryLayers._layers[3].show = false
        } else {
          //this.yxImg = require("../../assets/img/Screen/yximg.png")
          Viewer.imageryLayers._layers[1].show = false
          Viewer.imageryLayers._layers[2].show = true
          Viewer.imageryLayers._layers[3].show = true
        }
        this.YXState = !this.YXState
      }
      this.YXState = !this.YXState
      if (parm == "xr") {
        if (yunxuanLayer == null) {
          var urls = "https://tiles3.geovisearth.com/base/v1/ter"
          // 星图地球地形晕渲
          yunxuanLayer = sgworld.Creator.createUrlTemplateImageryProvider(
            "星图地球地形晕渲",
            {
              url:
                urls +
                "/{z}/{x}/{y}?format=webp&token=486dac3bec56d7d7c2a581c150be2bd937462f1e8f3bc9c78b5658b396122405",
            },
            "0",
            undefined,
            true,
            ""
          )
        }
        if (this.XRState) {
          yunxuanLayer.item.show = true
        } else {
          yunxuanLayer.item.show = false
        }
        this.XRState = !this.XRState
      }
    },
    handleMenuClick(menu) {
      this.currMenu = menu.menuName
@@ -170,58 +239,40 @@
      const currMenu = this.currMenu
      switch (currMenu) {
        case "工程巡视":
          this.showPathLine()
          this.showPathLine(child)
          break
        case "项目展示":
          // this.DisplayCurrentProject(child)
          this.changeProject(child)
          this.$bus.$emit("changeProjectCode", child.id)
          break
        case "专题展示":
          this.changeProject(child)
          break
        default:
          break
      }
    },
    showPathLine(res) {
      // 西气东输二线西段干线
      // console.log("PipeLine", PipeLine)
      const features = PipeLine.features
      // features.forEach(item => {
      //   const name = item.properties.pipename
      //   const rawArr = item.geometry.coordinates
      // })
      const pipeline = features.find(
        item => item.properties.pipename == "西气东输一线"
      )
      const name = pipeline.properties.pipename
      const rawArr = pipeline.geometry.coordinates[0]
    //工程巡视
    async showPathLine(params) {
      const line = wktToGeoJSON(params.wkt)
      const position = line.coordinates[0]
      const result = []
      rawArr.forEach(pos => {
        pos.push(50)
      position.forEach(pos => {
        // 添加漫游高度,后续修改SDK源码可以适配为地面高程
        pos.push(1000)
        result.push(...pos)
      })
      // console.log("result", result);
      // sgworld.Command.execute(2, 3, "", data => {
      //   data.showPoint = false
      //   data.showLine = true
      //   data.mode = 1
      //   // 弹窗数据
      //   window.PathAnimationData = {
      //     flyData: data,
      //   }
      //   window.PathAnimationData.winIndex = layer.open({
      //     type: 2,
      //     title: "路径动画",
      //     shade: false,
      //     area: ["352px", "690px"],
      //     offset: "r",
      //     skin: "other-class",
      //     content: SmartEarthRootUrl + "Workers/path/Path.html",
      //     end: function () {
      //       PathAnimationData.fly && PathAnimationData.fly.exit()
      //     },
      //   })
      // })
      // console.log("line", position)
      window.sgworld.Creator.getFlyData(result, data => {
        data.showPoint = false
        data.showLine = true
        data.mode = 1
        data.height = 2000
        data.mode = 0
        data.height = 5000
        // 弹窗数据
        window.PathAnimationData = {
@@ -229,12 +280,12 @@
        }
        window.PathAnimationData.winIndex = layer.open({
          type: 2,
          title: "路径动画",
          title: "工程巡视",
          shade: false,
          area: ["352px", "690px"],
          offset: "r",
          skin: "other-class",
          content: SmartEarthRootUrl + "Workers/path/Path.html",
          content: SmartEarthRootUrl + "Workers/path/ProjectPath.html",
          end: function () {
            PathAnimationData.fly && PathAnimationData.fly.exit()
          },
@@ -243,23 +294,80 @@
    },
    //项目展示
    DisplayCurrentProject(parm) {
      console.log(parm)
    DisplayCurrentProject(params) {
      //打开或者加载图层
      //飞到指定位置
      const point = wktToGeoJSON(params.wkt)
      const position = point.coordinates
      Viewer.camera.flyTo({
        destination: Cesium.Cartesian3.fromDegrees(...position, 7000),
      })
    },
    //工程漫游飞行
    FlyCurrentProject(parm) {
      console.log(parm)
    FlyCurrentProject(prams) {
      console.log(prams)
      //打开或者加载图层
      //开始飞行
    },
    filterNode(value, data) {
      if (!value) return true
      return children.name.indexOf(value) !== -1
    filterChildList(menuName) {
      const menuList = this.menuList
      const searchName = this.searchName
      // console.log(menuList.find(item => item.menuName == menuName));
      const menu = menuList.find(item => item.menuName == menuName)
      return menu.children
      // return menu.children.filter(item => item.name.indexOf(searchName) > -1)
    },
    handleSearchChange(currMenu) {},
    async getCountProjectDisplay() {
      // const res = await countProjectLocation()
      // if (res.code === 200) {
      //   const menu = this.menuList.find(item => item.menuName == "项目展示")
      //   menu.children = res.result.map(item => {
      //     return {
      //       name: item.projname,
      //       id: item.projname,
      //       wkt: item.wkt,
      //     }
      //   })
      // }
      const res = await selectProjectFileList()
      if (res.code === 200) {
        const menu = this.menuList.find(item => item.menuName == "项目展示")
        menu.children = res.result.map(item => {
          return {
            name: item.name,
            id: item.code,
            wkt: item.wkt,
          }
        })
      }
      selectProjectFileList
    },
    async getCountProjectTour() {
      const res = await countProjectTour()
      if (res.code === 200) {
        const menu = this.menuList.find(item => item.menuName == "工程巡视")
        menu.children = res.result.map(item => {
          return {
            name: item.projname,
            id: item.projname,
            wkt: item.wkt,
          }
        })
      }
    },
    //专题展示
    changeProject(params) {
      this.$bus.$emit("changeProject", params.name)
    },
    handleTree(params) {
      this.showTree = !this.showTree
      this.$bus.$emit("changeTree", this.showTree)
    },
  },
}
@@ -319,6 +427,7 @@
      color: #fff;
      font-weight: 600;
      cursor: pointer;
      &.active {
        background: url(~@/assets/img/Screen/centerbtnc.png);
        background-size: 100% 100%;
@@ -339,6 +448,7 @@
    }
  }
}
.popover {
  display: flex;
  justify-content: center;
@@ -347,9 +457,11 @@
  background: url(~@/assets/img/Screen/centerTooltipBg.png);
  background-size: 100% 100%;
  border: none;
  .popper__arrow {
    display: none;
  }
  .popover-content {
    &__header {
      display: flex;
@@ -360,6 +472,7 @@
      height: 30px;
      font-size: 18px;
      color: #fff;
      &::before,
      &::after {
        margin: 0 5px;
@@ -371,39 +484,50 @@
        height: 8px;
      }
    }
    .el-input {
      width: 119px;
      height: 21.5px;
      background: rgba(0, 48, 111, 0.2);
      border: 0.25px solid #2a80a9;
      &__inner {
    &__search {
      margin-top: 8px;
      width: 145px;
      text-align: center;
      .el-input {
        width: 125px;
        height: 21px;
        background: rgba(0, 48, 111, 0.2);
        border-radius: inherit;
        border: 0.25px solid #2a80a9;
      }
      .el-input-group__append {
        width: 32px;
        border: none;
        border-radius: inherit;
        height: 20px;
        padding: 0;
        text-align: center;
        background: #3a93c7;
        color: #fff;
        &__inner {
          background: rgba(0, 48, 111, 0.2);
          border-radius: inherit;
          border: 0.25px solid #2a80a9;
          padding: 0 5px;
          color: #fff;
        }
        .el-input-group__append {
          width: 32px;
          border: none;
          border-radius: inherit;
          height: 20px;
          padding: 0;
          text-align: center;
          background: #3a93c7;
          color: #fff;
        }
      }
    }
    &__list {
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      // justify-content: space-evenly;
      align-items: center;
      width: 145px;
      height: 180px;
      height: 155px;
      overflow-x: hidden;
      &__item {
        margin-top: 10px;
        margin-top: 8px;
        color: #fff;
        width: 130px;
        height: 30px;
@@ -422,6 +546,7 @@
      }
    }
  }
  ::-webkit-scrollbar {
    width: 2px;
    height: 2px;