<template>
  <div class="app-container">
    <van-nav-bar
      title="土地列表管理"
      left-arrow
      placeholder
      safe-area-inset-top
      @click-left="onClickLeft"
    />
    <div class="search_box">
      <div class="left">
        <van-field v-model="value" left-icon="search" placeholder="请输入用户名" />
      </div>
      <van-button type="primary" round >搜索</van-button>
    </div>

    <div class="location" :id="locationMap">
      <img src="../../assets/images/app/location.png" alt="">
    </div>

    <div id="full-screen-acceptance" style="width: 100%;height:100vh;">
      <!--<div id="landMapDiv"></div>-->
      <div id="landMapBox"></div>
<!--      <div id='land-btn-wrap'>-->
<!--        <el-row>-->
<!--          <input id="drawPolygon" class="ant-btn ant-btn-red" type="button" value="画图"/>&nbsp;&nbsp;-->
<!--          &lt;!&ndash; <input id="drawRemove" type="button" class="ant-btn ant-btn-red" value="取消画图"/>&nbsp;&nbsp; &ndash;&gt;-->
<!--          <input id="drawReset" type="button" class="ant-btn ant-btn-red" value="还原"/>-->
<!--        </el-row>-->
<!--      </div>-->
    </div>



      <van-popup v-model="open" position="bottom" round >
        <div class="landPopup">
          <p class="landPopup_title">属性数据 <img  @click="$router.push({name:'appAttributeEdit',query:{fid:form.fid}})" src="../../assets/images/app/edit.png" width="25" alt=""></p>
          <van-field readonly v-model="form.deptName" label="区域位置名称" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.bsm" label="标识码" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.ysdm" label="要素代码" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dkbm" label="地块代码" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dkmc" label="地块名称" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.syqxz" label="所有权性质" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dklb" label="地块类别" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.tdlylx" label="土地利用类型" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dldj" label="地力等级" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.tdyt" label="土地用途" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.sfjbnt" label="是否基本农田" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dkdz" label="地块东至" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dkxz" label="地块西至" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dknz" label="地块南至" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dkbz" label="地块北至" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.dkbzxx" label="备注信息" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.zjrxm" label="指界人姓名" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.txmj" label="图显面积" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.scmjm" label="实测面积" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.sfzwd" label="是否账外地" placeholder="请输入" input-align="right" label-width="auto" />

          <p class="landPopup_title">经营数据 <img @click="$router.push({name:'appOperateEdit',query:{dkbm:form.dkbm}})" src="../../assets/images/app/edit.png" width="25" alt=""></p>
          <van-field readonly v-model="form.jymj" label="经营面积(亩)" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.jyfs" label="经营方式" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.jydxmc" label="经营对象名称" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.jykssj" label="经营开始时间" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.jyjssj" label="经营结束时间" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.cbje" label="承包金额(元)" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.surveyStatus" label="调查状态" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly v-model="form.bzxx" label="备注信息" placeholder="请输入" input-align="right" label-width="auto" />
          <van-field readonly label="实物图" placeholder="" input-align="right" label-width="auto" />
          <div v-if="!!form.dkImg">
            <el-tooltip effect="light" :content="item" placement="bottom" v-for="(item, index) in form.dkImg.split(',')" :key="index">
              <el-image style="height: 64px; width: 64px; margin: 2px; display: inline-block;" fit="scale-down" :src="baseRoutingUrll + item" :preview-src-list="form.dkImg.split(',').map((x) => baseRoutingUrll + x)"/>
            </el-tooltip>
          </div>
          <div class="footer_main">
            <van-button type="danger" @click="open = false" hairline size="large">关闭弹窗</van-button>
          </div>
        </div>
      </van-popup>

  </div>
</template>
<script>
  import { listLand, listLandQuery,getLand, getLandDetail, getLandDetailByDkbm, delLand, addLand, updateLand, printLand } from "@/api/resource/land"
  import { getOperationDetailByDkbm } from "@/api/resource/operation"
  import { areaSavePri, cleanSavePri } from "@/api/gis/map"
  import { getToken } from "@/utils/auth"
  import Treeselect from "@riophae/vue-treeselect";
  import { Splitpanes, Pane } from "splitpanes"
  import "@riophae/vue-treeselect/dist/vue-treeselect.css"
  import "splitpanes/dist/splitpanes.css"
  import { deptTreeSelect } from "@/api/system/user"
  import {getConfigKey} from "@/api/system/config";
  import {getDept,getInfoByImportCode} from "@/api/system/dept";
  import MapField from "@/components/house/MapField";
  import {Toast} from "vant";
  import $ from "jquery";


  export default {
    name: "contractedVillageContractor",
    components: { Treeselect, Splitpanes, Pane,MapField },
    data() {
      return {
        baseRoutingUrll:'/api',
        form: {},                         // 地块信息表单参数
        map: "",                          // 地图
        mapGeoServerUrl: "",              // geoserver地址
        mapCenterLocation: [],            // 地图中心坐标
        landLayerName: "",                // 地块图层名称
        landLayer: "",                    // 地块图层
        mapBorder: "",                    // 地图边界
        villageBorderLayerName: "",       // 乡镇边界图层名称
        vectorLayer: "",                  // 绘制的矢量图层

        title: "",                        // 弹出层标题
        open: false,                      // 是否显示地块弹出层
        syqxzOptions: [],                 // 所有权性质字典
        syqxzText: null,                  // 所有权性质标签名
        showOwnership: false,             // 控制所有权性质字典弹出层的显示和隐藏
        dklbOptions: [],                  // 地块类别字典
        dklbText: null,                   // 地块类别标签名
        showLandCategory: false,          // 控制的地块类别字典弹出层的显示和隐藏
        dldjOptions: [],                  // 地力等级字典
        dldjText: null,                   // 地力等级标签名
        showLandGrade: false,             // 控制地力等级字典弹出层的显示和隐藏
        tdytOptions: [],                  // 土地用途字典
        tdytText: null,                   // 土地用途标签名
        showLandPurpose: false,           // 控制土地用途字典弹出层的显示和隐藏
        tdlylxOptions: [],                // 土地利用类型
        tdlylxText: null,                 // 土地利用类型标签名
        showLandType: false,              // 控制土地利用类型字典弹出层的显示和隐藏
        sfjbntOptions: [],                // 是否基本农田字典
        showSaveBtn: false,               // 控制保存按钮的显示隐藏
        showDeleteBtn: false,             // 控制删除按钮的显示隐藏
        // isDisabled: false,                // 是否禁用
        taskStatus: null,                 // 调查任务的完成状态：1表示已完成，2表示未完成
        landCategory: ['10'],             // 地块类别

        showLegend:true,
        value:'',
        deptId:100,
        importCode:'',
        locationMap: this.guidProduct(),

      };
    },
    computed: {
      isAndroid() {
        return !!window._Native_object;
      },
      hasSelectLocationMode() {
        return this.isAndroid && typeof(window._Native_object.SelectLocationMode) === 'function';
      },
      hasGetLocationTimeout() {
        return this.isAndroid && typeof(window._Native_object.GetLocationTimeout) === 'function';
      },
      hasGetLocationMode() {
        return this.isAndroid && typeof(window._Native_object.GetLocationMode) === 'function';
      },
    },
    created() {
      console.log(this.$store.getters.user.user.dept.deptId)
      this.deptId = this.$store.getters.user.user.dept.deptId;
      this.importCode = this.$store.getters.user.user.dept.importCode;
      // 获取geoserver的地址
      this.getGeoServerUrl();
      // 获取地块图层名称
      this.getLandLayerName();
      // 获取村边界的图层名称
      this.getVillageBorderLayerName();
    },
    mounted() {
      // 初始化地图
      listLandQuery().then(response => {
        setTimeout(() => {
          this.initMap(response.rows);
        }, 500);
      });
    },
    methods: {
      onClickLeft(){
        history.back(-1);
      },
      // 获取geoserver的地址
      getGeoServerUrl() {
        getConfigKey("system.geoServer.url").then(response => {
          this.mapGeoServerUrl = response.msg;
        });
      },
      // 获取地块图层名称
      getLandLayerName() {
        getConfigKey("geoserver.layer.resourceLand").then(response => {
          this.landLayerName = response.msg;
        });
      },
      // 获取村边界的图层名称
      getVillageBorderLayerName() {
        getConfigKey("geoserver.layer.villageBorder").then(response => {
          this.villageBorderLayerName = response.msg;
        });
      },
      guidProduct(){
        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
          var r = Math.random() * 16 | 0,
            v = c == 'x' ? r : (r & 0x3 | 0x8);
          return v.toString(16);
        });
      },
      // 初始化地图
      initMap(resourceList) {
        getDept(this.deptId).then(response => {
          let dept = response.data;
          if (dept.longitude && dept.latitude) {
            this.mapCenterLocation = [dept.longitude, dept.latitude];
          } else {
            this.mapCenterLocation = [116.391458, 39.902377];
          }
          document.getElementById("landMapBox").innerHTML = "";
          // 定义地图投影
          let projection = new ol.proj.Projection({
            code: "EPSG:3857",
            units: "degrees",
          });
          // 定义地图图层
          let aerial = new ol.layer.Tile({
            source: new ol.source.XYZ({
              url: "http://t{0-7}.tianditu.com/img_w/wmts?" +
                "SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles" +
                "&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=cc4aba6e967096098249efa069733067",
            }),
            isGroup: true,
            name: "卫星影像图",
          });

          let yingxzi = new ol.layer.Tile({
            source: new ol.source.XYZ({
              url: "http://t{0-7}.tianditu.com/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cc4aba6e967096098249efa069733067",
            }),
            isGroup: true,
            name: "天地图文字标注--卫星影像图",
          });
          //加载地图
          this.map = new ol.Map({
            controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]),
            layers: [aerial, yingxzi],
            projection: projection,
            target: "landMapBox",
            view: new ol.View({
              center: ol.proj.fromLonLat(this.mapCenterLocation), // 地图中心坐标
              zoom: 15.5,
              minZoom: 1, //地图缩小限制
              maxZoom: 18, //地图放大限制
              // extent: [13481224.75161,5667110.83528,13811063.06278,5880284.11416]
            }),
          });
          // // 添加村边界
          this.addVillageBorder();
          // 添加地块图层
          this.addLandLayer();
          // 绘制地块
          $("#drawLandPolygon").click(() => {
            // 创建矢量数据源
            let vectorSource = new ol.source.Vector({
              wrapX: false,
            });
            // 创建矢量图层
            this.vectorLayer = new ol.layer.Vector({
              source: vectorSource,
            });
            // 添加图层
            this.map.addLayer(this.vectorLayer);
            // 地图交互-绘制图形
            let drawInteraction = new ol.interaction.Draw({
              source: vectorSource,
              type: "Polygon",
            });
            // 添加交互
            this.map.addInteraction(drawInteraction);
            drawInteraction.on('drawend', (evt) => {
              // 移除交互
              this.map.removeInteraction(drawInteraction);
              let coordinates = evt.feature.getGeometry().getCoordinates();
              this.reset();
              this.form.theGeom = JSON.stringify(coordinates);
              this.title = "添加地块信息";
              this.showSaveBtn = true;
              this.showDeleteBtn = false;
              // this.isDisabled = false;
              setTimeout(() => {
                this.open = true;
              }, 10);

            });
          });
          var mark_layer = null;
          function addMark(lng, lat) {
            if(!mark_layer)
            {
              mark_layer = new ol.layer.Vector({
                source: new ol.source.Vector(),
              });
              that.map.addLayer(mark_layer);
            }
            else
              mark_layer.getSource().clear();

            let newFeature = new ol.Feature({
              geometry: new ol.geom.Point(ol.proj.fromLonLat([lng, lat])), //几何信息
              //name: "标注点",
            });
            newFeature.setStyle(new ol.style.Style({
              image: new ol.style.Icon({
                //设置图标偏移
                anchor: [0.5, 0.5],
                //标注样式的起点位置
                anchorOrigin: "top-right",
                //X方向单位：分数
                anchorXUnits: "fraction",
                //Y方向单位：像素
                anchorYUnits: "fraction",
                //偏移起点位置的方向
                offsetOrigin: "top-right",
                //透明度
                opacity: 0.9,
                //图片路径
                src: require('../../assets/images/app/mark.png'),
              }),
              zIndex: 9999,
            }));
            mark_layer.getSource().addFeature(newFeature);
          }
          var that = this;
          var Zb;
          $("#" + this.locationMap).click(function () {
            that.getCurrentLocation(res => {
              if (res.code == 200) {
                let lat = res.data.lat;
                let lng = res.data.lng;
                if(lat && lng){
                  Zb = [lng,lat];
                }else {
                  Zb =[115.452752, 31.789033];
                }
                addMark(lng,lat);
                that.map.getView().animate({
                  // 只设置需要的属性即可
                  center: ol.proj.fromLonLat(Zb), // 中心点
                  zoom: 18, // 缩放级别
                  rotation: undefined, // 缩放完成view视图旋转弧度
                  duration: 1000, // 缩放持续时间，默认不需要设置
                });
              }
            });
          });
          // 地图点击事件
          this.map.on("click", (evt) => {
            // 点击宅基地查看详情
            console.log(this.landLayer)
            if (this.landLayer) {
              const viewResolution = this.map.getView().getResolution();
              const url = this.landLayer.getSource()
                .getFeatureInfoUrl(evt.coordinate, viewResolution, 'EPSG:3857', {'INFO_FORMAT': 'application/json'});
              console.log(url)
              if (url) {
                fetch(url)
                  .then(response => response.json())
                  .then(data => {
                    if (data.features.length > 0) {
                      let id = data.features[0].properties.DKBM;
                      getLandDetailByDkbm(id).then(response => {
                        this.form = response.data;
                        setTimeout(() => {
                          this.open = true;
                        }, 500);
                      });
                      // getLandDetail(id).then(response => {
                      //   // this.form = response.data;
                      //   getLandDetailByDkbm(response.data.dkbm).then(res => {
                      //     res.data.txmj = response.data.txmj;
                      //     this.form = res.data;
                      //   });
                      //   // getOperationDetailByDkbm(response.data.dkbm).then(response => {
                      //   //   this.form = response.data
                      //   // })
                      //   setTimeout(() => {
                      //     this.open = true;
                      //   }, 500);
                      // });
                    }
                  });
              }
            }
          });
        });
      },
      filterLandLayer() {
        if (this.landLayer) {
          this.map.removeLayer(this.landLayer);
          this.landLayer = "";
        }
        this.addLandLayer();
      },
      getLocationMode() {
        let mode = '';
        if(this.hasGetLocationMode)
        {
          mode = window._Native_object.GetLocationMode();
        }
        console.log('当前选择定位模式: ' + mode);
        return mode;
      },
      getLocationTimeout() {
        let timeout = 10000;
        if(this.hasGetLocationMode)
        {
          let to = window._Native_object.GetLocationTimeout();
          if(to <= 0)
            to = 30000;
          timeout = to;
        }
        console.log('当前选择定位超时: ' + timeout);
        return timeout;
      },
      getDeptLocation(callback) {
        getQueryLand().then((response) => {
          if (response.code == 200) {
            let InsertCode = response.data;
            if (InsertCode != null) {
              var lat = InsertCode.lat;
              var lng = InsertCode.lng;
              if(lat !=null && lng !=null && lat !="" && lng !=""){
                callback(response);
                return;
              }
            }
          }
          this.getCurrentLocation(callback);
        });
      },
      getCurrentLocation(callback) {
        // 1. 首先尝试Android宿主端
        if(this.isAndroid) // Android层注入全局对象
        {
          let mode = this.getLocationMode();
          if(mode !== 'h5')
          {
            console.log('使用Native获取定位');
            let coord = window._Native_object.GetLocation(null);
            console.log('Native坐标: ' + coord);
            if(coord)
            {
              let arr = coord.split(',');
              let res = {
                code: 200,
                data: {
                  lng: arr[0],
                  lat: arr[1],
                },
              };
              callback(res);
              return;
            }
          }
        }

        // 2. 再尝试浏览器
        if (navigator.geolocation) {
          console.log('使用浏览器获取定位');
          const loading = Toast.loading({
            message: '定位中...',
            duration: 0,
          });
          let timeout = this.getLocationTimeout();
          navigator.geolocation.getCurrentPosition(
            (position) => {
              const { latitude, longitude } = position.coords;
              console.log('浏览器定位结果: 经纬度=' + longitude + ', ' + latitude);
              let res = {
                code: 200,
                data: {
                  lng: longitude,
                  lat: latitude,
                },
              };
              loading.clear();
              callback(res);
            },
            (error) => {
              loading.clear();
              console.log('定位失败: ' + error.message);
              getQueryLand().then(callback);
            },
            { enableHighAccuracy: true, timeout: timeout }
          );
          return;
        }

        // 最后使用地区坐标
        console.log('使用地区坐标定位');
        getQueryLand().then(callback);
      },
      // 添加地块图层
      addLandLayer() {
        this.landLayer = new ol.layer.Image({
          source: new ol.source.ImageWMS({
            url: this.mapGeoServerUrl + '/wms',
            params: {
              LAYERS: this.landLayerName,
              cql_filter: "import_code = '" + this.importCode + "'",
              SRID: 3857,
              abc: Math.random()        // 无效参数，保证每次发送的请求都不一样
            }
          }),
          name: 'landLayer'
        });
        this.map.getLayers().insertAt(3, this.landLayer);
        // this.map.addLayer(this.landLayer);
      },
      // 添加村边界
      addVillageBorder() {
        this.mapBorder = new ol.layer.Image({
          source: new ol.source.ImageWMS({
            url: this.mapGeoServerUrl + '/wms',
            params: {
              LAYERS: this.villageBorderLayerName,
              cql_filter: "import_code = '" + this.importCode + "'",
              SRID: 3857,
            },
          }),
          name: 'villageBorderLayer'
        });
        this.map.getLayers().insertAt(2, this.mapBorder);
      },
      saveLand() {
        this.$refs.landForm.validate().then(() => {
          if (this.form.id) {
            this.showSaveBtn = false;
            updateDk(this.form).then(response => {
              if (response.code == 200) {
                this.$toast({
                  icon: 'success',
                  message: '保存成功',
                  duration:"1000",
                  onClose: () => {
                    this.open = false;
                    this.showSaveBtn = true;
                  }
                });
              }
            });
          } else {
            this.form.deptId = this.deptId;
            this.showSaveBtn = false;
            addDk(this.form).then(response => {
              if (response.code == 200) {
                this.$toast({
                  icon: 'success',
                  message: '保存成功',
                  duration:"1000",
                  onClose: () => {
                    this.open = false;
                    this.showSaveBtn = true;
                    // 移除矢量图层
                    this.map.removeLayer(this.vectorLayer);
                    this.vectorLayer = "";
                    // 移除地块图层重新加载
                    this.map.removeLayer(this.landLayer);
                    this.landLayer = "";
                    this.addLandLayer();
                  }
                });
              }
            });
          }
        }).catch(() => {
          this.$notify({ type: 'danger', message: '请填写完整的表单项' });
        });
      },
      deleteLand(id) {
        this.$dialog.confirm({
          message: '是否确认删除此地块？',
        }).then(() => {
          // on confirm
          this.showDeleteBtn = false;
          deleteDk(id).then(res => {
            if (res.code == 200) {
              this.$toast({
                icon: 'success',
                message: '删除成功',
                duration: "1000",
                onClose: () => {
                  this.open = false;
                  this.showDeleteBtn = true;
                  // 移除地块图层重新加载
                  this.map.removeLayer(this.landLayer);
                  this.landLayer = "";
                  this.addLandLayer();
                }
              });
            }
          });
        }).catch(() => {
          // on cancel
        });
      },
      onConfirmOwnershipOptions(value){
        this.form.syqxz = value.dictValue;
        this.syqxzText = value.dictLabel;
        this.showOwnership = false;
      },
      onConfirmLandCategoryOptions(value){
        this.form.dklb = value.dictValue;
        this.dklbText = value.dictLabel;
        this.showLandCategory = false;
      },
      onConfirmLandTypeOptions(value) {
        this.form.tdlylx = value.dictValue;
        this.tdlylxText = value.dictLabel;
        this.showLandType = false;
      },
      onConfirmLandGradeOptions(value) {
        this.form.dldj = value.dictValue
        this.dldjText = value.dictLabel;
        this.showLandGrade = false;
      },
      onConfirmLandPurposeOptions(value){
        this.form.tdyt = value.dictValue;
        this.tdytText = value.dictLabel;
        this.showLandPurpose = false;
      },
      generateCode() {
        generateLandCode({deptId: this.deptId}).then(response => {
          this.$set(this.form, 'dkbm', response.data);
        });
      },
      closePopup() {
        // 移除矢量图层
        if (this.vectorLayer) {
          this.map.removeLayer(this.vectorLayer);
          this.vectorLayer = "";
        }
        this.open = false;
        this.reset();
      },
      reset() {
        this.form = {
          deptId: null,
          dkbm: null,
          dkmc: null,
          syqxz: '30',
          dklb: '99',
          tdlylx: '01',
          dldj: '01',
          tdyt: '1',
          sfjbnt: '1',
          scmjm: null,
          zjrxm: null,
          dkdz: null,
          dkxz: null,
          dknz: null,
          dkbz: null,
          dkbzxx: null,
          theGeom: null
        };
        this.syqxzText = '集体土地所有权';
        this.dklbText = '其他集体土地';
        this.tdlylxText = '【1】耕地';
        this.dldjText = '一等地';
        this.tdytText = '种植业';
      },
      openLandCategoryPopup() {
        // 修改时 && 地块类别为承包地块  不允许打开地块类别弹出层
        if (this.form.id && this.form.dklb === '10') {
          this.$toast({
            icon: 'fail',
            message: '当前地块为承包地块，不能更改地块类别',
            duration: '2000'
          })
          return ;
        }
        this.showLandCategory = true;
      }

    },
  };
</script>
<style scoped lang="scss">
  ::v-deep .van-nav-bar{
    background: linear-gradient( 173deg, #91E2D3 0%, #CDFCF0 100%);
    ::v-deep.van-icon{
      color: #000000;
    }
  }
  .location{
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin: 2vh;
    position: absolute;
    top: 12vh;
    right: 0vw;
    z-index: 9;
    background-color: rgba(0,0,0,0.5);
    border-radius: 10px;
    img{
      width: 30px;
      height: 30px;
      border: 1px dashed #ffffff;
    }
  }
  .van-popup{
    background: linear-gradient( 180deg, #E5FFF4 0%, #ffffff 100%);
    .landPopup{
      width: 94%;
      margin: 0 auto;
      .landPopup_title{
        color: #29D2AF;
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
    }
  }
  .app-container{
    /*background: #fff url("../../../../../static/images/contracted/contracted_index_bg.png") no-repeat center;*/
    background-size: 100% 100%;
    height: 100vh;
    padding: 0;
    overflow: hidden;
  }

  ::v-deep .van-hairline--bottom::after{
    border: none;
  }

  ::v-deep .van-field--disabled .van-field__label {
    color: #646566;
  }

  ::v-deep .landPopup .van-dialog {
    width: 90%;
    height: 85%;
    overflow-y: auto;
  }

  ::v-deep .landPopup .van-field__label {
    width: 7em;
  }

  .head{
    padding: 0 4vw;
  }

  .tap_block{
    width: 100%;
    display: flex;
    justify-content: space-between;
    background: #ebfaf2;
    padding: 2PX 4PX;
    border-radius: 10PX;
    margin-top: 1vh;
    .active{
      background-image: linear-gradient(to right,#c6fe8b,#48e5a2);
      box-shadow: 0 0 10PX #cccccc;
      color: #333333;
    }
    p{
      width: 25%;
      text-align: center;
      padding: 5PX 0;
      border-radius: 10PX;
      color: #666666;
    }
  }

  .legend_main{
    position: absolute;
    top: 2vh;
    right: 2vw;
  }

  .openLegend{
    position: absolute;
    top: 2vh;
    right: 0vw;
    background-color: rgba(255,255,255,.5);
    width: 20PX;
    height: 70PX;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top-left-radius: 10PX;
    border-bottom-left-radius: 10PX;
    .sanjiao-left {
      display: inline-block;
      border-right: 8PX solid #999999;
      border-right-color: initial;
      border-top: 5PX solid transparent;
      border-bottom: 5PX solid transparent;
    }
  }

  .legend_second{
    background: rgba(255,255,255,.5);
    padding: 2vh;
    border-radius: 10PX;
    margin-top: 2vh;
  }

  .legend_tt{
    font-size: 16PX;
    display: flex;
    align-items: center;
    justify-content: space-between;
    img{
      width: 20PX;
    }
  }

  .legend{
    background: rgba(255,255,255,.5);
    padding: 2vh;
    border-radius: 10PX;
    .van-checkbox{
      margin-top: 2vh;
      &:nth-child(1){
        ::v-deep .van-checkbox__icon .van-icon{
          /*border-color: rgba(22,233,15,1);*/
          border: 4px solid #16E90F;
        }
      }
      &:nth-child(2){
        ::v-deep .van-checkbox__icon .van-icon{
          /*border-color: rgba(1,198,222,1);*/
          border: 4px solid #01C6DE;
        }
      }
      &:nth-child(3){
        ::v-deep .van-checkbox__icon .van-icon{
          /*border-color: rgba(238,238,0,1);*/
          border: 4px solid #EEEE00;
        }
      }
      &:nth-child(4){
        ::v-deep .van-checkbox__icon .van-icon{
          /*border-color: rgba(238,60,60,1);*/
          border: 4px solid #EE3C3C;
        }
      }
      &:nth-child(5){
        ::v-deep .van-checkbox__icon .van-icon{
          /*border-color: rgba(235,134,0,1);*/
          border: 4px solid #EB8600;
        }
      }
    }
    .van-checkbox-group {
      .van-checkbox__label{
        i{
          display: block;
          width: 15PX;
          height: 15PX;
          border: 1px solid;
          border-radius: 3PX;
          margin-left: 10PX;
        }
        .i1{
          background: rgba(22,233,15,.7);
          border-color: rgba(22,233,15,1);
        }
        .i2{
          background: rgba(1,198,222,.7);
          border-color: rgba(1,198,222,1);
        }
        .i3{
          background: rgba(238,238,0,.7);
          border-color: rgba(238,238,0,1);
        }
        .i4{
          background: rgba(238,60,60,.7);
          border-color: rgba(238,60,60,1);
        }
        .i5{
          background: rgba(235,134,0,.7);
          border-color: rgba(235,134,0,1);
        }
        div{
          display: flex;
          align-items: center;
        }
      }
    }
  }

  .mapBox{
    height: 100vh;
    width: 100%;
  }

  .footer_main {
    flex: 0 0 120px;
    background: #ccc;
    display: flex;
    justify-content: center; /* 相对父元素水平居中 */
    align-items: center; /*  子元素相对父元素垂直居中 */
  }
  .search_box{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 94%;
    margin: 2vh auto;
    position: absolute;
    left: 3vw;
    z-index: 9;

    .left{
      display: flex;
      align-items: center;
      flex: 1;
      background-color: #ffffff;
      border-radius: 50vh;
      overflow: hidden;
      margin-right: 3vw;
    }
    p{
      flex-shrink: 0;
    }
    button{
      flex-shrink: 0;
      background: linear-gradient( 271deg, #53E4A5 0%, #24DBDB 100%);
      border: none;
      width: 20vw;
    }
  }

  #land-btn-wrap {
    position: relative;
    width: 40%;
    left: 60%;
    bottom: 95%;
    z-index: 2000;
  }

  #landMapBox {
    width: 100%;
    height: 100%;
  }
  .ant-btn-red {
    position: relative;
    display: inline-block;
    background: #D0EEFF;
    border: 1px solid #99D3F5;
    border-radius: 4px;
    padding: 4px 12px;
    overflow: hidden;
    color: #1E88C7;
    text-decoration: none;
    text-indent: 0;
    line-height: 20px;
    right: -36%;
  }
</style>
