Newer
Older
KaiFengPC / src / views / dataAnalysis / syntheticData / index.vue
@zhangdeliang zhangdeliang on 23 May 6 KB 初始化项目
<template>
  <!-- 综合监测分析 -->
  <div class="syntherticDataPage publicContainer">
    <!-- 头部 -->
    <div class="synHead">
      <div
        :class="['part', checkedKey == item.key ? 'changed' : '']"
        v-for="item in headArr"
        :key="item.key"
        @click="changeHeadData(item.key)"
      >
        <img :src="getImageUrl(item.imgUrl, 'images/monitor')" alt="" />
        <p>{{ item.name }}</p>
        <p class="value">{{ headerObj[item.key] }}</p>
      </div>
    </div>
    <div class="content">
      <!-- 左侧 -->
      <div class="synLeft">
        <EquipLeft :monitorTargetType="checkedKey" @getDialogData="getDialogData"></EquipLeft>
      </div>
      <!-- 右侧 -->
      <div class="synRight">
        <EquipRight></EquipRight>
      </div>
    </div>
    <!-- 弹窗 v-divDrag-->
    <div
      class="dialogDetail"
      v-divDrag="dialogType == 'dialogVideo' ? false : true"
      v-if="showDialogSelf"
      :style="{
        bottom: ifExpend ? '' : '20px',
        right: ifExpend ? '' : '20px',
        top: ifExpend ? '' : 'auto',
        left: ifExpend ? '' : 'auto',
        height: ifExpend ? '330px' : '40px',
      }"
    >
      <div class="dialogTitle">
        <p>{{ dialogName }}</p>
        <p>
          <el-icon title="收起" @click="dialogMinus"><Bottom /></el-icon>
          <el-icon title="展开" @click="dialogPlus"><Top /></el-icon>
          <el-icon title="关闭" @click="dialogClose"><Close /></el-icon>
        </p>
      </div>
      <div
        :class="['dialogCont', 'animate__animated', ifExpend ? 'animate__fadeInUp' : 'animate__fadeOutDown']"
        :style="{ height: ifExpend ? '280px' : '0px' }"
      >
        <!-- 数据状态- 故障及离线设备分析-->
        <EquipFault v-if="dialogType == 'dialogFault'" :stationRow="stationRow"></EquipFault>
        <!-- 数据状态- 数据异常分析-->
        <DataError v-if="dialogType == 'dialogSjyc'" :stationRow="stationRow"></DataError>
        <!-- 站点状态- 运维派单-->
        <EquipRepair v-if="dialogType == 'dialogOrder'" @closeRightLayer="dialogClose"></EquipRepair>
        <!-- 站点- 查看视频监控-->
        <EquipVideo v-if="dialogType == 'dialogVideo'"></EquipVideo>
      </div>
    </div>
  </div>
</template>
<script setup name="syntherticDataPage">
import { getSiteInfoCountZH } from '@/api/dataAnalysis/syntherticData';
import EquipLeft from './equipLeft.vue'; //左侧内容
import EquipRight from './equipRight.vue'; //右侧内容

import EquipFault from './equipFault.vue'; //数据状态- 故障及离线设备分析
import DataError from './dataError.vue'; //数据状态- 数据异常分析
import EquipRepair from './equipRepair.vue'; //站点状态- 运维派单
import EquipVideo from './equipVideo.vue'; //站点- 查看视频监控

const { proxy } = getCurrentInstance();

// 变量声明
const headArr = reactive([
  { name: '全部', value: '', imgUrl: 'all_icon.png', key: 'total' },
  { name: '源头地块', value: '', imgUrl: 'land_icon.png', key: 'typical_land' },
  { name: '雨量', value: '', imgUrl: 'gqjc_icon.png', key: 'rainfall' },
  { name: '管网', value: '', imgUrl: 'line_icon.png', key: 'pipeline' },
  { name: '内涝点', value: '', imgUrl: 'lake_icon.png', key: 'waterlogging' },
  { name: '排口', value: '', imgUrl: 'gqjc_icon.png', key: 'drain_outlet' },
  { name: '河道', value: '', imgUrl: 'river_icon.png', key: 'river' },
]);
const headerObj = ref({});
const checkedKey = ref('total');
const showDialogSelf = ref(false); //弹窗显示隐藏
const ifExpend = ref(true); //弹窗是否放大缩小
const dialogName = ref(''); //弹窗标题
const dialogType = ref(''); //弹窗具体显示内容
const stationRow = ref({}); //弹窗具体参数
// 方法
function changeHeadData(key) {
  checkedKey.value = key;
}
// 获取不同监测类型对应数量
const getStationCount = async () => {
  let res = await getSiteInfoCountZH();
  if (res && res.code == 200) {
    headerObj.value = res.data;
  }
};
// 缩小
function dialogMinus() {
  ifExpend.value = false;
  // 海康视频打开时要隐藏
  if (window.videoWebControl != null) {
    window.videoWebControl.JS_HideWnd();
  }
}
// 放大
function dialogPlus() {
  ifExpend.value = true;
  // 海康视频打开时要显示
  if (window.videoWebControl != null) {
    window.videoWebControl.JS_ShowWnd();
  }
}
// 关闭
function dialogClose() {
  showDialogSelf.value = false;
}
// 左侧列表点击弹窗,获取子组件传值
function getDialogData(param) {
  // console.log('接收子组件传值--', showDialogSelf.value);
  dialogName.value = param.name;
  dialogType.value = param.type;
  stationRow.value = param.obj;
  ifExpend.value = true;
  // 左侧列表,其他站点点击时也加载对应内容
  if (showDialogSelf.value) {
    showDialogSelf.value = false;
  }
  setTimeout(() => {
    showDialogSelf.value = true;
  });
}

// 初始化
onMounted(() => {
  getStationCount(); //获取不同监测类型对应数量
  changeHeadData(checkedKey.value); //默认显示全部
});
// 页面销毁
onBeforeUnmount(() => {
  localStorage.removeItem('searchDateRangeEquip');
});
</script>
<style lang="scss" scoped>
@import '@/assets/styles/variables.module.scss';
.syntherticDataPage {
  width: 100%;
  height: calc(100vh - 84px);
  position: relative;
  .synHead {
    width: 100%;
    background: $mainColor1;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 10px 0px;
    margin-top: -10px;
    .part {
      line-height: 25px;
      display: flex;
      align-items: center;
      cursor: pointer;
      height: 40px;
      padding: 5px 8px;
      img {
        margin-right: 6px;
      }
      .value {
        color: #8a969d;
      }
      &:hover {
        background: $mainBg;
      }
    }
    .changed {
      background: $mainBg;
      border: 1px solid $mainColor2;
      border-radius: 2px;
      animation-duration: 1s;
    }
  }
  .content {
    display: flex;
    margin-top: 10px;
    height: 96%;
    .synLeft {
      width: 320px;
      background: $mainColor1;
    }
    .synRight {
      flex: 1;
      margin-left: 10px;
      width: 100%;
      overflow-x: auto;
    }
  }
  .dialogDetail {
    position: absolute;
    z-index: 999;
    right: 20px;
    bottom: 10px;
    background: $mainColor2;
    box-shadow: 0px 2px 26px 0px rgba(28, 52, 92, 0.3);
    width: 900px;
    border-radius: 8px;
    .dialogTitle {
      width: 100%;
      height: 50px;
      line-height: 50px;
      background: $mainColor2;
      border-bottom: 1px solid $mainBg;
      color: #fff;
      border-radius: 8px 8px 0 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 15px;
      p {
        font-size: 17px;
      }
      .el-icon {
        font-size: 30px;
        cursor: pointer;
        margin-top: 20px;
        margin-left: 15px;
        &:hover {
          transform: scale(1.05);
        }
      }
    }
    .dialogCont {
      overflow: auto;
      padding: 10px;
    }
  }
}
</style>