32、使用滚动组件-下

40 阅读1分钟

c33.png

<template>
  <div
    class="dvm-doc-pd-alarm-detail"

    @click="clickMe"
  >
    <div style="overflow: hidden; height: 164px; position: relative">
      <AutoScorll :datas="datas" v-if="datas.length > 0">
        <template v-slot:default="item">
          <div
            class="dvm-doc-pd-alarm-detail-card"
            :class="bgEnums[item.scorllItem.alarmType]"
            @click="jump(item.scorllItem)"
          >
            <div>
              <span class="dvm-doc-pd-alarm-detail-card-name">{{
                item.scorllItem.name
              }}</span>
              <span class="dvm-doc-pd-alarm-detail-card-time">{{
                item.scorllItem.alertTime
              }}</span>
            </div>
            <div>
              <label class="dvm-doc-pd-alarm-detail-card-label"
                >所属节点:</label
              >
              <span class="dvm-doc-pd-alarm-detail-card-position">{{
                item.scorllItem.position
              }}</span>
              <span
                class="dvm-doc-pd-alarm-detail-card-alarm-type"
                :style="'color: ' + colorEnums[item.scorllItem.alarmType]"
                >{{ alarmTypeEnum[item.scorllItem.alarmType] }}</span
              >
            </div>
          </div>
        </template>
      </AutoScorll>
      <div v-else class="dvm-doc-pd-alarm-detail-nodata">
        暂无事件
      </div>
    </div>
    <slot></slot>
  </div>
</template>

<script>
import dataset from "./index";
import AutoScorll from "./autoScorll.vue";
export default {
  name: dataset.element,
  mixin: [],
  components: {
    AutoScorll,
  },
  props: {
    datasetdata: {
      type: Object,
    },
    wallData: {
      type: Object,
    },
  },
  data() {
    return {
      bgEnums: ["pressing", "serious", "normal", "normal", "unknow"],
      colorEnums: ["#c94f5a", "#821e2d", "#e0be58", "#e0be58", "#3f5563"],
      alarmTypeEnum: ["紧急事件", "严重事件", "一般事件", "预警事件", "未知事件"],
      intv: null,
      datas: [],
    };
  },
  computed: {
   
  },
  mounted() {
    this.eventBus.$on("pd/allDataChange", ({ alarmDetailData }) => {
      this.dealData(alarmDetailData);
    });
  },
  watch: {
  },
  methods: {
    dealData(alarmDetailData) {
      console.log('事件详情',alarmDetailData);
      
      this.datas = alarmDetailData;
    },
    /**
     * 点击事件处理
     */
    clickMe() {
      console.log("click");
    },
    jump(row) {
      if (localStorage.getItem("clientType") !== "1") {
        let obj = {
          menuCode: "EVOISMS_001",
          otherParam: JSON.stringify({
            subMenuIndex: 3,
            ...row,
          }),
        };
        // return nofifyClient("OpenModule", JSON.stringify(obj));
        console.log("跳转到事件管理", JSON.stringify(obj));
        window.ocxEvent.ocxMain("OpenModule", JSON.stringify(obj));
      }
    },
  },
};
</script>

<style scoped lang="less">
.dvm-doc-pd-alarm-detail {
  width: 100%;
  padding-top: 40px;
  height: 100%;
  background-image: url(./assets/bg.png);
  background-size: 100% 100%;
  &-nodata {
    background-image: url(./assets/noAlarm.png);
    height: 100%;
    width: 100%;
    background-repeat: no-repeat;
    background-position: top;
    color: #81c3fd;
    line-height: 250px;
  }
  &-card {
    width: 461px;
    height: 68px;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    margin-bottom: 15px;
    text-align: left;
    padding-left: 64px;
    padding-right: 10px;
    margin-left: 20px;
    z-index: 999;
    cursor: pointer;
    &-name {
      font-family: AdobeHeitiStd-Regular;
      font-size: 16px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 30px;
      letter-spacing: 0px;
      color: #ffffff;
      text-shadow: 0 0 10px #ffffff;
      display: inline-block;
    }
    &-time {
      //   display: inline-block;
      float: right;
      color: #e5fffb;
      font-family: DINPro-Regular;
      font-size: 12px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 30px;
      letter-spacing: 0px;
      opacity: 0.6;
    }
    &-position {
      display: inline-block;
      color: #e5fffb;
      font-family: AdobeHeitiStd-Regular;
      font-size: 16px;
      font-weight: normal;
      letter-spacing: 0px;
    }
    &-alarm-type {
      //   display: inline-block;
      float: right;
      font-family: AdobeHeitiStd-Regular;
      font-size: 14px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 42px;
      letter-spacing: 0px;
    }
    &-label {
      font-size: 14px;
      font-weight: normal;
      font-stretch: normal;
      line-height: 30px;
      letter-spacing: 0px;
      color: #84a9c3;
      display: inline-block;
      font-family: MicrosoftYaHei;
    }
    &.unknow {
      background-image: url(./assets/gray.png);
    }
    &.normal {
      background-image: url(./assets/yellow.png);
    }
    &.pressing {
      background-image: url(./assets/red.png);
    }
    &.serious {
      background-image: url(./assets/bigRed.png);
    }
     & > div {
      line-height: 32px;
    }
  }
}
</style>