| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448 |
- <template>
- <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 粉尘监测预警 </customHeader>
- <div class="dustWarn">
- <a-button preIcon="ant-design:rollback-outlined" type="text" size="small"
- style="position: absolute;left:15px;top:15px;color: #fff;" @click="getBack">返回</a-button>
- <div class="alarm-menu">
- <div class="card-btn">
- <div :class="activeIndex1 == ind ? 'btn1' : 'btn'" v-for="(item, ind) in menuList" :key="ind"
- @click="cardClick(ind, item)">
- <div class="text">{{ item.name }}</div>
- <div class="warn">{{ item.warn }}</div>
- </div>
- </div>
- </div>
- <div class="dust-content">
- <div class="top-area">
- <div :class="activeIndex == index ? 'top-box1' : 'top-box'" v-for="(item, index) in topAreaList"
- :key="index" @click="topAreaClick(index)">
- <div class="top-title">{{ item.title }}</div>
- <div class="top-content">
- <div class="content-item" v-for="(items, ind) in item.content" :key="ind">
- <span class="item-label">{{ items.label }}</span>
- <span class="item-value">{{ items.value }}</span>
- </div>
- </div>
- </div>
- </div>
- <div class="bot-area">
- <div class="title-t">
- <div class="text-t">粉尘信息状态监测</div>
- </div>
- <div class="echart-boxd">
- <echartLine :echartDataGq="echartDataFc" :maxY="maxY" :echartDw="echartDw" />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { ref, reactive, onMounted,onUnmounted } from 'vue'
- import { sysTypeWarnList, sysWarn } from '../common.api'
- import echartLine from '../common/echartLine.vue';
- import { useSystemSelect } from '/@/hooks/vent/useSystemSelect';
- import { useRouter } from 'vue-router';
- import CustomHeader from '/@/components/vent/customHeader.vue';
- const { options, optionValue, getSelectRow, getSysDataSource } = useSystemSelect('sys_surface_caimei'); // 参数为场景类型(设备类型管理中可以查询到)
- //左侧数据列表
- let menuList = reactive<any[]>([])
- //当前左侧激活菜单的索引
- let activeIndex1 = ref(0);
- //顶部区域激活选项
- let activeIndex = ref(0);
- //顶部区域数据
- let topAreaList = reactive<any[]>([]);
- let choiceData = reactive<any[]>([]);
- //粉尘图表数据
- let echartDataFc = reactive({
- maxData: {
- lengedData: '粉尘浓度(mg/m³)',
- data: [],
- },
- xData: [],
- });
- let maxY = ref(0);
- let echartDw = ref('(mg/m³)');
- let router = useRouter()
- // https获取监测数据
- let timer: null | NodeJS.Timeout = null;
- function getMonitor(deviceID, flag?) {
- timer = setTimeout(
- async () => {
- await getSysWarnList(deviceID, 'dust');
- if (timer) {
- timer = null;
- }
- getMonitor(deviceID);
- },
- flag ? 0 : 1000
- );
- }
- //返回首页
- function getBack() {
- router.push('/monitorChannel/monitor-alarm-home')
- }
- //获取左侧菜单列表
- async function getMenuList() {
- let res = await sysTypeWarnList({ type: 'dust' })
- if (res.length != 0) {
- menuList.length = 0
- res.forEach((el) => {
- menuList.push({
- name: el.systemname,
- warn: '低风险',
- deviceID: el.id,
- strtype: el.strtype,
- });
- });
- getMonitor(menuList[0].deviceID, true);
- }
- }
- //获取预警详情弹窗右侧数据
- function getSysWarnList(id, type) {
- sysWarn({ sysid: id, type: type }).then((res) => {
- // listData.common = res;
- topAreaList.length = 0;
- echartDataFc.maxData.data.length = 0;
- echartDataFc.xData.length = 0;
- if (JSON.stringify(res) != '{}') {
- res.dust.forEach((el) => {
- topAreaList.push({
- title: el.strinstallpos,
- content: [
- { ids: 0, label: '温度(°C)', value: el.readData.temperature || '--' },
- { ids: 1, label: '粉尘浓度(mg/m³)', value: el.readData.dustval || '--' },
- { ids: 2, label: '喷雾水压(MPa)', value: el.readData.waterPressure || '--' },
- { ids: 3, label: '喷雾状态', value: el.readData.atomizingState || '--' },
- ],
- });
- });
- choiceData = res.dust;
- if (choiceData[activeIndex.value]) {
- choiceData[activeIndex.value].history.forEach((el) => {
- echartDataFc.maxData.data.push(el.dustval);
- echartDataFc.xData.push(el.time);
- });
- let max1 = echartDataFc.maxData.data.reduce((acr, cur) => {
- return acr > cur ? acr : cur;
- });
- maxY.value = formatRoundNum(max1 * 1.5);
- } else {
- activeIndex.value = 0;
- choiceData[activeIndex.value].history.forEach((el) => {
- echartDataFc.maxData.data.push(el.dustval);
- echartDataFc.xData.push(el.time);
- });
- let max1 = echartDataFc.maxData.data.reduce((acr, cur) => {
- return acr > cur ? acr : cur;
- });
- maxY.value = formatRoundNum(max1 * 1.5);
- }
- }
- });
- }
- //菜单选项切换
- function cardClick(ind, item) {
- activeIndex1.value = ind;
- clearTimeout(timer);
- getMonitor(item.deviceID, true);
- }
- //顶部区域选项切换
- function topAreaClick(index) {
- activeIndex.value = index;
- echartDataFc.maxData.data.length = 0;
- echartDataFc.xData.length = 0;
- choiceData[index].history.forEach((el) => {
- echartDataFc.maxData.data.push(el.dustval);
- echartDataFc.xData.push(el.time);
- });
- }
- function formatRoundNum(num) {
- let interger = Math.ceil(num);
- let leng = String(interger).length;
- return Math.ceil(interger / Math.pow(10, leng - 1)) * Math.pow(10, leng - 1);
- }
- onMounted(() => {
- getMenuList()
- })
- onUnmounted(() => {
- if (timer) {
- clearTimeout(timer);
- timer = undefined;
- }
- });
- </script>
- <style lang="less" scoped>
- .dustWarn {
- width: 100%;
- height: 100%;
- padding: 80px 10px 15px 10px;
- box-sizing: border-box;
- display: flex;
- justify-content: space-between;
- .alarm-menu {
- height: 100%;
- width: 15%;
- .card-btn {
- width: 100%;
- height: 100%;
- overflow-y: auto;
- .btn {
- position: relative;
- width: 81%;
- height: 14%;
- margin-bottom: 10%;
- font-family: 'douyuFont';
- background: url('../../../../../assets/images/fire/no-choice.png') no-repeat;
- background-size: 100% 100%;
- cursor: pointer;
- .text {
- width: 80%;
- position: absolute;
- left: 50%;
- top: 28px;
- font-size: 16px;
- color: #01fefc;
- text-align: center;
- transform: translate(-50%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- bottom: 14px;
- font-size: 14px;
- color: #fff;
- text-align: center;
- transform: translate(-50%, 0);
- }
- }
- .btn1 {
- position: relative;
- width: 100%;
- height: 14%;
- margin-bottom: 10%;
- font-family: 'douyuFont';
- background: url('../../../../../assets/images/fire/choice.png') no-repeat;
- background-size: 100% 100%;
- cursor: pointer;
- .text {
- width: 80%;
- position: absolute;
- left: 50%;
- top: 28px;
- font-size: 16px;
- color: #01fefc;
- text-align: center;
- transform: translate(-62%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- bottom: 14px;
- font-size: 14px;
- color: #fff;
- text-align: center;
- transform: translate(-60%, 0);
- }
- }
- }
- }
- .dust-content {
- width: calc(85% - 10px);
- height: 100%;
- margin-left: 10px;
- padding: 15px;
- box-sizing: border-box;
- background: url('../../../../../assets/images/fire/border.png') no-repeat;
- background-size: 100% 100%;
- .top-area {
- width: 100%;
- height: 24%;
- display: flex;
- justify-content: flex-start;
- align-items: flex-end;
- margin-bottom: 10px;
- overflow-x: auto;
- transform: scaleY(-1);
- .top-box {
- position: relative;
- width: 474px;
- height: 88%;
- flex-shrink: 0;
- background: url('../../../../../assets/images/fire/fc-t.png') no-repeat center;
- background-size: 100% 100%;
- margin: 0px 20px;
- transform: scaleY(-1);
- .top-title {
- width: 80%;
- text-align: center;
- position: absolute;
- left: 50%;
- top: 8px;
- font-size: 14px;
- transform: translate(-50%, 0);
- color: #fff;
- }
- .top-content {
- position: absolute;
- top: 17%;
- left: 0;
- width: 100%;
- height: 83%;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- flex-wrap: wrap;
- cursor: pointer;
- .content-item {
- position: relative;
- width: 50%;
- height: 50%;
- background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
- background-size: 88% 50%;
- .item-label {
- position: absolute;
- left: 14%;
- top: 50%;
- transform: translate(0, -44%);
- font-size: 14px;
- color: #fff;
- // font-size: 12px;
- }
- .item-value {
- position: absolute;
- right: 14%;
- top: 50%;
- transform: translate(0, -38%);
- // font-size: 12px;
- font-size: 14px;
- font-family: 'douyuFont';
- color: #3df6ff;
- }
- }
- }
- }
- .top-box1 {
- position: relative;
- width: 474px;
- height: 100%;
- flex-shrink: 0;
- background: url('../../../../../assets/images/fire/fc-t1.png') no-repeat center;
- background-size: 100% 100%;
- margin: 0px 20px;
- transform: scaleY(-1);
- .top-title {
- width: 80%;
- text-align: center;
- position: absolute;
- left: 50%;
- top: 8px;
- font-size: 14px;
- transform: translate(-50%, 0);
- color: #fff;
- }
- .top-content {
- position: absolute;
- top: 17%;
- left: 0;
- width: 100%;
- height: 83%;
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- flex-wrap: wrap;
- padding-bottom: 20px;
- box-sizing: border-box;
- cursor: pointer;
- .content-item {
- position: relative;
- width: 50%;
- height: 50%;
- background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
- background-size: 88% 50%;
- .item-label {
- position: absolute;
- left: 14%;
- top: 50%;
- transform: translate(0, -44%);
- color: #fff;
- font-size: 14px;
- // font-size: 12px;
- }
- .item-value {
- position: absolute;
- right: 14%;
- top: 50%;
- transform: translate(0, -38%);
- // font-size: 12px;
- font-size: 14px;
- font-family: 'douyuFont';
- color: #3df6ff;
- }
- }
- }
- }
- }
- .bot-area {
- height: calc(76% - 10px);
- padding: 10px;
- background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
- background-size: 100% 100%;
- box-sizing: border-box;
- .title-t {
- height: 30px;
- margin-bottom: 10px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .text-t {
- font-family: 'douyuFont';
- font-size: 14px;
- color: #fff;
- }
- }
- .echart-boxd {
- width: 100%;
- height: calc(100% - 40px);
- }
- }
- }
- }
- </style>
|