<template>
  <div id="data-statis">
    <div id="amap-container"></div>
    <!-- v-loading="mapLoading"
      element-loading-background="rgba(0, 0, 0, 0.2)"
      element-loading-text="地图加载中..." -->
    <div class="left-area">
      <Section class="sections" title="政府监管">
        <template #right-slot>
          <span class="show-more" @click="showZFJG">查看更多</span>
        </template>
        <STable :headers="header1" :table-data="data1">
          <template slot-scope="scope">
            <template v-if="scope.header.slot == 'regulation_score'">
              <span
                :style="{
                  color: scope.row.regulation_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.regulation_score }}</span
              >
            </template>
          </template>
        </STable>
      </Section>
      <Section class="sections" title="工程质量">
        <template #right-slot>
          <span class="show-more" @click="showGCZL">查看更多</span>
        </template>
        <STable :headers="header2" :table-data="data2">
          <template slot-scope="scope">
            <template v-if="scope.header.slot == 'quality_score'">
              <span
                :style="{
                  color: scope.row.quality_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.quality_score }}</span
              >
            </template>
            <template v-if="scope.header.slot == 'quality_check_score'">
              <span
                :style="{
                  color: scope.row.quality_check_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.quality_check_score }}</span
              >
            </template>
            <template v-if="scope.header.slot == 'quality_total_score'">
              <span
                :style="{
                  color: scope.row.quality_total_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.quality_total_score }}</span
              >
            </template>
          </template>
        </STable>
      </Section>
      <Section class="sections" title="创新创优">
        <template #right-slot>
          <span class="show-more" @click="showCXCY">查看更多</span>
        </template>
        <STable :headers="header3" :table-data="data3">
          <template slot-scope="scope">
            <template v-if="scope.header.slot == 'excellence_score'">
              <span
                :style="{
                  color: scope.row.excellence_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.excellence_score }}</span
              >
            </template>
          </template>
        </STable>
      </Section>
    </div>
    <div class="right-area" v-if="currentCityName">
      <Section class="sections long" type="long" :title="currentCityName">
        <template #right-slot>
          <span class="show-more" @click="showCityList">查看更多</span>
        </template>
        <div class="get-points">
          <div class="points">
            <div
              class="grade"
              :style="{ color: zfjg_score < 80 ? '#f86262' : '#5aefd1' }"
            >
              {{ zfjg_score }}
            </div>
            <div class="label">政府监管</div>
          </div>
          <div class="points">
            <div
              class="grade"
              :style="{ color: zljc_score < 80 ? '#f86262' : '#5aefd1' }"
            >
              {{ zljc_score }}
            </div>
            <div class="label">工程质量</div>
          </div>
          <div class="points">
            <div
              class="grade"
              :style="{ color: score_count < 80 ? '#f86262' : '#5aefd1' }"
            >
              {{ score_count }}
            </div>
            <div class="label">区域总得分</div>
          </div>
        </div>
        <!-- <div class="switch-buttons">
          <div :class="[activeTab == 1 ? 'active' : '']" @click="switchList(1)">
            政府监管
          </div>
          <div :class="[activeTab == 2 ? 'active' : '']" @click="switchList(2)">
            质量评定
          </div>
          <div :class="[activeTab == 3 ? 'active' : '']" @click="switchList(3)">
            质量检测
          </div>
        </div> -->
        <STable2
          :style="{ marginTop: '.1rem', height: 'calc(100% - 1rem)' }"
          :headers="header4_1"
          :table-data="data4"
        >
          <template slot-scope="scope">
            <template v-if="scope.header.slot == 'regulation_score'">
              <span
                :style="{
                  color: scope.row.regulation_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.regulation_score }}</span
              >
            </template>
            <template v-if="scope.header.slot == 'quality_total_score'">
              <span
                :style="{
                  color: scope.row.quality_total_score < 80 ? '#f86262' : '',
                }"
                >{{ scope.row.quality_total_score }}</span
              >
            </template>
            <template v-if="scope.header.slot == 'total_score'">
              <span
                :style="{ color: scope.row.total_score < 80 ? '#f86262' : '' }"
                >{{ scope.row.total_score }}</span
              >
            </template>
          </template>
        </STable2>
        <!-- activeTab == 1 ? header4_1 : activeTab == 2 ? header4_2 : header4_3 -->

        <!-- <div class="no-data" v-if="activeTab == 3">
          <div class="inner">
            <img src="@/assets/images/index/no-data.png" alt="" />
            <div>暂无数据</div>
          </div>
        </div> -->
      </Section>
    </div>

    <ProjectList
      :visible="projectListVisible"
      @change-visible="(val) => (projectListVisible = val)"
    ></ProjectList>
    <div class="bottom-area">
      <Section2 title="严重问题预警" class="bottom-section">
        <STable2 :headers="header5" :table-data="data5">
          <template slot-scope="scope">
            <template v-if="scope.header.slot == 'count'">
              <span
                >{{ scope.row.question_count }}/<span style="color: green">{{
                  scope.row.question_general
                }}</span></span
              >
            </template>
          </template>
        </STable2>
      </Section2>
    </div>
    <!-- <img src="@/assets/images/index/lt.png" class="lt" alt="" />
    <img src="@/assets/images/index/rt.png" class="rt" alt="" />
    <img src="@/assets/images/index/btm.png" class="btm" alt="" /> -->
  </div>
</template>
<script>
import * as echarts from "echarts";
import { zhejiangJson } from "@/assets/data/zhejiang.js";
import {
  getMapData,
  getYearQuestion,
  getLevelQuestion,
  getStatusQuestion,
  getScoreByCity,
  getScoreStatusByCity,
  getProjectList,
} from "@/api/dataStatis";

import { mapState } from "vuex";
import zhejiangMapData from "@/assets/data/mapData.json";
import Section2 from "@/components/common/Section2.vue";
import STable2 from "@/components/common/STable2.vue";
import ProjectList from "@/views/DataStatis/project/Index.vue";
export default {
  name: "DataStatis",
  components: {
    Section2,
    STable2,
    ProjectList,
  },
  data() {
    return {
      mapLoading: true,
      header1: [
        {
          name: "工程名称",
          props: "project_name",
          width: "70%",
          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
        },
        {
          name: "政府监管得分",
          props: "regulation_score",
          width: "30%",
          slot: "regulation_score",
        },
      ],
      header2: [
        {
          name: "工程名称",
          props: "project_name",
          width: "45%",
          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
        },
        {
          name: "质量评定",
          props: "quality_score",
          width: "20%",
          slot: "quality_score",
        },
        {
          name: "质量检测",
          props: "quality_check_score",
          width: "20%",
          slot: "quality_check_score",
        },
        {
          name: "总得分",
          props: "quality_total_score",
          width: "15%",
          slot: "quality_total_score",
        },
      ],
      header3: [
        {
          name: "工程名称",
          props: "project_name",
          width: "70%",
          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
        },
        {
          name: "创新创优得分",
          props: "excellence_score",
          width: "30%",
          slot: "excellence_score",
        },
      ],
      // header1: [
      //   {
      //     name: "市区",
      //     props: "city_name",
      //     width: "calc(100% / 5 - .1rem)",
      //   },
      //   {
      //     name: "政府监管",
      //     props: "zfjg",
      //     width: "calc(100% / 5)",
      //   },
      //   {
      //     name: "质量管理制度",
      //     props: "zlglzd",
      //     width: "calc(100% / 5 + .1rem)",
      //   },
      //   {
      //     name: "资质资格",
      //     props: "zzzg",
      //     width: "calc(100% / 5)",
      //   },
      //   {
      //     name: "实体质量",
      //     props: "stzl",
      //     width: "calc(100% / 5)",
      //   },
      // ],
      data1: [],
      // header2: [
      //   {
      //     name: "市区",
      //     props: "city_name",
      //     width: "calc(100% / 4)",
      //   },
      //   {
      //     name: "严重问题",
      //     props: "serious",
      //     width: "calc(100% / 4)",
      //   },

      //   {
      //     name: "一般问题",
      //     props: "general",
      //     width: "calc(100% / 4)",
      //   },
      //   {
      //     name: "问题总数",
      //     props: "count",
      //     width: "calc(100% / 4)",
      //   },
      // ],
      data2: [],

      // header3: [
      //   {
      //     name: "市区",
      //     props: "city_name",
      //     width: "20%",
      //   },
      //   {
      //     name: "涉及工程",
      //     props: "project_count",
      //     width: "20%",
      //   },
      //   {
      //     name: "涉及单位",
      //     props: "units_count",
      //     width: "20%",
      //   },
      //   {
      //     name: "问题总数/已处理数",
      //     props: "count",
      //     slot: "count",
      //     width: "40%",
      //   },
      // ],
      data3: [],

      header4_1: [
        {
          name: "工程名称",
          props: "project_name",
          width: "40%",
          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
        },
        {
          name: "政府监管",
          props: "regulation_score",
          width: "20%",
          slot: "regulation_score",
        },
        {
          name: "工程质量",
          props: "quality_total_score",
          width: "20%",
          slot: "quality_total_score",
        },
        {
          name: "工程总得分",
          props: "total_score",
          width: "20%",
          slot: "total_score",
        },
      ],
      header4_2: [
        {
          name: "工程名称",
          props: "name",
          width: "calc(100% / 3)",
          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
        },
        {
          name: "单位工程",
          props: "value1",
          width: "calc(100% / 3)",
          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
          // headerStyle: {
          //   fontSize: "0.13rem",
          // },
        },
        {
          name: "得分情况",
          props: "value2",
          width: "calc(100% / 3)",
        },
      ],
      header4_3: [
        {
          name: "工程名称",
          props: "name",

          width: "70%",

          headerStyle: {
            textAlign: "left",
          },
          style: {},
          align: "left",
        },
        {
          name: "不合格率",
          props: "value1",
          width: "30%",
        },
      ],
      header4_4: [
        {
          name: "人员资格",
          props: "name",
          width: "calc(100% / 4)",
        },
        {
          name: "工程外观",
          props: "category_count_11",
          width: "calc(100% / 4)",
        },
        {
          name: "开挖与基础处理质量",
          props: "category_count_12",
          width: "calc(100% / 3)",
        },
        {
          name: "工程结构质量",
          props: "category_count_13",
          width: "calc(100% / 4)",
        },
      ],
      data4: [],

      header5: [
        {
          name: "工程名称",
          props: "project_name",
          width: "45%",
          headerStyle: {},
          style: {},
          align: "left",
        },
        {
          name: "所属区域",
          props: "prname",
          width: "20%",
          headerStyle: {},
          style: {},
          align: "left",
        },
        {
          name: "当前问题总数",
          props: "zfjg",
          width: "10%",
        },
        {
          name: "严重问题数量",
          props: "zlglzd",
          width: "10%",
        },
        {
          name: "最近严重预警时间",
          props: "zzzg",
          width: "15%",
        },
      ],
      data5: [],
      activeTab: 1,

      mapCenter: [],
      AMap: null,
      map: null,
      mapActive: 1,
      loca: null,
      renderColor: {
        A: "#208995",
        B: "#2a5dc6",
        C: "#23366f",
        D: "#a9a715",
        E: "#b74f4f",
      },
      districtArr: [],
      polygons: [],
      currentCityName: "",
      currentCityId: "",
      zfjg_score: 0,
      zljc_score: 0,
      score_count: 0,
      projectListVisible: false,
    };
  },
  methods: {
    initMap() {
      getMapData().then((res) => {
        var newZhejiangMapData = [];
        res.data.map((item) => {
          newZhejiangMapData.push({
            name: item.name,
            value: [
              zhejiangMapData.filter((cx) => {
                return cx.name == item.name;
              })[0].value[0],
              zhejiangMapData.filter((cx) => {
                return cx.name == item.name;
              })[0].value[1],
              item.score,
            ],
            id: item.id,
          });
          if (item.name == "杭州市") {
            this.currentCityId = item.id;
            this.currentCityName = item.name;
          }
        });
        this.switchList(1);
        this.initMapData("amap-container", zhejiangJson, newZhejiangMapData, 1);
      });
    },
    getData() {
      getProjectList({ limit: 20 }, false).then((res) => {
        this.data1 = res.data.data;
        this.data2 = res.data.data;
        this.data3 = res.data.data;
      });
      // getYearQuestion().then((res) => {
      //   this.data1 = res.data;
      // });
      // getLevelQuestion().then((res) => {
      //   this.data2 = res.data;
      // });
      // getStatusQuestion().then((res) => {
      //   this.data3 = res.data;
      // });
      // this.data1 = [
      //   {
      //     project_name: "东苕溪防洪后续西险大塘达标加固工程（杭州市段）",
      //     quality_score: "90",
      //   },
      //   {
      //     project_name: "杭州市萧山区西江塘义桥段古海塘抢险加固工程",
      //     quality_score: "85",
      //   },
      //   {
      //     project_name: "钱塘江北岸五堡排涝泵站工程",
      //     quality_score: "77",
      //   },
      //   {
      //     project_name: "钱塘江西江塘闻堰段海塘提标加固工程",
      //     quality_score: "92",
      //   },
      //   {
      //     project_name: "杭州市萧围西线（一工段至四工段）提标加固工程",
      //     quality_score: "85",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程 （三堡至乔司段海塘）一期",
      //     quality_score: "90",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（珊瑚沙海塘）",
      //     quality_score: "82",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（上泗南北大塘）二期",
      //     quality_score: "87",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（三堡船闸段海塘）",
      //     quality_score: "88",
      //   },
      //   {
      //     project_name: "临安区双溪口水库工程",
      //     quality_score: "81",
      //   },
      //   {
      //     project_name: "宁波市界牌碶泵站工程",
      //     quality_score: "79",
      //   },
      //   {
      //     project_name: "奉化区柏坑水库扩容工程",
      //     quality_score: "89",
      //   },
      //   {
      //     project_name: "余姚市陶家路江排涝枢纽及供水工程",
      //     quality_score: "85",
      //   },
      // ];
      // this.data2 = [
      //   {
      //     project_name: "东苕溪防洪后续西险大塘达标加固工程（杭州市段）",
      //     quality_score: "80",
      //   },
      //   {
      //     project_name: "杭州市萧山区西江塘义桥段古海塘抢险加固工程",
      //     quality_score: "75",
      //   },
      //   {
      //     project_name: "钱塘江北岸五堡排涝泵站工程",
      //     quality_score: "97",
      //   },
      //   {
      //     project_name: "钱塘江西江塘闻堰段海塘提标加固工程",
      //     quality_score: "92",
      //   },
      //   {
      //     project_name: "杭州市萧围西线（一工段至四工段）提标加固工程",
      //     quality_score: "82",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程 （三堡至乔司段海塘）一期",
      //     quality_score: "90",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（珊瑚沙海塘）",
      //     quality_score: "82",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（上泗南北大塘）二期",
      //     quality_score: "84",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（三堡船闸段海塘）",
      //     quality_score: "82",
      //   },
      //   {
      //     project_name: "临安区双溪口水库工程",
      //     quality_score: "81",
      //   },
      //   {
      //     project_name: "宁波市界牌碶泵站工程",
      //     quality_score: "79",
      //   },
      //   {
      //     project_name: "奉化区柏坑水库扩容工程",
      //     quality_score: "83",
      //   },
      //   {
      //     project_name: "余姚市陶家路江排涝枢纽及供水工程",
      //     quality_score: "82",
      //   },
      // ];
      // this.data3 = [
      //   {
      //     project_name: "东苕溪防洪后续西险大塘达标加固工程（杭州市段）",
      //     quality_score: "90",
      //   },
      //   {
      //     project_name: "杭州市萧山区西江塘义桥段古海塘抢险加固工程",
      //     quality_score: "90",
      //   },
      //   {
      //     project_name: "钱塘江北岸五堡排涝泵站工程",
      //     quality_score: "87",
      //   },
      //   {
      //     project_name: "钱塘江西江塘闻堰段海塘提标加固工程",
      //     quality_score: "92",
      //   },
      //   {
      //     project_name: "杭州市萧围西线（一工段至四工段）提标加固工程",
      //     quality_score: "85",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程 （三堡至乔司段海塘）一期",
      //     quality_score: "77",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（珊瑚沙海塘）",
      //     quality_score: "90",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（上泗南北大塘）二期",
      //     quality_score: "95",
      //   },
      //   {
      //     project_name: "杭州市本级海塘安澜工程（三堡船闸段海塘）",
      //     quality_score: "88",
      //   },
      //   {
      //     project_name: "临安区双溪口水库工程",
      //     quality_score: "97",
      //   },
      //   {
      //     project_name: "宁波市界牌碶泵站工程",
      //     quality_score: "79",
      //   },
      //   {
      //     project_name: "奉化区柏坑水库扩容工程",
      //     quality_score: "83",
      //   },
      //   {
      //     project_name: "余姚市陶家路江排涝枢纽及供水工程",
      //     quality_score: "74",
      //   },
      // ];
    },

    async load() {
      console.log("load");
    },

    switchList(type) {
      this.activeTab = type;
      this.data4 = [];

      getProjectList({ city_id: this.currentCityId, limit: 20 }, false).then(
        (res) => {
          this.data4 = res.data.data;
        }
      );
      getScoreStatusByCity(this.currentCityId).then((res) => {
        this.zfjg_score = res.data.zfjg_score;
        this.zljc_score = res.data.zljc_score;
        this.score_count = res.data.score_count;
      });

      // if (type == 1) {

      // } else if (type == 2) {
      //   this.data4 = [
      //     {
      //       name: "环湖大堤施工2标",
      //       value1: "堤防工程",
      //       value2: "92.8%",
      //     },
      //     {
      //       name: "环湖大堤施工2标",
      //       value1: "蔡浦港闸站工程",
      //       value2: "93.4%",
      //     },
      //     {
      //       name: "环湖大堤施工2标",
      //       value1: "其他口门建筑物单位工程",
      //       value2: "89.5%",
      //     },
      //     {
      //       name: "环湖大堤施工2标",
      //       value1: "夹浦港-秋龙港-吴城港河道堤防工程",
      //       value2: "93.4%",
      //     },
      //     {
      //       name: "环湖大堤施工2标",
      //       value1: "夹浦港-秋龙港-吴城港闸站第一单位工程",
      //       value2: "91.9%",
      //     },
      //     {
      //       name: "环湖大堤施工2标",
      //       value1: "夹浦港-秋龙港-吴城港闸站第二单位工程",
      //       value2: "91.1%",
      //     },
      //     {
      //       name: "衢州市柯城区寺桥水库工程",
      //       value1: "混凝土面板堆石坝",
      //       value2: "/",
      //     },
      //     {
      //       name: "衢州市柯城区寺桥水库工程",
      //       value1: "导流泄放洞",
      //       value2: "/",
      //     },
      //     {
      //       name: "衢州市柯城区寺桥水库工程",
      //       value1: "溢洪道",
      //       value2: "/",
      //     },
      //     {
      //       name: "金华市安地灌区续建配套与节水改造项目（2021-2022年）调增项目施工标【金华市安地灌区续建配套与节水改造项目（2021-2022年）IV标】",
      //       value1: "渠道及信息化项目",
      //       value2: "/",
      //     },
      //   ];
      // } else if (type == 3) {
      //   this.data4 = [
      //     {
      //       name: "苍南县江南垟平原骨干排涝工程（龙港段）龙金运河和新兰闸站工程",
      //       value1: "98%",
      //     },
      //     {
      //       name: "慈溪市水资源开发利用二期（梅湖水库扩容工程）",
      //       value1: "87%",
      //     },
      //     {
      //       name: "东苕溪防洪后续西险大塘达标加固工程（杭州市段）",
      //       value1: "76.4%",
      //     },
      //     {
      //       name: "奉化区柏坑水库扩容工程",
      //       value1: "87.1%",
      //     },
      //     {
      //       name: "海宁市百里钱塘综合整治提升工程一期（盐仓段）",
      //       value1: "95.1%",
      //     },
      //     {
      //       name: "杭州市本级海塘安澜工程 （三堡至乔司段海塘）一期",
      //       value1: "98%",
      //     },
      //     {
      //       name: "杭州市本级海塘安澜工程（三堡船闸段海塘）",
      //       value1: "87%",
      //     },
      //     {
      //       name: "杭州市本级海塘安澜工程（珊瑚沙海塘）",
      //       value1: "76.4%",
      //     },
      //     {
      //       name: "杭州市本级海塘安澜工程（上泗南北大塘）二期",
      //       value1: "87.1%",
      //     },
      //     {
      //       name: "杭州市萧山区西江塘义桥段古海塘抢险加固工程",
      //       value1: "95.1%",
      //     },
      //     {
      //       name: "杭州市萧围西线（一工段至四工段）提标加固工程",
      //       value1: "98%",
      //     },
      //     {
      //       name: "湖州市苕溪清水入湖河道整治后续工程（德清县段）",
      //       value1: "87%",
      //     },
      //     {
      //       name: "环湖大堤（浙江段）后续工程（长兴段）",
      //       value1: "76.4%",
      //     },
      //     {
      //       name: "嘉兴市区城市防洪扩展工程三期（封闭工程）",
      //       value1: "87.1%",
      //     },
      //     {
      //       name: "金华市安地灌区续建配套与节水改造项目（2021-2022年）调增项目",
      //       value1: "95.1%",
      //     },
      //     {
      //       name: "杭州市本级海塘安澜工程（珊瑚沙海塘）",
      //       value1: "76.2%",
      //     },
      //   ];
      // }
    },
    initMapData(mapid, baseAreaJson, mapData, maplevel) {
      var myChart = echarts.init(document.getElementById(mapid));
      echarts.registerMap(mapid, baseAreaJson);
      var outdata = []; //地图区域挂载数据
      mapData.forEach(function (item, index) {
        outdata.push({
          name: item.name,
          id: item.id,
          value: item.value[2],
          index: index,
        });
      });
      var _layoutSize = "100%";

      var option = {
        tooltip: {
          show: true,
          formatter: function (params) {
            if (
              params.seriesType == "scatter" ||
              params.seriesType == "effectScatter"
            ) {
              return false;
            }

            return params.name + "<br>" + params.value;
          },
        },
        grid: {
          left: "0%",
          right: "0%",
          top: "0%",
          bottom: "0%",
          show: true,
          borderWidth: 0,
          backgroundColor: "transparent",
        },
        // 地图的阴影底图
        geo: {
          map: mapid,
          left: 0,
          right: 0,
          bottom: 0,
          top: 0,
          aspectScale: 0.9,
          layoutCenter: ["50%", "50%"], //地图位置
          layoutSize: _layoutSize,
          itemStyle: {
            normal: {},
          },
          z: 1,
          animationDurationUpdate: 0,
          roam: false,

          data: outdata,
        },
        visualMap: {
          type: "piecewise",
          splitNumber: 2,
          min: 0,
          max: 100,
          align: "left",
          right: 20,
          bottom: 20,
          itemWidth: 60,
          itemHeight: 20,
          itemGap: 5,
          // itemSymbol: 'circle',
          orient: "vertical",
          //区域颜色
          color: ["#2f4ca3", "#8c2d2d"],
          //区域颜色范范围
          pieces: [
            { min: 0, max: 79 },
            { min: 80, max: 100 },
          ],
          textStyle: {
            color: "#eee",
            fontSize: 14,
          },
          show: false,
        },
        series: [
          {
            type: "map",
            map: mapid,
            aspectScale: 0.9,
            layoutCenter: ["50%", "50%"], //地图位置
            layoutSize: _layoutSize,

            label: {
              normal: {
                show: false,
                fontFamily: "SourceHanSansCN",
                fontSize: "14",
                color: "#FEFEFE",
                position: "bottom",
              },
              emphasis: {
                show: false,
                fontFamily: "SourceHanSansCN",
                fontSize: "14",
                color: "#FEFEFE",
              },
            },
            select: {
              label: {
                color: "#fff",
                show: false,
              },
              itemStyle: {
                areaColor: "#2a5dc6",
                borderColor: "#14ddf5",
              },
            },
            itemStyle: {
              normal: {
                borderColor: "#6b97f2",
                borderWidth: 1,
                color: "#032359",
                areaColor: "#23366f",
              },
              emphasis: {
                shadowColor: "rgba(0, 0, 0, 1)",
                shadowBlur: 10,
                shadowOffsetX: 5,
                shadowOffsetY: 5,
                areaColor: "#2a5dc6",
                // areaColor: {
                //   type: "linear-gradient",
                //   x: 0,
                //   y: 0,
                //   x2: 0,
                //   y2: 1,
                //   colorStops: [
                //     {
                //       offset: 0,
                //       color: "#15b5f5", // 0% 处的颜色
                //     },
                //     {
                //       offset: 1,
                //       color: "#106fd5",
                //     },
                //   ],
                // },
              },
            },

            z: 1,
            data: outdata.map((item) => {
              return {
                ...item,
                selected: item.name == "杭州市",
              };
            }),
            roam: false,
          },

          {
            name: "点",
            type: "scatter",
            coordinateSystem: "geo",
            symbol: (value, params) => {
              if (value[2] < 80) {
                return (
                  "image://" + require("@/assets/images/index/icon_hong.png")
                );
              } else {
                return (
                  "image://" + require("@/assets/images/index/icon_lan.png")
                );
              }
            },

            colorBy: "data",
            symbolSize: 50,
            symbolOffset: [20, -20],
            label: {
              position: "inside",
              formatter: function (params) {
                return `${params.data.name}\n${params.data.value[2]}分`;
              },
              show: true,
              color: "#fff",
              fontSize: 14,
              offset: [10, -6],
            },
            z: 3,
            data: mapData,
          },
        ],
      };
      myChart.clear();
      myChart.setOption(option);
      window.addEventListener("resize", () => {
        setTimeout(() => {
          myChart.resize();
        }, 500);
      });
      myChart.off().on("click", (params) => {
        if (maplevel == 1 && params.componentType === "series") {
          var streetName = null;
          var areaGUID = null;

          if (params.seriesType == "map") {
            // 地图
            streetName = params.data.name;
            areaGUID = params.data.id;
          } else {
            // 散点图
            streetName = params.name.split("|")[0];
            areaGUID = params.name.split("|")[1];
          }
          this.currentCityId = params.data.id;
          this.currentCityName = params.data.name;
          this.switchList(1);
        }
      });

      this.$nextTick(() => {
        myChart.resize();
      });
      return myChart;
    },
    showZFJG() {
      this.projectListVisible = true;
      this.$eventBus.$emit("switchTab", "ZFJG");
    },
    showGCZL() {
      this.projectListVisible = true;
      this.$eventBus.$emit("switchTab", "GCZL");
    },
    showCXCY() {
      this.projectListVisible = true;
      this.$eventBus.$emit("switchTab", "CXCY");
    },
    showCityList() {
      this.projectListVisible = true;
      this.$eventBus.$emit("switchTab", "ProjectDetail");
    },
  },

  mounted() {
    this.getData();
    this.initMap();
    window.clickDetail = this.clickDetail;
  },
  watch: {},
  destroyed() {
    this.map && this.map.destroy();
  },
  computed: {
    ...mapState(["userInfo"]),
  },
};
</script>
<style lang="less" scoped>
#data-statis {
  position: relative;
  width: 100%;
  height: 100%;
}
#amap-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  width: calc(100% - 900px);
  height: calc(100% - calc(calc(100% - 90px) / 3 - calc(28px / 3)));
  background: transparent !important;
  z-index: 5;
}
.left-area {
  width: 440px;
  left: 10px;
  top: 80px;
  position: fixed;
  height: calc(100% - 90px);
  z-index: 999;
}
.right-area {
  position: fixed;
  right: 10px;
  top: 80px;
  width: 440px;
  height: calc(
    calc(100% - 90px) - calc(calc(100% - 90px) / 3 - calc(28px / 3)) - 10px
  );
  z-index: 999;
}
.bottom-area {
  position: fixed;
  width: calc(100% - 480px);
  left: 470px;
  bottom: 10px;
  right: 10px;
  height: calc(calc(100% - 90px) / 3 - calc(28px / 3)) !important;
  z-index: 999;
}
.sections {
  height: calc(100% / 3 - calc(28px / 3)) !important;
  margin-bottom: 14px;
  &:last-child {
    margin-bottom: 0;
  }
}
.sections.long {
  height: calc(100% - calc(28px / 3)) !important;
}
.bottom-section {
  width: 100%;
  height: 100% !important;
}
::v-deep .span-status {
  &.green {
    color: #47ae5f;
  }
  &.orange {
    color: #df7a1f;
  }
  &.red {
    color: #df441f;
  }
  &.blue {
    color: #b83be7;
  }
}
.lt {
  position: fixed;
  left: 0;
  width: 500px;
  top: 80px;
  height: 100%;
  z-index: 10;
}
.rt {
  position: fixed;
  right: 0;
  width: 500px;
  top: 80px;
  height: 100%;
  z-index: 10;
}
.btm {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(calc(100% - 90px) / 3 - calc(28px / 3) + 50px) !important;
  z-index: 10;
}
.switch-buttons {
  margin-top: 10px;
  line-height: 40px;
  display: flex;
  justify-content: space-between;
  div {
    background: url("@/assets/images/index/icon_yier@2x.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    margin-right: 4px;
    width: calc(100% / 3 - calc(8px / 3));
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    &:last-child {
      margin-right: 0;
    }
    &:hover,
    &.active {
      color: rgba(255, 255, 255, 1);
      background: url("@/assets/images/index/icon_yiyi@2x.png");
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }
  }
}
.get-points {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
  .points {
    width: calc(100% / 3 - calc(8px / 3));
    background: url("@/assets/images/index/grade-bg.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;
    margin-right: 4px;
    height: 80px;
    &:last-child {
      margin-right: 0;
    }
    .label {
      width: 70%;
      margin: 0 auto;
      text-align: center;
      line-height: 36px;
      color: #bdcae4;
      border-top: 1px solid rgba(255, 255, 255, 0.7);

      font-size: 14px;
    }
    .grade {
      line-height: 44px;
      text-align: center;
      font-size: 24px;
    }
  }
}
::v-deep .amap-marker-label {
  border: none;
  background-color: transparent;
  font-size: 14px !important;
  line-height: 14px !important;
  top: 2% !important;
  left: 10% !important;
}
.no-data {
  text-align: center;
  color: #fff;

  height: 100%;
  font-size: 20px;
  position: relative;
  img {
    width: 100px;
    vertical-align: top;
    opacity: 0.7;
  }
  .inner {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
  }
}
.show-more {
  cursor: pointer;
}
</style>