| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <!-- eslint-disable vue/multi-word-component-names -->
- <template>
- <div class="warning">
- <div class="warning-item" v-for="item in WARNING_CONFIG" :key="item.id" @click="$emit('click', item)">
- <div class="img"> <img :src="item.src" alt="" /> </div>
- <div class="text">{{ item.text }}</div>
- <div class="extra">监测数量</div>
- <div class="num" :class="`warning-level_${warnData.maxLevel}`">{{ warnData[item.prop] }}</div>
- <div class="risk" :class="`warning-level_${warnData.maxLevel}`">{{ warnData[item.prop2] }}</div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { shallowRef, onMounted } from 'vue';
- import { BillboardType, DEFAULT_TEST_DATA, WARNING_CONFIG } from '../billboard.data';
- import _ from 'lodash-es';
- const props = withDefaults(
- defineProps<{
- data?: BillboardType;
- }>(),
- {
- data: () => DEFAULT_TEST_DATA,
- }
- );
- defineEmits(['click']);
- const warnData = shallowRef<BillboardType['warningInfo']>({
- total: 5,
- vent: 1,
- ventRisk: '低风险',
- gas: 1,
- gasRisk: '低风险',
- dust: 1,
- dustRisk: '低风险',
- fire: 1,
- fireRisk: '低风险',
- safety: 1,
- safetyRisk: '低风险',
- maxLevel: 5,
- });
- function fetchData() {
- const info = props.data.warningInfo;
- if (!info) return;
- warnData.value = info;
- }
- onMounted(() => {
- fetchData();
- });
- </script>
- <style lang="less" scoped>
- @import '@/design/vent/color.less';
- @font-face {
- font-family: 'douyuFont';
- src: url(/@/assets/images/files/douyuFont.otf);
- }
- .warning {
- height: 100%;
- // display: flex;
- // justify-content: space-evenly;
- // align-items: center;
- // flex-wrap: wrap;
- }
- .warning-item:first-of-type {
- background-image: url(/@/assets/images/vent/home/select-bg.png);
- background-size: auto 100%;
- background-position: left center;
- padding-left: 60px;
- .text {
- width: 100px;
- text-align: left;
- }
- .risk {
- display: none;
- }
- .extra {
- display: none;
- }
- .num {
- text-align: right;
- flex-grow: 1;
- }
- // .warning-level_5 {
- // color: red;
- // }
- // .warning-level_4 {
- // color: orange;
- // }
- // .warning-level_3 {
- // color: yellow;
- // }
- // .warning-level_2 {
- // color: green;
- // }
- }
- .warning-item {
- display: flex;
- align-items: center;
- background-image: url(/@/assets/images/company/list-item-9.png);
- background-size: auto 80%;
- background-repeat: no-repeat;
- background-position: right center;
- height: 40px;
- margin-top: 10px;
- .text {
- text-align: center;
- width: 60px;
- }
- .extra {
- text-align: center;
- width: 100px;
- }
- .num {
- text-align: center;
- width: 100px;
- }
- .risk {
- text-align: right;
- width: 80px;
- }
- }
- .num {
- font-size: 20px;
- font-family: douyuFont;
- color: @vent-gas-primary-text;
- }
- .risk {
- font-size: 20px;
- font-family: douyuFont;
- color: @vent-gas-primary-text;
- }
- </style>
|