<!--
 * @Author: SunTao 328867980@qq.com
 * @Date: 2024-10-17 11:34:00
 * @LastEditors: SunTao 328867980@qq.com
 * @LastEditTime: 2024-11-13 14:11:57
 * @FilePath: \znxjxt-ui\src\views\big-screen\index.vue
 * @Description: 大屏首页
-->
<template>
  <div class="screen-content">
    <div class="screen-header">
      <div class="header-weather">
        <iframe
          width="150"
          scrolling="no"
          height="45"
          frameborder="0"
          allowtransparency="true"
          src="https://i.tianqi.com?c=code&id=12&icon=1&color=%2389C5E8&py=shenyang&num=1&site=12"
        ></iframe>
      </div>
      <div class="header-time">
        <div class="header-data">{{ dataTime }}</div>
        <div class="header-week">
          <span>{{ weekTime }}</span>
          <span>{{ yearTime }}</span>
        </div>
        <div class="header-home">
          <div class="home" @click="goIndex"></div>
        </div>
      </div>
    </div>
    <div class="screen-middle">
      <div class="screen-left">
        <module-block
          v-for="(item, index) in leftModuleList"
          :key="`left-module-list-${index}`"
          :width="item.width"
          :height="item.height"
          :title="item.title"
          :class="item.class"
        >
          <template
            ><component
              :select="item.select"
              :is="item.component"
              :bottomTipClick="bottomTipClick"
            ></component
          ></template>
          <template slot="operation" v-if="item.selectIsShow">
            <el-radio-group class="screen-checkBox" v-model="item.select">
              <el-radio-button
                v-for="(item, index) in selectTypeArr"
                :label="item.value"
                :key="`left-screen-${index}`"
                >{{ item.label }}</el-radio-button
              >
            </el-radio-group>
          </template>
        </module-block>
      </div>
      <div class="screen-right">
        <module-block
          v-for="(item, index) in rightModuleList"
          :key="`right-module-list-${index}`"
          :width="item.width"
          :height="item.height"
          :title="item.title"
          :class="item.class"
        >
          <template
            ><component
              :select="item.select"
              :is="item.component"
              :bottomTipClick="bottomTipClick"
            ></component
          ></template>
          <template slot="operation" v-if="item.selectIsShow">
            <el-radio-group class="screen-checkBox" v-model="item.select">
              <el-radio-button
                v-for="(item, index) in selectTypeArr"
                :label="item.value"
                :key="`right-screen-${index}`"
                >{{ item.label }}</el-radio-button
              >
            </el-radio-group>
          </template>
        </module-block>
      </div>
      <div class="road-content">
        <!-- 地图右上角多选框切换坐标类型 -->
        <!-- <div class="road-checkBox">
          <fssm-scroll class="road-scroll">
            <el-checkbox-group v-model="iconType" @change="handleChecked">
              <el-checkbox
                v-for="(item, index) in iconTypeList"
                :label="item.value"
                :key="`check-${index}`"
                >{{ item.label }}</el-checkbox
              >
            </el-checkbox-group>
          </fssm-scroll>
        </div> -->
        <!-- 地图图例 -->
        <div class="map-legend"></div>
        <!-- 图片背景 -->
        <div class="disease-content" v-if="elementDiv === 'OverviewScreen'">
          <div class="disease-title"></div>
          <!-- 图背景下选择框 -->
          <div class="map-image-select">
            病害类型筛选：
            <el-select
              :popper-append-to-body="false"
              v-model="mapCareSelect"
              placeholder="请选择"
              @change="getMapCare"
            >
              <el-option
                v-for="item in dieaseTypeList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </div>
          <div class="map-care">
            <div
              class="map-care-div"
              :class="`map-care-div-${item.status}`"
              v-for="(item, index) in mapCareList"
              :key="`map-care-${index}`"
              :style="{ left: item.left, top: item.top }"
            >
              <span>{{ item.name }}</span>
            </div>
          </div>
        </div>
        <!-- 地图 -->
        <fssm-map
          v-if="elementDiv !== 'OverviewScreen'"
          ref="roadMap"
          :showChange="true"
          :controlStyle="{ top: '10%', left: '26%' }"
          @map-moveend="mapMoveend"
          @map-zoom="getZoom"
          @feature-select="featureSelect"
        ></fssm-map>
      </div>
    </div>
    <div class="screen-footer">
      <!-- 病害巡检4种类型按钮 -->
      <div class="footer-change-map">
        <template v-if="elementDiv === 'DiseaseScreen'">
          <div
            class="change-map-div"
            :class="bottomTipClick === item.click ? 'change-map-click' : ''"
            v-for="(item, index) in changeMapBtn"
            :key="`btn-${index}`"
            @click="changeIconType(item.click)"
          >
            {{ item.name }}
          </div>
        </template>
      </div>
      <!-- 切换3种导航栏按钮 -->
      <div class="footer-change-vue">
        <div
          :class="
            elementDiv === item.component
              ? `change-vue-click-${item.component}`
              : `change-vue-${item.component}`
          "
          v-for="(item, index) in elementList"
          :key="`footer-${index}`"
          @click="changeElement(item)"
        ></div>
      </div>
    </div>
    <!-- 图片弹窗 -->
    <el-dialog
      :title="imgTitle"
      :visible.sync="imgVisible"
      width="85rem"
      append-to-body
      :close-on-click-modal="false"
      destroy-on-close
      @close="imgCancel"
    >
      <img-dialog></img-dialog>
    </el-dialog>

    <!-- 查看点位图片弹窗 -->
    <el-dialog
      title="查看点位"
      :visible.sync="showImageDialog"
      width="80rem"
      append-to-body
      :close-on-click-modal="false"
      destroy-on-close
      @close="screenImgCancel"
    >
      <div class="view-image-container" ref="imageContainer">
        <img
          :src="screenImage.imageUrl"
          alt="Main Image"
          ref="mainImage"
          @load="updateScreenRects"
        />
        <div
          v-for="(rect, index) in screenRects"
          :key="index"
          class="rect-overlay"
          :style="getScreenRectStyle(rect)"
        ></div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
// 地图
import FssmMap from "@/components/map/fssm-map.vue";
import { Feature } from "ol";
import { Point } from "ol/geom";
import { Style, Icon, Fill, Stroke, Circle, Text } from "ol/style";
import VectorSource from "ol/source/Vector";
import VectorLayer from "ol/layer/Vector";
import * as geomExports from "ol/geom";
import Cluster from "ol/source/Cluster";
// 组件
import ModuleBlock from "./module-block.vue";
import TodayInspection from "./overview-components/today-inspection.vue";
import DiseaseTrends from "./overview-components/disease-trends.vue";
import DiseaseCurrent from "./overview-components/disease-current.vue";
import PatrolOrder from "./overview-components/patrol-order.vue";
import InspectionVehicles from "./overview-components/inspection-vehicles.vue";
import RoadStatistic from "./road-components/road-statistic.vue";
import ManageMaintain from "./road-components/manage-maintain.vue";
import AnomalyFacilities from "./road-components/anomaly-facilities";
import AncillaryFacilities from "./road-components/ancillary-facilities.vue";
import TrafficSafety from "./disease-components/traffic-safety.vue";
import TrafficTrend from "./disease-components/traffic-trend.vue";
import TrafficStatistic from "./disease-components/traffic-statistic.vue";
import TrafficLog from "./disease-components/traffic-log.vue";
import ImgDialog from "./components/img-dialog.vue";
import FssmScroll from "@/components/scroll/fssm-scroll.vue";
// 接口
import {
  selectTypeList,
  mapPointList,
  mapPciList,
  comppanyImg,
  getItemTypes,
  getRoadListTypes,
} from "@/api/xj/screen/index";
import { DefectType } from "@/api/xj/screen/traffic-screen";
export default {
  name: "BigScreen",
  components: {
    FssmMap,
    ModuleBlock,
    TodayInspection,
    DiseaseTrends,
    DiseaseCurrent,
    PatrolOrder,
    InspectionVehicles,
    RoadStatistic,
    ManageMaintain,
    AnomalyFacilities,
    AncillaryFacilities,
    TrafficSafety,
    TrafficTrend,
    TrafficStatistic,
    ImgDialog,
    FssmScroll,
    TrafficLog,
  },
  data() {
    return {
      // 计时器标识
      timeFlag: null,
      // 时间
      dataTime: "",
      // 星期
      weekTime: "",
      // 年
      yearTime: "",
      // 数据栏右上角选择框
      selectTypeArr: [],
      // 左侧切换模块
      leftModuleList: [
        {
          width: "100%",
          height: "27%",
          title: "今日巡查",
          component: TodayInspection,
          selectIsShow: false,
          class: "one",
        },
        {
          width: "100%",
          height: "27%",
          title: "病害趋势",
          component: DiseaseTrends,
          selectIsShow: false,
          class: "twe",
        },
        {
          width: "100%",
          height: "29%",
          title: "病害统计",
          component: DiseaseCurrent,
          selectIsShow: true,
          select: "",
          class: "twe",
        },
      ],
      // 右侧切换模块
      rightModuleList: [
        {
          width: "100%",
          height: "18%",
          title: "巡查里程",
          component: PatrolOrder,
          selectIsShow: false,
          class: "one",
        },
        {
          width: "100%",
          height: "65%",
          title: "巡检车辆",
          component: InspectionVehicles,
          selectIsShow: false,
          class: "twe",
        },
      ],
      // 图片背景下打点坐标数据
      mapCareList: [],
      // 切换地图图标类别按钮
      changeMapBtn: [
        { name: "路面", click: "1" },
        { name: "交安", click: "2" },
        { name: "道桥", click: "3" },
        { name: "绿化", click: "4" },
      ],
      // 具体icon类别
      iconTypeList: [],
      // icon类别绑定
      iconType: [],
      // 图片背景下病害类型下拉选择绑定
      mapCareSelect: "",
      // 图片背景下病害类型下拉选择数据
      dieaseTypeList: [],
      // 路段下拉绑定
      roadList: [],
      // 路段选择绑定
      roadSelect: "",
      // 图标类别切换标识
      bottomTipClick: "1",
      // 中间展示的动态组件绑定
      elementDiv: "OverviewScreen",
      // 下方三个按钮数据
      elementList: [
        { name: "总览", component: "OverviewScreen" },
        { name: "病害巡检", component: "DiseaseScreen" },
        { name: "道路资产", component: "RoadScreen" },
      ],
      // 中心点集合(全部)
      centerPiont: [],
      // 中心点集合（当前）
      drawPointList: [],
      // 点位图标map
      mapLogeList: {},
      // 线段点集合
      lineString: [],
      // 地图放大缩小层级
      mapZoom: "",
      // 聚合图层
      clusters: null,
      // 线段图层
      markLayerLines: null,
      // 图片弹窗标题
      imgTitle: "查看",
      // 图片弹窗显隐控制
      imgVisible: false,
      // 查看点位图片数据
      screenImage: {},
      // 查看点位图片弹窗显隐控制
      showImageDialog: false,
      // 查看点位图片弹窗红框数据
      screenRects: [],
    };
  },
  created() {
    this.setTime();
    this.getSelect();
    this.getMapCare();
    this.getRoadList();
    this.getDieaseTypeList();
  },
  methods: {
    /* 获取当前时间 */
    setTime() {
      this.timeFlag = setInterval(() => {
        const weekMap = [
          "星期天",
          "星期一",
          "星期二",
          "星期三",
          "星期四",
          "星期五",
          "星期六",
        ];
        const date = new Date();
        const year = date.getFullYear();
        const month =
          date.getMonth() + 1 < 10
            ? `0${date.getMonth() + 1}`
            : date.getMonth() + 1;
        const day = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate();
        const hours =
          date.getHours() < 10 ? `0${date.getHours()}` : date.getHours();
        const minutes =
          date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes();
        const seconds =
          date.getSeconds() < 10 ? `0${date.getSeconds()}` : date.getSeconds();
        const week = date.getDay();
        // this.currentTime = `${year}-${month}-${day}\t\t${hours}:${minutes}:${seconds}\t\t${weekMap[week]}`;
        this.yearTime = `${year}.${month}.${day}`;
        this.weekTime = `${weekMap[week]}`;
        this.dataTime = `${hours}:${minutes}:${seconds}`;
      }, 1000);
    },

    /* 获取数据栏右上角选项数据 */
    getSelect() {
      selectTypeList().then(({ code, data }) => {
        if (code === 200) {
          this.selectTypeArr = data;
        }
      });
    },

    /* 获取路段下拉数据 */
    getRoadList() {
      getRoadListTypes().then(({ code, data }) => {
        if (code === 200) {
          this.roadList = data;
        }
      });
    },

    /* 获取图片背景左上角病害类型下拉 */
    getDieaseTypeList() {
      DefectType().then(({ code, data }) => {
        if (code === 200) {
          this.dieaseTypeList = data;
        }
      });
    },

    /* 获取图片背景下坐标数据 */
    getMapCare() {
      comppanyImg({ type: this.mapCareSelect }).then(({ code, data }) => {
        if (code === 200) {
          this.mapCareList = data;
        }
      });
    },

    /* 点击病害筛查 */
    clickImg() {
      this.imgVisible = true;
    },

    /* 关闭图片查看弹窗 */
    imgCancel() {
      this.imgVisible = false;
    },

    /* 关闭查看点位大图弹窗 */
    screenImgCancel() {
      this.showImageDialog = false;
    },

    /* 切换icon类型多选框事件 */
    handleChecked(value) {
      this.centerPiont = this.drawPointList.filter(
        (item) => value.indexOf(item.iconType) > -1
      );
      this.$nextTick(() => {
        const map = this.$refs.roadMap.instance.get("map");
        map.removeLayer(this.clusters);
        this.clusters = null;
        this.drawPoint();
      });
    },

    /* 获取地图点位信息 */
    getCenterPiont() {
      // 如果当前已经有打点坐标
      if (this.clusters) {
        this.$nextTick(() => {
          const map = this.$refs.roadMap.instance.get("map");
          map.removeLayer(this.clusters);
          this.clusters = null;
        });
      }
      mapPointList({
        type: this.bottomTipClick,
        segmentId: this.roadSelect,
      }).then(({ code, data }) => {
        if (code === 200) {
          this.drawPointList = data.map((item) => {
            if (item.geometry) {
              return {
                ...item,
                geometry: [item.geometry[0], item.geometry[1]],
              };
            }
            return [];
          });
          this.centerPiont = data.map((item) => {
            if (item.geometry) {
              return {
                ...item,
                geometry: [item.geometry[0], item.geometry[1]],
              };
            }
            return [];
          });
          this.drawPoint();
        }
      });
    },

    /* 绘制地图点位 */
    drawPoint() {
      const features = [];
      this.centerPiont.forEach((element) => {
        // 修改坐标样式
        const point = new Point(element.geometry);
        const feature = new Feature({
          geometry: point,
          data: {
            iconType: element.iconType,
            imageUrl: element.imageUrl,
            rect: element.rect,
          },
          // 自己设置一个标识
          type: "icon",
        });
        // 可以给点位设置样式
        // feature.setStyle([
        //   new Style({
        //     image: new Icon({
        //       crossOrigin: "anonymous",
        //       src: logo,
        //       // 图标缩放比例
        //       scale: 0.05,
        //     }),
        //   }),
        // ]);
        features.push(feature);
      });
      const clusterSource = new Cluster({
        distance: this.mapZoom > 15 ? 0 : 130,
        minDistance: this.mapZoom > 15 ? 0 : 130,
        source: new VectorSource({
          features,
        }),
        type: "Cluster",
      });
      this.clusters = new VectorLayer({
        source: clusterSource,
        name: "clusterLayer",
        zIndex: 10,
        style: (feature) => {
          const count = feature.get("features").length;
          if (count > 1) {
            return new Style({
              image: new Icon({
                crossOrigin: "anonymous",
                src: require(`@/assets/screen/index/龟裂.png`),
                // 图标缩放比例
                scale: 0.6,
                displacement: [0, 30],
                // 0.3为30度
                // rotation: 0.3,
              }),
              text: new Text({
                textAlign: "center", //位置
                textBaseline: "middle",
                font: "normal 14px 微软雅黑",
                offsetY: -50,
                fill: new Fill({
                  color: "#ffffff",
                }),
                text: count.toString(),
              }),
            });
          } else {
            return new Style({
              image: new Icon({
                crossOrigin: "anonymous",
                src: require(`@/assets/screen/index/${
                  this.mapLogeList[
                    feature.getProperties().features[0].get("data").iconType
                  ]
                }.png`),
                // 图标缩放比例
                scale: 0.6,
                displacement: [0, 30],
                // 0.3为30度
                // rotation: 0.3,
              }),
              text: new Text({
                textAlign: "center", //位置
                textBaseline: "middle",
                font: "normal 14px 微软雅黑",
                offsetY: -50,
                fill: new Fill({
                  color: "#ffffff",
                }),
                text: "",
              }),
            });
          }
        },
      });
      this.$nextTick(() => {
        const map = this.$refs.roadMap.instance.get("map");
        map.addLayer(this.clusters);
      });
    },

    /* 获取地图线段点位信息 */
    getLinePoint() {
      mapPciList({ zoom: this.mapZoom }).then(({ code, data }) => {
        if (code === 200) {
          this.lineString = data;
          this.drawLine();
        }
      });
    },

    /* 绘制地图线段 */
    drawLine() {
      const features = [];
      this.lineString.forEach((element) => {
        const lines = element?.coordinates?.split(";").map((it) => {
          return it.split(",").map(Number);
        });
        const line = new Feature({
          geometry: new geomExports.LineString(lines),
          type: "line",
        });
        line.setStyle([
          new Style({
            // 填充色
            fill: new Fill({
              color: "red",
            }),
            // 边线颜色
            stroke: new Stroke({
              color: "#0ABE67",
              width: 5,
            }),
            // 形状
            image: new Circle({
              radius: 17,
              fill: new Fill({
                color: "#ffffff",
              }),
            }),
          }),
        ]);
        features.push(line);
      });
      const lineSource = new VectorSource({
        features,
      });
      this.markLayerLines = new VectorLayer({
        source: lineSource,
        properties: {
          type: "line",
        },
      });
      this.$nextTick(() => {
        const map = this.$refs.roadMap.instance.get("map");
        map.addLayer(this.markLayerLines);
      });
    },

    /* 地图下方4图标类别切换点击事件 */
    changeIconType(value) {
      if (this.bottomTipClick !== value) {
        this.bottomTipClick = value;
      }
    },

    /* 获取icon多选数据 */
    getIconType(value) {
      this.mapLogeList = {};
      getItemTypes({ type: value }).then(({ code, data }) => {
        if (code === 200) {
          this.iconTypeList = data;
          this.iconType = data.map((item) => {
            return item.value;
          });
          data.forEach((item) => {
            this.mapLogeList[item.value] = item.label;
          });
        }
      });
    },

    /* 传回来的地图图层 */
    getZoom(zoom) {
      if (zoom === "11" && this.mapZoom !== zoom) {
        this.mapZoom = zoom;
        this.$nextTick(() => {
          const map = this.$refs.roadMap.instance.get("map");
          map.removeLayer(this.markLayerLines);
          this.markLayerLines = null;
        });
        this.getLinePoint();
      } else if (zoom === "10" && this.mapZoom !== zoom) {
        this.mapZoom = zoom;
        this.$nextTick(() => {
          const map = this.$refs.roadMap.instance.get("map");
          map.removeLayer(this.markLayerLines);
          this.markLayerLines = null;
        });
        this.getLinePoint();
      }
    },

    /* 地图缩放完成事件 */
    mapMoveend(zoom) {
      if (this.clusters && zoom * 1 > 15) {
        this.clusters.getSource().setDistance(0);
      } else if (this.clusters && zoom * 1 <= 15) {
        this.clusters.getSource().setDistance(130);
      }
    },

    /* 地图选中feature事件 */
    featureSelect(e) {
      const map = this.$refs.roadMap.instance.get("map");
      let selectedFeatures = e.selected;
      if (selectedFeatures.length > 0) {
        let feature = selectedFeatures[0];
        let features = feature.get("features");
        // 点击线段事件
        if (feature.getProperties().type === "line") {
          console.log(feature, "线段参数");
        } else {
          if (features.length === 1) {
            // 单个点位
            // 执行之前的业务逻辑
            // 获取点击的图层信息
            const selectFeature = feature.getProperties().features[0];
            console.log(selectFeature, "点位");
            // 获取点位数据
            this.screenImage = selectFeature.get("data");
            this.showImageDialog = true;
            console.log(selectFeature.get("data"));
          } else {
            // 聚合点
            // 放大地图层级
            map.getView().animate({
              center: feature.getGeometry().getCoordinates(),
              zoom: map.getView().getZoom() + 1,
            });
          }
        }
      }
    },

    /* 数据栏切换事件 */
    changeElement(item) {
      if (this.elementDiv !== item) {
        this.elementDiv = item.component;
        if (item.component === "OverviewScreen") {
          this.leftModuleList = [
            {
              width: "100%",
              height: "27%",
              title: "今日巡查",
              component: TodayInspection,
              selectIsShow: false,
              class: "one",
            },
            {
              width: "100%",
              height: "27%",
              title: "病害趋势",
              component: DiseaseTrends,
              selectIsShow: false,
              class: "twe",
            },
            {
              width: "100%",
              height: "29%",
              title: "病害统计",
              component: DiseaseCurrent,
              selectIsShow: true,
              select: "",
              class: "twe",
            },
          ];
          this.rightModuleList = [
            {
              width: "100%",
              height: "18%",
              title: "巡查里程",
              component: PatrolOrder,
              selectIsShow: false,
              class: "one",
            },
            {
              width: "100%",
              height: "65%",
              title: "巡检车辆",
              component: InspectionVehicles,
              selectIsShow: false,
              class: "twe",
            },
          ];
        } else if (item.component === "RoadScreen") {
          this.leftModuleList = [
            {
              width: "100%",
              height: "17%",
              title: "管养道路统计",
              component: ManageMaintain,
              selectIsShow: false,
              class: "one",
            },
            {
              width: "100%",
              height: "55%",
              title: "附属设施分布",
              component: AncillaryFacilities,
              selectIsShow: false,
              class: "twe",
            },
          ];
          this.rightModuleList = [
            {
              width: "100%",
              height: "29%",
              title: "附属设施异常统计",
              component: AnomalyFacilities,
              selectIsShow: true,
              select: "",
              class: "one",
            },
            {
              width: "100%",
              height: "57%",
              title: "路产统计",
              component: RoadStatistic,
              selectIsShow: true,
              select: "",
              class: "twe",
            },
          ];
        } else if (item.component === "DiseaseScreen") {
          this.leftModuleList = [
            {
              width: "100%",
              height: "27%",
              title: "今日巡查",
              component: TrafficSafety,
              selectIsShow: false,
              class: "one",
            },
            {
              width: "100%",
              height: "27%",
              title: "病害趋势",
              component: TrafficTrend,
              selectIsShow: true,
              class: "twe",
            },
            {
              width: "100%",
              height: "33%",
              title: "病害统计",
              component: TrafficStatistic,
              selectIsShow: true,
              select: "",
              class: "twe",
            },
          ];
          this.rightModuleList = [
            {
              width: "100%",
              height: "85%",
              title: "病害日志",
              component: TrafficLog,
              selectIsShow: false,
              select: "",
              class: "one",
            },
          ];
        }
      }
    },

    /* 跳转系统首页 */
    goIndex() {
      this.$router.push("/index");
    },

    /* 图片位置信息获取 */
    updateScreenRects() {
      1;
      this.screenRects = [];
      const image = this.$refs.mainImage;
      const rects = this.screenImage?.rect?.split(",").map(Number) || [];
      this.screenRects = [
        {
          left: rects[0],
          top: rects[1],
          width: rects[2],
          height: rects[3],
        },
      ];
    },

    /* 图片红框位置 */
    getScreenRectStyle({ left, top, width, height }) {
      const image = this.$refs.mainImage;
      const container = this.$refs.imageContainer;
      if (!image || !container) return {};

      const scaleX = container.clientWidth / image.naturalWidth;
      const scaleY = container.clientHeight / image.naturalHeight;
      const scale = Math.min(scaleX, scaleY);

      const renderedWidth = image.naturalWidth * scale;
      const renderedHeight = image.naturalHeight * scale;

      const offsetX = (container.clientWidth - renderedWidth) / 2;
      const offsetY = (container.clientHeight - renderedHeight) / 2;

      return {
        position: "absolute",
        left: `${left * scale + offsetX}px`,
        top: `${top * scale + offsetY}px`,
        width: `${width * scale}px`,
        height: `${height * scale}px`,
        border: "2px solid #FF0000",
        boxSizing: "border-box",
      };
    },
  },
  beforeDestroy() {
    clearInterval(this.timeFlag);
  },
};
</script>

<style lang="scss" scoped>
.screen-content {
  width: 100%;
  height: 100%;
}

// 中间样式
.screen-middle {
  width: 100%;
  height: 100%;

  .screen-left {
    width: 25.5%;
    height: calc(100% - 5rem);
    padding-left: 3.5rem;
    position: fixed;
    top: 5rem;
    z-index: 1;
    background-image: url("../../assets/screen/index/bg-left.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;

    ::v-deep .screen-checkBox {
      .el-radio-button__inner {
        background-color: transparent;
        padding: 0 0.3rem;
        border: none;
      }

      .el-radio-button__orig-radio:checked + .el-radio-button__inner {
        color: #1cb6ff;
      }
    }
  }

  .screen-right {
    width: 25.5%;
    height: calc(100% - 5rem);
    top: 5rem;
    padding-right: 3.5rem;
    position: fixed;
    right: 0;
    z-index: 1;
    background-image: url("../../assets/screen/index/bg-right.png");
    background-repeat: no-repeat;
    background-size: 100% 100%;

    ::v-deep .screen-checkBox {
      .el-radio-button__inner {
        background-color: transparent;
        padding: 0 0.3rem;
        border: none;
      }

      .el-radio-button__orig-radio:checked + .el-radio-button__inner {
        color: #1cb6ff;
      }
    }
  }

  .road-content {
    width: 100%;
    height: 100%;
    position: relative;

    // 图例
    .map-legend {
      height: 7rem;
      width: 2rem;
      position: absolute;
      top: 17%;
      left: 26%;
      z-index: 1;
      background-image: url("../../assets/screen/index/map-legend.png");
      background-repeat: no-repeat;
      background-size: 100% 100%;
    }

    // 右上角切换图标样式多选框
    .road-checkBox {
      width: 8rem;
      height: 10rem;
      position: absolute;
      right: 26%;
      top: 10%;
      padding: 0.4rem;
      border-radius: 0.4rem;
      border: 1px solid #193dae;
      background-color: #082843;
      z-index: 1;

      .road-scroll {
        overflow-x: hidden;
      }

      ::v-deep .el-checkbox__label {
        color: #9aadd8;
      }
    }

    // 图片背景样式
    .disease-content {
      width: 100%;
      height: 100%;
      background-image: url("../../assets/screen/index/map-liaoning.jpg");
      background-repeat: no-repeat;
      background-size: 100% 100%;
      position: relative;

      // 标题
      .disease-title {
        width: 20rem;
        height: 2.8rem;
        position: absolute;
        // top: 5rem;
        left: 50%;
        transform: translate(-50%, 5rem);
        background-image: url("../../assets/screen/index/disease-title.png");
        background-repeat: no-repeat;
        background-size: 100%;
      }

      // 筛选病害类型下拉
      .map-image-select {
        left: 28%;
        top: 10%;
        position: absolute;
        color: #ffffff;
      }

      // 打点部分
      .map-care {
        width: 48%;
        height: 73%;
        position: absolute;
        left: 26%;
        top: 13%;

        .map-care-div {
          height: 8.5rem;
          min-width: 3.5rem;
          display: flex;
          justify-content: center;
          line-height: 1.6rem;
          font-size: 0.7rem;
          color: #ffffff;
          position: absolute;
          background-repeat: no-repeat;
          background-size: 100% 100%;
          background-position: 50%;

          span {
            height: 1rem;
          }
        }

        .map-care-div-1 {
          background-image: url("../../assets/screen/index/map-care-div-1.png");
        }

        .map-care-div-2 {
          background-image: url("../../assets/screen/index/map-care-div-2.png");
        }

        .map-care-div-3 {
          background-image: url("../../assets/screen/index/map-care-div-3.png");
        }

        .map-care-div-4 {
          background-image: url("../../assets/screen/index/map-care-div-4.png");
        }

        .map-care-div-5 {
          background-image: url("../../assets/screen/index/map-care-div-5.png");
        }

        .map-care-div-6 {
          background-image: url("../../assets/screen/index/map-care-div-6.png");
        }
      }
    }

    ::v-deep .baseLayerClass {
      filter: grayscale(200%) invert(200%) sepia(50%) hue-rotate(175deg)
        brightness(80%) saturate(550%);
    }
  }
}

// 头部样式
.screen-header {
  width: 100%;
  height: 5rem;
  padding: 1rem 3rem;
  position: fixed;
  top: 0;
  display: flex;
  justify-content: space-between;
  z-index: 1;
  background-image: url("../../assets/screen/index/bg-top.png");
  background-repeat: no-repeat;
  background-size: 100% 120%;
  background-position-x: 50%;

  .header-weather {
    display: flex;
    align-items: flex-end;
    font-size: 1rem;
    color: #89c5e8;
  }

  .header-time {
    display: flex;
    color: #89c5e8;

    > div {
      margin: 0 0.5rem;
      display: flex;
      align-items: flex-end;
    }

    .header-data {
      font-size: 1.8rem;
    }

    .header-week {
      display: flex;
      align-items: flex-start;
      justify-content: flex-end;
      flex-direction: column;
    }

    .header-home {
      .home {
        cursor: pointer;
        height: 1.5rem;
        width: 1.2rem;
        background-image: url("../../assets/screen/index/exit.png");
        background-repeat: no-repeat;
        background-size: 100%;
      }
    }
  }
}

// 大屏下方样式
.screen-footer {
  width: 49%;
  height: 7.55rem;
  position: fixed;
  bottom: 0;
  left: 25.5%;
  background-image: url("../../assets/screen/index/bg-foot.png");
  background-repeat: no-repeat;
  background-size: 100.1% 99%;

  .footer-change-map {
    width: 100%;
    height: 40%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #8deeff;
    font-style: italic;
    font-size: 0.7rem;

    .change-map-div {
      cursor: pointer;
      margin: 0 2rem;
    }

    .change-map-click {
      color: #fffed2;
    }
  }

  .footer-change-vue {
    width: 100%;
    height: 60%;
    display: flex;
    justify-content: center;
    align-items: center;

    > div {
      height: 100%;
      width: 37.5%;
    }

    > div:nth-child(2) {
      height: 100%;
      width: 25%;
    }

    // 未点击样式
    .change-vue-OverviewScreen {
      background-image: url("../../assets//screen/index/button-overview.png");
      background-repeat: no-repeat;
      background-size: 95% 60%;
      background-position: 75% 15%;
    }

    .change-vue-click-OverviewScreen {
      background-image: url("../../assets//screen/index/button-overview-click.png");
      background-repeat: no-repeat;
      background-size: 95% 60%;
      background-position: 75% 15%;
    }

    .change-vue-DiseaseScreen {
      background-image: url("../../assets//screen/index/button-disease.png");
      background-repeat: no-repeat;
      background-size: 99% 60%;
      background-position: 50% 13%;
    }

    .change-vue-click-DiseaseScreen {
      background-image: url("../../assets//screen/index/button-disease-click.png");
      background-repeat: no-repeat;
      background-size: 99% 60%;
      background-position: 50% 13%;
    }

    .change-vue-RoadScreen {
      background-image: url("../../assets//screen/index/button-road.png");
      background-repeat: no-repeat;
      background-size: 93% 60%;
      background-position: 15% 15%;
    }
    .change-vue-click-RoadScreen {
      background-image: url("../../assets//screen/index/button-road-click.png");
      background-repeat: no-repeat;
      background-size: 93% 60%;
      background-position: 15% 15%;
    }

    // .change-vue-click {
    //   color: red;
    // }
  }
}

/* 修改弹窗样式 */
::v-deep .el-dialog__header {
  padding: 10px;
  background-color: #113463;

  span,
  i {
    color: #ffffff;
  }
}

::v-deep .el-dialog__body {
  padding: 0;
  background-color: #113463;

  /* 查看点位大图弹窗 */
  .view-image-container {
    position: relative;
    width: 100%;
    height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .view-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .rect-overlay {
    position: absolute;
    // pointer-events: none;
    border: 2px solid red;
  }
}

// 大屏下拉框样式
::v-deep .el-select {
  width: 6.5rem;

  .el-input .el-select__caret {
    line-height: 1.5rem;
  }

  .el-input--medium .el-input__inner {
    height: 1.5rem;
    background-color: transparent;
    color: #89c5e8;
    border-color: #6991cd;
  }

  .el-select-dropdown {
    background-color: #102649;
    border-color: #08204f;
    .el-scrollbar {
      .el-select-dropdown__wrap {
        .el-scrollbar__view {
          .el-select-dropdown__item {
            color: #aaabb8;
          }

          .el-select-dropdown__item:hover {
            background-color: #2b4c7e;
          }

          .el-select-dropdown__item.selected {
            background-color: #2b4c7e;
          }

          .el-select-dropdown__item.hover {
            background-color: #2b4c7e;
          }
        }

        .el-select-dropdown__list {
          background-color: #102649;
        }
      }
    }
  }
}
</style>