<template>
  <div class="container">
    <div class="mask" @click="handleClose"></div>
    <div class="toilet">
      <!-- 名称区域 -->
      <div class="title" :title="currentToilet">{{ currentToilet }}</div>

      <!-- 信息盒子区域 -->
      <div class="info">
        <!-- 男厕区域 -->
        <div class="info_box">
          <img class="box_img" src="@/assets/images/41.png" />
          <div class="box_type">男厕</div>
          <div class="box_num">50/1020</div>
          <img class="box_line" src="@/assets/images/57.png" />
          <div class="box_msg">
            <div>入流量</div>
            <div>1015</div>
          </div>
          <div class="box_msg">
            <div>出流量</div>
            <div>1015</div>
          </div>
          <div class="box_msg">
            <div>驻留人数</div>
            <div>1015</div>
          </div>
        </div>

        <!-- 女厕区域 -->
        <div class="info_box">
          <img class="box_img" src="@/assets/images/42.png" />
          <div class="box_type">女厕</div>
          <div class="box_num">50/1020</div>
          <img class="box_line" src="@/assets/images/57.png" />
          <div class="box_msg">
            <div>入流量</div>
            <div>1015</div>
          </div>
          <div class="box_msg">
            <div>出流量</div>
            <div>1015</div>
          </div>
          <div class="box_msg">
            <div>驻留人数</div>
            <div>1015</div>
          </div>
        </div>

        <!-- 无障碍厕所区域 -->
        <div class="info_box">
          <img class="box_img" src="@/assets/images/43.png" />
          <div class="box_type">无障碍厕所</div>
          <div class="box_num">50/1020</div>
          <img class="box_line" src="@/assets/images/57.png" />
          <div class="box_msg">
            <div>入流量</div>
            <div>1015</div>
          </div>
          <div class="box_msg">
            <div>出流量</div>
            <div>1015</div>
          </div>
          <div class="box_msg">
            <div>驻留人数</div>
            <div>1015</div>
          </div>
        </div>
      </div>

      <!-- 关闭按钮区域 -->
      <div class="close" @click="handleClose"></div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";
// 引入厕所数据
import { toiletData } from "@/components/map/toiletData";

const $emit = defineEmits(["closeDialog"]);
const props = defineProps(["currentToilet"]);

// 厕所信息
const info = ref();

onMounted(() => {
  // 匹配出当前厕所的信息
  info.value = toiletData.find((ele: any) => ele.title === props.currentToilet);
  // console.log(info.value);
});

// 点击关闭按钮回调
const handleClose = () => {
  $emit("closeDialog", false);
};
</script>

<style lang="scss" scoped>
.container {
  z-index: 9999;
  position: absolute;
  top: -151px;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 7072px;
  height: 1872px;
  background-color: rgba($color: #000000, $alpha: 0.4);

  .mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 7072px;
    height: 1872px;
  }

  .toilet {
    position: relative;
    width: 668px;
    height: 401px;
    background-image: url(@/assets/images/56.png);
    background-size: 100% 100%;

    .title {
      margin-top: 3px;
      margin-left: 230px;
      padding: 0 20px;
      width: 224px;
      height: 46px;
      line-height: 46px;
      text-align: center;
      color: #ff8e3d;
      font-size: 24px;
      font-weight: bold;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .info {
      display: flex;
      justify-content: space-evenly;
      margin-top: 8px;
      margin-left: 37px;
      width: 604px;
      height: 307px;

      .info_box {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-top: 46px;
        width: 127px;
        font-size: 16px;
        color: #fff;

        .box_img {
          width: 46px;
          height: 46px;
        }

        .box_type {
          margin-top: 10px;
        }

        .box_num {
          margin-top: 10px;
        }

        .box_line {
          margin-top: 10px;
          width: 100%;
          height: 4px;
        }

        .box_msg {
          display: flex;
          justify-content: space-between;
          margin-top: 15px;
          width: 100%;
        }
      }
    }

    .close {
      position: absolute;
      top: 10px;
      right: 6px;
      width: 42px;
      height: 42px;
      cursor: pointer;
      background-image: url(@/assets/images/12.png);
      background-size: 100% 100%;
    }
  }
}
</style>
