<template>
  <div class="project-detail-wrapper">
    <div class="header">
      <span>{{ data.name }}</span>
      <div class="btns">
        <el-icon @click="handleClose">
          <Close />
        </el-icon>
      </div>
    </div>
    <div class="content">
      <el-tabs class="main-tabs" :tab-position="'left'" v-model="activeTab">
        <el-tab-pane label="基础信息" name="1" lazy>
          <BaseInfo ref="baseInfoRef" :resCode="resCode" @getResInfo="handleGetResInfo"></BaseInfo>
        </el-tab-pane>
        <el-tab-pane label="数据统计" name="2" lazy>
          <DataStatistics ref="dataStatisticsRef" :resCode="resCode"></DataStatistics>
        </el-tab-pane>
        <el-tab-pane label="监测预警" name="5" lazy>
          <MonitorWarning ref="monitorWarning" :resCode="resCode"></MonitorWarning>
        </el-tab-pane>
        <!-- <el-tab-pane label="视频分析" name="6" lazy>
          <VideoAnalysis ref="videoAnalysis" :resCode="resCode"></VideoAnalysis>
        </el-tab-pane> -->
      </el-tabs>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, defineOptions, defineEmits, defineProps, watch } from "vue";
import BaseInfo from "./components/BaseInfo.vue";
import DataStatistics from "./components/DataStatistics.vue";
import MonitorWarning from "./components/MonitorWarning.vue";
import { Close } from "@element-plus/icons-vue";
// import VideoAnalysis from "./components/VideoAnalysis.vue";
const props = defineProps({
  data: {
    type: Object,
    default: {},
  },
});
const resCode = ref("");
defineOptions({
  name: "ProjectDetail",
});
const emits = defineEmits(["getResInfo"]);
const activeTab = ref("1");
function handleGetResInfo(data: any) {
  emits("getResInfo", data);
}

function handleClose() {
  window.$bus.$emit("close-water-dialog");
}
watch(
  () => props.data,
  (val) => {
    if (val) {
      resCode.value = val.code;
    }
  },
  { immediate: true },
);
</script>
<style scoped lang="scss">
.project-detail-wrapper {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 80%;
  min-height: 600px;
  max-height: 800px;
  transform: translate(-50%, -50%);
  border-radius: 4px;
  background: #fff;
  .header {
    display: flex;
    padding: 0 20px;
    height: 42px;
    color: #262626;
    font-family: PingFang SC;
    font-size: 16px;
    font-weight: 500;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .content {
    height: 748px;
    :deep(.main-tabs) {
      height: 100%;
      .sy-tabs__content,
      .sy-tab-pane {
        height: 100%;
      }
    }
  }
}
</style>
