<template>
  <div class="ZTGlobal rootele">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="拆迁补偿预估" name="first">
        <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="8rem" class="demo-ruleForm">
          <el-form-item label="项目范围：" prop="">
            <input @change="handleUpload" type="file" style="display:none" id="fileInput" accept=".zip"></input>
            <el-button type="primary" @click="inputGeometry">导入</el-button>
            <el-button type="primary" @click="drawPolygon()">绘制</el-button>
            <el-button type="primary" @click="clear()">清除</el-button>
            <!-- </div> -->
          </el-form-item>
          <div class="el-upload__tip" style="height: 1rem; color: #f5f761f1; text-align: center">
            只能上传shape压缩文件(zip)，且不超过500kb
          </div>
          <el-form-item label="项目名称：" prop="projectName">
            <!-- <el-col :span="7">项目名称：</el-col> -->
            <el-col :span="16">
              <el-input size="mini" placeholder="输入项目名称" v-model="ruleForm.projectName"></el-input>
            </el-col>
          </el-form-item>
          <el-form-item label="征地补偿标准：" prop="zdValue">
            <!-- <el-col :span="7">征地补偿标准：</el-col> -->
            <el-col :span="13">
              <el-select size="mini" v-model="ruleForm.zdValue" placeholder="请选择">
                <el-option v-for="item in zdList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="7" class="buttongroup">
              <el-button size="mini" type="primary" id="zdShow" @click="zdShow()" plain>查看</el-button>
              <el-button size="mini" type="primary" id="zdSet" @click="zdSet()" plain>配置</el-button>
            </el-col>
          </el-form-item>
          <el-form-item label="青苗补偿标准：" prop="qmValue">
            <!-- <el-col :span="7">青苗补偿标准：</el-col> -->
            <el-col :span="13">
              <el-select size="mini" v-model="ruleForm.qmValue" placeholder="请选择">
                <el-option v-for="item in qmList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="7" class="buttongroup">
              <el-button size="mini" type="primary" id="qmShow" @click="qmShow()" plain>查看</el-button>
              <el-button size="mini" type="primary" id="qmSet" @click="qmSet()" plain>配置</el-button>
            </el-col>
          </el-form-item>
          <el-form-item label="拆迁补偿标准：" prop="cqValue">
            <!-- <el-col :span="7">拆迁补偿标准：</el-col> -->
            <el-col :span="13">
              <el-select size="mini" v-model="ruleForm.cqValue" placeholder="请选择">
                <el-option v-for="item in cqList" :key="item.id" :label="item.name" :value="item.id">
                </el-option>
              </el-select>
            </el-col>
            <el-col :span="7" class="buttongroup">
              <el-button size="mini" type="primary" id="cqShow" @click="cqShow()" plain>查看</el-button>
              <el-button size="mini" type="primary" id="cqSet" @click="cqSet()" plain>配置</el-button>
            </el-col>
          </el-form-item>
          <el-row style="text-align: center">
            <el-button type="primary" plain @click="submitForm('ruleForm')">确定</el-button>
            <el-button type="primary" plain @click="dialogClose()">取消</el-button>
          </el-row>
        </el-form>
        <!-- <canvas id="CVS" style="height: 100%;width: 100%; z-index: 10000;"></canvas> -->
        <!-- <el-card v-loading="loading" element-loading-text="正在数据分析......" element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(63 113 165, 0.8)"
         style="height:10rem;border: 0px;color:#ffffff "></el-card> -->
        <!-- element-loading-background="rgba(0, 0, 0, 0.8) -->
      </el-tab-pane>
      <el-tab-pane label="分析记录" name="second">
        <el-row>
          <el-col :span="10">
            <el-input size="mini" placeholder="请输入项目名称" v-model="searchName">
              <!-- <i slot="suffix" class="el-input__icon el-icon-search"></i> -->
            </el-input>
          </el-col>
          <el-col :span="10">
            <el-date-picker size="mini" v-model="dateVal" type="daterange" range-separator="至" start-placeholder="开始日期"
              end-placeholder="结束日期">
            </el-date-picker>
          </el-col>
          <el-col :span="2">
            <el-button type="primary" size="mini" @click="queryProject">查询</el-button>
          </el-col>

        </el-row>
        <div>
          <el-card class="box-card" v-for="projectInfo in projectList" :key="projectInfo.id">
            <el-row>
              <el-col :span="14">
                <span>{{ projectInfo.projectName }}</span></el-col>
              <el-col :span="10">
                <span>{{ formatDateTime(new Date(projectInfo.dateTime)) }}</span>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="10">
                <el-button style="float: right; padding: 3px 0" type="success">完成</el-button>
              </el-col>
              <el-col :span="10" justify="center">
                <!-- <el-button type="primary" style="float: right; padding: 3px 0">日志</el-button> -->
                <el-button type="primary" style="float: right; padding: 3px 0"
                  @click="showResult(projectInfo)">分析结果</el-button>
                <el-button type="primary" style="float: right; padding: 3px 0"
                  @click="exportWord(projectInfo)">报告</el-button>
              </el-col>
              <el-col :span="4">
                <el-button type="warning" style="float: right; padding: 3px 0"
                  @click="deletProject(projectInfo)">删除</el-button>
              </el-col>
            </el-row>
          </el-card>
          <el-pagination background layout="prev, pager, next" :page-size="pageSize" :total="rowsCount"
            :current-page="currentPage" @current-change="onCurrentChange">
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="分析结果" name="third">
        <el-row class="box-card" v-model="curProjectInfo">
          <el-col :span="18">
            <span style="font-size: 1rem">{{
              curProjectInfo.name
            }}</span></el-col>
          <el-col :span="6">
            <el-button type="primary" size="mini" @click="exportWord(curProjectInfo)">导出报告</el-button>
          </el-col>
        </el-row>
        <el-tabs v-model="activePage1" @tab-click="pageClick" style="height: auto;">
          <el-tab-pane label="国有评估" name="GY">
            <div class="divrow">
              <div class="divCol">
                <div class="divImg">
                  <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                </div>
                <div class="divText">
                  <div>
                    <span style="color: #fff">国有用地(亩)</span>
                  </div>
                  <div>
                    <span color="#2d8cf0">{{ formatterArea(zdResult.gyMJ) }}</span>
                  </div>
                </div>
              </div>
              <div class="divCol">
                <div class="divImg">
                  <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                </div>
                <div class="divText">
                  <div>
                    <span style="color: #fff">国有建筑面积(平方米)</span>
                  </div>
                  <div>
                    <span color="#2d8cf0">{{ formatterArea(cqResult.gyJZMJ) }}</span>
                  </div>
                </div>
              </div>
            </div>
            <el-tabs v-model="activePage2" @tab-click="gyPpageClick" style="height: auto;">
              <el-tab-pane label="国有权属" name="GYQS">
                <div id="GYQSChart" style="height: 15rem; width: 25rem;"></div>
                <div id="GYDLChart" style="height: 15rem; width: 25rem;"></div>
              </el-tab-pane>
              <el-tab-pane label="国有房产" name="GYFC">
                <ul style="width: 25rem;height: 25rem;overflow-y: auto;">
                  <!-- item = { id: smid, cqr: cqrVal, jg: fwjgVal, fwdj: fwdjVal, floor: floorVal, jzmj: jzmjVal, zdmj: zdmjVal, address: addressVal, pay: pay, single: BZ } -->
                  <li v-for="(cqItem, index) in cqResult.gyList" :key="index"
                    style="margin-bottom: 0.5rem; font-size: 0.8rem">
                    <el-row>
                      <el-col :span="20">
                        <span style="color: #06c4f3; font-weight: 600">{{ index + 1 }}.&nbsp{{ cqItem.cqr }}</span>
                      </el-col>
                      <el-col :span="4">
                        <el-image src="../../../../static/images/location1.png" style="height: 1.5rem; width: 1.5rem"
                          @click="cqLocation(true, cqItem.smid, cqItem.cqr)"></el-image>
                      </el-col>

                    </el-row>
                    <el-row>
                      <el-col :span="12"> 结构：{{ cqItem.jg }} </el-col>
                      <el-col :span="12"> 层数：{{ cqItem.floor }} </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        建筑面积：{{ formatterArea(cqItem.jzmj) }}平方米
                      </el-col>
                      <!-- <el-col :span="12"> 拆迁补偿：{{ cqItem.pay }}万元 </el-col> -->
                    </el-row>
                    <!-- <el-row>
                      <el-col :span="24">
                        <el-image src="../../../../static/images/location1.png" style="height: 1.2rem; width: 1.2rem"
                          @click="cqLocation(true, cqItem.smid, cqItem.cqr)"></el-image>
                        地址：{{ cqItem.address }}
                      </el-col>
                    </el-row> -->
                  </li>
                </ul>
              </el-tab-pane>
            </el-tabs>
          </el-tab-pane>
          <el-tab-pane label="集体评估" name="JT">
            <div class="divCol">
              <div class="divImg">
                <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
              </div>
              <div class="divText">
                <div>
                  <span style="color: #fff">集体用地(亩)</span>
                </div>
                <div>
                  <span color="#2d8cf0">{{ formatterArea(zdResult.jtMJ) }}</span>
                </div>
              </div>
            </div>
            <el-tabs v-model="activePage3" @tab-click="jtPageClick">
              <!-- <el-tab-pane label="集体权属" name="JTQS">
                 <div id="GYQSChart" style="height: 12rem; width: 25rem;"></div>
              </el-tab-pane> -->
              <el-tab-pane label="征地补偿评估" name="ZDPG">
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 集体征地补偿费(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(zdResult.totalPay) }}</span>
                      </div>
                    </div>
                  </div>
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 集体土地补偿费(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(zdResult.totalZDPay) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <!-- 第三行 -->
                <div class="divrow">
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 集体安置补偿费(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(zdResult.totalAZPay) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <div id="JTOWNERChart" style="height:12rem; width: 25rem;"></div>
                <div id="JTUSEChart" style="height: 12rem; width: 25rem;"></div>
                <div id="JTDLChart" style="height: 12rem; width: 25rem;"></div>

              </el-tab-pane>
              <el-tab-pane label="青苗补偿评估" name="QMPG">
                <!-- 第一行 -->
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 补偿面积(亩)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(qmResult.totalMJ) }}</span>
                      </div>
                    </div>
                  </div>
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 青苗补偿(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0"> {{ formatterArea(qmResult.totalPay) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <!-- 第2行 -->
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 农作物补偿面积(亩)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(qmResult.nzwMJ) }}</span>
                      </div>
                    </div>
                  </div>
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 农作物补偿费用(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0"> {{ formatterArea(qmResult.nzwPay) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <!-- 第3行 -->
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 经济作物补偿面积(亩)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(qmResult.jjzwMJ) }}</span>
                      </div>
                    </div>
                  </div>
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 经济作物补偿费(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0"> {{ formatterArea(qmResult.jjzwPay) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <!-- 第4行 -->
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 树木补偿面积(亩)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(qmResult.smMJ) }}</span>
                      </div>
                    </div>
                  </div>
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 树木补偿费用(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0"> {{ formatterArea(qmResult.smPay) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <div id="QMMJChart" style="height: 10rem; width: 25rem"></div>
                <div id="QMFYChart" style="height: 10rem; width: 25rem"></div>
              </el-tab-pane>
              <el-tab-pane label="房屋拆迁补偿评估" name="FWCQ">
                <!-- 第1行 -->
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 房屋数量(个)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ cqResult.jtCount }}</span>
                      </div>
                    </div>
                  </div>
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 房屋建筑面积(平方米)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0"> {{ formatterArea(cqResult.jtJZMJ) }}</span>
                      </div>
                    </div>
                  </div>
                </div>
                <!-- 第2行 -->
                <div class="divrow">
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd1" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 预计补偿(万元)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0">{{ formatterArea(cqResult.totalPay) }}</span>
                      </div>
                    </div>
                  </div>
                  <!-- 123 -->
                  <div class="divCol">
                    <div class="divImg">
                      <img :src="imgs.zd2" style="height: 2.5rem; width: 2.5rem" />
                    </div>
                    <div class="divText">
                      <div>
                        <span style="color: #fff"> 平均补偿费(元/平方米)</span>
                      </div>
                      <div>
                        <span color="#2d8cf0"> {{ formatterArea(cqResult.average) }}</span>
                      </div>
                    </div>
                  </div>
                </div>

                <ul style="width: 25rem;height: 25rem;overflow-y: auto;">
                  <!-- item = { id: smid, cqr: cqrVal, jg: fwjgVal, fwdj: fwdjVal, floor: floorVal, jzmj: jzmjVal, zdmj: zdmjVal, address: addressVal, pay: pay, single: BZ } -->
                  <li v-for="(cqItem, index) in cqResult.jtList" :key="index"
                    style="margin-bottom: 0.5rem; font-size: 0.8rem">
                    <el-row>
                      <el-col :span="20">
                        <span style="color: #06c4f3; font-weight: 600">{{ index + 1 }}.&nbsp{{ cqItem.cqr }}</span>
                      </el-col>
                      <el-col :span="4">
                        <el-image src="../../../../static/images/location1.png" style="height: 1.5rem; width: 1.5rem"
                          @click="cqLocation(false, cqItem.smid, cqItem.cqr)"></el-image>
                        <!-- <img src="imgs.zd1" /> -->
                        <!-- <i class="el-icon-s-operation"></i> -->
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12"> 结构：{{ cqItem.jg }} </el-col>
                      <el-col :span="12"> 层数：{{ cqItem.floor }} </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        建筑面积：{{ formatterArea(cqItem.jzmj) }}平方米
                      </el-col>
                      <el-col :span="12"> 拆迁补偿：{{ formatterArea(cqItem.pay) }}万元 </el-col>
                    </el-row>
                    <!-- <el-row>
                      <el-col :span="24">
                      
                        地址：{{ cqItem.address }}
                      </el-col>
                    </el-row> -->
                  </li>
                </ul>
              </el-tab-pane>
            </el-tabs>
          </el-tab-pane>
        </el-tabs>
      </el-tab-pane></el-tabs>
  </div>
</template>
<script>

import {
  polygon,
  area,
  booleanContains,
  intersect,
} from "@turf/turf";
import proj4 from "proj4";
// import shpjs from "shpjs";
import CQSetInfo from "./CQSetInfo.vue";
import CQShowInfo from "./CQShowInfo.vue";
import QMSetInfo from "./QMSetInfo.vue";
import QMShowInfo from "./QMShowInfo.vue";

import ZDSetInfo from "./ZDSetInfo.vue";
import ZDShowInfo from "./ZDShowInfo.vue";
import Property from "./Property.vue";
import {
  getCqBcbzList, getZdBcbzList, getQmbcbzList,
  getZdProjectList, getZdProjectById, addZdProject, delZdProject,
  addQmResult, addCqResult, addZdResult, expotZDBCWord
} from "@/api/zt/ztApi.js";
import zdAnalyse from './zdAnalyse.js'
import Popup from "../Popup.js";
var handlerPolygon;
var handleInput;
var polygonEntity = null;
var popupBox=null;
export default {
  props: ["layerid"],
  name: "DemolitionList",
  data() {
    return {
      
      searchName: "",
      FileList: [],
      localLoading: null,
      tableData: [],
      imageData: '',
      /**
       *
       */
      imgs: {
        loc: require("@/assets/images/loc.png"),
        /**
         * 征地版面图片
         */
        zd1: require("@/assets/homeimg/1.png"),
        zd2: require("@/assets/homeimg/1.png"),
        zd3: require("@/assets/homeimg/1.png"),
        zd4: require("@/assets/homeimg/1.png"),
        /**
         * 拆迁版面图片
         */
        cq1: require("@/assets/homeimg/1.png"),
        cq2: require("@/assets/homeimg/1.png"),
        cq3: require("@/assets/homeimg/1.png"),
        cq4: require("@/assets/homeimg/1.png"),
        /**
         * 青苗版面图片
         */
        qm1: require("@/assets/homeimg/1.png"),
        qm2: require("@/assets/homeimg/1.png"),
        qm3: require("@/assets/homeimg/1.png"),
        qm4: require("@/assets/homeimg/1.png"),
      },
      /**
       * tabs 标签
       */
      activeName: 'first',
      activePage1: "GY",
      activePage2: 'GYQS',
      activePage3: "ZDPG",
      /**土地权属 */
      activateQS: 'gytd',
      /**
       * 弹窗保证弹出唯一
       */
      sublayerid: null,

      ruleForm: {
        projectName: "",
        /**
         * 征地标准值
         */
        zdValue: "",
        /* 青苗标准值
         */
        qmValue: "",
        /**
         * 拆迁标准值
         */
        cqValue: "",
      },
      rules: {
        projectName: [
          { required: true, message: "请输入项目名称", trigger: "blur" },
        ],
        zdValue: [
          { required: true, message: "请选择征地补偿标准", trigger: "blur" },
        ],

        qmValue: [
          { required: true, message: "请选择青苗补偿标准", trigger: "blur" },
        ],

        cqValue: [
          { required: true, message: "请选择拆迁补偿标准", trigger: "blur" },
        ],
      },
      /**
      /**
      /**
       * 征地标准列表
       */
      zdList: [
        // {
        //     label: "征地标准01",
        //     value: '征地标准01',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
        // {
        //     label: "征地标准02",
        //     value: '征地标准02',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
        // {
        //     label: "征地标准03",
        //     value: '征地标准03',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
      ],
      /**
       * 青苗标准值
       */
      qmList: [
        // {
        //     label: "青苗标准01",
        //     value: '01',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
        // {
        //     label: "青苗标准02",
        //     value: '02',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
        // {
        //     label: "青苗标准03",
        //     value: '03',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
      ],
      /**
       * 拆迁标准值
       */
      cqList: [
        // {
        //     label: "拆迁标准01",
        //     value: '01',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
        // {
        //     label: "拆迁标准02",
        //     value: '02',
        //     rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
        // {
        //     label: "拆迁标准03",
        //     value: '03', rules: {
        //         /**
        //          * 土地统一年产值
        //          */
        //         TDCZ: 1000,
        //         /**
        //          * 土地补偿倍数
        //          */
        //         TDBCBS: 10,
        //         /**
        //          * 土地补偿费
        //          */
        //         TDBCF: 1000,
        //         /**
        //                                 * 安置补偿倍数
        //                                 */
        //         AZBCBS: 10,
        //         /**
        //         * 安置补偿费
        //         */
        //         ZBBCF: 111,
        //         //  /**
        //         //  * 土地补偿费
        //         //  */
        //         // BCHJ:1000,
        //     }
        // },
      ],
      /***
       * tab2
       */

      dateVal: "",
      projectList: [
        // {
        //     id: '',
        //     name: '',
        //     date: '',
        //     /* 征地标准值
        //     */
        //     zdValue: '',
        //     /* 青苗标准值
        //      */
        //     qmValue: '',
        //     /**
        //      * 拆迁标准值
        //      */
        //     cqValue: '',
        //     /**
        //      * 分析范围
        //      */
        //     geometry: {},
        //     /**
        //      * 拆迁分析结果
        //      */
        //     cqResult: {},
        //     /**
        //      * 青苗分析结果
        //      */
        //     qmResult: {},
        //     /**
        //      * 征地分析结果
        //      */
        //     zdResult: {}
        // }
      ],
      rowsCount: 10,
      pageSize: 10,
      currentPage: 1,
      curProjectInfo: {
        id: "",
        projectName: "",
        imageData: "",
        totalZDMJ: 0.0,
        gyMJ: 0.0,
        jtMJ: 0.0,
        dateTime: "",
        /* 征地标准值
         */
        zdValue: "",
        /* 青苗标准值
         */
        qmValue: "",
        /**
         * 拆迁标准值
         */
        cqValue: "",
        /**
         * 分析范围
         */
        regions: {},
        /**
         * 拆迁分析结果
         */
        cqResult: {
        },
        /**
         * 青苗分析结果
         */
        qmResult: {},
        /**
         * 征地分析结果
         */
        zdResult: {},
        /**
         * 权属信息
         */
        qsResult: {}
      },
      /**
       * 拆迁结果
       */
      cqResult: {
        count: 0,
        totalJZMJ: 0,
        totalPay: 0,
        average: 0,
        gyJZMJ: 0,
        jtJZMJ: 0,
        gyCount: 0,
        jtCount: 0,
        gyList: [],
        jtList: [],
        gyfeatures: [],
        jtfeatures: [],
        fieldInfos: []
      },
      // {
      //     id: 3,
      //     name: '朱长贵明',
      //     jg: '砖木结构',
      //     area: 123.98,
      //     floor: 1,
      //     address: '朱楼村111号',
      //     pay: 730021,
      //     single: 5862,
      // },
      /**
       * 青苗结果
       */
      qmResult: {
        totalPay: 0.0,
        totalMJ: 0.0,
        nzwMJ: 0.0,
        nzwPay: 0.0,
        jjzwMJ: 0.0,
        jjzwPay: 0.0,
        smMJ: 0.0,
        smPay: 0.0,
        fieldInfos: [],
        features: [],
      },
      /**
       * 征地结果
       */
      zdResult: {
        //国有面积
        gyMJ: 0,
        //集体面积
        jtMJ: 0,
        //征地面积
        totalZDMJ: 0,
        //总补偿
        totalPay: 0,
        //征地补偿
        totalZDPay: 0,
        //安置补偿
        totalAZPay: 0,
        //国有地类及面积
        gydlList: [],
        //地类及面积
        jtdlList: [],
        gyfeatures: [],
        jtfeatures: [],
        fieldInfos: [],
      },
      /**
       * 权属信息
       */
      qsResult: {
        stateUsedMJ: 0,
        stateUsedFeatures: [],
        stateUsedList: [],
        stateUsedFieldInfos: [],

        collectiveOwnerMJ: 0,
        collectiveOwnerFeatures: [],
        collectiveOwnerList: [],
        collectiveOwnerFieldInfos: [],

        collectiveUsedMJ: 0,
        collectiveUsedList: [],
        collectiveUsedFeatures: [],
        collectiveUsedFieldInfos: []
      },
      /**
       * 绘制多边形
       */
      // handlerPolygon: null,
      positions: [],
      regions: [],
      /**
       * 临时图元信息
       */
      entities: [
        // {type:'zdbc',id:'',entity:null}
      ],
      qsEntities: [],
      // handlerPolygon: null
      // clipMode: Cesium.ModifyRegionMode.CLIP_OUTSIDE;
      gyqsChartdatas: [],
      jtqsChartDatas: []
    };
  },
  created() {
    if (viewer.shadows == false) {
      viewer.shadows = true; //开启场景阴影
      viewer.terrainShadows = true; //地形阴影
    }
    let scene = viewer.scene;
    let layers = scene.layers.layerQueue;
    //图层模型设置阴影
    for (let i = 0; i < layers.length; i++) {
      if (layers[i].shadowType !== 2) {
        layers[i].shadowType = 2;
        // layers[i].refresh();
      }
    }
    this.initSetting();
  },
  methods: {
    formatterArea(area) {
      if (area) {
        return area.toFixed(2);
      }
      return 0.0;
    },
    formatterPay(number) {
      return (number / 10000).toFixed(2);
    },
    /**
     * tas切换
     * @param {String} tab
     * @param {Object} event
     */
    handleClick(tab, event) {
      if (this.activeName == "third") {
        this.pageClick();
      }
    },
    /**
     * 初始化
     */
    initSetting() {
      var that = this;
      var date = new Date()
      that.ruleForm.projectName = "拆迁补偿项目_" + that.formatDateTimeToLong(date)

      if (window.isUseDB) {
        getCqBcbzList().then((res) => {
          if (res) {
            that.cqList = res.rows;
            that.ruleForm.cqValue = that.cqList[0].id
          }
        }).catch((err) => {
          console.log(err)
        })
        getQmbcbzList().then((res) => {
          that.qmList = res.rows;
          that.ruleForm.qmValue = that.qmList[0].id
        }).catch((err) => {
          console.log(err)
        })
        getZdBcbzList().then((res) => {
          that.zdList = res.rows;
          that.ruleForm.zdValue = that.zdList[0].id
        }).catch((err) => {
          console.log(err)
        })
        // getZdProjectList().then((res) => {
        //   that.projectList = res.rows;
        // }).catch((err) => {
        //   console.log(err)
        // })
        that.queryProject();

      }
      else {
        that.zdList = window.ZSBC.ZDBCList;
        that.cqList = window.ZSBC.CQBCList;
        that.qmList = window.ZSBC.QMBCList;
        that.ruleForm.qmValue = that.qmList[0].id
        that.ruleForm.cqValue = that.cqList[0].id
        that.ruleForm.zdValue = that.zdList[0].id
        var list = JSON.stringify(window.ZSBC.projectList)
        if (list)
          that.projectList = JSON.parse(list)
      }
    },
    /**
     * 查询项目
     */
    queryProject() {
      var startDate;
      var endDate;
      var that = this
      if (this.dateVal == null || this.dateVal == "") {
        // var interval = that.dateVal[1] - that.dateVal[0]
        startDate = "";
        endDate = ""
      }
      else {
        startDate = that.formatDateTime(that.dateVal[0])
        endDate = that.formatDateTime(that.dateVal[1])
      }
      if (window.isUseDB) {
        var queryParams = {
          "pageNum": that.currentPage,
          "pageSize": that.pageSize,
          // "orderByColumn": "zt_zd_project_list.dateTime",
          // "isAsc": "DESC",

          "projectName": that.searchName,
          "params": {
            "beginDateTime": startDate,
            "endDateTime": endDate,
          }
        }

        debugger
        getZdProjectList(queryParams).then((res) => {
          that.projectList = res.rows;
          that.rowsCount = res.total;
        }).catch((err) => {
          console.log(err)
        })
      }
      else {
        var list
        if (that.dateVal != null) {
          if (that.searchName.length > 0)
            list = window.ZSBC.projectList.find(t => t.projectName.indexOf(that.searchName) > -1 && t.dateTime >= startDate &&
              t.dateTime < endDate)
          else
            list = window.ZSBC.projectList.find(t => t.dateTime >= startDate &&
              t.dateTime < endDate).se
        }
        else {
          if (that.searchName.length > 0)
            list = window.ZSBC.projectList.find(t => t.projectName.indexOf(that.searchName) > -1)
          else {
            list = window.ZSBC.projectList
          }
        }
        that.rowsCount = list.length;
        list = list.slice((that.currentPage - 1) * that.pageSize, that.pageSize)
      }
    },
    onCurrentChange() {
      this.queryProject()
    },
    formatDateTimeToLong(date) {
      if (date == undefined || date == null)
        return '';
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? ('0' + m) : m;
      var d = date.getDate();
      d = d < 10 ? ('0' + d) : d;
      var h = date.getHours();
      h = h < 10 ? ('0' + h) : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? ('0' + minute) : minute;
      var second = date.getSeconds();
      second = second < 10 ? ('0' + second) : second;
      return y.toString() + m.toString() + d.toString() + h.toString() + minute.toString() + second.toString();
    },
    formatDateTime(date) {
      if (date == undefined)
        return '';
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? ('0' + m) : m;
      var d = date.getDate();
      d = d < 10 ? ('0' + d) : d;
      var h = date.getHours();
      h = h < 10 ? ('0' + h) : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? ('0' + minute) : minute;
      var second = date.getSeconds();
      second = second < 10 ? ('0' + second) : second;
      return y.toString() + '-' + m.toString() + '-' + d.toString() + ' ' + h.toString() + ':' + minute.toString() + ':' + second.toString();
    },
    //关闭窗体
    dialogClose() {
      viewer.entities.removeAll();
      if (handlerPolygon) {
        handlerPolygon.deactivate();
        handlerPolygon.clear();
      }
      this.positions = [];
      this.regions = [];
      if (this.layerid) this.$layer.close(this.layerid);
    },
    /**
     * 导出报告
     * @param item 报告信息
     */
    async handleGetBG(item) {
      debugger;
      if (item) {
        await getZDBCWord(item);
      }
    },
    /**
     *拆迁标准查看
     */
    cqShow() {
      var that = this;
      if (that.sublayerid) that.$layer.close(that.sublayerid);
      var width = 400;
      var top = 500;
      var left = 680; //Math.floor(document.body.clientWidth - width / 2);
      var height = 350;

      that.sublayerid = that.$layer.iframe({
        content: {
          content: CQShowInfo, //传递的组件对象
          parent: this, //当前的vue对象
          data: { cqValue: that.ruleForm.cqValue }, //props
        },
        // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
        area: ["35rem", "40rem"],
        title: "拆迁补偿标准详情",
        maxmin: false,
        shade: false, //是否显示遮罩
        shadeClose: false, //点击遮罩是否关闭
        cancel: () => {
          //关闭事件
          // alert("关闭iframe");
        },
      });
    },
    /**
     * 拆迁标准设置
     */
    cqSet() {
      var that = this;
      if (that.sublayerid) that.$layer.close(that.sublayerid);
      var width = 400;
      var top = 500;
      var left = Math.floor(document.body.clientWidth - width / 2);
      var height = 350;
      that.sublayerid = that.$layer.iframe({
        content: {
          content: CQSetInfo, //传递的组件对象
          parent: this, //当前的vue对象
          data: { cqValue: that.ruleForm.cqValue }, //props
        },
        // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
        area: ["50rem", "48rem"],
        title: "拆迁补偿标准配置",
        maxmin: false,
        shade: false, //是否显示遮罩
        shadeClose: false, //点击遮罩是否关闭
        cancel: () => {
          //关闭事件
          // alert("关闭iframe");
        },
      });
    },
    /**
     *青苗标准查看
     */
    qmShow() {
      var that = this;
      if (that.sublayerid) that.$layer.close(that.sublayerid);
      var width = 400;
      var top = 500;
      var left = Math.floor(document.body.clientWidth - width / 2);
      var height = 350;
      that.sublayerid = that.$layer.iframe({
        content: {
          content: QMShowInfo, //传递的组件对象
          parent: this, //当前的vue对象
          data: { qmValue: that.ruleForm.qmValue }, //props
        },
        // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
        area: ["30rem", "18rem"],
        title: "青苗补偿标准详情",
        maxmin: false,
        shade: false, //是否显示遮罩
        shadeClose: false, //点击遮罩是否关闭
        cancel: () => {
          //关闭事件
          // alert("关闭iframe");
        },
      });
    },
    /**
     * 青苗标准设置
     */
    qmSet() {
      var that = this;
      if (that.sublayerid) that.$layer.close(that.sublayerid);
      var width = 400;
      var top = 500;
      var left = Math.floor(document.body.clientWidth - width / 2);
      var height = 350;
      that.sublayerid = that.$layer.iframe({
        content: {
          content: QMSetInfo, //传递的组件对象
          parent: this, //当前的vue对象
          data: { qmValue: that.ruleForm.qmValue }, //props
        },
        // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
        area: ["35rem", "22rem"],
        title: "青苗补偿标准配置",
        maxmin: false,
        shade: false, //是否显示遮罩
        shadeClose: false, //点击遮罩是否关闭
        cancel: () => {
          //关闭事件
          // alert("关闭iframe");
        },
      });
    },
    /**
     *征地标准查看
     */
    zdShow() {
      var that = this;
      if (that.sublayerid) that.$layer.close(that.sublayerid);
      var width = 400;
      var top = 500;
      var left = Math.floor(document.body.clientWidth - width / 2);
      var height = 350;
      that.sublayerid = that.$layer.iframe({
        content: {
          content: ZDShowInfo, //传递的组件对象
          parent: this, //当前的vue对象
          data: { zdValue: that.ruleForm.zdValue }, //props
        },
        // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
        area: ["35rem", "32rem"],
        title: "征地补偿标准详情",
        maxmin: false,
        shade: false, //是否显示遮罩
        shadeClose: false, //点击遮罩是否关闭
        cancel: () => {
          //关闭事件
          // alert("关闭iframe");
        },
      });
    },
    /**
     * 征地标准设置
     */
    zdSet() {
      var that = this;
      if (that.sublayerid) that.$layer.close(that.sublayerid);
      var width = 400;
      var top = 500;
      var left = Math.floor(document.body.clientWidth - width / 2);
      var height = 350;
      that.sublayerid = that.$layer.iframe({
        content: {
          content: ZDSetInfo, //传递的组件对象
          parent: this, //当前的vue对象
          data: { zdValue: that.ruleForm.zdValue }, //props
        },
        // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
        area: ["35rem", "39rem"],
        title: "征地补偿标准配置",
        maxmin: false,
        shade: false, //是否显示遮罩
        shadeClose: false, //点击遮罩是否关闭
        cancel: () => {
          //关闭事件
          // alert("关闭iframe");
        },
      });
    },
    /**
     * 查看姓名结果
     * @param {object} projectInfo
     */
    showResult(projectInfo) {
      var that = this
      that.activeName = "third";
      debugger
      that.curProjectInfo = projectInfo;
      that.regions = JSON.parse(that.curProjectInfo.regions)
      var nPositions = [];
      that.regions.forEach((item) => {
        nPositions.push(item.x)
        nPositions.push(item.y)
      })
      viewer.entities.removeById('polygon');
      polygonEntity = new Cesium.Entity({
        id: 'polygon',
        polygon: {
          hierarchy: new Cesium.PolygonHierarchy(
            new Cesium.Cartesian3.fromDegreesArray(nPositions)
          ),
          material: Cesium.Color.WHITE.withAlpha(0.3),
          outline: true,
          outlineColor: Cesium.Color.RED,
          outlineWidth: 2.0,
        },
      });
      viewer.entities.add(polygonEntity)
      viewer.flyTo(polygonEntity)
      if (window.isUseDB) {
        getZdProjectById(projectInfo.id).then((res) => {
          projectInfo = res.data
          that.setSeletedReslut(projectInfo);
        }).catch((err) => {
          console.log(err)
        })
      }
      else {
        that.setSeletedReslut(projectInfo);
      }
    },
    /**
     * 根据页面切换加载地图数据 主入口
     */
    loadInitData() {
      var that = this;
      that.entities.forEach((item) => {
        viewer.entities.removeById(item.id);
      });
      that.entities = [];
      that.qsEntities.forEach((item) => {
        viewer.entities.removeById(item.id);
      })
      that.qsEntities = [];
      if (that.activePage1 == "GY") {
        if (that.activePage2 == "GYQS") {
          that.GYQSChart();
          that.GYDLChart();
        }
        // else if (that.activePage2 == "GYFC") {
        //   // that.cqLocation(true, null)
        // }
      }
      else {
        if (that.activePage3 == "ZDPG") {
          that.JTDLChart();
          that.JTOwnerChart();
          that.JTUseChart();
        }
        else if (that.activePage3 == "QMPG") {
          that.QMBCChart();
        }

      }
    },
    //显示项目信息
    setSeletedReslut(projectInfo) {
      this.qmResult = {
        totalPay: projectInfo.qmResult.totalPay,
        totalMJ: projectInfo.qmResult.totalMJ,
        nzwMJ: projectInfo.qmResult.nzwMJ,
        nzwPay: projectInfo.qmResult.nzwPay,
        jjzwMJ: projectInfo.qmResult.jjzwMJ,
        jjzwPay: projectInfo.qmResult.jjzwPay,
        smMJ: projectInfo.qmResult.smMJ,
        smPay: projectInfo.qmResult.smPay,
        fieldInfos: JSON.parse(projectInfo.qmResult.fieldInfos),
        features: JSON.parse(projectInfo.qmResult.features),
      }
      this.cqResult = {
        count: projectInfo.cqResult.count,
        totalJZMJ: projectInfo.cqResult.totalJZMJ,
        totalPay: projectInfo.cqResult.totalPay,
        average: projectInfo.cqResult.average,
        gyJZMJ: projectInfo.cqResult.gyJZMJ,
        jtJZMJ: projectInfo.cqResult.jtJZMJ,
        gyCount: projectInfo.cqResult.gyCount,
        jtCount: projectInfo.cqResult.jtCount,
        gyList: JSON.parse(projectInfo.cqResult.gyList),
        jtList: JSON.parse(projectInfo.cqResult.jtList),
        gyfeatures: JSON.parse(projectInfo.cqResult.gyfeatures),
        jtfeatures: JSON.parse(projectInfo.cqResult.jtfeatures),
        fieldInfos: JSON.parse(projectInfo.cqResult.fieldInfos)
      }
      this.zdResult = {
        //国有面积
        gyMJ: projectInfo.zdResult.gyMJ,
        //集体面积
        jtMJ: projectInfo.zdResult.jtMJ,
        //征地面积
        totalZDMJ: projectInfo.zdResult.totalZDMJ,
        //总补偿
        totalPay: projectInfo.zdResult.totalPay,
        //征地补偿
        totalZDPay: projectInfo.zdResult.totalZDPay,
        //安置补偿
        totalAZPay: projectInfo.zdResult.totalAZPay,
        //国有地类及面积
        gydlList: JSON.parse(projectInfo.zdResult.gydlList),
        //地类及面积
        jtdlList: JSON.parse(projectInfo.zdResult.jtdlList),
        gyfeatures: JSON.parse(projectInfo.zdResult.gyfeatures),
        jtfeatures: JSON.parse(projectInfo.zdResult.jtfeatures),
        fieldInfos: JSON.parse(projectInfo.zdResult.fieldInfos),

      }
      this.qsResult = {
        stateUsedMJ: projectInfo.qsResult.stateUsedMJ,
        stateUsedFeatures: JSON.parse(projectInfo.qsResult.stateUsedFeatures),
        stateUsedList: JSON.parse(projectInfo.qsResult.stateUsedList),
        stateUsedFieldInfos: JSON.parse(projectInfo.qsResult.stateUsedFieldInfos),

        collectiveOwnerMJ: projectInfo.qsResult.collectiveOwnerMJ,
        collectiveOwnerFeatures: JSON.parse(projectInfo.qsResult.collectiveOwnerFeatures),
        collectiveOwnerList: JSON.parse(projectInfo.qsResult.collectiveOwnerList),
        collectiveOwnerFieldInfos: JSON.parse(projectInfo.qsResult.collectiveOwnerFieldInfos),

        collectiveUsedMJ: projectInfo.qsResult.collectiveUsedMJ,
        collectiveUsedList: JSON.parse(projectInfo.qsResult.collectiveUsedList),
        collectiveUsedFeatures: JSON.parse(projectInfo.qsResult.collectiveUsedFeatures),
        collectiveUsedFieldInfos: JSON.parse(projectInfo.qsResult.collectiveUsedFieldInfos)

      }
      this.loadInitData()
      // this.JTDLChart();
      // this.GYDLChart();
      // this.QMBCChart();

      // this.GYQSChart();
      // this.JTOwnerChart();
      // this.JTUseChart();
    },
    //删除项目
    deletProject(projectInfo) {
      var that = this
      var id = that.$layer.confirm("确定要删除吗？", {}, function () {
        delZdProject([projectInfo.id]).then((res) => {
          if (res)
            debugger
          that.$layer.close(id)
          that.$message("数据已删除!");
          that.queryProject();
        }).catch((err) => {
          console.log(err)
        })

      }, function () {
        return
      });

    },
    /**
     * 页面切换
     */
    pageClick(tab, event) {
      // var name = tab.name
      this.loadInitData();
    },
    gyPpageClick(tab, event) {
      this.loadInitData();
    },
    jtPageClick(tab, event) {
      this.loadInitData();
    },
    /**
     * 征地权属切换
     */
    qsClick(tab, event) {
      // viewer.entities.removeAll()
      this.entities.forEach((item) => {
        viewer.entities.removeById(item.id)
      })
      this.entities = []
    },
    handlePreview(file) { },
    handleRemove(file, fileList) { },
    beforeRemove(file, fileList) { },
    handleOnChange(file, fileList) { },
    /**
     * 点击导入范围
     */
    inputGeometry() {
      var element = document.getElementById('fileInput')
      // debugger
      // document.getElementsByClassName("el-upload__input")= ""
      if (element)
        element.click();

    },
    handleUpload(event) {
      var element = document.getElementById('fileInput')
      // element.files=[];
      debugger
      if (polygonEntity) {
        viewer.entities.remove(polygonEntity)
      }
      // let fileName = document.getElementsByClassName("el-upload__input")[0].value
      let fileName = event.target.files[0];
      var size = fileName.size
      if (size > 512 * 1024) {
        {
          this.$message("文件大小超限，请重新输入!");
          event.target.value = ''
          return
        }
      }
      let reader = new FileReader();
      var geojson;
      var that = this

      reader.readAsArrayBuffer(fileName);
      reader.onload = function (e) {
        debugger;
        let res = e.target.result; //ArrayBuffer
        shp(res)
          .then(function (res) {
            // self.addGeometry(res)
            geojson = res;
            console.log(geojson);
            that.addGeometry(geojson)
          })
          .catch(function (e) {
            console.log(e);
          });
        event.target.value = ''
      };
      // this.parsingZip();
    },
    /**
     * 导入范围添加图形
     */
    addGeometry(geojson) {
      var that = this;
      proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs +type=crs");
      debugger
      var coordinates = geojson.features[0].geometry.coordinates;
      var box = geojson.features[0].geometry.bbox;
      var centerX = (box[0] + box[2]) / 2;
      var centerY = (box[1] + box[3]) / 2;
      var positions = [];
      that.regions = [];
      for (var i = 0; i < coordinates.length; i++) {
        var coor = coordinates[i];
        var nCoor;
        if (coor && coor.length > 0) {
          for (var j = 0; j < coor.length; j++) {
            nCoor = proj4(proj4("EPSG:4326"), proj4("EPSG:4490"), coor[j]);
            that.regions.push({ x: nCoor[0], y: nCoor[1] })
            positions.push(nCoor[0])
            positions.push(nCoor[1])
          }
        }
      }
      viewer.entities.removeById('polygon');
      polygonEntity = new Cesium.Entity({
        id: 'polygon',
        position: Cesium.Cartesian3.fromDegreesArray([
          centerX,
          centerY,
        ]),
        // classificationType: ClassificationType.TERRAIN,
        polygon: {
          hierarchy: new Cesium.PolygonHierarchy(
            new Cesium.Cartesian3.fromDegreesArray(positions)
          ),
          // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
          material: Cesium.Color.WHITE.withAlpha(0.3),
          outline: true,
          outlineColor: Cesium.Color.RED,
          outlineWidth: 2.0,
        },
      });
      that.curProjectInfo.regions = that.regions
      viewer.entities.add(polygonEntity);
      viewer.flyTo(polygonEntity)

    },
    handleExceed(files, fileList) { },

    handleChange(response, file, fileList) {
      console.log(file);
    },
    onchange() {
      console.log("上传失败");
    },
    /**
     * 上传失败
     */
    uploadError(response, file, fileList) {
      this.$message("导入失败，选择其它文件!");
    },
    /**
     * 上传成功
     */
    uploadSuccess(response, file, fileList) {
      debugger;
      console.log("上传成功");
    },
    /**
     * 读取shape  zip
     */
    getShapeGeometry(response, file, fileList) {
      const geojson = shpjs("files/pandr.zip");
    },
    /**
     * 拾取实体并查询属性
     */
    pickEntity(prefix) {
      {
        var that = this
        var id = '';
        var pick
        that.tableData = [];
        if (this.sublayerid)
          that.$layer.close(that.sublayerid)
        if (handlerPolygon) {
          handlerPolygon.deactivate()
          handlerPolygon.clear();
        }

        handleInput = new Cesium.ScreenSpaceEventHandler(scene.canvas);
        handleInput.setInputAction(function (movement) {
          pick = viewer.scene.pick(movement.position);
          if (pick != null) {
            that.tableData = [];
            var fieldNames = [];
            var fieldValues = []
            id = pick.id._id
            if (id&&id.indexOf && id.indexOf(prefix) > -1) {
              fieldNames = pick.id.attributes.fieldNames;
              fieldValues = pick.id.attributes.fieldValues;
              for (var i = 0; i < fieldNames.length; i++) {
                if (
                  fieldNames[i].name.toUpperCase() == "SMID" ||
                  fieldNames[i].name.toUpperCase() == "SMUSERID" ||
                  fieldNames[i].name.toUpperCase() == "SMAREA" ||
                  fieldNames[i].name.toUpperCase() == "SMPERIMETER" ||
                  fieldNames[i].name.toUpperCase() == "SMGEOMETRY" ||
                  fieldNames[i].name.toUpperCase() == "OBJECTID" ||
                  fieldNames[i].name.toUpperCase() == "SHAPE_LENGTH" ||
                  fieldNames[i].name.toUpperCase() == "SHAPE_AREA" ||
                  fieldNames[i].name.toUpperCase() == "SHAPE_LENG"
                )
                  continue;
                that.tableData.push({
                  name: fieldNames[i].caption,
                  value: fieldValues[i],
                });
              }

              that.sublayerid = that.$layer.iframe({
                id: 'ss',
                content: {
                  content: Property, //传递的组件对象
                  parent: that, //当前的vue对象
                  data: { tableData: that.tableData }, //props
                },
                // offset: [left.toString(), top.toString()], //left top  左上角(left=430px/2;top=（800px+header高）/2)
                area: ["20rem", "30rem"],
                title: "属性信息",
                maxmin: false,
                shade: false, //是否显示遮罩
                shadeClose: false, //点击遮罩是否关闭
                cancel: () => {
                  //关闭事件
                  // alert("关闭iframe");
                },
              });
            }
          }
        }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

      }
    },
    /**
     * 获取用地用海分类统一颜色
     */
    getLandColor(name) {
      var color = "rgb(172,255,207)";
      window.colorList.forEach((element) => {
        if (element.name.indexOf(name) > -1)
          color = element.color;
      });
      return color;
    },
    /**
     *征地补偿chart
     */
    JTDLChart() {
      var that = this;
      var chartDom = document.getElementById("JTDLChart");
      var myChart = window.echarts.init(chartDom);
      // this.zdResult.list.push({ 'dlbm': dlbmVal, 'dlmc': dlmcVal, 'mj': insertArea });
      var datas = [];
      var nameLength = 0;
      var colors = [];
      var color;
      that.zdResult.jtdlList.forEach(item => {
        datas.push({ name: item.dlmc, value: item.mj })
        color = that.getLandColor(item.dlmc)
        if (color != null)
          colors.push(color);
      })
      var option = {
        title: {
          text: '现状情况',
          subtext: '',
          top: 'top',
          left: 'center',
          textStyle: {
            color: "#FFFFFF"
          }
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          type: "scroll",
          orient: "vertical",
          right: 0,
          top: '20%',
          bottom: 20,
          radius: "55%",
          // bottom: 20,
          textStyle: {
            // fontSize: '12px',
            color: "#FFFF",
          },
          pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          data: datas.map((t) => t.name),
          formatter: function (name) {
            var val = datas.find((t) => t.name == name).value;
            var lastSpace = (10 - name.length) * 3;
            return name + new Array(lastSpace).join(" ") + val + "亩";
          },
        },
        color: colors, // ['#0a915d', '#bb88dd', '#6699ff', '#d5b158', '#ff6347', 'indigo', 'purple'],
        series: [
          {
            name: "征地补偿分析",
            type: "pie",
            center: ["25%", "50%"],
            radius: ["25%", "45%"],
            avoidLabelOverlap: false,
            // itemStyle: {
            //   borderRadius: 10,
            //   borderColor: "#fff",
            //   borderWidth: 2,
            // },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: datas,
          },
        ],
      };
      myChart.clear()
      myChart.setOption(option);
      var showOrHide = false;
      that.JTDLLoad(null, showOrHide);
      myChart.on("legendselectchanged", function (parmas) {
        that.pickEntity('ZDJTYD');
        var name = parmas.name
        showOrHide = parmas.selected[name]
        that.JTDLLoad(name, showOrHide);
      });
    },
    /**
     * 集体地类展示
     * @param {*} name 
     */
    JTDLLoad(name, showOrHide) {
      var that = this;
      var fieldValues = [];
      var dlmcIndex = -1;
      var geometry;
      var dlmcFld = window.ZSBC.ZDBCJS.DLTB.dlmc.field;
      dlmcIndex = that.getfldIndex(that.zdResult.fieldInfos, dlmcFld);
      var dlmc = "";
      var features = that.zdResult.jtfeatures;
      var attributes = {};
      var color = "";
      var colorArr = [3];
      for (var i = 0; i < features.length; i++) {
        fieldValues = features[i].fieldValues;
        if (dlmcIndex > -1) {
          dlmc = fieldValues[dlmcIndex];
        }
        if (name != null && dlmc != name)
          continue;
        var simIndex = features[i].fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        var smid = features[i].fieldValues[simIndex];
        var ff = that.entities.find(t => t.id == "ZDJTYD_" + smid)
        var entity;
        if (ff != null) {
          entity = viewer.entities.getById("ZDJTYD_" + smid)
          if (entity != undefined)
            entity.show = showOrHide;
        }
        else {

          var dlColor = that.getLandColor(dlmc);
          var color = dlColor.replace("rgb", "")
            .replace("(", "")
            .replace(")", "");
          var colorArr = color.split(",");
          attributes = {
            fieldNames: that.zdResult.fieldInfos,
            fieldValues: features[i].fieldValues,
          };
          geometry = features[i].geometry;
          var positions = [];
          for (var j = 0; j < geometry.points.length; j++) {
            positions.push(geometry.points[j].x);
            positions.push(geometry.points[j].y);
          }
          var entity = new Cesium.Entity({
            id: "ZDJTYD_" + smid,
            position: Cesium.Cartesian3.fromDegreesArray([
              geometry.center.x,
              geometry.center.y,
            ]),
            show: true,
            polygon: {
              hierarchy: new Cesium.PolygonHierarchy(
                new Cesium.Cartesian3.fromDegreesArray(positions)
              ),
              material: new Cesium.Color(
                parseInt(colorArr[0]) / 255,
                parseInt(colorArr[1]) / 255,
                parseInt(colorArr[2]) / 255,
                1
              ),
              outline: true,
              outlineColor: Cesium.Color.BLACK,
              outlineWidth: 1.5,
            },
          });
          entity.show = showOrHide;
          entity.attributes = attributes;
          that.entities.push({ type: "ZDJTYD", id: "ZDJTYD_" + smid });
          viewer.entities.add(entity);
        }
      }
    },
    /**
    *国有chart
    */
    GYDLChart() {
      var that = this;
      var chartDom = document.getElementById("GYDLChart");
      var myChart = window.echarts.init(chartDom);
      var datas = [];
      var nameLength = 0;
      var colors = []

      for (var i = 0; i < that.zdResult.gydlList.length; i++) {
        datas.push({
          value: parseFloat((that.zdResult.gydlList[i].mj).toFixed(2)),
          name: that.zdResult.gydlList[i].dlmc,
        });
        var color = that.getLandColor(that.zdResult.gydlList[i].dlmc);
        colors.push(color);
      }
      var option = {
        title: {
          text: '现状情况', //国有所有权信息
          subtext: '',
          top: 'top',
          left: 'center',
          textStyle: {
            color: "#FFFFFF"
          }
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          type: "scroll",
          orient: "vertical",
          right: 0,
          top: '20%',
          bottom: 20,
          radius: "55%",
          // bottom: 20,
          textStyle: {
            // fontSize: '12px',
            color: "#FFFF",
          },
          pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          data: datas.map((t) => t.name),
          formatter: function (name) {
            var val = datas.find((t) => t.name == name).value;
            var spname = '';
            if (name.length > 13)
              spname = name.substring(0, 12) + val + '亩\n' + name.substring(13, name.length)
            else {
              spname = name
              var lastSpace = (13 - spname.length) * 3;
              if (lastSpace < 0)
                lastSpace = 0
              spname += new Array(lastSpace).join(" ") + val + "亩";
            }

            return spname
          },

        },
        color: colors,
        series: [
          {
            name: "国有征地权属分析",
            type: "pie",
            center: ["25%", "50%"],
            radius: ["25%", "45%"],
            avoidLabelOverlap: false,
            // itemStyle: {
            //   borderRadius: 1,
            //   borderColor: "#fff",
            //   borderWidth: 2,
            // },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: datas,
          },
        ],
      };
      myChart.setOption(option);

      var shaowOrHide = false;
      that.GYDLLoad(null, shaowOrHide);
      myChart.on("legendselectchanged", function (parmas) {
        that.pickEntity('ZDGYDL');
        var name = parmas.name
        shaowOrHide = parmas.selected[name]
        that.GYDLLoad(name, shaowOrHide);
      });
    },
    /**
     * 国有地类展示
     * @param {*} datas 
     * @param {*} name 
     * @param {*} shaowOrHide 
     */
    GYDLLoad(name, shaowOrHide) {
      var that = this;
      var color = "";
      // var colors = window.colorList;
      var fieldValues = [];
      var dlmcIndex = -1;
      var dlmcFld = window.ZSBC.ZDBCJS.DLTB.dlmc.field;
      dlmcIndex = that.getfldIndex(that.zdResult.fieldInfos, dlmcFld);
      var dlmc = "";
      var geometry;

      var entity;
      var features = that.zdResult.gyfeatures;
      var attributes = {};
      for (var i = 0; i < features.length; i++) {
        fieldValues = features[i].fieldValues;
        if (dlmcIndex > -1) {
          dlmc = fieldValues[dlmcIndex];
        }
        if (name != null && dlmc != name)
          continue;
        var dlColor = that.getLandColor(dlmc);
        var color = dlColor.replace("rgb", "")
          .replace("(", "")
          .replace(")", "");
        var colorArr = color.split(",");
        var simIndex = features[i].fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        var smid = features[i].fieldValues[simIndex]
        var ff = that.entities.find(t => t.id == "ZDGYDL_" + smid)

        if (ff != null) {
          entity = viewer.entities.getById("ZDGYDL_" + smid)
          if (entity != undefined)
            entity.show = shaowOrHide;
        }
        else {
          attributes = {
            fieldNames: that.zdResult.fieldInfos,
            fieldValues: features[i].fieldValues,
          };
          geometry = features[i].geometry;
          fieldValues = features[i].fieldValues;
          // if (qsdwIndex > -1) {
          //   qsdw = fieldValues[qsdwIndex];
          // }
          var positions = [];
          for (var j = 0; j < geometry.points.length; j++) {
            positions.push(geometry.points[j].x);
            positions.push(geometry.points[j].y);
          }
          entity = new Cesium.Entity({
            id: "ZDGYDL_" + smid,
            position: Cesium.Cartesian3.fromDegreesArray([
              geometry.center.x,
              geometry.center.y,
            ]),
            show: true,
            // classificationType: ClassificationType.TERRAIN,
            polygon: {
              hierarchy: new Cesium.PolygonHierarchy(
                new Cesium.Cartesian3.fromDegreesArray(positions)
              ),
              // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
              material: new Cesium.Color(
                parseInt(colorArr[0]) / 255,
                parseInt(colorArr[1]) / 255,
                parseInt(colorArr[2]) / 255,
                1
              ),
              outline: true,
              outlineColor: Cesium.Color.BLACK,
              outlineWidth: 1.5,
            },
          });
          entity.show = shaowOrHide;
          entity.attributes = attributes;
          that.entities.push({ type: name, id: "ZDGYDL_" + smid });
          viewer.entities.add(entity);

        }
      }
    },
    /**
     * 青苗补偿chart
     */
    QMBCChart() {

      var that = this;
      var chartDom1 = document.getElementById("QMMJChart");
      var myChart1 = window.echarts.init(chartDom1);
      var smfl = window.ZSBC.ZDBCJS.DLTB.smfl.fl;
      var nzwfl = window.ZSBC.ZDBCJS.DLTB.nzwfl.fl;
      var jjzwfl = window.ZSBC.ZDBCJS.DLTB.jjzwfl.fl;
      var color3 = window.ZSBC.ZDBCJS.DLTB.smfl.color;
      var color2 = window.ZSBC.ZDBCJS.DLTB.jjzwfl.color;
      var color1 = window.ZSBC.ZDBCJS.DLTB.nzwfl.color;
      var colors = [color1, color2, color3];
      var datas1 = [];
      debugger
      if (that.qmResult) {
        datas1 = [
          { value: this.qmResult.nzwMJ, name: nzwfl },
          { value: this.qmResult.jjzwMJ, name: jjzwfl },
          { value: this.qmResult.smMJ, name: smfl },
        ];
      } else {
        datas1 = [
          { value: 0.0, name: nzwfl },
          { value: 0.0, name: jjzwfl },
          { value: 0.0, name: smfl },
        ];
      }
      var option1 = {
        title: {
          text: "农作物补偿面积",
          //   subtext: '',
          left: "center",
          textStyle: {
            fontSize: "16",
            color: "#FFFF",
          },
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          orient: "vertical",
          right: 0,
          top: "20%",
          radius: "55%",
          // bottom: 20,
          textStyle: {
            // fontSize: '1rem',
            color: "#FFFF",
          }, pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          data: datas1.map((t) => t.name),
          formatter: function (name) {
            var val = datas1.find((t) => t.name == name).value;
            return (
              name + new Array(20 - name.length * 3).join(" ") + val + "亩"
            );
          },
        },
        color: colors,
        series: [
          {
            name: "征地补偿分析",
            type: "pie",
            center: ["25%", "45%"],
            radius: ["50%", "70%"],
            avoidLabelOverlap: false,
            // itemStyle: {
            //   borderRadius: 1,
            //   borderColor: "#fff",
            //   borderWidth: 2,
            // },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: datas1,
          },
        ],
      };
      myChart1.setOption(option1);
      var showOrHide = false;
      that.QMBCLoad(null, showOrHide)
      myChart1.on("legendselectchanged", function (parmas) {
        that.pickEntity('ZDQMBC');
        var name = parmas.name
        showOrHide = parmas.selected[name]
        that.QMBCLoad(name, showOrHide)

      });
      var chartDom2 = document.getElementById("QMFYChart");
      var myChart2 = window.echarts.init(chartDom2);
      var datas2 = [];
      debugger
      if (that.qmResult) {
        datas2 = [
          { value: that.qmResult.nzwPay, name: nzwfl },
          { value: that.qmResult.jjzwPay, name: jjzwfl },
          { value: that.qmResult.smPay, name: smfl },
        ];
      } else {
        datas2 = [
          { value: 0.0, name: nzwfl },
          { value: 0.0, name: jjzwfl },
          { value: 0.0, name: smfl },
        ];
      }
      var option2 = {
        title: {
          text: "农作物补偿费用",
          subtext: "",
          left: "center",
          textStyle: {
            fontSize: "16",
            color: "#FFFF",
          },
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          orient: "vertical",
          right: 0,
          top: "20%",
          radius: "55%",
          // bottom: 20,
          textStyle: {
            // fontSize: '12px',
            color: "#FFFF",
          },
          pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          data: datas2.map((t) => t.name),
          formatter: function (name) {
            var val = datas2.find((t) => t.name == name).value;
            return (
              name + new Array(20 - name.length * 3).join(" ") + val + "万元"
            );
          },
        },
        color: colors,
        series: [
          {
            name: "征地补偿分析",
            type: "pie",
            center: ["25%", "45%"],
            radius: ["50%", "70%"],
            avoidLabelOverlap: false,
            // itemStyle: {
            //   borderRadius: 1,
            //   borderColor: "#fff",
            //   borderWidth: 2,
            // },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: datas2,
          },
        ],
      };
      myChart2.setOption(option2);
    },
    QMBCLoad(name, showOrHide) {
      var that = this;
      var dlmcIndex = -1;
      debugger;
      var dlmcFld = window.ZSBC.ZDBCJS.DLTB.dlmc.field;
      dlmcIndex = that.getfldIndex(that.qmResult.fieldInfos, dlmcFld);
      // var smfl = window.ZSBC.ZDBCJS.DLTB.smfl.dlmc;
      // var nzwfl = window.ZSBC.ZDBCJS.DLTB.nzwfl.dlmc;
      // var jjzwfl = window.ZSBC.ZDBCJS.DLTB.jjzwfl.dlmc;
      var dlmc = "";
      var geometry;
      var color3 = window.ZSBC.ZDBCJS.DLTB.smfl.color;
      var color2 = window.ZSBC.ZDBCJS.DLTB.jjzwfl.color;
      var color1 = window.ZSBC.ZDBCJS.DLTB.nzwfl.color;
      var curDLMC;

      var attributes;
      var fieldValues;
      var color;
      var features = that.qmResult.features;
      for (var i = 0; i < features.length; i++) {
        geometry = features[i].geometry;
        fieldValues = features[i].fieldValues;
        if (dlmcIndex > -1) {
          dlmc = fieldValues[dlmcIndex];
        }
        if (name != null) {
          if (name == window.ZSBC.ZDBCJS.DLTB.smfl.fl) {
            curDLMC = window.ZSBC.ZDBCJS.DLTB.smfl.dlmc
          }
          else if (name == window.ZSBC.ZDBCJS.DLTB.nzwfl.fl) {
            curDLMC = window.ZSBC.ZDBCJS.DLTB.nzwfl.dlmc
          }
          else if (name == window.ZSBC.ZDBCJS.DLTB.jjzwfl.fl) {
            curDLMC = window.ZSBC.ZDBCJS.DLTB.jjzwfl.dlmc
          }
          if (curDLMC.indexOf(dlmc) == -1)
            continue;
        }
        if (window.ZSBC.ZDBCJS.DLTB.nzwfl.dlmc.indexOf(dlmc) > -1)
          color = color1
        else if (window.ZSBC.ZDBCJS.DLTB.jjzwfl.dlmc.indexOf(dlmc) > -1)
          color = color2
        else if (window.ZSBC.ZDBCJS.DLTB.smfl.dlmc.indexOf(dlmc) > -1)
          color = color3
        color = color.replace("rgb", "")
          .replace("(", "")
          .replace(")", "");
        var colorArr = color.split(",");
        var simIndex = features[i].fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        var smid = features[i].fieldValues[simIndex]
        var ff = that.entities.find(t => t.id == "ZDQMBC_" + smid)

        if (ff != null) {
          var entity = viewer.entities.getById("ZDQMBC_" + smid)
          if (entity != undefined)
            entity.show = showOrHide;
        }
        else {
          var positions = [];
          for (var j = 0; j < geometry.points.length; j++) {
            positions.push(geometry.points[j].x);
            positions.push(geometry.points[j].y);
          }
          var entity = new Cesium.Entity({
            id: "ZDQMBC_" + smid,
            position: Cesium.Cartesian3.fromDegreesArray([
              geometry.center.x,
              geometry.center.y,
            ]),
            // classificationType: ClassificationType.TERRAIN,
            polygon: {
              hierarchy: new Cesium.PolygonHierarchy(
                new Cesium.Cartesian3.fromDegreesArray(positions)
              ),
              // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
              material: new Cesium.Color(
                parseInt(colorArr[0]) / 255,
                parseInt(colorArr[1]) / 255,
                parseInt(colorArr[2]) / 255,
                1
              ),
              outline: true,
              outlineColor: Cesium.Color.BLACK,
              outlineWidth: 1.5,
            },
          });
          attributes = {
            fieldNames: that.qmResult.fieldInfos,
            fieldValues: features[i].fieldValues,
          };
          entity.show = showOrHide;
          entity.attributes = attributes;
          that.entities.push({ type: "QM", id: "ZDQMBC_" + smid });
          viewer.entities.add(entity);
        }

      }
    },
    /**
     * 拆迁补偿chart
     */
    CQBCChart() {
      // var chartDom = document.getElementById('CQBCChart');
      // var myChart = window.echarts.init(chartDom);

      var item = {
        id: smid,
        smid: smid,
        cqr: cqrVal,
        jg: fwjgVal,
        fwdj: fwdjVal,
        floor: floorVal,
        jzmj: jzmjVal,
        zdmj: zdmjVal,
        address: addressVal,
        pay: pay,
        single: BZ,
      };
      that.cqResult.list.push(item);
      that.cqResult.totalJZMJ += jzmjVal;
      that.cqResult.totalPay += pay;
    },
    /**
     * 国有权属
     */
    GYQSChart() {
      var that = this;
      var chartDom = document.getElementById("GYQSChart");
      var myChart = window.echarts.init(chartDom);
      that.gyqsChartdatas = [];
      var nameLength = 0;
      var colors = ["rgb(63,177,227)", "rgb(107,230,193)", "rgb(196,235,173)", "rgb(150,222,232)"];
      // ["rgb(245,248,220)", "rgb(191,233,170)", "rgb(104,177,103)", "rgb(205,245,122)",
      //   "rgb(101,205,170)",
      //   "rgb(216,215,159)",
      //   "rgb(255,255,45)",
      //   "rgb(255,211,128)"];
      var color = "";
      var qsList = [];

      for (var i = 0; i < that.qsResult.stateUsedList.length; i++) {
        that.gyqsChartdatas.push({
          value: Number(that.qsResult.stateUsedList[i].mj.toFixed(2)),
          name: that.qsResult.stateUsedList[i].qsdwmc,
        });
      }
      var option = {
        title: {
          text: '权属信息', //国有所有权信息
          subtext: '',
          top: 'top',
          left: 'center',
          textStyle: {
            color: "#FFFFFF"
          }
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          type: "scroll",
          orient: "vertical",
          right: 0,
          top: '20%',
          bottom: 20,
          radius: "55%",
          // bottom: 20,
          textStyle: {
            // fontSize: '12px',
            color: "#FFFF",
          },
          pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          data: that.gyqsChartdatas.map((t) => t.name),
          formatter: function (name) {
            var val = that.gyqsChartdatas.find((t) => t.name == name).value;
            var spname = '';
            if (name.length > 13) {

              spname = name.substring(0, 12) + val + '亩\n' + name.substring(13, name.length)
            }
            else {
              spname = name
              var lastSpace = (13 - spname.length) * 3;
              if (lastSpace < 0)
                lastSpace = 0
              spname += new Array(lastSpace).join(" ") + val + '亩';
            }
            return spname
          },
          // itemStyle: {
          //   borderType: 'solid',
          //   borderWidth: 1,
          //   borderColor: '#ff00ff' //'rgb(255,0,255)'
          // },
          // pageIconColor:"#ffffff"
        },
        color: colors,
        series: [
          {
            name: "",
            type: "pie",
            center: ["25%", "50%"],
            radius: ["35%", "50%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 0,
              borderColor: "#ff00ff",
              borderWidth: 1,
              borderType: 'solid',
            },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: that.gyqsChartdatas,
          },
        ],
      };

      myChart.clear();
      myChart.setOption(option);
      that.GYQSLoad(that.gyqsChartdatas, null, false);

      myChart.on("legendselectchanged", function (parmas) {
        that.pickEntity('ZDGYQS');
        var name = parmas.name
        var showOrHide = parmas.selected[name]
        // var index = Object.keys(parmas.selected).findIndex(t => t == name)
        that.GYQSLoad(that.gyqsChartdatas, name, showOrHide);
      });
    },
    GYQSLoad(datas, name, showOrHide) {
      var that = this;
      //国有信息
      var stateUsedfldVal = "";
      var stateUsedfld = window.ZSBC.ZDBCJS.StateUsed.ownerfld;
      var stateUsedIndex = that.getfldIndex(that.qsResult.stateUsedFieldInfos, stateUsedfld);

      var colors = ["rgb(63,177,227)", "rgb(107,230,193)", "rgb(196,235,173)", "rgb(150,222,232)"];
      var fieldValues = [];

      var entity;
      var geometry;
      var features = that.qsResult.stateUsedFeatures;
      var attributes = {};
      for (var i = 0; i < features.length; i++) {

        fieldValues = features[i].fieldValues;
        if (stateUsedIndex > -1) {
          stateUsedfldVal = fieldValues[stateUsedIndex];
        }
        if (name != null && stateUsedfldVal != name)
          continue;
        var index = datas.findIndex(t => t.name == stateUsedfldVal);
        var mod = index % colors.length;
        var color = colors[mod].replace("rgb", "")
          .replace("(", "")
          .replace(")", "");
        var colorArr = color.split(",");
        var simIndex = features[i].fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        var smid = features[i].fieldValues[simIndex]
        var ff = that.qsEntities.find(t => t.id == "ZDGYQS_" + smid)
        if (ff != null) {
          entity = viewer.entities.getById("ZDGYQS_" + smid)
          if (entity != undefined)
            entity.show = showOrHide;
        }
        else {
          attributes = {
            fieldNames: that.zdResult.fieldInfos,
            fieldValues: features[i].fieldValues,
          };
          geometry = features[i].geometry;
          fieldValues = features[i].fieldValues;
          let point3ds = [];
          let pointholes = [];
          let startindex = 0;
          for (
            let index = 0;
            index < geometry.parts.length;
            index++
          ) {
            let thisps = [];
            const endindex = startindex + geometry.parts[index];
            let geometryPoints = geometry.points.slice(
              startindex,
              endindex
            );
            for (
              let pointindex = 0;
              pointindex < geometryPoints.length;
              pointindex++
            ) {
              const point = geometryPoints[pointindex];
              thisps.push(point.x);
              thisps.push(point.y);
            }
            if (geometry.partTopo[index] === 1) {
              point3ds.push(Cesium.Cartesian3.fromDegreesArray(thisps));
            } else {
              pointholes.push(Cesium.Cartesian3.fromDegreesArray(thisps));
            }

            startindex = endindex;
          }

          if (point3ds.length > 0 && pointholes.length > 0) {
            let holes = [];
            pointholes.forEach((hole) => {
              holes.push({ positions: hole });
            });

            entity = new Cesium.Entity({
              id: "ZDGYQS_" + smid,

              polygon: {
                hierarchy: {
                  // Cesium.PolygonHierarchy
                  positions: point3ds[0],
                  holes: holes, // Cesium.PolygonHierarchy 数组
                },
                material: new Cesium.Color(
                  parseInt(colorArr[0]) / 255,
                  parseInt(colorArr[1]) / 255,
                  parseInt(colorArr[2]) / 255,
                  0.2
                ),
                outline: true,
                outlineColor: Cesium.Color.DEEPPINK,
                outlineWidth: 1.5,
              },
            });
          } else if (point3ds.length > 0) {
            entity = new Cesium.Entity({
              id: "ZDGYQS_" + smid,

              polygon: {
                hierarchy: point3ds[0],
                material: new Cesium.Color(
                  parseInt(colorArr[0]) / 255,
                  parseInt(colorArr[1]) / 255,
                  parseInt(colorArr[2]) / 255,
                  0.2
                ),
                outline: true,
                outlineColor: Cesium.Color.DEEPPINK,
                outlineWidth: 1.5,
              },
            });
          }
          entity.show = showOrHide;
          entity.attributes = attributes;
          that.qsEntities.push({ type: name, id: "ZDGYQS_" + smid });
          viewer.entities.add(entity);
        }
      }
    },
    /**
     * 集体使用权
     */
    JTUseChart() {
      var that = this;
      var chartDom = document.getElementById("JTUSEChart");
      var myChart = window.echarts.init(chartDom);
      var datas = [];
      var nameLength = 0;
      var colors = ["rgb(63,177,227)", "rgb(107,230,193)", "rgb(196,235,173)", "rgb(150,222,232)"];
      for (var i = 0; i < that.qsResult.collectiveUsedList.length; i++) {
        datas.push({
          value: parseFloat(that.qsResult.collectiveUsedList[i].mj.toFixed(2)),
          name: that.qsResult.collectiveUsedList[i].qsdwmc,
        });
      }
      var option = {
        title: {
          text: '集体使用权信息',
          subtext: '',
          top: 'top',
          left: 'center',
          textStyle: {
            color: "#FFFFFF"
          }
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          type: "scroll",
          orient: "vertical",
          right: 0,
          top: '20%',
          bottom: 20,
          radius: "55%",
          itemStyle: {
            // color: colors[0],
            borderColor: 'rgb(,0,255)',
            borderWidth: 1
          },
          pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          // bottom: 20,
          textStyle: {
            // fontSize: '12px',
            color: "#FFFF",
          },
          data: datas.map((t) => t.name),
          formatter: function (name) {
            var val = datas.find((t) => t.name == name).value;
            var spname = '';
            // nameLength = Math.ceil(nameLength / 2)
            if (name.length > 13)
              spname = name.substring(0, 12) + val + "亩" + '\n' + name.substring(13, name.length)
            else {
              spname = name
              var lastSpace = (13 - spname.length) * 3;
              if (lastSpace < 0)
                lastSpace = 0
              spname += new Array(lastSpace).join(" ") + val + "亩" + '\n';
            }

            return spname
          },

        },
        color: colors,
        series: [
          {
            name: "集体使用权信息",
            type: "pie",
            center: ["25%", "50%"],
            radius: ["25%", "45%"],
            avoidLabelOverlap: false,
            // itemStyle: {
            //   borderRadius: 10,
            //   borderWidth: 1,
            // },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: datas,
          },
        ],
      };
      myChart.clear();
      myChart.setOption(option);
      var shaowOrHide = false;
      that.JTUseLoad(datas, null, shaowOrHide)
      myChart.on("legendselectchanged", function (parmas) {
        that.pickEntity('ZDJTUSE');
        var name = parmas.name
        shaowOrHide = parmas.selected[name]
        that.JTUseLoad(datas, name, shaowOrHide)
      });

    },
    JTUseLoad(datas, name, shaowOrHide) {
      var that = this;
      // //集体使用信息
      var collectiveUsedfldVal = "";
      var colors = ["rgb(63,177,227)", "rgb(107,230,193)", "rgb(196,235,173)", "rgb(150,222,232)"];
      var collectiveUsedfld = window.ZSBC.ZDBCJS.CollectiveUsed.ownerfld;
      var collectiveUsedIndex = that.getfldIndex(that.qsResult.collectiveUsedFieldInfos, collectiveUsedfld);
      var color = "";
      var fieldValues = [];
      var geometry;
      var entity;
      var features = that.qsResult.collectiveUsedFeatures;
      var attributes = {};
      for (var i = 0; i < features.length; i++) {
        fieldValues = features[i].fieldValues;
        if (collectiveUsedIndex > -1) {
          collectiveUsedfldVal = fieldValues[collectiveUsedIndex];
        }
        if (name != null && collectiveUsedfldVal != name)
          continue;
        var simIndex = features[i].fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        var smid = features[i].fieldValues[simIndex]
        var ff = that.qsEntities.find(t => t.id == "ZDJTUSE_" + smid)

        if (ff != null) {
          entity = viewer.entities.getById("ZDJTUSE_" + smid)
          if (entity != undefined)
            entity.show = shaowOrHide;
        }
        else {
          var index = datas.findIndex(t => t.name == collectiveUsedfldVal)
          var mod = index % colors.length
          var color = colors[mod]
          if (color == null)
            continue;
          color = color.replace("rgb", "")
            .replace("(", "")
            .replace(")", "");
          var colorArr = color.split(",");
          if (colorArr == null || colorArr.length == 0)
            continue;
          attributes = {
            fieldNames: that.zdResult.fieldInfos,
            fieldValues: features[i].fieldValues,
          };
          geometry = features[i].geometry;
          fieldValues = features[i].fieldValues;
          let point3ds = [];
          let pointholes = [];
          let startindex = 0;
          for (
            let index = 0;
            index < geometry.parts.length;
            index++
          ) {
            let thisps = [];
            const endindex = startindex + geometry.parts[index];
            let geometryPoints = geometry.points.slice(
              startindex,
              endindex
            );
            for (
              let pointindex = 0;
              pointindex < geometryPoints.length;
              pointindex++
            ) {
              const point = geometryPoints[pointindex];
              thisps.push(point.x);
              thisps.push(point.y);
            }
            if (geometry.partTopo[index] === 1) {
              point3ds.push(Cesium.Cartesian3.fromDegreesArray(thisps));
            } else {
              pointholes.push(Cesium.Cartesian3.fromDegreesArray(thisps));
            }

            startindex = endindex;
          }

          if (point3ds.length > 0 && pointholes.length > 0) {
            let holes = [];
            pointholes.forEach((hole) => {
              holes.push({ positions: hole });
            });

            entity = new Cesium.Entity({
              id: "ZDJTUSE_" + smid,
              polygon: {
                hierarchy: {
                  // Cesium.PolygonHierarchy
                  positions: point3ds[0],
                  holes: holes, // Cesium.PolygonHierarchy 数组
                },
                material: new Cesium.Color(
                  parseInt(colorArr[0]) / 255,
                  parseInt(colorArr[1]) / 255,
                  parseInt(colorArr[2]) / 255,
                  0.3
                ),
                outline: true,
                outlineColor: Cesium.Color.FUCHSIA,
                outlineWidth: 1.5,
              },
            });
          } else if (point3ds.length > 0) {
            entity = new Cesium.Entity({
              id: "ZDJTUSE_" + smid,

              polygon: {
                hierarchy: point3ds[0],
                material: new Cesium.Color(
                  parseInt(colorArr[0]) / 255,
                  parseInt(colorArr[1]) / 255,
                  parseInt(colorArr[2]) / 255,
                  0.3
                ),
                outline: true,
                outlineColor: Cesium.Color.FUCHSIA,
                outlineWidth: 1.5,
              },
            });
          }
          entity.show = shaowOrHide;
          entity.attributes = attributes;
          that.qsEntities.push({ type: name, id: "ZDJTUSE_" + smid });
          viewer.entities.add(entity);
        }
      }
    },
    /**
     * 集体所有权
     */
    JTOwnerChart() {
      var that = this;
      var chartDom = document.getElementById("JTOWNERChart");
      var myChart = window.echarts.init(chartDom);
      var datas = [];
      var nameLength = 0;
      var colors = ["rgb(63,177,227)", "rgb(107,230,193)", "rgb(196,235,173)", "rgb(150,222,232)"];
      var qsList = [];
      for (var i = 0; i < that.qsResult.collectiveOwnerList.length; i++) {
        // var name = that.qsResult.collectiveUsedList[i].qsdwmc;
        datas.push({
          value: parseFloat(that.qsResult.collectiveOwnerList[i].mj.toFixed(2)),
          name: that.qsResult.collectiveOwnerList[i].qsdwmc,
        });
      }
      var option = {
        title: {
          text: '集体所有权信息',
          subtext: '',
          top: 'top',
          left: 'center',
          textStyle: {
            color: "#FFFFFF"
          }
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          type: "scroll",
          orient: "vertical",
          right: 0,
          top: '20%',
          bottom: 20,
          radius: "55%",
          // bottom: 20,
          textStyle: {
            // fontSize: '12px',
            color: "#FFFF",
          },
          pageIconColor: "#ffffff",
          pageTextStyle: {
            color: "#ffffff"
          },
          data: datas.map((t) => t.name),
          formatter: function (name) {
            var val = datas.find((t) => t.name == name).value;
            var spname = '';
            // nameLength = Math.ceil(nameLength / 2)
            if (name.length > 13)
              spname = name.substring(0, 12) + val + '亩\n' + name.substring(13, name.length) //+ val + "个"
            else {
              spname = name
              var lastSpace = (13 - spname.length) * 3;
              if (lastSpace < 0)
                lastSpace = 0
              spname += new Array(lastSpace).join(" ") + val + '亩';
            }
            return spname
          },
          itemStyle: {
            borderWidth: 1,
            borderColor: 'rgb(0,0,255)'
          },

        },
        color: colors,
        series: [
          {
            name: "集体所有权属分析",
            type: "pie",
            center: ["25%", "50%"],
            radius: ["25%", "45%"],
            avoidLabelOverlap: false,
            // itemStyle: {
            //   borderRadius: 10,
            //   borderColor: "#fff",
            //   borderWidth: 2,
            // },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: 12,
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: datas,
          },
        ],
      };
      var showOrHide = false;
      that.JTOwnerLoad(datas, null, showOrHide);
      myChart.clear();
      myChart.setOption(option);
      myChart.on("legendselectchanged", function (parmas) {
        that.pickEntity('ZDJTOWNER');
        var name = parmas.name
        showOrHide = parmas.selected[name]
        that.JTOwnerLoad(datas, name, showOrHide);
      });
    },
    JTOwnerLoad(datas, name, showOrHide) {
      var that = this;
      var color = "";
      var fieldValues = [];
      var geometry;
      var colors = ["rgb(63,177,227)", "rgb(107,230,193)", "rgb(196,235,173)", "rgb(150,222,232)"];
      var entity;
      var features = that.qsResult.collectiveOwnerFeatures;
      var attributes = {};
      // //集体使用信息
      var collectiveUsedownerfldVal = "";
      var collectiveUsedownerfld = window.ZSBC.ZDBCJS.CollectiveOwner.ownerfld;
      var collectiveUsedownerIndex = that.getfldIndex(that.qsResult.collectiveOwnerFieldInfos, collectiveUsedownerfld);
      for (var i = 0; i < features.length; i++) {
        fieldValues = features[i].fieldValues;
        if (collectiveUsedownerIndex > -1) {
          collectiveUsedownerfldVal = fieldValues[collectiveUsedownerIndex];
        }
        if (name != null && collectiveUsedownerfldVal != name)
          continue;
        var simIndex = features[i].fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        var smid = features[i].fieldValues[simIndex]
        var ff = that.qsEntities.find(t => t.id == "ZDJTOWNER_" + smid)
        if (ff != null) {
          entity = viewer.entities.getById("ZDJTOWNER_" + smid)
          if (entity != undefined)
            entity.show = showOrHide;
        }
        else {
          attributes = {
            fieldNames: that.zdResult.fieldInfos,
            fieldValues: features[i].fieldValues,
          };
          geometry = features[i].geometry;
          fieldValues = features[i].fieldValues;
          var index = datas.findIndex(t => t.name == collectiveUsedownerfldVal)
          var mod = index % colors.length
          var color = colors[mod]
          if (color == null)
            continue;
          color = color.replace("rgb", "")
            .replace("(", "")
            .replace(")", "");
          var colorArr = color.split(",");
          if (colorArr == null || colorArr.length == 0)
            continue;
          let point3ds = [];
          let pointholes = [];
          let startindex = 0;
          for (
            let index = 0; index < geometry.parts.length; index++) {
            let thisps = [];
            const endindex = startindex + geometry.parts[index];
            let geometryPoints = geometry.points.slice(
              startindex,
              endindex
            );
            for (
              let pointindex = 0;
              pointindex < geometryPoints.length;
              pointindex++
            ) {
              const point = geometryPoints[pointindex];
              thisps.push(point.x);
              thisps.push(point.y);
            }
            if (geometry.partTopo[index] === 1) {
              point3ds.push(Cesium.Cartesian3.fromDegreesArray(thisps));
            } else {
              pointholes.push(Cesium.Cartesian3.fromDegreesArray(thisps));
            }

            startindex = endindex;
          }

          if (point3ds.length > 0 && pointholes.length > 0) {
            let holes = [];
            pointholes.forEach((hole) => {
              holes.push({ positions: hole });
            });

            entity = new Cesium.Entity({
              id: "ZDJTOWNER_" + smid,
              polygon: {
                hierarchy: {
                  // Cesium.PolygonHierarchy
                  positions: point3ds[0],
                  holes: holes, // Cesium.PolygonHierarchy 数组
                },
                material: new Cesium.Color(
                  parseInt(colorArr[0]) / 255,
                  parseInt(colorArr[1]) / 255,
                  parseInt(colorArr[2]) / 255,
                  0.3
                ),
                outline: true,
                outlineColor: Cesium.Color.FUCHSIA,
                outlineWidth: 1.5,
              },
            });
          } else if (point3ds.length > 0) {
            entity = new Cesium.Entity({
              id: "ZDJTOWNER_" + smid,
              polygon: {
                hierarchy: point3ds[0],
                material: new Cesium.Color(
                  parseInt(colorArr[0]) / 255,
                  parseInt(colorArr[1]) / 255,
                  parseInt(colorArr[2]) / 255,
                  0.3
                ),
                outline: true,
                outlineColor: Cesium.Color.FUCHSIA,
                outlineWidth: 1.5,
              },
            });
          }
          entity.show = showOrHide
          entity.attributes = attributes;
          that.qsEntities.push({ type: name, id: "ZDJTOWNER_" + smid });
          viewer.entities.add(entity);

        }
      }
    },
    /**
     * 绘制多边形
     */
    startPolygon() {
      var that = this;
      debugger
      if (handleInput) {
        handleInput.destroy();
      }
      handlerPolygon = new Cesium.DrawHandler(
        viewer,
        Cesium.DrawMode.Polygon,
        0
      );
      handlerPolygon.activate()
      handlerPolygon.activeEvt.addEventListener(function (isActive) {
        if (isActive == true) {
          viewer.enableCursorStyle = false;
          viewer._element.style.cursor = "";
          // var nodes = document.getElementsByTagName('body')
          // if (nodes.length > 0)
          //     nodes[0].className.replace('drawCur','drawCur')
        } else {
          viewer.enableCursorStyle = true;
          // var nodes = document.getElementsByTagName('body')
          // if (nodes.length > 0) {
          //     nodes[0].className.replace('drawCur','')
          // }
        }
      });
      handlerPolygon.movingEvt.addEventListener(function (windowPosition) {
        // if (this.handlerPolygon.isDrawing) {
        //     window.createTooltip.showAt(windowPosition, '点击确定多边形顶点,右键单击结束绘制,');
        // } else {
        //     window.createTooltip.showAt(windowPosition, '点击绘制第一个点,');
        // }
      });
      handlerPolygon.drawEvt.addEventListener(function (result) {

        // handlerPolygon.polygon.show = false;
        // handlerPolygon.polyline.show = false;


        var nPositions = [];
        that.regions = [];
        for (var pt of result.object.positions) {
          var cartographic = Cesium.Cartographic.fromCartesian(pt);
          var longitude = Cesium.Math.toDegrees(cartographic.longitude);
          var latitude = Cesium.Math.toDegrees(cartographic.latitude);
          var height = cartographic.height;
          that.regions.push({ x: longitude, y: latitude });
          nPositions.push(longitude)
          nPositions.push(latitude)
        }

        that.regions.push(that.regions[0]);

        viewer.entities.removeAll();
        polygonEntity = new Cesium.Entity({
          id: 'polygon',
          // position: Cesium.Cartesian3.fromDegreesArray([
          //   centerX,
          //   centerY,
          // ]),
          // classificationType: ClassificationType.TERRAIN,
          polygon: {
            hierarchy: new Cesium.PolygonHierarchy(
              new Cesium.Cartesian3.fromDegreesArray(nPositions)
            ),
            // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
            material: Cesium.Color.WHITE.withAlpha(0.3),
            outline: true,
            outlineColor: Cesium.Color.RED,
            outlineWidth: 2.0,
          },
        });
        viewer.entities.add(polygonEntity)
        that.curProjectInfo.regions = that.regions;


        // that.regions = [];
        // that.regions.push(that.positions);
        viewer.flyTo(polygonEntity)

        handlerPolygon.clear()
        handlerPolygon.deactivate();
      });
    },
    clipImage() {
      var that = this;
      var promise = scene.outputSceneToFile();
      Cesium.when(promise, function (base64data) {
        that.imageData = base64data
      })
    },
    /**
     * 点击绘制多边形
     */
    drawPolygon() {
      viewer.entities.removeAll();
      if (polygonEntity) {
        viewer.entities.remove(polygonEntity)
      }
      this.startPolygon();
      // else {
      //   handlerPolygon=;
      //   this.positions = [];
      //   this.regions = [];
      // }
      // handlerPolygon.activate();
    },

    /**
     * 拆迁定位
     * @param {string} smid 图斑id
     * @param {string} cqr //产权人
     */
    cqLocation(isGYFC, smid, cqr) {
      var features;
      var that = this;
      if (isGYFC == true)
        features = that.cqResult.gyfeatures;
      else
        features = that.cqResult.jtfeatures;
      var fieldNames = [];
      var smidIndex = -1;
      var fieldValues = [];
      var geometry = null;
      if (features == null) return;
      var attributes;
      //产权人
      var entity;
      //  var index = that.entities.findIndex(t => t.id == "ZDBDC_" + smid)

      // if (index > -1) {
      //   entity = viewer.entities.getById("ZDBDC_" + smid);
      //   entity.show = true;
      //   viewer.entities.removeById('aad')
      //   var point = new Cesium.Entity({
      //     id: "aad",
      //     position: entity.position,
      //     point: {
      //       // 点的大小（像素）
      //       pixelSize: 10,
      //       // 点位颜色，fromCssColorString 可以直接使用CSS颜色
      //       color: Cesium.Color.RED.withAlpha(0),
      //       // 边框颜色
      //       outlineColor: Cesium.Color.fromCssColorString("#fff").withAlpha(0),
      //       // 边框宽度(像素)
      //       outlineWidth: 2,
      //       // 显示在距相机的距离处的属性，多少区间内是可以显示的
      //       // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
      //       //   0,
      //       //   1500
      //       // ),
      //       // 是否显示
      //       show: true,
      //     }
      //   })
      //   viewer.entities.add(point);
      //   viewer.flyTo(point)
      //   setTimeout(function () {
      //     viewer.entities.removeById('aad')
      //   }, 3000)
      // }
      // else {
      //   var curID;
      //   for (var i = 0; i < features.length; i++) {
      //     fieldNames = features[i].fieldNames;
      //     fieldValues = features[i].fieldValues;
      //     smidIndex = fieldNames.findIndex(t => t.toUpperCase() == "SMID")
      //     attributes = {
      //       fieldNames: fieldNames,
      //       fieldValues: fieldValues,
      //     };
      //     curID = fieldValues[smidIndex];
      //     if (curID != smid)
      //       continue;
      //     geometry = features[i].geometry;
      //     var positions = [];
      //     for (var i = 0; i < geometry.points.length; i++) {
      //       positions.push(geometry.points[i].x);
      //       positions.push(geometry.points[i].y);
      //     }
      //     entity = new Cesium.Entity({
      //       id: "ZDBDC_" + smid,
      //       // label: {
      //       //   text: cqr,
      //       //   heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
      //       //   font: "14px sans-serif",
      //       //   fillColor: new Cesium.Color(1, 0, 0, 1),
      //       //   showBackground: true,
      //       //   backgroundColor: new Cesium.Color(0, 0.8, 0, 0.8)
      //       // },
      //       position: Cesium.Cartesian3.fromDegrees(
      //         geometry.center.x,
      //         geometry.center.y,
      //         50
      //       ),
      //       show: true,
      //       polygon: {
      //         hierarchy: new Cesium.PolygonHierarchy(
      //           new Cesium.Cartesian3.fromDegreesArray(positions)
      //         ),
      //         // positions: new Cesium.Cartesian3.fromDegreesArray(positions),
      //         material: new Cesium.Color(255 / 255, 211 / 255, 128 / 255, 1),
      //         outline: true,
      //         outlineColor: Cesium.Color.BLACK,
      //         outlineWidth: 1.5,
      //       },
      //     });
      //     entity.attributes = attributes;
      //     viewer.entities.add(entity);
      //     that.entities.push({ type: "ZDBDC", id: "ZDBDC_" + smid })
      //     viewer.entities.removeById('aad')
      //     var point = new Cesium.Entity({
      //       id: 'aad',
      //       position: entity.position,
      //       point: {
      //         // 点的大小（像素）
      //         pixelSize: 10,
      //         // 点位颜色，fromCssColorString 可以直接使用CSS颜色
      //         color: Cesium.Color.RED.withAlpha(0),
      //         // 边框颜色
      //         outlineColor: Cesium.Color.fromCssColorString("#fff").withAlpha(0),
      //         // 边框宽度(像素)
      //         outlineWidth: 2,
      //         // 显示在距相机的距离处的属性，多少区间内是可以显示的
      //         // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
      //         //   0,
      //         //   1500
      //         // ),
      //         // 是否显示
      //         show: true,
      //       }
      //     })
      //     viewer.entities.add(point);
      //     viewer.flyTo(point)
      //     setTimeout(function () {
      //       viewer.entities.removeById('aad')
      //     }, 3000)

      //   }
      // }

      var index = that.entities.findIndex(t => t.id == "ZDBDC_FC")
      if (index == -1) {
        that.entities.push({ type: "ZDBDC", id: "ZDBDC_FC" });
      }
      viewer.entities.removeById('ZDBDC_FC');
      viewer.entities.removeById('aad')
      if(popupBox){
        popupBox.destroy();
        popupBox=null;
      }
      
      var curID;
      for (var i = 0; i < features.length; i++) {
        fieldNames = features[i].fieldNames;
        fieldValues = features[i].fieldValues;
        smidIndex = fieldNames.findIndex(t => t.toUpperCase() == "SMID")
        attributes = {
          fieldNames: fieldNames,
          fieldValues: fieldValues,
        };
        curID = fieldValues[smidIndex];
        if (curID != smid)
          continue;
        geometry = features[i].geometry;
        var positions = [];
        for (var i = 0; i < geometry.points.length; i++) {
          positions.push(geometry.points[i].x);
          positions.push(geometry.points[i].y);
        }



        let dom = document.createElement("div");
                dom.id = "ZDBDC_FCtext";
                dom.style.position = "absolute";
                dom.style.width = "0";
                dom.style.height = "0";
                // dom.style.color = "rgba(2, 23, 44, 0.8)";
                // dom.style.backgroundColor = "rgba(2, 23, 44, 0.8)";
                dom.style.fontSize = "1rem";

                let domContent = document.createElement("div");
                domContent.style.position = "absolute";
                domContent.style.borderRadius = "5px";
                domContent.style.border = "1px solid rgba(7, 131, 250, 0.3)";
                domContent.style.backgroundColor = "rgba(2, 23, 44, 0.7)";
                domContent.style.bottom = "0px";
                domContent.style.left = "0px";
                domContent.style.whiteSpace = "nowrap";
                domContent.style.color = "white";
                // domContent.style.padding = "8px 12px";
                domContent.style.transform = "translate(-50%, 0%)";

                domContent.innerHTML = cqr;
                dom.appendChild(domContent);

                popupBox = new Popup({
                  viewer: viewer,
                  element: dom,
                  pixelOffset: new Cesium.Cartesian2(0, 0),
                  translucencyByDistance: new Cesium.NearFarScalar(
                    0,
                    1,
                    50000,
                    1
                  ),
                  distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
                    0,
                    51000
                  ),
                  position: Cesium.Cartesian3.fromDegrees(geometry.center.x,geometry.center.y,20),
                });

                popupBox.show();


        entity = new Cesium.Entity({
          id: "ZDBDC_FC",
          // label: {
          //   text: cqr,
          //   heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
          //   font: "14px sans-serif",
          //   fillColor: new Cesium.Color(1, 0, 0, 1),
          //   showBackground: true,
          //   backgroundColor: new Cesium.Color(0, 0.8, 0, 0.8)
          // },
          position: Cesium.Cartesian3.fromDegrees(
            geometry.center.x,
            geometry.center.y,
            50
          ),
          show: true,
          polygon: {
            hierarchy: new Cesium.PolygonHierarchy(
              new Cesium.Cartesian3.fromDegreesArray(positions)
            ),
            material: new Cesium.Color(255 / 255, 211 / 255, 128 / 255, 1),
            outline: true,
            outlineColor: Cesium.Color.BLACK,
            outlineWidth: 1.5,
          },
        });
        entity.attributes = attributes;
        viewer.entities.add(entity);
      }
      var point = new Cesium.Entity({
        id: "aad",
        position: entity.position,
        point: {
          // 点的大小（像素）
          pixelSize: 10,
          // 点位颜色，fromCssColorString 可以直接使用CSS颜色
          color: Cesium.Color.RED.withAlpha(0),
          // 边框颜色
          outlineColor: Cesium.Color.fromCssColorString("#fff").withAlpha(0),
          // 边框宽度(像素)
          outlineWidth: 2,
          // 显示在距相机的距离处的属性，多少区间内是可以显示的
          // distanceDisplayCondition: new Cesium.DistanceDisplayCondition(
          //   0,
          //   1500
          // ),
          // 是否显示
          show: true,
        }
      })
      viewer.entities.add(point);
      viewer.flyTo(point);
      setTimeout(function () {
        viewer.entities.removeById('aad');
      }, 3000)
    },
    /**
     * 点击确定开始计算
     */
    submitForm(formName) {
      var that = this;
      if (that.regions.length == 0) {
        that.$alert("请导入或绘制项目范围", "警告");
        // alert('请导入或绘制项目范围')
        return false;
      }
      console.log(JSON.stringify(that.regions));
      debugger
      var area = that.getRegionArea() / 666.66;
      if (area > 3000) {
        that.$alert("项目范围不要超过3000亩,请重新输入项目范围", "警告");
        viewer.entities.removeAll();
        return false;
      }

      that.loading = that.$loading({
        lock: true,
        text: '正在数据分析,请稍后...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      that.clipImage();
      that.$refs[formName].validate(async (valid) => {
        if (valid) {
          //alert('submit!');
          // that.doQuery();
          //脚本函数
          var param = {
            geometry: that.regions,
            zdValue: that.ruleForm.zdValue,
            cqValue: that.ruleForm.cqValue,
            qmValue: that.ruleForm.qmValue
          }
          var jdResult = await zdAnalyse.doQuery(param);
          if (jdResult) {
            that.zdResult = jdResult.zdResult;
            that.cqResult = jdResult.cqResult;
            that.qmResult = jdResult.qmResult;
            that.qsResult = jdResult.qsResult;
          }
          that.loading.close();
          that.$message({
            message: "征地分析计算完成",
            type: "success",
          });
          var date = new Date();
          debugger
          var projectName = that.ruleForm.projectName;
          var item = {
            "id": that.projectList.length + 1,
            "projectName": projectName,
            "imageData": that.imageData,
            // 分析范围
            "regions": JSON.stringify(that.regions),
            "gyMJ": parseFloat(that.zdResult.gyMJ.toFixed(2)),
            //集体面积
            "jtMJ": parseFloat(that.zdResult.jtMJ.toFixed(2)),
            //征地面积
            "totalZDMJ": parseFloat(that.zdResult.totalZDMJ.toFixed(2)),
            "dateTime": that.dateFormat(date),
            /* 征地标准值
            //  */
            "zdValue": that.ruleForm.zdValue,
            // // zdZBData: window.ZSBC.ZDBCList.find(c => c.value == that.ruleForm.zdValue),
            // /* 青苗标准值
            //  */
            "qmValue": that.ruleForm.qmValue,
            // // qmZBData: window.ZSBC.QMBCList.find(c => c.value == that.ruleForm.qmValue),
            // /**
            //  * 拆迁标准值
            //  */
            "cqValue": that.ruleForm.cqValue,
            // // cqZBData: window.ZSBC.CQBCList.find(c => c.value == that.ruleForm.cqValue),
            /**
             * 拆迁分析结果
             */
            "cqResult": {
              "id": null,
              "projectId": null,
              "count": that.cqResult.count,
              "totalJZMJ": parseFloat(that.cqResult.totalJZMJ.toFixed(2)),
              "totalPay": parseFloat(that.cqResult.totalPay.toFixed(2)),
              "average": parseFloat(that.cqResult.average.toFixed(2)),
              "gyJZMJ": parseFloat(that.cqResult.gyJZMJ.toFixed(2)),
              "jtJZMJ": parseFloat(that.cqResult.jtJZMJ.toFixed(2)),
              "gyCount": that.cqResult.gyCount,
              "jtCount": that.cqResult.jtCount,
              "gyList": JSON.stringify(that.cqResult.gyList),
              "jtList": JSON.stringify(that.cqResult.jtList),
              "gyfeatures": JSON.stringify(that.cqResult.gyfeatures),
              "jtfeatures": JSON.stringify(that.cqResult.jtfeatures),
              "fieldInfos": JSON.stringify(that.cqResult.fieldInfos)
            },
            /**
             * 青苗分析结果
             */
            "qmResult": {
              "id": null,
              "projectId": null,
              "totalPay": parseFloat(that.qmResult.totalPay.toFixed(2)),
              "totalMJ": parseFloat(that.qmResult.totalMJ.toFixed(2)),
              "nzwMJ": parseFloat(that.qmResult.nzwMJ.toFixed(2)),
              "nzwPay": parseFloat(that.qmResult.nzwPay.toFixed(2)),
              "jjzwMJ": parseFloat(that.qmResult.jjzwMJ.toFixed(2)),
              "jjzwPay": parseFloat(that.qmResult.jjzwPay.toFixed(2)),
              "smMJ": parseFloat(that.qmResult.smMJ.toFixed(2)),
              "smPay": parseFloat(that.qmResult.smPay.toFixed(2)),
              "fieldInfos": JSON.stringify(that.qmResult.fieldInfos),
              "features": JSON.stringify(that.qmResult.features),
            },
            /**
             * 征地分析结果
             */
            "zdResult": {
              "id": null,
              "projectId": null,
              //国有面积
              "gyMJ": parseFloat(that.zdResult.gyMJ.toFixed(2)),
              //集体面积
              "jtMJ": parseFloat(that.zdResult.jtMJ.toFixed(2)),
              //征地面积
              "totalZDMJ": parseFloat(that.zdResult.totalZDMJ.toFixed(2)),
              //总补偿
              "totalPay": parseFloat(that.zdResult.totalPay.toFixed(2)),
              //征地补偿
              "totalZDPay": parseFloat(that.zdResult.totalZDPay.toFixed(2)),
              //安置补偿
              "totalAZPay": parseFloat(that.zdResult.totalAZPay.toFixed(2)),
              //国有地类及面积
              "gydlList": JSON.stringify(that.zdResult.gydlList),
              //地类及面积
              "jtdlList": JSON.stringify(that.zdResult.jtdlList),
              "gyfeatures": JSON.stringify(that.zdResult.gyfeatures),
              "jtfeatures": JSON.stringify(that.zdResult.jtfeatures),
              "fieldInfos": JSON.stringify(that.zdResult.fieldInfos),
            },
            /**
             * 权属结果
             */
            "qsResult": {
              "id": null,
              "projectId": null,
              "stateUsedMJ": parseFloat(that.qsResult.stateUsedMJ.toFixed(2)),
              "stateUsedFeatures": JSON.stringify(that.qsResult.stateUsedFeatures),
              "stateUsedList": JSON.stringify(that.qsResult.stateUsedList),
              "stateUsedFieldInfos": JSON.stringify(that.qsResult.stateUsedFieldInfos),

              "collectiveOwnerMJ": parseFloat(that.qsResult.collectiveOwnerMJ.toFixed(2)),
              "collectiveOwnerFeatures": JSON.stringify(that.qsResult.collectiveOwnerFeatures),
              "collectiveOwnerList": JSON.stringify(that.qsResult.collectiveOwnerList),
              "collectiveOwnerFieldInfos": JSON.stringify(that.qsResult.collectiveOwnerFieldInfos),

              "collectiveUsedMJ": parseFloat(that.qsResult.collectiveUsedMJ.toFixed(2)),
              "collectiveUsedList": JSON.stringify(that.qsResult.collectiveUsedList),
              "collectiveUsedFeatures": JSON.stringify(that.qsResult.collectiveUsedFeatures),
              "collectiveUsedFieldInfos": JSON.stringify(that.qsResult.collectiveUsedFieldInfos)
            }
          };
          // 保存项目
          if (window.isUseDB)
            that.saveAnalysResult(item);
          else {
            var dd = JSON.stringify(item);
            var sd = JSON.parse(dd);
            that.curProjectInfo = sd;
            that.projectList.push(sd);
            var list = JSON.stringify(that.projectList.reverse())
            window.ZSBC.projectList = JSON.parse(list)
          }
          var date = new Date()
          debugger
          that.ruleForm.projectName = "拆迁补偿项目_" + that.formatDateTimeToLong(date);
          that.activeName = "second"
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    /**
     * 保存分析结果
     */
    saveAnalysResult(projectInfo) {
      var that = this
      // var projectInfo = {
      //   "id": that.curProjectInfo.id,
      //   "projectName": that.curProjectInfo.name,
      //   "dateTime": that.curProjectInfo.dateTime,
      //   "regions": JSON.stringify(that.curProjectInfo.regions),
      //   "cqValue": that.curProjectInfo.cqValue,
      //   "qmValue": that.curProjectInfo.qmValue,
      //   "zdValue": that.curProjectInfo.zdValue,
      //   /**
      //    * 拆迁分析结果
      //    */
      //   "cqResult": {
      //     "id": null,
      //     "projectId": null,
      //     "count": that.curProjectInfo.cqResult.count,
      //     "totalJZMJ": that.curProjectInfo.cqResult.totalJZMJ,
      //     "totalPay": that.curProjectInfo.cqResult.totalPay,
      //     "average": that.curProjectInfo.cqResult.average,
      //     "gyJZMJ": that.curProjectInfo.cqResult.gyJZMJ,
      //     "jtJZMJ": that.curProjectInfo.cqResult.jtJZMJ,
      //     "gyCount": that.curProjectInfo.cqResult.gyCount,
      //     "jtCount": that.curProjectInfo.cqResult.jtCount,
      //     "gyList": JSON.stringify(that.curProjectInfo.cqResult.gyList),
      //     "jtList": JSON.stringify(that.curProjectInfo.cqResult.jtList),
      //     "gyfeatures": JSON.stringify(that.curProjectInfo.cqResult.gyfeatures),
      //     "jtfeatures": JSON.stringify(that.curProjectInfo.cqResult.jtfeatures),
      //     "fieldInfos": JSON.stringify(that.curProjectInfo.cqResult.fieldInfos)
      //   },
      //   /**
      //    * 青苗分析结果
      //    */
      //   "qmResult": {
      //     "id": null,
      //     "projectId": null,
      //     "totalPay": that.curProjectInfo.qmResult.totalPay,
      //     "totalMJ": that.curProjectInfo.qmResult.totalMJ,
      //     "nzwMJ": that.curProjectInfo.qmResult.nzwMJ,
      //     "nzwPay": that.curProjectInfo.qmResult.nzwPay,
      //     "jjzwMJ": that.curProjectInfo.qmResult.jjzwMJ,
      //     "jjzwPay": that.curProjectInfo.qmResult.jjzwPay,
      //     "smMJ": that.curProjectInfo.qmResult.smMJ,
      //     "smPay": that.curProjectInfo.qmResult.smPay,
      //     "fieldInfos": JSON.stringify(that.curProjectInfo.qmResult.fieldInfos),
      //     "features": JSON.stringify(that.curProjectInfo.qmResult.features),
      //   },
      //   /**
      //    * 征地分析结果
      //    */
      //   "zdResult": {
      //     "id": null,
      //     "projectId": null,
      //     //国有面积
      //     "gyMJ": that.curProjectInfo.zdResult.gyMJ,
      //     //集体面积
      //     "jtMJ": that.curProjectInfo.zdResult.jtMJ,
      //     //征地面积
      //     "totalZDMJ": that.curProjectInfo.zdResult.totalZDMJ,
      //     //总补偿
      //     "totalPay": that.curProjectInfo.zdResult.totalPay,
      //     //征地补偿
      //     "totalZDPay": that.curProjectInfo.zdResult.totalZDPay,
      //     //安置补偿
      //     "totalAZPay": that.curProjectInfo.zdResult.totalAZPay,
      //     //国有地类及面积
      //     "gydlList": JSON.stringify(that.curProjectInfo.zdResult.gydlList),
      //     //地类及面积
      //     "jtdlList": JSON.stringify(that.curProjectInfo.zdResult.jtdlList),
      //     "gyfeatures": JSON.stringify(that.curProjectInfo.zdResult.gyfeatures),
      //     "jtfeatures": JSON.stringify(that.curProjectInfo.zdResult.jtfeatures),
      //     "fieldInfos": JSON.stringify(that.curProjectInfo.zdResult.fieldInfos),
      //   },
      //   /**
      //    * 权属结果
      //    */
      //   "qsResult": {
      //     "id": null,
      //     "projectId": null,
      //     "stateUsedMJ": that.curProjectInfo.qsResult.stateUsedMJ,
      //     "stateUsedFeatures": JSON.stringify(that.curProjectInfo.qsResult.stateUsedFeatures),
      //     "stateUsedList": JSON.stringify(that.curProjectInfo.qsResult.stateUsedList),
      //     "stateUsedFieldInfos": JSON.stringify(that.curProjectInfo.qsResult.stateUsedFieldInfos),

      //     "collectiveOwnerMJ": that.curProjectInfo.qsResult.collectiveOwnerMJ,
      //     "collectiveOwnerFeatures": JSON.stringify(that.curProjectInfo.qsResult.collectiveOwnerFeatures),
      //     "collectiveOwnerList": JSON.stringify(that.curProjectInfo.qsResult.collectiveOwnerList),
      //     "collectiveOwnerFieldInfos": JSON.stringify(that.curProjectInfo.qsResult.collectiveOwnerFieldInfos),

      //     "collectiveUsedMJ": that.curProjectInfo.qsResult.collectiveUsedMJ,
      //     "collectiveUsedList": JSON.stringify(that.curProjectInfo.qsResult.collectiveUsedList),
      //     "collectiveUsedFeatures": JSON.stringify(that.curProjectInfo.qsResult.collectiveUsedFeatures),
      //     "collectiveUsedFieldInfos": JSON.stringify(that.curProjectInfo.qsResult.collectiveUsedFieldInfos)
      //   }
      // }
      addZdProject(projectInfo).then((res) => {
        if (res)
          console.log('项目保存完成')
        that.queryProject();
      }).catch((err) => {
        console.log('项目保存失败')
      })


    },
    //范围面积
    getRegionArea() {
      debugger
      var points1 = this.regions;
      var parts1 = [];
      var poly1;
      for (var i = 0; i < points1.length; i++) {
        parts1.push([points1[i].x, points1[i].y]);
      }
      poly1 = polygon([parts1]);
      var textarea = area(poly1) * window.earthRadius;
      return textarea;
    },
    /***
     * pararm {object} @arr
     */
    creaturfPolygon(arr) {
      var points = [];
      var parts = [];
      var polygon = [];

      if (arr && arr.length > 0)
        for (var i = 0; i < arr.length; i++) {
          points.push([arr[i].x, arr[i].y]);
        }
      parts.push(points);
      polygon.push(parts);
      return polygon(polygon);
    },
    getfldIndex(fieldInfos, fldName) {
      var fldIndex = -1;
      fieldInfos.forEach((fld, index) => {
        if (fld.name.toUpperCase() == fldName.toUpperCase()) {
          fldIndex = index;
        }
      });
      return fldIndex;
    },
    /**
     * point1(裁剪),points2(被裁剪) [{x:1,y:2}]
     */
    computerInsertArea(points1, points2) {
      var area = 0;
      if (
        points1 == null ||
        points2 == null ||
        points2.length == 0 ||
        points1.length == 0
      ) {
        console.log("征地补偿图斑计算传入参数错误");
        area = 0;
      }
      var parts1 = [];
      var poly1 = [];
      var parts2 = [];
      var poly2 = [];
      // parts1.push()
      for (var i = 0; i < points1.length; i++) {
        parts1.push([points1[i].x, points1[i].y]);
      }
      poly1 = polygon([parts1]);
      var textarea = area(poly1) * window.earthRadius;

      for (var i = 0; i < points2.length; i++) {
        parts2.push([points2[i].x, points2[i].y]);
      }
      poly2 = polygon([parts2]);
      var isContain = booleanContains(poly1, poly2);
      if (isContain) {
        area = area(poly2) * window.earthRadius;
      }
      else {
        var intersection = intersect(poly1, poly2);
        area = area(intersection) * window.earthRadius;
      }
      return area;
    },
    areaFrom4326To4525(region) {
      var fromProj = proj4.defs();
      var toProj = proj4.defs(window.localWkid4525);
      proj4.defs("EPSG:4525", "+proj=longlat +ellps=GRS80 +no_defs +type=crs");
      var point;

      proj4.transform(fromProj, toProj, point)
    },

    /**
    * 时间格式化2022-02-10  12:00:00
    * @param {date} date
    */
    dateFormat(date) {
      // console.log(showTime(date.getHours()));
      var year = date.getFullYear(); // 年
      var month = this.showTime(date.getMonth() + 1); // 月
      // var week = this.showTime(date.getDay());           // 星期
      var day = this.showTime(date.getDate()); // 日
      var hours = this.showTime(date.getHours()); // 小时
      var minutes = this.showTime(date.getMinutes()); // 分钟
      var second = this.showTime(date.getSeconds()); // 秒
      var str = "";
      str =
        year +
        "-" +
        month +
        "-" +
        day +
        " " +
        hours +
        ":" +
        minutes +
        ":" +
        second;
      return str;
    },
    // 封装一个不够两位数就补零的函数
    showTime(t) {
      var time;
      time = t >= 10 ? t : "0" + t;
      return time;
    },
    clear() {

      this.positions = [];
      this.regions = [];
      this.entities.forEach((item) => {
        viewer.entities.removeById(item.id);
      })
      this.qsEntities.forEach((item) => {
        viewer.entities.removeById(item.id);
      })
      this.entities = []
      this.qsEntities = [];
      if (polygonEntity) {
        viewer.entities.remove(polygonEntity)
      }
      if (handlerPolygon) {
        handlerPolygon.deactivate();
        handlerPolygon.clear();
      }

    },
    exportWord(projectInfo) {
      if (projectInfo)
        var promise = scene.outputSceneToFile();
      Cesium.when(promise, function (base64data) {
        projectInfo.isUseDB = window.isUseDB;
        expotZDBCWord(projectInfo)
      })

      // .then((response) => {
      //     debugger;
      //     var fileName = projectInfo.projectName;
      //     debugger;
      //     const contentDisposition = response.headers["content-disposition"];
      //     if (contentDisposition) {
      //       fileName = window.decodeURI(
      //         response.headers["content-disposition"].split("=")[1],
      //         "UTF-8"
      //       );
      //     }
      //     const isBlob = blobValidate(response.data);
      //     debugger;
      //     if (isBlob) {
      //       const blob = new Blob([response.data]);
      //       saveAs(blob, fileName);
      //     } else {
      //       const resText = response.text();
      //       const rspObj = JSON.parse(resText);
      //       const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode["default"];
      //       that.$message.error(errMsg);
      //     }
      //   }).catch((err) => {
      //     console.log(err)
      //   })
    }
  },
  /**
   * 清楚临时图元
   */
  beforeDestroy() {
    if (polygonEntity) {
      viewer.entities.remove(polygonEntity)
    }
    if (handlerPolygon) {
      handlerPolygon.deactivate();
      handlerPolygon.clear();
    }
    if (handleInput)
      handleInput.destroy()
    this.positions = [];
    this.regions = [];
    this.entities = []
    this.qsEntities = [];
    viewer.entities.removeAll();
    if(popupBox){
        popupBox.destroy();
        popupBox=null;
    }
    
  },
  destroyed() { }

};
</script>
<style lang="scss">
@import "@/../../zt.scss";
</style>
<style scoped>
.fileInput {
  display: none;
}

.file-upload-button {
  background-color: #0f7ac8 !important
}

.divrow {
  margin: 0;
  padding: 0;
  display: flex;
  height: 2.5rem;
}

.divImg {
  width: 20%;
}

img {
  height: 2rem;
  width: 2rem;
}

.divCol {
  width: 49.5%;
  display: flex;
  white-space: nowrap;
}

.divText {
  width: 79%;
  padding-left: 0.5rem;
}

input.el-range-input {
  background-color: transparent;
}

.el-range-editor.el-input__inner {
  background-color: transparent;
}

.el-row {
  /* padding: 0.5rem 0 0.5rem 0; */
  /* display: inline-flex; */
  align-items: center;
  margin-bottom: 0.5rem;
}

.el-col {
  display: inline-flex;
}

.buttongroup {
  display: inline-flex;
  margin-top: 0.45rem;
}

.rootele {
  padding: 0.5rem;
  color: white;
  overflow-y: none;
}

.el-col {
  color: white;
}

.el-tab-pane {
  color: white;
}

.el-input {
  background: transparent;
}

/* ul {
  height: 100;
  width: 100%;
  overflow-y: auto;
  font-size: 1rem;
  padding: 1rem;
  list-style-type: none;
} */
.el-pagination {
  color: #ffffff;
}
</style>
