regionManage.vue 28.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819
<template>
  <div class="componentSty">
    <el-row style="width: 100%; height: 100%;">
      <el-col :span="24">
        <el-form :model="queryForm" ref="queryForm" :inline="true" style="display: flex; justify-content: space-between">
          <div>
            <el-form-item label="区域名称:">
              <el-input v-model="queryForm.regionalName"  placeholder="请输入姓名" clearable></el-input>
            </el-form-item>
            <el-form-item label="区域类型:">
              <el-select v-model="queryForm.regionalType"  placeholder="请选择状态" clearable>
                <el-option v-for="item in regionalTypeOptions" :key="item.KEY_" :label="item.NAME_" :value="item.KEY_">
                </el-option>
              </el-select>
            </el-form-item>
          </div>
          <el-form-item>
            <el-button type="primary" icon="el-icon-refresh"
                       style="border: 1px solid #5875eb; background: #ffffff; color: #5875eb; border-radius: 5px;"
                       @click="handleReset" plain>重置
            </el-button>
            <el-button type="primary" style="background: #5875eb; border: 1px solid #5875eb; border-radius: 5px;"
                       icon="el-icon-search" @click="handleSearch"> 查询
            </el-button>
          </el-form-item>
        </el-form>
      </el-col>
      <el-col :span="24" style="margin-bottom: 10px;">
          <el-button type="primary" style="background: #5875eb; border: 1px solid #5875eb; border-radius: 5px;"
                     icon="el-icon-plus" @click=" hanleOpt('add')"> 新增
          </el-button>
      </el-col>
      <el-col :span="24" style="height: calc(100% - 95px);overflow: auto;">
        <el-table
          style="width: 100%"
          v-loading="loading"
          :data="tableData">
          <el-table-column
            type="index"
            label="序号">
          </el-table-column>
          <el-table-column
            prop="f_ssqymc"
            label="企业名称">
          </el-table-column>
          <el-table-column
            prop="f_name"
            label="区域名称">
          </el-table-column>
          <el-table-column
            prop="f_regional_type"
            label="类型">
          </el-table-column>
          <el-table-column
            prop="f_shape"
            label="区域形状">
          </el-table-column>
          <el-table-column
            prop="f_remark"
            label="备注">
          </el-table-column>
          <el-table-column
            prop="opt"
            width="100"
            label="操作">
            <template slot-scope="scope">
              <el-button type="text"  @click="hanleOpt('edit',scope.row)">编辑</el-button>
              <el-button type="text" style="color: red;" @click="hanleOpt('delete',scope.row)">删除</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="24">
        <el-pagination
          style="float: right; margin-top: 10px;"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageParam.page"
          :page-sizes="[10, 20, 30, 50]"
          :page-size="pageParam.size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageParam.total">
        </el-pagination>
      </el-col>
    </el-row>
    <el-dialog
      :title="dialogParams.title"
      :visible.sync="dialogParams.dialogVisible"
      width="80%"
      @close="handleDialogClose">
      <el-form :model="dialogParams" :inline="true" :rules="dialogRules" ref="dialogParams">
        <el-form-item label="区域名称:" prop="regionalName">
          <el-input v-model="dialogParams.regionalName" placeholder="请输入区域名称" clearable></el-input>
        </el-form-item>
        <el-form-item label="区域类型:" prop="regionalType">
          <el-select v-model="dialogParams.regionalType" clearable placeholder="请选择">
            <el-option
              v-for="item in regionalTypeOptions"
              :key="item.KEY_"
              :label="item.NAME_"
              :value="item.KEY_">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="备注:">
          <el-input
            clearable
            style="width: 100%;"
            type="textarea"
            placeholder="请输入内容"
            v-model="dialogParams.fRemark">
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button :class="[dialogParams.fShape == '多边形'?'clickBtn':'','btn']" @click="draw('polygon','多边形')" style="margin-bottom: 5px">绘制多边形</el-button>
          <el-button :class="[dialogParams.fShape == '矩形'?'clickBtn':'','btn']" @click="draw('rectangle','矩形')" style="margin-bottom: 5px">绘制矩形</el-button>
          <el-button :class="[dialogParams.fShape == '圆形'?'clickBtn':'','btn']" @click="draw('circle','圆形')" style="margin-bottom: 5px">绘制圆形</el-button>
          <el-button  @click="closeDraw" v-if="dialogParams.dialogType == 'edit'" style="margin-bottom: 5px">结束编辑</el-button>
        </el-form-item>
      </el-form>
      <el-row>
        <el-col :span="24">
          <div id="mapContainer" style="width: 100%; height: 500px;"></div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
          <el-button @click="dialogParams.dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="handleSubmit('dialogParams')">确 定</el-button>
        </span>
    </el-dialog>
  </div>
</template>

<script>
import AMapLoader from '@amap/amap-jsapi-loader';
import {
  regionalTablePort,
  regionalAddEditPort,
  regionTypePort,
  regionalDetailInfo,
  regionDeletePort,
  delVideoPort
} from '@/api/regionalManage'
export default {
  name: "regionManage",
  props:{
    rowData:{
      type:Object,
      default:()=>{}
    }
  },
  async mounted() {
    await this.getDataList();
    await this.getRegionTypeList();
  },
  data(){
    return {
      loading:false,
      tableData:[],
      regionalTypeOptions:[
        {
          label:'经营区域',
          value:'经营区域'
        },
        {
          label:'流动区域',
          value:'流动区域'
        }
      ],
      dialogRules:{
        regionalName:[
          {required:true,message:'请输入区域名称',trigger:'blur'}
        ],
        regionalType:[
          {required:true,message:'请选择区域类型',trigger:'change'}
        ]
      },
      queryForm:{
        regionalType:'',
        regionalName:'',
        orgId:'',
        tabType:'region'
      },
      dialogParams:{
        title:'新增区域',
        radius:'',//圆形半径
        dialogVisible:false,
        fSsczid:'',
        fShape:'',
        fRemark:'',
        id:'',
        dialogType:'',
        regionalType:'',
        regionalName:'',
        rectangleNothPoint:[],
        rectangleSouthPoint:[],
        polygonPoint:[],//多边形坐标点
        centerOfCircle:[],//圆形中心点坐标
      },
      polygon: null,
      map:null,
      mapEditor:null,
      mouseTool:null,
      overlays:[],
      circleOverlays:[],//圆形中心点的坐标
      centerPoint:[116.403322, 39.920255],
      pageParam:{
        page:1,
        size:10,
        total:0
      },
      handler:null,

    }
  },
  methods:{
    //初始化区域类型的接口数据
    async getRegionTypeList(){
      let params =[
        {
          "key": "PARENT_ID_",
          "value": "1828635308418162688"
        }
      ]
      await regionTypePort(params).then((res)=>{
        const { rows } = res;
        this.regionalTypeOptions = rows;
      })
    },
    async getRegionDetailInfoData(id){
      await regionalDetailInfo({id:id}).then((res)=>{
        console.log('打印详情res======>',res);
        const { value } = res;
        const { fShape,fName,fRemark,radius,fBoundary,centerOfCircle,fRegionalType} = value;
        this.dialogParams.fRemark = fRemark;
        this.dialogParams.regionalName = fName;
        this.dialogParams.regionalType = fRegionalType;
        this.dialogParams.radius = radius;
        this.dialogParams.fShape = fShape;
        console.log('打印fBoundary',JSON.parse(fBoundary));
        this.dialogParams.centerOfCircle = centerOfCircle?centerOfCircle.split(','):[];
        let pointfBoundary = JSON.parse(fBoundary).coordinates;
        if(this.dialogParams.fShape == '矩形'){
          this.dialogParams.rectangleNothPoint =pointfBoundary[0][0];
          this.dialogParams.rectangleSouthPoint = pointfBoundary[0][2];
          // console.log('打印this.dialogParams.rectangleNothPoint ',this.dialogParams.rectangleNothPoint ,this.dialogParams.rectangleSouthPoint )
        }else if(this.dialogParams.fShape == '多边形'){
          console.log('pointfBoundary',pointfBoundary[0])
          let array = pointfBoundary.pop();
          console.log('打印array',array);
          this.dialogParams.polygonPoint = array;
          console.log('打印this.this.dialogParams.polygonPoint ',this.dialogParams.polygonPoint );
        }

      })
    },
    //初始化数据接口
    async getDataList(){
      let params= {
        pageBean: {
          page: this.pageParam.page,
          pageSize: this.pageParam.size,
          showTotal: true
        },
        querys: []
      }
      if(this.queryForm.regionalName){
        params.querys.push({
          property: "f_name",
          value: this.queryForm.regionalName,
          group: "advance",
          relation: "AND",
          operation: "LIKE"
        })
      }
      if(this.queryForm.regionalType){
        params.querys.push({
          property: "f_regional_type",
          value: this.queryForm.regionalType,
          group: "advance",
          relation: "AND",
          operation: "LIKE"
        })
      }
      if(this.rowData.orgId){
        params.querys.push({
          property: "orgId",
          value: this.rowData.orgId,
          group: "advance",
          relation: "AND",
          operation: "LIKE"
        })
      }
      this.loading = true;
      await regionalTablePort(params).then((res)=>{
        console.log('打印区域管理中res====>',res);
        const { rows,total } = res;
        this.tableData = rows;
        this.pageParam.total = total;
        setTimeout(()=>{
          this.loading  = false;
        },500)
      })
    },
    //强调说明:自定义的dom是基于地图对象生成的,并不能像vue一样绑定事件,这里采用jQuery的方式出发的事件。如下
    //定义右键内容
    rightclickObj() {
      let that = this;
      //���义内容
      let content = [];
      content.push("<div class='context_menu'>");
      content.push(
        "<p class='menu-list menu-list-edit-start' >启用编辑</p>"
      );
      content.push(
        "<p class='menu-list menu-list-edit-end' >结束编辑</p>"
      );
      content.push(
        "<p class='menu-list menu-list-get-area' >计算面积</p>"
      );
      content.push(
        "<p class='menu-list menu-list-remove' >移除图形</p>"
      );
      if (that.circleEditor) {
        content.push(
          "<p class='menu-list menu-list-radius'>半径</p>"
        );
      }
      content.push('</div>');
      //创建右键实例并添加自定义的内容

      that.contextMenu = new AMap.ContextMenu({
        isCustom: true,
        content: content.join('')
      });
    },
    //初始化地图
    initializeMap() {
      AMapLoader.reset();
      AMapLoader.load({
        "key": "65f6591039d0e723f91a2bfab50712f7",// 申请好的Web端开发者Key,首次调用 load 时必填
        "version": "2.0",   // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
        "plugins": ['AMap.ToolBar', 'AMap.Driving','AMap.InfoWindow',
          'AMap.ContextMenu',
          'AMap.Heatmap',
          'AMap.MouseTool',
          'AMap.RangingTool',
          'AMap.CircleEditor',
          'AMap.RectangleEditor',
          'AMap.PolyEditor',
          'AMap.VectorMap',
          'AMap.ToolBar',
          'AMap.Scale',
          'AMap.OverView',
          'AMap.MapType',
          'AMap.Geolocation'], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
        "AMapUI": {
          "version": "1.1",
          "plugins": []
        },
        Loca: {
          version: '2.0' //数据可视化
        }
      }).then((AMap)=>{
        console.log('打印AMap====>',AMap);
        let that = this;
        this.map = new T.Map('mapContainer',{
          projection: 'EPSG:900913' 
        });
        this.map.centerAndZoom(new T.LngLat(this.centerPoint[0], this.centerPoint[1]), 16);
        //允许鼠标双击放大地图
        this.map.enableScrollWheelZoom();
        // 允许拖拽
        setTimeout(function () {
          that.map.enableDrag();
        }, 500);

        var config = {
            showLabel: true,
            color: "blue", weight: 3, opacity: 0.5, fillColor: "#FFFFFF", fillOpacity: 0.5
        };
        //创建标注工具对象
        this.polygonTool = new T.PolygonTool(this.map, config);


        // this.map = new AMap.Map('mapContainer', {//设置地图容器id
        //   viewMode: '2D', //是否为3D地图模式
        //   zoom: 16, //初始化地图层级
        //   center: this.centerPoint,//初始化地图中心点
        // });


        // this.map.on('rightclick', (e)=> {
        //   this.rightclickObj(); //定义右键内容
        //   this.contextMenu.open(this.map, e.lnglat);
        //   this.contextMenuPositon = e.lnglat; //右键菜单位置
        // });
      
        // let that = this;
        // this.mouseTool = new AMap.MouseTool(this.map);
        // this.mouseTool.on('draw',function (e){
        //   console.log("e======",e);
        //   if(that.overlays.length>0){
        //     console.log('打印this.overlays=====>',that.overlays);
        //     that.map.remove(that.overlays);
        //     //关闭绘画
        //     // that.mouseTool.close(true);
        //     that.overlays = [];
        //   }
        //   if(that.dialogParams.fShape == '圆形'){
        //     let circleCenterPoint = e.obj.getCenter(); //获取圆形坐标点
        //     let circleRadius = e.obj.getRadius();//获取半径
        //     that.dialogParams.radius = circleRadius;
        //     let circlePointList = [
        //       {
        //         jd:circleCenterPoint.lng,
        //         wd:circleCenterPoint.lat
        //       }
        //     ];
        //     that.circleOverlays = circlePointList;
        //     console.log('打印position',circleCenterPoint,circleRadius);
        //   }
        //   that.overlays.push(e.obj);
        //   console.log('打印that.overlays',that.overlays);
        // })
        if(this.dialogParams.dialogType == 'edit'){
          // var editShap = null;
          if(this.dialogParams.fShape == '圆形'){
            this.handler = new T.Circle(new T.LngLat(
              this.dialogParams.centerOfCircle[0], 
              this.dialogParams.centerOfCircle[1]),
              parseInt(this.dialogParams.radius),{
              color:"blue",
              weight:5,
              opacity:0.5,
              fillColor:"#FFFFFF",
              fillOpacity:0.5,
              lineStyle:"solid"});
              this.handler.enableEdit();
              this.handler.on("edit",this.editPointsDrawCircle);
              this.map.addOverLay(this.handler);
            //  editShap = new AMap.Circle({
            //   center: this.dialogParams.centerOfCircle,
            //   radius: this.dialogParams.radius, //半径
            //   borderWeight: 3,
            //   strokeColor: "#FF33FF",
            //   // strokeOpacity: 1,
            //   strokeWeight: 6,
            //   strokeOpacity: 0.2,
            //   fillOpacity: 0.4,
            //   strokeStyle: 'dashed',
            //   strokeDasharray: [10, 10],
            //   // 线样式还支持 'dashed'
            //   fillColor: '#1791fc',
            //   zIndex: 50,
            // });
            // this.mapEditor = new AMap.CircleEditor(this.map, editShap);
          }else if(this.dialogParams.fShape == '矩形'){
            // var southWest = new AMap.LngLat(this.dialogParams.rectangleSouthPoint[0], this.dialogParams.rectangleSouthPoint[1])
            // var northEast = new AMap.LngLat(this.dialogParams.rectangleNothPoint[0], this.dialogParams.rectangleNothPoint[1])
            // var bounds = new AMap.Bounds(southWest, northEast)
            // editShap = new AMap.Rectangle({
            //   bounds: bounds,
            //   strokeColor:'#FF33FF',
            //   strokeWeight: 6,
            //   strokeOpacity:0.2,
            //   strokeDasharray: [30,10],
            //   // strokeStyle还支持 solid
            //   // 线样式还支持 'dashed'
            //   fillColor: '#1791fc',
            //   strokeStyle: 'dashed',
            //   fillOpacity:0.5,
            //   cursor:'pointer',
            //   zIndex:50,
            // });
            // this.mapEditor = new AMap.RectangleEditor(this.map, editShap);
            var bounds = new T.LngLatBounds(new T.LngLat(
            this.dialogParams.rectangleSouthPoint[0],
            this.dialogParams.rectangleSouthPoint[1]),
            new T.LngLat( 
              this.dialogParams.rectangleNothPoint[0],
              this.dialogParams.rectangleNothPoint[1]
            ));
            this.handler = new T.Rectangle(bounds);
            this.handler.enableEdit();
            this.handler.on("edit",this.editPointsDrawRectangle);
            this.map.addOverLay(this.handler);
          } else {
            // editShap = new AMap.Polygon({
            //   path: this.dialogParams.polygonPoint,
            //   strokeColor: "#FF33FF",
            //   strokeWeight: 6,
            //   strokeOpacity: 0.2,
            //   fillOpacity: 0.4,
            //   fillColor: '#1791fc',
            //   zIndex: 50,
            // });
            // this.mapEditor = new AMap.PolyEditor(this.map, editShap);
            var points = [];
            this.dialogParams.polygonPoint.map(item =>{
              points.push(new T.LngLat(item[0], item[1]));
            })
            this.handler = new T.Polygon(points,{
                color: "blue", weight: 3, opacity: 0.5, fillColor: "#FFFFFF", fillOpacity: 0.5
            });
            //向地图上添加面
           this.handler.enableEdit();
           this.handler.on("edit",this.editPointsDrawPolygon);
           this.map.addOverLay(this.handler);
          }
          return
          editShap.setMap(this.map);
          // 缩放地图到合适的视野级别
          this.map.setFitView([ editShap ]);
          this.mapEditor.open();
          this.mapEditor.on('end', function(event) {
            if(that.dialogParams.fShape == '圆形'){
              let editCircleCenterPoint = event.target.getCenter(); //获取圆形坐标点
              let editCircleRadius = event.target.getRadius();//获取半径
              that.dialogParams.radius = editCircleRadius;
              let editCirclePointList = [
                {
                  jd:editCircleCenterPoint.lng,
                  wd:editCircleCenterPoint.lat
                }
              ];
              that.circleOverlays = editCirclePointList;
            }else if(that.dialogParams.fShape == '矩形'){
              console.log('触发事件: end=====>',event);
            }
            that.overlays.push(event.target);
            // event.target 即为编辑后的圆形对象
          })
        }
      })
    },
    //结束编辑
    closeDraw(){
      // this.mapEditor.close();
      this.handler.disableEdit();
    },
    getPointsDrawPolygon(e){
      let that = this;
      let arry = e.currentLnglats;
      arry.forEach(item => {
         that.overlays.push({ 
          jd:item.lng,
          wd:item.lat 
        });
      });
      that.overlays.push(that.overlays[0])
      console.log('多边形overlays===',JSON.parse(JSON.stringify(this.overlays)));
    },
    // 编辑多边形
    editPointsDrawPolygon(e){
      let that = this;
      let lines = this.handler.getLngLats();
      let arry = lines[0];
      arry.forEach(item => {
         that.overlays.push({ 
          jd:item.lng,
          wd:item.lat 
        });
      });
      that.overlays.push(that.overlays[0])
      console.log('编辑多边形overlays===',JSON.parse(JSON.stringify(this.overlays)));
    },
    getPointsDrawRectangle(e){
      let that = this;
      let arry = e.currentBounds;
      let southwest = { jd: arry.Lq.lng, wd: arry.Lq.lat }; // 西南角
      let northeast = { jd: arry.kq.lng, wd: arry.kq.lat }; // 东北角
      let northwest = { jd: arry.Lq.lng, wd: arry.kq.lat }; // 西北角
      let southeast = { jd: arry.Lq.lng, wd: arry.Lq.lat }; // 东南角
      // 将四个角点推入 overlays 数组
      that.overlays = [southwest, northwest, northeast, southeast];
      console.log("矩形===",this.overlays);
    },
    //编辑矩形
    editPointsDrawRectangle(e){
      console.log("编辑矩形",e);
      // console.log("矩形范围",this.handler.getBounds());
      let that = this;
      let arry = e.target.Qr;
      let southwest = { jd: arry.Lq.lng, wd: arry.Lq.lat }; // 西南角
      let northeast = { jd: arry.kq.lng, wd: arry.kq.lat }; // 东北角
      let northwest = { jd: arry.Lq.lng, wd: arry.kq.lat }; // 西北角
      let southeast = { jd: arry.Lq.lng, wd: arry.Lq.lat }; // 东南角
      // 将四个角点推入 overlays 数组
      that.overlays = [southwest, northwest, northeast, southeast];
      console.log("矩形===",this.overlays);
    },
    getPointsDrawCircle(e){
      console.log("圆形",e);
      let arry = e.currentCenter;
      let circleRadius = e.currentRadius
      this.overlays = [{jd:arry.lng, wd:arry.lat}]
      this.circleOverlays = [{jd:arry.lng, wd:arry.lat}]
      this.dialogParams.radius = circleRadius
    },
    // 编辑圆形
    editPointsDrawCircle(e){
      console.log("编辑圆形e",e);
      let center,radius;
      center = this.handler.getCenter();
      radius = this.handler.getRadius();
      this.overlays = [{jd:center.lng, wd:center.lat}];
      this.circleOverlays = [{jd:center.lng, wd:center.lat}];
      this.dialogParams.radius = radius;
    },
    //draw 绘制圆形,矩形,多边形
    draw(type,shapType){
      if(this.dialogParams.dialogType == 'edit'){
        this.handler.close();
        // this.handler.clear();
        // this.mapEditor.close();
      }
      this.overlays = [];
      this.dialogParams.fShape = shapType;
      switch (type){
        case 'polygon':{
          if (this.handler) {
            this.handler.close();
            this.handler.clear();
          }
          this.handler = new T.PolygonTool(this.map);
          this.handler.open();
          this.handler.addEventListener("draw",this.getPointsDrawPolygon);
          
          // this.mouseTool.polygon({
          //   fillColor:'#00b0ff',
          //   strokeColor:'#80d8ff'
          // });
          break;
        }
        case 'rectangle':{
          if (this.handler) {
            this.handler.close();
            this.handler.clear();
          }
          this.handler = new T.RectangleTool(this.map, {follow: true});
          this.handler.open();
          this.handler.addEventListener("draw",this.getPointsDrawRectangle);
          
          // this.mouseTool.rectangle({
          //   fillColor:'#00b0ff',
          //   strokeColor:'#80d8ff'
          // });
          break;
        }
        case 'circle':{
          if (this.handler) {
            this.handler.close();
            this.handler.clear();
          }
          this.handler = new T.CircleTool(this.map, {follow: true});
          this.handler.open();
          this.handler.addEventListener("draw",this.getPointsDrawCircle);
          
          // this.mouseTool.circle({
          //   fillColor:'#00b0ff',
          //   strokeColor:'#80d8ff'
          // });
          break;
        }
      }
    },
    //提交事件
   async handleSubmit(formName){
     this.$refs[formName].validate(async (valid) => {
       if (valid) {
         console.log('打印this.overlays',this.overlays)
         if(this.overlays.length<=0){
           this.$message.warning('请规划区域!');
           return;
         }
        //  let jwdDTOListArray = this.overlays[0].getPath().map((item)=>{
        //   console.log("item222",item);
        //    return {
        //      jd:item.lng,
        //      wd:item.lat
        //    }
        //  });
          // jwdDTOListArray.push(jwdDTOListArray);
        let jwdDTOListArray = this.overlays
        console.log("jwdDTOListArray",jwdDTOListArray);
         let params= {
           id:this.dialogParams.id,
           fName: this.dialogParams.regionalName,
           fSsczid: this.dialogParams.fSsczid,
           fRegionalType: this.dialogParams.regionalType,
           fShape: this.dialogParams.fShape,
           fRemark:this.dialogParams.fRemark,
           jwdDTOList:this.dialogParams.fShape == '圆形'?this.circleOverlays:jwdDTOListArray
         }
         if(this.dialogParams.fShape == '圆形'){
           params ={
             ...params,
             radius:this.dialogParams.radius
           }
         }
         console.log("params",params);
        //  return;
         await regionalAddEditPort(params).then((res)=>{
           this.dialogParams.dialogVisible = false;
          //  this.mouseTool.close(true);
           this.overlays = [];
           this.handleSearch();
           this.pageParam.page = 1;
         })
       } else {
         return false;
       }
     });
    },
    //弹窗关闭
    handleDialogClose(){
      this.$refs.dialogParams.resetFields();
      this.dialogParams.dialogVisible = false;
      // this.mouseTool.close(true);
      this.overlays =  [];

    },
    //分页功能的size改变事件
    handleSizeChange(val){
      this.pageParam.size = val;
      this.handleSearch();
    },
    //分页功能page改变事件
    handleCurrentChange(val){
      this.pageParam.page = val;
      this.handleSearch();
    },
    //操作栏按钮
    hanleOpt(type,row){
      console.log('打印row=====>',row);
      this.dialogParams.dialogType= type;
      switch (type){
        case 'add':
          this.handler = null;
          this.dialogParams.fSsczid = this.rowData.fSsczid;
          this.dialogParams.id ='';
          this.dialogParams.radius = '';
          this.dialogParams.fShape = '';
          this.dialogParams.fRemark = '';
          this.dialogParams.regionalType ='';
          this.dialogParams.regionalName ='';
          this.dialogParams.rectangleNothPoint =[];
          this.dialogParams.rectangleSouthPoint=[];
          this.dialogParams.polygonPoint = [];//多边形坐标点
          this.dialogParams.centerOfCircle = [];//圆形中心点坐标
          this.dialogParams.title='新增区域';
          break;
        case 'edit':
          this.dialogParams.fSsczid = row.f_ssczid;
          this.dialogParams.id = row.id_;
          this.dialogParams.title='编辑区域';
          this.getRegionDetailInfoData(row.id_);
          break;
        case 'delete':
          this.$confirm('确定是否删除该区域?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          }).then(async() => {
            await regionDeletePort(row.id_).then((res)=>{
              if(res.code == 200){
                this.$message.success('删除区域成功!');
              }
              this.handleSearch();
            })
          })
          break
      }
      if(!this.rowData.fSsczid && type == 'add'){
        this.$message.warning('请选择气站!')
        return
      }
      if(type !=='delete'){
        this.dialogParams.dialogVisible = true;
        this.$nextTick(()=>{
          this.initializeMap();
        })
      }
      console.log('打印是否触发新增功能');
    },
    //重置按钮事件
    handleReset(){
      this.queryForm.regionalType ='';
      this.queryForm.regionalName ='';
      this.pageParam.page = 1;
      this.handleSearch();
    },
    //查询按钮事件
    handleSearch(){
      this.getDataList();
    },
    //新增用户事件
    handleAdd(){
      this.showDialog = true;
      this.$nextTick(()=>{
        this.$refs.showDialog.open('add');
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.clickBtn{
  background-color:#5875eb;
  color: #ffffff;
}
.componentSty{
  height: 100%;
  width: calc(100% - 2px);
}

</style>