| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 | <template>  <div class="deviceWarn">    <div class="title-top" @click="getDetail">设备预警</div>    <div class="toggle-search">      <div class="status-yx">        <div class="now-name">          <i style="margin: 0px 5px 0px 5px">            <SvgIcon class="icon" size="14" name="internet-bad" />          </i>          <span style="color: #fff">{{nowStatus ? '报警信息' : '网络断开'}}</span>        </div>        <div class="now-status">{{ nowStatus ? nowStatus : 0}}</div>      </div>    </div>     <div class="warn-contents">      <div class="warn-box" v-for="(item, index) in warnList" :key="index">        <div class="warn-icon">          <img :src="item.icon" alt="" />        </div>        <div class="warn-text">          <div class="text-n">            {{ item.name }}          </div>        </div>        <div class="warn-val">          <div class="val-n"> {{ item.val }}</div>        </div>      </div>    </div>  </div></template><script lang="ts" setup>  import { ref, reactive, defineProps, watch } from 'vue';  import { SvgIcon } from '/@/components/Icon';  import { getAssetURL } from '/@/utils/ui';  let props = defineProps({    warnData: Array,  }); let nowStatus=ref<any>(0)  const options1 = reactive<any>([    {      value: '测试',      label: '测试',    },    {      value: '测试1',      label: '测试1',    },    {      value: '测试2',      label: '测试2',      disabled: true,    },  ]);  let warnList = reactive<any[]>([    { name: '报警', icon: getAssetURL('home-container/warn-icon.png'), val: 0 },    { name: '重大风险预警', icon: getAssetURL('home-container/warn-icon.png'), val: 0 },    { name: '较大风险预警', icon: getAssetURL('home-container/warn-icon1.png'), val: 0 },    { name: '一般风险预警', icon: getAssetURL('home-container/warn-icon2.png'), val: 0 },    { name: '低风险预警', icon: getAssetURL('home-container/warn-icon3.png'), val: 0 },  ]);  //跳转详情   function getDetail(){    console.log('跳转详情')  }  watch(    () => props.warnData,    (val) => {      console.log(val, '预警数据');      val.forEach(el=>{       nowStatus.value=el.netstatus.val        warnList[0].val=el.red.val       warnList[1].val=el.alarm.val       warnList[2].val=el.orange.val       warnList[3].val=el.yellow.val       warnList[4].val=el.blue.val      })    },    {      deep: true,    }  );</script><style lang="less" scoped>  @font-face {    font-family: 'douyuFont';    src: url('../../../../../assets/font/douyuFont.otf');  }  .deviceWarn {    width: 100%;    height: 100%;    position: relative;    .title-top {      position: absolute;      top: 9px;      left: 46px;      color: #fff;      font-size: 16px;      font-family: 'douyuFont';      cursor: pointer;      &:hover{        color: #66ffff;      }    }    .toggle-search {      position: absolute;      left: 9px;      top: 37px;      display: flex;      .status-yx {        height: 30px;        width: 180px;        background-color: rgba(8, 148, 255, 0.3);        border: 1px solid #1d80da;        display: flex;        justify-content: space-between;        align-items: center;        .now-status {          margin-right: 5px;          padding-top: 3px;          font-family: 'douyuFont';          color: #3df6ff;        }      }    }    .warn-contents {      position: absolute;      top: 66px;      left: 0;      height: calc(100% - 66px);      width: 100%;      padding: 20px 15px;      box-sizing: border-box;      display: flex;      flex-direction: column;      justify-content: space-between;      align-items: center;      .warn-box {        position: relative;        width: 396px;        height: 16px;        display: flex;        background: url('../../../../../assets/images/home-container/warn1.png') no-repeat;        .warn-icon {          position: absolute;          left: 10%;          top: -20px;          width: 44px;          height: 35px;          img {            width: 100%;            height: 100%;          }        }        .warn-text {          width: 168px;          height: 2px;          position: absolute;          left: 22%;          top: -2px;          background: url('../../../../../assets/images/home-container/warn7.png') no-repeat;          background-size: 100% 100%;          .text-n {            position: absolute;            left: 50%;            top: -10px;            transform: translate(-50%, 0);            color: #fff;          }        }        .warn-val {          position: absolute;          left: 66%;          top: -21px;          width: 94px;          height: 45px;          background: url('../../../../../assets/images/home-container/warn8.png') no-repeat;          .val-n {            position: absolute;            left: 50%;            top: 50%;            font-size: 14px;            font-family: 'douyuFont';            transform: translate(-50%, -52%);          }        }        &:nth-child(1) .val-n {          color: red;        }        &:nth-child(2) .val-n {          color: #f93825;        }        &:nth-child(3) .val-n {          color: #ff9b17;        }        &:nth-child(4) .val-n {          color: #ffff00;        }        &:nth-child(5) .val-n {          color: #31dbfd;        }      }    }  }  :deep .zxm-select-selector {    width: 100%;    height: 30px !important;    padding: 0 11px 0px 25px !important;    background-color: rgba(8, 148, 255, 0.3) !important;    border: 1px solid #1d80da !important;  }  :deep .zxm-select-selection-item {    color: #fff !important;    line-height: 28px !important;  }  :deep .zxm-select-arrow {    color: #fff !important;  }</style>
 |