<template lang="pug">
  <div class="inspect_point">
    <el-container style='padding-left:0px;'>
      <el-aside width='333px'>
          <el-card  :style="{height:currentHeight-69+'px'}">
            <div class="inspect_point_left_top">
              <div class="inspect_point_left_topL">
                <div :class="[activeName==1?'on':'']" @click="handleClick(1)">资源列表</div>
                <div :class="[activeName==2?'on':'']" @click="handleClick(2)">收藏夹</div>
              </div>
              <div style="float:right; margin:5px 5px 0 5px">
                <el-button type="text" size="mini" icon='el-icon-shoucang' @click="treeDataOffClick()"></el-button>
              </div>
              <div class="inspect_point_left_topR">
                <el-input size="mini" suffix-icon="el-icon-search" clearable v-model="searchInput"></el-input>
              </div>
            </div>
            <div class="tree-container">
              <el-tree :style="{height:currentHeight-145+'px'}" class="dic_tree" :data="treeData" ref='tree' :accordion='true' :filter-node-method="filterNode" :highlight-current='true' :props="defaultProps" :default-expand-all='false' @node-click="handleNodeClick" :default-expanded-keys='defaultExpandedKeys' :node-key='nodeKey' >
                <span class="custom-tree-node" style='width:85%;line-height: 18px;' slot-scope="{ node, data }">
                  <span v-if="node.data.level == 4 && node.data.iconB" class="el-icon-wq-treeIcon1 xa-icon"></span>
                  <span v-if="node.data.level == 4 && !node.data.iconB" class="el-icon-wq-treeIcon xa-icon"></span>
                  <span v-if="node.data.level == 6 " :class="node.data.icon+'7'" class='xa-icon'></span>
                  <span style="position: relative;" v-if="node.label.indexOf('在线') == -1 && node.label.indexOf('离线') == -1">&nbsp;{{node.label}}<span style="width:25px; height:16px; position: absolute;left: -46px;top: -3px;"></span></span>
                  <span style="position: relative;" v-if="node.label.indexOf('在线') > -1">&nbsp;{{node.label.substring(0,node.label.length - 4)}}<span style='color:green;'>[在线]</span><span style="width:25px; height:16px; position: absolute;left: -46px;top: -3px;"></span></span>
                  <span style="position: relative;" v-if="node.label.indexOf('离线') > -1">&nbsp;{{node.label.substring(0,node.label.length - 4)}}<span style='color:red;'>[离线]</span><span style="width:25px; height:16px; position: absolute;left: -46px;top: -3px;"></span></span>
                  <span style="float:right;">
                    <el-button style="padding:0;" v-if="activeName == 2 && node.data.level == 6" type='text' icon="el-icon-delete" @click="treeDataDeleteClick(node,data)" ></el-button>
                  </span>
                  span(v-if=" node.data.iconB" class='el-icon-my-treeFlag')
                </span>
              </el-tree>
            </div>
          </el-card>
      </el-aside>

      <el-main style="padding:0px;">
        <el-card>
          <div class="inspect_point_right_button">
            <el-row style="padding-bottom:15px;" :span="24">
                <el-col :md='18' :sm="5" class='tier-btn'>
                  div(v-for="item in mapList" :key='item.id')
                    <el-button type="primary" size="small" plain :class="[checkedData.tierId===item.id?'active-tier':'']" style="float:left;margin-left:10px;"  @click="changeMap(item)">{{item.name}}</el-button>
                </el-col>
            </el-row>
          </div>
          <div class="inspect_point_right_button_r">
            <div :class="[transformationSta == 1?'on':'']" @click="transformation(1)">2D</div>
            <div :class="[transformationSta == 2?'on':'']" @click="transformation(2)">3D</div>
          </div>
          <div v-show="transformationSta==1">
            <el-row style="background:#fff;" :style="{height:currentHeight-115+'px'}" :span="24">
                <el-col class="resource-container" :style="obj" ref="drag">
                  <div id="map" class="map"  ref='map' style="width: 100%;position: relative;" :style="{height:currentHeight-135+'px'}"></div>
                </el-col>
            </el-row>
          </div>
          <div class="map_right" >
            <div>
              <iframe :src="src" ref="iframe"></iframe>
            </div>
          </div>
        </el-card>
      </el-main>
      <query-detail v-if='queryDetailVisible' ref='queryDetail' @closeQ="closeQueryDetailVisible"></query-detail>
    </el-container>
  </div>

</template>

<script>
import QueryDetail from './query-detail'
import { getUUID } from '@/util'
import Vue from 'vue'
import 'ol/ol.css'
import { Map, View, layer, Markers } from 'ol'
import { Projection, Transform } from 'ol/proj'
import { getCenter } from 'ol/extent'
import overviewmap from 'ol/control/OverviewMap'
import ImageLayer from 'ol/layer/Image'
import ImageStatic from 'ol/source/ImageStatic'
import { control } from 'ol/control/Control'
import Zoom from 'ol/control/Zoom'
import { DoubleClickZoom, Select } from 'ol/interaction'
// 图上图标相关
import OlFeature from 'ol/Feature'
import OlGeomPoint from 'ol/geom/Point'
import OlLayerVector from 'ol/layer/Vector'
import OlSourceVector from 'ol/source/Vector'
import OlStyleStyle from 'ol/style/Style'
import OlStyleIcon from 'ol/style/Icon'
import LineString from 'ol/geom/LineString'
// 用来添加相关文字描述的
import { Text, Fill, Stroke, Circle, Style } from 'ol/style'

import { log } from 'util'

let that
export default {
  name: 'sys-user',
  filters: {
    ellipsis (value) {
      if (!value) return ''
      if (value.length > 20) {
        return value.slice(0, 20) + '...'
      }
      return value
    }
  },
  computed: {
    currentHeight() {
      return this.$store.state.d2admin.currentHeight.height
    }
  },
  data () {
    return {
      systemList: [],
      imgLayerList: [],
      controlList: [],
      transformationSta: 1,
      urlPath: window.CONFIG.urlPath,
      isCollapse: true,
      dataList: [],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
      dataListSelections: [],
      addOrUpdateVisible: false,
      queryDetailVisible: false,
      treeData: [],
      defaultExpandedKeys: [],
      defaultProps: {
        children: 'children',
        label: 'name',
        level1: 'level'
      },
      nodeKey: 'id',
      station: {}, //当前选择的站点
      mapList: [], //当前站点的所有层
      stationMap: {}, //当前选择的层
      resource: {}, //当前选择的资源点
      lineId: localStorage.getItem('currenLineId'),
      stationId: localStorage.getItem('stationId'),
      checkedData: {
        lineId: '',
        lineName: '',
        stationId: '',
        stationName: '',
        subSystem: '',
        tierId: '',
        tierName: '',
        resourceId: '',
        sId: localStorage.getItem('stationId'),
        subCode: '04'
      },
      currentNode: {},
      dragAble: false,
      list: [],
      obj: 'pointer-events:initial',
      src: window.CONFIG.bimPath,
      editable: false,
      activeName: '1',
      searchInput: ''
    }
  },
  components: {
    QueryDetail
  },
  watch: {
    searchInput (val) {
      this.$refs.tree.filter(val)
    }
  },
  created () {
    that = this
    this.initTreeStationMap()
  },
  methods: {
                  // 初始化地图
    initMap(url) {
      let mapList = this.mapList
      this.imgurl = url
      // 计算静态地图映射到地图上的范围
      let extent = [-1100, 110, 1460, 820]

      let projection = new Projection({
        // 投影
        code: 'xkcd-image',
        units: 'pixels',
        extent: extent
      })
      if (mapList.length > 0) {
         for (var i = 0; i < mapList.length; i++) {
              let layerItem = new ImageLayer({
                  id: mapList[i].id,
                  source: new ImageStatic({
                    url: mapList[i].readPath, //这里添加静态图片的地址
                    projection: projection,
                    imageExtent: extent
                  }),
                  visible: false
                })
              this.imgLayerList.push(layerItem)

             let controlItem = new overviewmap({
                  className: 'ol-overviewmap myOverview', //鹰眼控件样式
                  // 在鹰眼中加载相同坐标系下不同数据源的图层
                  layers: [
                    new ImageLayer({
                      source: new ImageStatic({
                        url: mapList[i].readPath, //这里添加静态图片的地址
                        projection: projection,
                        imageExtent: extent
                      })
                    })
                  ],
                  // layers:this.controlList,
                  collapseLabel: '\u00BB', //鹰眼控件展开时功能按钮上的标识
                  label: '\u00AB', //鹰眼控件折叠时功能按钮上的标识
                  collapsed: false //初始为展开方式
                })
              this.controlList.push(controlItem)
        }
      }
      let zoomControl = new Zoom({
        delta: 0.2,
        zoomInTipLabel: '',
        zoomOutTipLabel: ''
      })
      // 大图
      this.map = new Map({
        target: 'map',
        layers: this.imgLayerList,
        controls: [zoomControl],
        view: new View({
          projection: projection,
          center: getCenter([0, 0, 0, 0]), // 获取范围的中心坐标。
          zoom: 2.5,
          maxZoom: 5.0,
          minZoom: 1.5,
          extent: [-1100, -100, 2000, 1000]//[minX, minY, maxX, maxY] 控制拖动

        })
      })
      // 删除默认的双击事件
    const dblClickInteraction = this.map
      .getInteractions()
      .getArray()
      .find(interaction => {
        return interaction instanceof DoubleClickZoom
    })
    this.map.removeInteraction(dblClickInteraction)
    //将鹰眼控件加载到map中
    this.map.addControl(this.controlList[0])

      //点击事件
      this.changeVectorLayer(this.list)

      this.map.on('click', function (evt) {
        let feature = evt.map.forEachFeatureAtPixel(evt.pixel, function (feature) {
          return feature
        })
        if (feature) {
          for (let i in that.list) {
            let style = that.getPointStyle(that.list[i].imageSrc + '.png', that.list[i].name)
            let style2 = that.getPointStyle(that.list[i].imageSrc + '2.png', that.list[i].name, 0.3)
            //获取feature对象
            let feature_ = that.vectorLayer.getSource().getFeatureById(that.list[i].id)
            //获取红外对射或者振动光纤第二个点的feature对象
            let featureEnd = that.vectorLayer.getSource().getFeatureById(that.list[i].key + 'end')
            if (feature_) {
                if (feature_ === feature || featureEnd === feature) {
                    //修改选中样式
                    feature_.setStyle(style2)
                    if (featureEnd) {
                        featureEnd.setStyle(style2)
                    }
                    that.pointListClick(that.list[i])
                } else {
                    //清除选中以外的样式
                    feature_.setStyle(style)
                    if (featureEnd) {
                        featureEnd.setStyle(style)
                    }
                }
            }
          }
        }
      })
    },
    getPointStyle(src, name, zoom) {
      let style = new OlStyleStyle({
                  image: new OlStyleIcon({
                    anchor: [0.5, 0.5],
                    scale: zoom || 0.4,
                    //rotation:0 旋转度
                    src: require('@/assets/images/' + src)
                  }),
                  text: new Text({
                    text: name, // 添加文字描述
                    font: '14px font-size', // 设置字体大小
                    fill: new Fill({
                      // 设置字体颜色
                      color: 'black'
                    }),
                    offsetY: 30 // 设置文字偏移量
                  })
                })
      return style
    },
    changeVectorLayer(list) {
      if (list) {
          this.list = list
      } else {
          return
      }
      if (this.map) {
         this.map.removeLayer(this.vectorLayer)
         this.map.removeLayer(this.lineVectorLayer)
      } else {
          return
      }

      this.lineVectorLayer = new OlLayerVector({
        source: new OlSourceVector({
            features: []
        }),
        style: new OlStyleStyle({
             stroke: new Stroke({
             color: '#409EFF',
             width: 3
             })
        })
      })
      this.map.addLayer(this.lineVectorLayer)

      let lineLastArr = []
      let featuresArr = []
      for (let i in list) {
          if (list[i].imageSrc) {
              //振动光纤和红外线对射
              if (list[i].type === 'e670524ecb9e4a03b8ddbc7d91a63b1b' || list[i].type === '4f69755dbc0c45e49c142857286c5669') {
                  let lineFeatures = []
                  lineFeatures.push([list[i].xlongit, list[i].ylat])
                  lineFeatures.push([list[i].xpoint, list[i].ypoint])
                  this.lineVectorLayer.getSource().addFeature(new OlFeature(new LineString(lineFeatures)))
                  lineLastArr.push(list[i])
              }
                 featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat))
                 let style = this.getPointStyle(list[i].imageSrc + '.png', this.list[i].name)
                 featuresArr[i].setStyle(style)
                 featuresArr[i].setId(list[i].id)
          } else {
            continue
          }
      }

      let LinefeaturesArr = []
      for (let i in lineLastArr) {
          // let bean = JSON.parse(JSON.stringify(lineLastArr[i]))
          // LinefeaturesArr.push(this.getFeature(bean.xpoint, bean.ypoint))
          // let style = this.getPointStyle(bean.imageSrc + '.png', bean.name)
          // LinefeaturesArr[i].setStyle(style)
          // bean.id = getUUID()
          // bean.key = lineLastArr[i].id
          // LinefeaturesArr[i].setId(bean.key + 'end')
          // this.list.push(bean)
          LinefeaturesArr.push(this.getFeature(lineLastArr[i].xpoint, lineLastArr[i].ypoint))
          let style = this.getPointStyle(lineLastArr[i].imageSrc + '.png', lineLastArr[i].name)
          LinefeaturesArr[i].setStyle(style)
          LinefeaturesArr[i].setId(lineLastArr[i].key + 'end')
          this.list.push(lineLastArr[i])
      }

      this.vectorLayer = new OlLayerVector({
        source: new OlSourceVector({
        features: featuresArr.concat(LinefeaturesArr)
        })
      })
      this.map.addLayer(this.vectorLayer)
    },
    getFeature(x, y) {
       return new OlFeature({
                    type: 'icon',
                    geometry: new OlGeomPoint([x, y])
                 })
    },
            // 改变层级和鹰眼图
    changeImgControl(id) {
          let srcIndex = this.imgLayerList.findIndex((e) => {
             return e.values_.id == id
          })
          this.map.removeControl(this.controlList[srcIndex])
          this.map.addControl(this.controlList[srcIndex])
          for (var k = 0; k < this.imgLayerList.length; k++) {
              if (this.imgLayerList[k].values_.id == id) {
                      // that.imgurl=map.readPath
              this.imgLayerList[k].setVisible(true)
            } else {
                this.imgLayerList[k].setVisible(false)
            }
        }
    },
            mapClick(feature, item, flag) {
        //默认样式
        let style = this.getPointStyle(item.imageSrc + '.png', item.name)
        //选中样式
        let style2 = this.getPointStyle(item.imageSrc + '2.png', item.name, 0.3)
        //获取feature对象
        let feature_ = this.vectorLayer.getSource().getFeatureById(item.id)
        //获取红外对射或者振动光纤第二个点的feature对象
        let featureEnd = this.vectorLayer.getSource().getFeatureById(item.key + 'end')
        if (feature_) {
            if (feature_ === feature || featureEnd === feature) {
                //console.log(feature_)
                //修改选中样式
                feature_.setStyle(style2)
                if (featureEnd) {
                    featureEnd.setStyle(style2)
                }
                // if(!this.editable) this.openAddOrUpdate(item)  //未编辑状态下 点击查看
                if (flag) this.openAddOrUpdate(item)
            } else {
                //清除选中以外的样式
                feature_.setStyle(style)
                if (featureEnd) {
                    featureEnd.setStyle(style)
                }
            }
        } else {
            //获取新增的feature对象
            let newFeature = this.vectorLayer.getSource().getFeatureById(item.key)
            //获取红外对射或者振动光纤第二个点的feature对象
            let newFeatureEnd = this.vectorLayer.getSource().getFeatureById(item.key + 'end')
            if (newFeature) {
                if (newFeature === feature || newFeatureEnd === feature) {
                    newFeature.setStyle(style2)
                    if (newFeatureEnd) {
                        newFeatureEnd.setStyle(style2)
                    }
                    if (flag) this.openAddOrUpdate(item) //查看
                } else {
                    //清除选中以外的样式
                    newFeature.setStyle(style)
                    if (newFeatureEnd) {
                        newFeatureEnd.setStyle(style)
                    }
                }
            }
        }
    },
    sendMessage(lineId, stationId, code, type) {
      setTimeout(() => {
        if (!this.$refs.iframe) {
          return
      }
        if (type == 1) {
          this.$refs.iframe.contentWindow.postMessage(
            {
              func: 'init',
              data: {
                  lineId: lineId,
                  stationId: stationId
              }
            },
            this.src
          )
        } else {
          this.$refs.iframe.contentWindow.postMessage(
            {
              func: 'locateByCode',
              data: {
                  lineId: lineId,
                  stationId: stationId,
                  code: code
              }
            },
            this.src
          )
        }
      }, 1000)
    },
    // 树节点过滤
    filterNode (value, data) {
      if (!value) return true
      return data.name.indexOf(value) !== -1
    },
    handleClick (tab) { //左侧tab切换
      if (tab) {
        this.activeName = tab
      }
      if (this.activeName == 1) {
        this.initTreeStationMap()
      } else {
        this.initTreeStationMap(true)
      }
    },
    treeDataDeleteClick (node, data) { //左侧tree取消收藏按钮
      this.$confirm('确认取消该收藏?', '取消收藏', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        closeOnClickModal: false
      })
      .then(() => {
        this.$http({
          url: this.$http.adornUrlEq('/liEnshrine/delete'),
          method: 'post',
          data: {
            resourceId: node.data.id,
            stationId: this.checkedData.sId
          }
        }).then(data => {
          if (data && data.code === 0) {
            this.$message.success('取消收藏成功')
            this.initTreeStationMap(true)
          }
        })
      })
      .catch(() => {})
    },
    treeDataOffClick () { //左侧tree收藏按钮
      let node = this.$refs.tree.getCurrentNode()
      if (node.level != 6) {
        this.$message.warning('只能收藏资源点')
        return
      }
      this.$http({
        url: this.$http.adornUrlEq('/liEnshrine/save'),
        method: 'post',
        data: {
          resourceId: node.id,
          stationId: this.checkedData.sId
        }
      }).then(data => {
        if (data && data.code === 0) {
          if (data.msg === '收藏成功') {
            this.$message.success(data.msg)
          } else {
            this.$message.warning(data.msg)
          }
        }
      })
    },
    pointListClick (item) { //监视器列表点击
      this.currentNode = this.$refs.tree.getNode(item.id).data
      //将选中的层级树节点设置为选中
      this.$refs.tree.setCurrentNode(this.currentNode)
      this.defaultExpandedKeys = [this.currentNode.id]
      this.isFlag(this.treeData, this.currentNode.id)

      if (this.transformationSta == 1) {
        this.queryDetail(item.id)
      }
      this.activeChooseResourceBox(item.id)
      // this.defaultExpandedKeys = [item.id]
      // this.$refs.tree.setCurrentKey(item.id)
    },
    //初始化站点下的资源点
    initTreeStationMap (save) {
      let url = ''
      if (!save) { // 摄像头列表接口路径
        url = this.$http.adornUrlEq('/liResource/getStationMapCodeTreeList')
      } else { // 收藏夹接口路径
        url = this.$http.adornUrlEq('/liEnshrine/getEnshrineStationMapTreeList')
      }

      this.$http({
        url: url,
        method: 'post',
        data: {
          subCode: this.checkedData.subCode,
          stationId: this.checkedData.sId
        }
      }).then(data => {
        if (data && data.code === 0) {
          this.treeData = data.nodes
          this.$refs.tree.updateKeyChildren(this.checkedData.sId, data.nodes)
          if (this.treeData) {
            // Vue.set(this.treeData[0], 'iconB', true)
          }
        }
      }).then(() => {
        if (this.treeData && this.treeData.length > 0) {
          this.defaultExpandedKeys = [this.treeData[0].id]
          // this.$refs.tree.setCurrentNode(this.treeData[0])
        }
        this.initStation(this.checkedData.sId)
      })
    },

    initStation (id) {
      this.$http({
        url: this.$http.adornUrl(`/liStation/getId/${id}`),
        method: 'get',
        params: this.$http.adornParams()
      }).then(data => {
        if (data && data.code === 0) {
          this.station = data.bean
          this.mapList = data.bean.mapList
          if (this.mapList && this.treeData && this.treeData.length > 0) {
            this.mapList.forEach(element => {
              element.readPath = this.urlPath + element.filePath
            })
            this.checkedData.lineId = this.station.lineId
            this.checkedData.lineName = this.station.lineName
            this.checkedData.stationId = this.station.id
            this.checkedData.stationName = this.station.stationName
            this.checkedData.tierId = !this.mapList[0] ? '' : this.mapList[0].id
            if (!this.checkedData.tierId) {
              return
            }
            this.defaultExpandedKeys = [this.mapList[0].id]
            this.isFlag(this.treeData, this.mapList[0].id)
            this.$nextTick(() => {
              this.$refs.tree.setCurrentNode(this.treeData[0])
            })
            this.checkedData.tierName = this.mapList[0].name
            this.stationMap = this.mapList[0]
          }
        }
      }).then(() => {
        if (!this.checkedData.tierId) {
          return
        }
        this.showResourceByMapId()
        if (!this.map) {
            this.initMap()
            this.imgLayerList[0].setVisible(true) //初始第一个显示
            } else {
                this.changeVectorLayer(this.list)
            }
      })
    },

      isFlag(data, id) {
          data.forEach(res => {
              if (res.id === id) {
                  Vue.set(res, 'iconB', true)
              } else {
                  Vue.set(res, 'iconB', false)
              }
              if (res.children) {
                this.isFlag(res.children, id)
              }
          })
      },

    //线路资源点树节点点击事件
    handleNodeClick (node) {
      this.currentNode = node
      let name = node.name
      let id = node.id
      this.isFlag(this.treeData, id)
      // this.treeData.forEach(res => {
      //   if (res.id === id) {
      //     Vue.set(res, 'iconB', true)
      //   } else {
      //     Vue.set(res, 'iconB', false)
      //   }
      // })

      //每次选择节点都先清空资源位

      if (node.level === 4) { //子系统
        this.checkedData.tierId = id
        this.checkedData.tierName = name
        this.checkedData.stationId = node.stationId
        this.stationMap = node
        this.showResourceByMapId()
        this.changeImgControl(id)
        this.changeVectorLayer(this.list)
      } else if (node.level === 6) { //资源点1
        this.checkedData.tierId = node.tierId
        let subNode = this.$refs.tree.getNode(node.tierId).data
        this.list = []
        subNode.children.forEach(res => {
            this.list.push(res)
        })
        this.activeChooseResourceBox(id)
        this.pointListClick(node)
        this.changeImgControl(node.tierId)
        this.changeVectorLayer(this.list)
        let feature = this.vectorLayer.getSource().getFeatureById(id)
        if (feature) {
            for (let i in this.list) {
              if (feature.id_ == that.list[i].id) {
                  this.listItem = that.list[i]
              }
                //flag为ture打开详情或者编辑页面
              this.mapClick(feature, that.list[i], false)
            }
        }

        if (this.transformationSta == 2) {
          console.log(1111111111111)
          this.sendMessage(node.lineId, node.stationId, node.code)
        }
      }
    },
    //激活选中资源点位节点
    activeChooseResourceBox (id, level) {
      this.list.forEach(res => {
        if (res.id === id) {
          Vue.set(res, 'active', true)
        } else {
          Vue.set(res, 'active', false)
        }
      })
    },
    //切换层级
    changeMap (map) {
      //图层缩放级别设置为默认
      this.map.getView().setZoom(1)
      console.log(map.id, '层级 id')
      // console.log('选择的层级', map)
      this.changeImgControl(map.id)

      this.currentNode = this.$refs.tree.getNode(map.id).data
      // console.log('当前要选中的节点', this.currentNode)
      //将选中的层级树节点设置为选中

      this.$refs.tree.setCurrentNode(this.currentNode)
      this.defaultExpandedKeys = [this.currentNode.id]
      this.isFlag(this.treeData, this.currentNode.id)
      // this.$nextTick(() => {
      //     this.$refs.tree.setCurrentNode(this.currentNode)
      // })
      // console.log('当前要选中的节点2', this.currentNode)
      this.checkedData.tierId = map.id
      this.checkedData.tierName = map.name
      this.stationMap = map
      this.showResourceByMapId()
      this.changeVectorLayer(this.list)
    },
    //根据层级id展示当前层级所有的资源点
    showResourceByMapId () {
      let tierNode = this.$refs.tree.getNode(this.checkedData.tierId).data
      // console.log('当前要选中的层级节点', tierNode.children)
      this.list = []
      if (tierNode && tierNode.children) {
        tierNode.children.forEach(subSystem => {
          this.list.push(subSystem)
        })
      }
    },
    //详情
    queryDetail (id) {
      this.queryDetailVisible = true
      this.$nextTick(() => {
        this.$refs.queryDetail.init(id, this.checkedData.sId)
      })
    },
    closeQueryDetailVisible () {
      this.queryDetailVisible = false
    },
    transformation (now) { //2D3D转换
      this.transformationSta = now
      if (now == 2) {
        if (this.currentNode.level == 6) {
          this.sendMessage(this.currentNode.lineId, this.currentNode.stationId, this.currentNode.code)
        } else {
          this.sendMessage(this.lineId, this.stationId, null, 1)
        }
      }
    }

  }

}
</script>
<style lang='scss' scoped>
    .dic_tree {
        background: #f4f4f4;
        font-size: 14px;
        transform: translateX(-6px);
        margin-top: 20px;
    }
    .dic_tree /deep/ .el-tree-node__content {
        padding-left: 0px !important;
    }

    .dic_tree /deep/ .el-tree-node {
        position: relative;
        padding-left: 16px;
    }

    .dic_tree /deep/ .el-tree-node__children {
        padding-left: 8px;
    }

    .dic_tree /deep/ .el-tree-node :last-child:before {
        height: 38px;
    }

    .dic_tree /deep/ .el-tree > .el-tree-node:before {
        border-left: none;
    }

    .tree-container /deep/ .el-tree > .el-tree-node:after {
        border-top: none;
    }

    .dic_tree /deep/ .el-tree-node:before {
        content: "";
        left: -4px;
        position: absolute;
        right: auto;
        border-width: 1px;
    }

    .dic_tree /deep/ .el-tree-node:after {
        content: "";
        left: -4px;
        position: absolute;
        right: auto;
        border-width: 1px;
    }

    .dic_tree /deep/ .el-tree-node:before {
        border-left: 1px dashed #bfbfbf;
        bottom: 0px;
        height: 100%;
        top: -26px;
        width: 1px;
    }

    .dic_tree /deep/ .el-tree-node:after {
        border-top: 1px dashed #bfbfbf;
        height: 20px;
        top: 12px;
        width: 36px;
    }
    .tree-container /deep/ .el-tree > .el-tree-node:after {
        border-top: none;
    }

    .tree-container {
        /* 树的parent,样式自定 */
    }
    .dic_tree /deep/ .el-tree-node__expand-icon.expanded {
        transform: rotate(0deg);
        -webkit-transform: rotate(0deg);
    }
    .dic_tree /deep/ .el-icon-caret-right:before {
        background: url("../../../assets/images/add.png");
        content: "";
        display: block;
        width: 18px;
        height: 18px;
        font-size: 18px;
        background-size: 18px;
    }
    .dic_tree
    /deep/
    .el-tree-node__expand-icon.expanded.el-icon-caret-right:before {
        background: url("../../../assets/images/sub.png");
        content: "";
        display: block;
        width: 18px;
        height: 18px;
        font-size: 18px;
        background-size: 18px;
    }
.dic_tree /deep/.el-tree-node__content > .el-tree-node__expand-icon{
  padding:0 2px 0 0;
}
    .dic_tree /deep/.el-tree-node__expand-icon.is-leaf::before {
        opacity: 0;
    }
    .dic_tree /deep/.is-leaf.el-tree-node__expand-icon.el-icon-caret-right {
      // margin-left: -15px !important;
    }
</style>
<style lang='scss'>
.inputWidth {
  width: 130px;
}

.resource-container {
  width: 100%;
  height: 100%;
  position: relative;
  border: 0px solid black;
  overflow: auto;
  .span-box {
    height: 48px;
    width: 60px;
    font-size: 12px;
    border-radius: 5px;
    /* border: 1px solid red; */
    position: absolute;
    // left: 0;
    // top: 0;
  }
  .span-box.el-icon-wq-qiangji1 {
    height: 60px;
    width: 72px;
  }
  .span-box.el-icon-wq-qiuji1 {
    height: 60px;
    width: 72px;
  }
  .active {
    background-color: #fd949d;
  }
}

.tier-btn {
  .active-tier {
    background-color: #409eff;
    color: #ffffff;
  }
}
.inspect_point {
  .el-tree {
    background: #f4f4f4;
    font-size: 12px;
    overflow-y: auto;
    height: 675px;
  }
  .el-card__body {
    padding: 0;
  }
  .el-card {
    height: 99%;
    background: #f4f4f4;
  }
  .el-tree--highlight-current
    .el-tree-node.is-current
    > .el-tree-node__content {
    background-color: #f4f4f4 !important;
    color: #fff !important;
    .el-button--text {
      color: #fff;
    }
    .custom-tree-node {
      background-color: #35aff8 !important;
    }
  }

  .inspect_point_left_top {
    height: 50px;
    background: #e1edf4;
    padding-left: 10px;
    .inspect_point_left_topL {
      height: 40px;
      padding-top: 10px;
      float: left;
      div {
        height: 40px;
        float: left;
        padding: 0 10px 0 10px;
        border: 1px solid transparent;

        line-height: 40px;
        cursor: pointer;
        font-size: 14px;
        span {
          color: #35aff8;
        }
      }
      div.on {
        background: #fff;
        border: 1px solid #c3c3c3;
        border-bottom: none;
        font-family: Microsoft YaHei;
        font-weight: 400;
      }
    }
    .inspect_point_left_topR {
      float: right;
      margin-top: 10px;
      .el-input {
        width: 109px;
      }
    }
  }
  .inspect_point_right_button {
    position: relative;
    height: 50px;
    width: 100%;
    background: #e3e4e6;
    inspect_point_right_button_l {
      margin-left: 20px;
    }
    .el-button--primary {
      margin-top: 10px;
      background: #ced1d6;
      border: none;
      color: #656565;
    }
    .tier-btn .active-tier {
      background-color: #409eff;
      color: #ffffff;
    }
    .el-button:hover {
      background: #fff;
      border-color: #32a5ea;
      color: #32a5ea;
    }

  }
  .inspect_point_right_button_r {
      position: absolute;
      right: 20px;
      top: 60px;
      width: 95px;
      height: 26px;
      z-index: 10;
      font-size: 12px;
      line-height: 25px;
      overflow: hidden;
      border-radius: 13px;
      background: #ced1d6;
      border: 1px solid rgba(0, 0, 0, 0.2);
      box-shadow: 0px 1px 0px 1px rgba(255, 255, 255, 0.25),
        0px 2px 4px 0px rgba(0, 0, 0, 0.1);
      div {
        width: 46px;
        height: 24px;
        float: left;
        text-align: center;
        cursor: pointer;
      }
      div.on {
        background: #45b5f8;
        color: #fff;
        border-radius: 13px;
        border: 1px solid rgba(23, 41, 71, 0.5);
        box-shadow: 0px 1px 0px 0px rgba(255, 255, 255, 0.3),
          0px 2px 0px 0px rgba(255, 255, 255, 0.15);
      }
    }
  .map_right {
    // border:1px solid #F00;
    // margin-top:50px;
    iframe  {
      width: 100%;
      height: 705px;
    }
  }
}
.ol-overviewmap .ol-overviewmap-map{
  height: 110px!important;
}
// openlayer 样式
.resource-container {
  .ol-overviewmap {
    left: 89%;
  }
}
</style>