<template>
  <div style="height:100%;">
    <div class="map" v-if="!hasCommunityId">
      <ai-title title="房屋地图" is-show-bottom-border style="margin-left: 20px"/>
      <div id="map" ref="rootmap" @click="hidePopup"/>
      <div class="map-area">
        <div class="map-area__container">
          <div class="map-area__left">
            <div class="left">
              <i class="iconfont iconLocation"></i>
              <span>{{ areaName }}</span>
            </div>
            <el-input placeholder="请输入姓名、房屋" v-model="community"
                      @focus="isShowSearch = true, isShowArea = false"></el-input>
            <i class="search-icon iconfont iconSearch" @click="search(false)"></i>
          </div>
        </div>
        <div class="search-result" v-if="isShowSearch && searchList.length">
          <div class="search-result__item" v-for="(item, index) in searchList" :key="index"
              @click="chooseCommunity(item)">
            <i class="search-icon iconfont iconLocation"></i>
            <h2 v-if="type != 1">{{ item.residentName }}</h2>
            <span v-if="type != 1">{{ item.createAddress }}</span>
            <h2 v-if="type == 1">{{ item.name }}</h2>
            <span v-if="type == 1">{{ item.homesteadAddress }}</span>
          </div>
        </div>
      </div>
      <div class="community-info" v-show="isShowInfo">
        <div class="community-info__close" title="关闭" @click="info = {}, isShowInfo = false,chooseBuildId=''">
          <i class="iconClean iconfont"></i>
        </div>
        <div class="community-info__header">
          <h2 v-if="!info.name">{{ info.createAddress }}</h2>
          <h2 v-if="info.name">{{ info.homesteadAddress }}</h2>
          <div>{{ info.lng }},{{ info.lat }}</div>
        </div>
        <div class="community-info__wrapper" v-if="info.name">
          <h2>户主信息</h2>
          <div class="community-info__item">
            <label>所属村</label>
            <span>{{info.areaName}}</span>
          </div>
          <div class="community-info__item">
            <label>姓名</label>
            <span style="color:#2266FF;">{{info.name}}</span>
          </div>
          <div class="community-info__item">
            <label>联系电话</label>
            <span style="color:#2266FF;">{{info.phone}}</span>
          </div>
          <div class="community-info__item">
            <label>性别</label>
            <span>{{info.sex == 1 ? '男' : '女'}}</span>
          </div>
          <div class="community-info__item">
            <label>年龄</label>
            <span>{{info.age}}</span>
          </div>
          <div class="community-info__item bg-fff"></div>
        </div>
        <div class="community-info__wrapper" v-if="info.name">
          <h2>宅基地信息</h2>
          <div class="community-info__item">
            <label>住宅建筑面积</label>
            <span>{{info.liveBuildingArea}}m²</span>
          </div>
          <div class="community-info__item">
            <label>建筑层数</label>
            <span>{{info.buildingFloorNumber}}层</span>
          </div>
          <div class="community-info__item">
            <label>建筑高度</label>
            <span>{{info.buildingHeight}}m</span>
          </div>
        </div>
        <div class="community-info__wrapper" v-if="!info.name">
          <h2>房屋信息</h2>
          <div class="community-info__item">
            <label>所属社区</label>
            <span>{{ info.areaName}}</span>
          </div>
          <div class="community-info__item">
            <label>所属小区</label>
            <span>{{ info.communityName }}</span>
          </div>
          <div class="community-info__item">
            <label>房屋类型</label>
            <span>{{ dict.getLabel("communityBuildingType",info.buildingType) }}</span>
          </div>
          <div class="community-info__item">
            <label>楼长姓名</label>
            <span>{{ info.managerName }}</span>
          </div>
          <div class="community-info__item">
            <label>楼长电话</label>
            <span>{{ info.managerPhone}}</span>
          </div>
        </div>
        <div class="community-btn" v-if="!info.name">
          <el-button icon="iconfont iconloudongmoxing" size="small"
                    @click="showStatistics=true; $router.push({query: {communityId: info.communityId, buildingId: info.id,unitNum:house ? house.unitNumber : 1,buildingNumber:info.buildingNumber}})">楼栋模型
          </el-button>
        </div>
      </div>
      
      <div class="map-menu">
        <div class="map-menu__item">
          <div class="map-layers__wrapper">
            <div class="map-layers">
              <div class="map-layers__item" @click="switchLayer(false)"
                  :class="[!isImageMap ? 'map-layers__item-active' : '']">
                <img src="https://cdn.cunwuyun.cn/AppCommunityMap/dz.png" alt="">
                <div class="map-layers__item--tag" :class="[!isImageMap ? 'map-layers__item--tag-active' : '']">地图</div>
              </div>
              <div class="map-layers__item" @click="switchLayer(true)"
                  :class="[isImageMap ? 'map-layers__item-active' : '']">
                <img src="https://cdn.cunwuyun.cn/AppCommunityMap/yx.png" alt="">
                <div class="map-layers__item--tag" :class="[isImageMap ? 'map-layers__item--tag-active' : '']">卫星</div>
              </div>
            </div>
          </div>
          <i class="iconfont iconEarth"></i>
        </div>
        <div class="map-menu__item" @click="changeZoom(true)">
          <i class="iconfont iconfangda"></i>
        </div>
        <div class="map-menu__item" @click="changeZoom()">
          <i class="iconfont iconsuoxiao"></i>
        </div>
      </div>
    </div>
    <building-statistics :instance="instance" :dict="dict" v-if="hasCommunityId"/>
  </div>
</template>

<script>
import AMapLoader from '@amap/amap-jsapi-loader'
import {mapState} from 'vuex'
import BuildingStatistics from "./buildingStatistics"

export default {
  name: 'AppHouseMap',
  label: '房屋地图',
  components: {BuildingStatistics},
  provide() {
    return {
      root: this
    }
  },
  props: {
    instance: Function,
    dict: Object
  },
  data() {
    return {
      map: null,
      community: '',
      isShowLayer: false,
      isShowSearch: false,
      isShowArea: false,
      styleFunction: null,
      areaData: {},
      isImageMap: false,
      isShowInfo: false,
      areaId: '',
      areaName: '',
      list: [],
      areaList: [],
      info: {},
      resident:null,
      satellite: null,
      zoom: 11,
      chooseBuildId: '',
      buildList: [],
      searchList: [],
      house:null,
      center: [],
      type: '0',
      showStatistics: false
    }
  },
  computed: {
    ...mapState(['user']),

    hasCommunityId() {
      return !!this.$route.query?.communityId
    }
  },

  watch: {
    community: {
      deep: true,
      handler() {
        this.debounce(this.search, 500)
      }
    },
    hasCommunityId(v) {
      if (!v) {
        this.getCorpLocation()
      }
    },
    showStatistics: {
      deep: true,
      handler() {
        this.debounce(this.getCorpLocation, 500)
      }
    },
  },

  created() {
    this.dict.load('householdRelation','communityBuildingType')
  },

  mounted() {
    this.areaId = this.user.info.areaId
    this.areaName = this.user.info.areaName
    this.initMap()
  },

  methods: {
    changeZoom(isAdd) {
      const zoom = isAdd ? this.map.getZoom() + 1 : this.map.getZoom() - 1
      this.map.setZoom(zoom, false, 600)
    },

    debounce(fn, wait) {
      if (this.timer !== null) {
        clearTimeout(this.timer)
      }
      this.timer = setTimeout(fn, wait)
    },

    search() {
      if(this.type === '') {
        this.searchList = []
        this.$message.error('请先选择房屋类型')
        return
      }
      this.isShowArea = false
      var url = '/app/appcommunityhouseinfo/queryHouseByName'
      if(this.type == 1) {
        url = '/app/apphomesteadinfo/list'
      }
      this.instance.post(url, null, {
        params: {
          current: 1,
          size: 20,
          areaId: this.user.info.areaId,
          name: this.community
        }
      }).then(res => {
        if (res.code === 0) {
          var data = []
          if(this.type == 1) {
            data = res.data.records
          }else {
            data = res.data
          }

          if (data.length) {
            this.searchList = data
          } else {
            this.$message.error('未搜索到结果')
            this.searchList = []
          }
        }
      })
    },

    getBuildInfo(id, type) {
      var url = `/app/apphomesteadinfo/queryDetailById?id=${id}`
      if(type == 0) {
        url= `/app/appcommunityhouseinfo/queryDetailByIdWithBuilding?buildId=${id}`
      }
      this.instance.post(url).then(res => {
        if (res.code === 0) {
          if(type == 1) {
            this.info = res.data
          }else {
            this.info = res.data.build
            this.resident = null;
          }
          this.$nextTick(() => {
            this.isShowInfo = true
          })
        }
      })
    },

    chooseCommunity(item) {
      if(item.name) { //宅基地
        if(!item.lng || !item.lat) {
          return this.$message.error('未获取到该房屋坐标信息')
        }else {
          this.map.setZoomAndCenter(18, [item.lng, item.lat], false, 600)
          this.info = item
          this.$nextTick(() => {
            this.isShowSearch = false
            this.isShowInfo = true
          })
        }
        
      }else { //楼栋
        this.instance.post(`/app/appcommunityhouseinfo/queryDetailByIdWithBuilding`,null,{
        params:{
          buildId:item.buildingId,
          houseId:item.id,
          residentId:item.residentId
        }
      }).then(res => {
        if (res.code === 0) {
          if (!res.data.build?.lng || !res.data.build?.lat) {
            this.isShowInfo = true
            this.isShowSearch = false
            this.info = res.data.build;
            return this.$message.error('未获取到该房屋坐标信息')
          } else {
            this.chooseBuildId = res.data.build.id
            this.house = res.data.house
            this.resident = res.data.resident;
          }

          this.map.setZoomAndCenter(18, [res.data.build?.lng, res.data.build?.lat], false, 600)
          this.info = res.data.build
          this.$nextTick(() => {
            this.isShowSearch = false
            this.isShowInfo = true
          })
        }
      })
      }
    },

    toCenter() {
      this.map.setZoomAndCenter(this.zoom, this.center, false, 600)
    },

    renderClusterMarker(context) {
      let el = `<div class="polymeric">
        <div class="polymeric-container">
          <p>${context.count}</p>
        </div>
      </div>`

      let offset = new AMap.Pixel(-9, -9)
      context.marker.setContent(el)
      context.marker.setOffset(offset)
      context.marker.lnglat = context.clusterData[0].lnglat

      context.marker.on('click', e => {
        this.map.setZoomAndCenter(this.map.getZoom() + 2, e.target.lnglat, false, 500)
      })
    },

    renderMarker(context) {
      const buildId = context.data[0].id
      let el = ''
      var urlType = ''
      if(context.data[0].communityName == context.data[0].buildingNumber) { //宅基地
        urlType = 1
        el = `<div class="mark" id="buildId-${buildId}" style="${buildId === this.chooseBuildId?'background-color:#2266FF':'background-color:#FF701A'}">
         <div class="mark-contaienr">
            <span>${context.data[0].areaName}</span>&nbsp;&nbsp;
            <span>${context.data[0].communityName}</span>
          </div>
        <div class="arrow" style="${buildId === this.chooseBuildId?'border-top-color: #2266FF':'border-top-color:#FF701A'}"></div>
      </div>`
      }else {
        urlType = 0
        el = `<div class="mark" id="buildId-${buildId}" style="${buildId === this.chooseBuildId?'background-color:#2266FF':''}">
         <div class="mark-contaienr">
            <span>${context.data[0].communityName}</span>&nbsp;&nbsp;
            <span>${context.data[0].buildingNumber}栋</span>
          </div>
        <div class="arrow" style="${buildId === this.chooseBuildId?'border-top-color: #2266FF':''}"></div>
      </div>`
      }

      context.marker.setContent(el);
      context.marker.setAnchor("center")
      context.marker.id = `${buildId}`
      context.marker.lnglat = context.data[0].lnglat
      context.marker.urlType = urlType

      context.marker.on('click', e => {
        this.chooseBuildId = e.target.id
        this.getBuildInfo(e.target.id, e.target.urlType)
        context.marker.setContent(el);
        document.querySelectorAll('.mark').forEach(el => {
          el.style['background-color'] = '#0F8F64'
          el.querySelector('.arrow').style['border-top-color'] = '#0F8F64'
        })
        document.querySelector(`#buildId-${e.target.id}`).style['background-color'] = '#2266FF'
        document.querySelector(`#buildId-${e.target.id}`).querySelector('.arrow').style['border-top-color'] = '#2266FF'
        // this.map.setZoomAndCenter(this.map.getZoom() + 2 + 0.00001, e.target.lnglat, false, 300)
      })
    },

    addMakert(points) {
      new AMap.MarkerClusterer(this.map, points, {
        gridSize: 60,
        maxZoom: 15,
        clusterByZoomChange: false,
        renderClusterMarker: this.renderClusterMarker,
        renderMarker: this.renderMarker
      })
    },

    getCommunityList() {
      this.instance.post('/app/appcommunitybuildinginfo/listByBuildingAndHomestead', null, {
        params: {
          current: 1,
          size: 1000000
        }
      }).then(res => {
        if (res.code === 0) {
          this.buildList = res.data
          const points = res.data.map(item => {
            return {
              lnglat: [item.lng, item.lat],
              id: item.id,
              corpId: item.corpId,
              areaName:item.areaName,
              buildingNumber: item.name || item.buildingNumber,
              communityName:item.name || item.communityName,
            }
          })

          this.addMakert(points)
        }
      })
    },

    hidePopup() {
      this.isShowArea = false
      this.isShowSearch = false
    },

    switchLayer(flag) {
      if (flag) {
        this.map.addLayer(this.satellite)
      } else {
        this.map.removeLayer(this.satellite)
      }

      this.isImageMap = flag
    },

    initMap() {
      AMapLoader.load({
        key: 'b553334ba34f7ac3cd09df9bc8b539dc',
        version: '2.0',
        plugins: ['AMap.ToolBar', 'AMap.Scale', 'AMap.MouseTool', 'AMap.MarkerClusterer'],
        AMapUI: {
          version: '1.1',
          plugins: []
        }
      }).then((AMap) => {
        this.map = new AMap.Map('map', {
          resizeEnable: true,
          zooms: [6, 20],
          zoom: this.zoom
        })
        this.satellite = new AMap.TileLayer.Satellite()
        this.getCommunityList()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.no-more {
  display: block;
  height: 60px;
  line-height: 60px;
  margin-top: 2px;
  text-align: center;
  font-size: 12px;
  color: #999;
  width: 100%;
}

::v-deep .ai-list__content--right-wrapper{
  height: 100%;
  margin: 0px !important;
  background-color: transparent !important;
  box-shadow: none !important;
}


.map {
  ::v-deep .amap-logo, ::v-deep .amap-copyright {
    display: none !important;
  }

  ::v-deep .amap-icon {
    width: 40px !important;
    height: 40px !important;

    img {
      width: 100%;
      height: 100%;
    }
  }
}

.community-btn {
  margin: 16px auto 20px;
  text-align: center;
}

.community-info__star {
  margin-top: 4px;
  margin-bottom: 8px;

  .community-info__star--content {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    color: #666666;
    font-size: 12px;

    span {
      flex: 1;
      text-align: center;

      &:first-child {
        text-align: left;
      }

      &:last-child {
        text-align: right;
      }
    }

    &:nth-of-type(2n) {
      background: #fff;
    }
  }

  .community-info__star--tab {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 12px;
    user-select: none;
    background: #fff;

    span {
      height: 100%;
      line-height: 36px;
      color: #999999;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      border-bottom: 2px solid transparent;

      &:first-child {
        margin-right: 16px;
      }

      &.star-active {
        color: #2266FF;
        border-bottom: 2px solid #2266FF;
      }
    }
  }
}

.community-info__item--imgs {
  display: block !important;
  height: auto !important;

  label {
    height: 36px;
    line-height: 36px;
  }

  .community-info__item--img {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding-bottom: 10px;
    overflow: hidden;

    img {
      width: 69px;
      height: 69px;
      margin-right: 4px;
      margin-bottom: 4px;
      cursor: pointer;

      &:nth-of-type(4n) {
        margin-right: 0;
      }

      &:last-child {
        margin-right: 0;
      }
    }
  }
}

.map-menu {
  position: absolute;
  bottom: 52px;
  left: 30px;
  z-index: 11;

  .map-layers__wrapper {
    display: none;
    position: absolute;
    bottom: 28px;
    left: 0;
    padding-bottom: 4px;
  }

  .map-layers {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 180px;
    height: 66px;
    margin-bottom: 4px;
    padding: 5px;
    background: #FFFFFF;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1);
    border-radius: 2px;

    .map-layers__item {
      position: relative;
      width: 80px;
      height: 56px;
      margin-right: 10px;
      cursor: pointer;
      user-select: none;
      border: 1px solid transparent;

      &.map-layers__item-active {
        border: 1px solid #366FFF;
      }

      .map-layers__item--tag {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 32px;
        height: 18px;
        line-height: 18px;
        text-align: center;
        color: #fff;
        font-size: 12px;
        border: 1px solid transparent;
        background: transparent;

        &.map-layers__item--tag-active {
          background: #366FFF;
        }
      }

      img {
        width: 100%;
        height: 100%;
      }

      &:last-child {
        margin-right: 0;
      }
    }
  }

  .map-menu__item {
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    background: #FFFFFF;
    box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    cursor: pointer;
    user-select: none;

    &:hover {
      .map-layers__wrapper {
        display: block;
      }
    }

    &:last-child {
      margin-bottom: 0;
    }

    i {
      font-size: 16px;
      color: #89b;
    }
  }
}

.switch-layer {
  position: absolute;
  bottom: 4.6em;
  left: .56em;
  z-index: 11;
  width: 29px;
  height: 29px;
  padding: 3px;
  color: #fff;
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  cursor: pointer;

  .switch-layer__wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: rgba(0, 60, 136, 0.5);

    &:hover {
      background-color: rgba(0, 60, 136, 0.7);
    }
  }
}

.map {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;

  ::v-deep .ol-zoom {
    display: none !important;
    top: inherit !important;
    bottom: 0.5em !important;
  }

  div {
    box-sizing: border-box;
  }

  #map {
    width: 100%;
    height: 100%;
  }
}

.community {
  display: flex;
  align-items: center;
  position: relative;
  height: 28px;
  padding: 0 10px;
  background: #0F8F64;
  border-radius: 26px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;

  &.color1 {
    background: #2266FF;

    em:after {
      border-top-color: #2266FF !important;
    }
  }

  &.color2 {
    background: #F46159;

    em:after {
      border-top-color: #F46159 !important;
    }
  }

  em {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translate(-50%, 0);

    &::after {
      position: absolute;
      bottom: -6px;
      left: 0;
      width: 0;
      height: 0;
      border: 6px solid #0F8F64;
      border-bottom-color: transparent;
      border-left-color: transparent;
      border-right-color: transparent;
      transform: translate(-50%, 0);
      overflow: hidden;
      content: ' ';
    }
  }

  i {
    padding-right: 2px;
    position: relative;
    color: #ffc928;
    font-size: 16px;
    font-style: normal;
  }
}

::v-deep .polymeric {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;

  &.polymeric-active {
    .polymeric-container {
      background: #F46159;
    }

    &::after {
      background-color: #F46159;
    }
  }

  &::after {
    position: absolute;
    z-index: -1;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    -webkit-animation: warn 1s ease-out 0s infinite;
    animation: warn 1s ease-out 0s infinite;
    background-color: rgba(15, 143, 100, 1);
    transform: translate(-50%, -50%);
    content: " ";
  }

  .polymeric-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(15, 143, 100, 1);

    p {
      text-align: center;
      width: 58px;
      color: #fff;
      font-size: 18px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    p:first-child{
      font-size: 14px;
    }

    h2 {
      color: #fff;
      font-weight: normal;
      font-size: 12px;
    }
  }
}

::v-deep .mark{
  user-select: none;
  cursor: pointer;
  height: 32px;
  border-radius: 26px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0F8F64;
  box-sizing: border-box;
  padding: 0 12px;

  .mark-contaienr{
    color: white;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .arrow{
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -21px;
    width: 0;
    height: 0;
    border: 12px solid transparent;
    border-top: 12px solid #0F8F64;
  }

}

@-webkit-keyframes warn {
  0% {
    transform: scale(.5);
    opacity: 1
  }

  30% {
    opacity: .5
  }

  to {
    transform: scale(1.8);
    opacity: 0
  }
}

@keyframes warn {
  0% {
    transform: scale(.5);
    opacity: 1
  }

  30% {
    opacity: .5
  }

  to {
    transform: scale(1.4);
    opacity: 0
  }
}

.community-info {
  position: absolute;
  top: 58px;
  right: 10px;
  width: 320px;
  height: calc(100% - 117px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 111;
  box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  background: #fff;

  .community-info__close {
    position: absolute;
    right: 0;
    top: 0;
    padding: 16px 12px 0 12px;
    font-size: 16px;
    color: #fff;
    cursor: pointer;

    &:hover {
      opacity: 0.6;
    }
  }

  &::-webkit-scrollbar {
    width: 6px;
    height: 1px;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: rgba(144, 147, 153, .5);
  }

  .community-info__header {
    min-height: 92px;
    padding: 12px;
    background: #2266FF;

    h2 {
      max-width: 260px;
      margin: 0;
      color: #fff;
      font-size: 18px;
      font-weight: 500;
      margin-bottom: 20px;
    }

    div {
      display: flex;
      align-items: center;
      color: #D2E0FF;
      font-size: 12px;
    }

    span {
      display: block;
      margin-top: 4px;
      font-style: normal;
      color: #D2E0FF;
      font-size: 12px;
    }
  }

  .community-info__table {
    margin: 4px 0;
    font-size: 0;

    .community-info__table--item {
      display: inline-block;
      width: 25%;
      font-size: 12px;
      color: #333;

      span {
        display: block;
        width: 80px;
        height: 48px;
        padding: 8px 10px;
        text-align: center;
        box-sizing: border-box;
        background: #fff;
        border-bottom: 1px solid #DEE6F3;
        border-right: 1px solid #DEE6F3;
      }

      h2 {
        width: 80px;
        height: 40px;
        line-height: 40px;
        font-size: 12px;
        text-align: center;
        font-weight: normal;
        box-sizing: border-box;
        background: #F3F6F9;
        border-bottom: 1px solid #DEE6F3;
        border-right: 1px solid #DEE6F3;
      }

      &:last-child {
        border-right: none;
      }
    }
  }

  .community-info__wrapper {
    h2 {
      height: 36px;
      line-height: 36px;
      margin: 0;
      padding: 0 12px;
      font-size: 12px;
      font-weight: 900;
      background: #F3F6F9;
    }

    .community-info__item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 12px;
      font-size: 12px;
      color: #333;
      background: #fff;

      &:nth-of-type(2n) {
        background: #F3F6F9;
      }

      span {
        max-width: 70%;
        text-align: right;
      }

      label {
        flex-shrink: 1;
        color: #333;
      }
    }

    &.community-info__wrapper--last {
      .community-info__item {
        background: #fff;

        &:nth-of-type(2n-1) {
          background: #fff;
        }
      }
    }

    .bg-fff{
      background-color: #fff!important;
    }
  }
}

.map-area__list {
  position: absolute;
  top: 51px;
  left: 0;
  z-index: 111;
  width: 320px;
  overflow-y: auto;
  box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  background: #fff;

  .content {
    padding: 10px 20px;
    font-size: 0;

    h2 {
      margin-bottom: 10px;
      color: #5088FF;
      font-size: 12px;
      cursor: pointer;
    }

    span {
      display: inline-block;
      margin-right: 10px;
      margin-bottom: 10px;
      color: #333;
      font-size: 12px;
      cursor: pointer;
      transition: all 0.3s ease;

      &:hover {
        color: #5088FF;
      }
    }
  }

  .top {
    height: 36px;
    line-height: 36px;
    padding: 0 20px;
    border-bottom: 1px solid #EEEEEE;

    h2 {
      font-weight: normal;
      color: #666666;
      font-size: 12px;
    }
  }
}

.search-result {
  position: absolute;
  top: 51px;
  left: 0;
  z-index: 111;
  width: 360px;
  height: 216px;
  overflow-y: auto;
  box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
  border-radius: 2px;
  background: #fff;

  &::-webkit-scrollbar {
    width: 6px;
    height: 1px;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: rgba(144, 147, 153, .5);
  }

  .search-result__item {
    display: flex;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    &:hover {
      background: #f5f7fa;
    }

    i {
      position: relative;
      top: 2px;
      color: #ccc;
      font-size: 16px;
    }

    h2 {
      padding: 0 8px 0 10px;
      color: #333333;
      font-size: 14px;
    }

    span {
      max-width: 240px;
      color: #999999;
      font-size: 12px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
}

.map-area {
  position: absolute;
  top: 58px;
  left: 10px;
  z-index: 111;

  .map-area__container {
    display: flex;

    .map-area__left {
      display: flex;
      align-items: center;
      width: 360px;
      height: 36px;
      padding: 0 16px 0 0;
      box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
      border-radius: 2px;
      cursor: pointer;
      user-select: none;
      background: #fff;

      .left {
        display: flex;
        position: relative;
        align-items: center;
        height: 100%;
        line-height: 1;
        padding: 0 20px 0 8px;

        &:hover {
          opacity: 0.6;
        }

        &:after {
          position: absolute;
          right: 0;
          top: 50%;
          width: 1px;
          height: 24px;
          background: #DDDDDD;
          transform: translateY(-50%);
          box-shadow: -1px 0px 0px 0px #DDDDDD;
          border-radius: 2px 0 0 0;
          opacity: 0.9;
          content: ' ';
        }

        span {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          font-size: 12px;
          color: #333;
        }

        i {
          font-size: 16px;
        }
      }

      ::v-deep .el-input, ::v-deep input {
        border: none;
      }

      ::v-deep input {
        position: relative;
        flex: 1;
        height: 36px;
        padding: 0 32px 0 16px;
        font-size: 14px;
        border: none;
      }

      .search-icon {
        &:after {
          position: absolute;
          left: -16px;
          top: 50%;
          width: 1px;
          height: 24px;
          background: #DDDDDD;
          transform: translateY(-50%);
          box-shadow: -1px 0px 0px 0px #DDDDDD;
          border-radius: 2px 0 0 0;
          opacity: 0.9;
          content: ' ';
        }
      }

      i {
        position: relative;
        color: #89B;
      }
    }
    .map-area__right{
      margin-left: 16px;
    }
  }
}
</style>
