123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707 |
- <template>
- <customHeader :options="options" @change="getSelectRow" :optionValue="optionValue"> 粉尘监测预警 </customHeader>
- <div class="dustWarn">
- <div class="top-dust">
- <a-button preIcon="ant-design:rollback-outlined" type="text" size="small"
- style="position: absolute;left:15px;top:15px;color:
- <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="content-left">
- <div :class="activeIndex == index ? 'content-left-item' : 'content-left-item1'"
- v-for="(item, index) in topAreaList" :key="index" @click="topAreaClick(index)">
- <div class="content-title">{{ item.title }}</div>
- <div class="content-items" v-for="(ite, ind) in item.content" :key="ind">
- <span>{{ ite.label }}</span>
- <span style="color:#01fefc">{{ ite.value }}</span>
- </div>
- </div>
- </div>
- <div class="content-right">
- <div class="title-t">
- <div class="text-t">粉尘信息状态监测</div>
- </div>
- <div class="echart-boxd">
- <echartLine :echartDataGq="echartDataFc" :maxY="maxY" :echartDw="echartDw" :gridV="gridV" />
- </div>
- </div>
- </div>
- </div>
- <div class="bot-dust">
- <div class="bot-area">
- <div class="title-b">
- <div class="text-b">粉尘监控测点信息</div>
- </div>
- <div class="content-b">
- <div class="card-b" v-for="(item, index) in cardListTf" :key="index">
- <div class="item-l">
- <div class="label-l">{{ item.label }}</div>
- <div class="value-l">{{ item.value }}</div>
- </div>
- <div class="item-r">
- <div class="content-r" v-for="(items, ind) in item.listR" :key="ind">
- <span>{{ `${items.label} : ` }}</span>
- <span :class="{
- 'status-f': items.value == 1,
- 'status-l': items.value == 0,
- }">{{ items.value == 1 ? '异常' : items.value == 0 ? '正常' : `${items.value}${items.dw}`
- }}</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { ref, reactive, onMounted, onUnmounted } from 'vue'
- import { sysTypeWarnList, sysWarn, getDevice } 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: [],
- },
- minData: {
- lengedData: '预测值(mg/m³)',
- data: [],
- },
- aveValue: {
- lengedData: '最新值(mg/m³)',
- data: [],
- },
- xData: [],
- });
- let maxY = ref(0);
- let echartDw = ref('(mg/m³)');
- let gridV = reactive({
- top: '12%',
- left: '1%',
- bottom: '5%',
- right: '2%',
- containLabel: true,
- })
- let cardListTf = reactive<any[]>([])
- let router = useRouter()
- let echartDatas = ref<any[]>([])
- let echartDat = reactive<any[]>([])
- // 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')
- }
- //菜单选项切换
- function cardClick(ind, item) {
- activeIndex1.value = ind;
- clearTimeout(timer);
- getMonitor(item.deviceID, true);
- }
- function uniqueObjects(arr, key) {
- const unique = arr.map((e) => e[key])
- // 存储每个属性值
- .map((e, i, final) => final.indexOf(e) === i && i)
- // 移除重复值的索引
- .filter((e) => arr[e])
- // 映射到对应的对象
- .map((e) => arr[e]);
- return unique;
- }
- //顶部区域选项切换
- function topAreaClick(index) {
- activeIndex.value = index;
- echartDataFc.maxData.data.length = 0;
- echartDataFc.minData.data.length = 0;
- echartDataFc.aveValue.data.length = 0;
- echartDataFc.xData.length = 0;
- echartDat.length = 0
- echartDatas.value = JSON.parse(choiceData[index].readData.expectInfo)['list']
- echartDat.push({ id: '1', time: JSON.parse(choiceData[index].readData.expectInfo)['aveTime'], value: JSON.parse(choiceData[index].readData.expectInfo)['aveVal'] })
- echartDat.push({ id: '2', time: JSON.parse(choiceData[index].readData.expectInfo)['nowTime'], value: JSON.parse(choiceData[index].readData.expectInfo)['nowVal'] })
- let unique = uniqueObjects(echartDat, 'time');
- let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
- console.log(setData,'setData----------')
- setData.forEach((m, n) => {
- echartDataFc.xData.push(m.time);
- if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {
- echartDataFc.maxData.data.push(0);
- echartDataFc.minData.data.push(m.value);
- echartDataFc.aveValue.data.push(0);
- } else if (unique.filter(t => t.time == m.time).length != 0 && m.id == '2') {
- echartDataFc.maxData.data.push(0);
- echartDataFc.minData.data.push(0);
- echartDataFc.aveValue.data.push(m.value);
- } else {
- echartDataFc.maxData.data.push(m.value);
- echartDataFc.minData.data.push(0);
- echartDataFc.aveValue.data.push(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);
- }
- //获取左侧菜单列表
- 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.minData.data.length = 0;
- echartDataFc.aveValue.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]) {
- echartDatas.value = JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['list']
- echartDat.push({ id: '1', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveVal'] })
- echartDat.push({ id: '2', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowVal'] })
- let unique = uniqueObjects(echartDat, 'time');
- let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
- setData.forEach((m, n) => {
- echartDataFc.xData.push(m.time);
- if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {
- echartDataFc.maxData.data.push(0);
- echartDataFc.minData.data.push(m.value);
- echartDataFc.aveValue.data.push(0);
- } else if (unique.filter(t => t.time == m.time).length != 0 && m.id == '2') {
- echartDataFc.maxData.data.push(0);
- echartDataFc.minData.data.push(0);
- echartDataFc.aveValue.data.push(m.value);
- } else {
- echartDataFc.maxData.data.push(m.value);
- echartDataFc.minData.data.push(0);
- echartDataFc.aveValue.data.push(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);
- } else {
- activeIndex.value = 0;
- echartDatas.value = JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['list']
- echartDat.push({ id: '1', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['aveVal'] })
- echartDat.push({ id: '2', time: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowTime'], value: JSON.parse(choiceData[activeIndex.value].readData.expectInfo)['nowVal'] })
- let unique = uniqueObjects(echartDat, 'time');
- let setData = [...echartDatas.value, ...unique].sort((a,b)=>Date.parse(new Date(a.time)) - Date.parse(new Date(b.time)))
- setData.forEach((m, n) => {
- echartDataFc.xData.push(m.time);
- if (unique.filter(t => t.time == m.time).length != 0 && m.id == '1') {
- echartDataFc.maxData.data.push(0);
- echartDataFc.minData.data.push(m.value);
- echartDataFc.aveValue.data.push(0);
- } else if (unique.filter(t => t.time == m.time).length != 0 && m.id == '2') {
- echartDataFc.maxData.data.push(0);
- echartDataFc.minData.data.push(0);
- echartDataFc.aveValue.data.push(m.value);
- } else {
- echartDataFc.maxData.data.push(m.value);
- echartDataFc.minData.data.push(0);
- echartDataFc.aveValue.data.push(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);
- }
- }
- });
- }
- //获取粉尘监控测点信息
- async function getWindDeviceList() {
- cardListTf.length = 0
- let res = await getDevice({ devicetype: 'dusting', pagetype: 'normal' })
- if (res && res.msgTxt[0]) {
- let list = res.msgTxt[0].datalist || [];
- if (list.length > 0) {
- list.forEach((el: any) => {
- const readData = el.readData;
- el = Object.assign(el, readData);
- cardListTf.push({
- label: '通信状态',
- value: el.netStatus == '0' ? '断开' : '连接',
- listR: [
- { id: 0, label: '安装位置', dw: '', value: el.strinstallpos || '-' },
- { id: 1, label: '粉尘浓度', dw: '(mg/m³)', value: el.dustval || '-' },
- { id: 2, label: '巷道湿度', dw: el.humidity ? '(RH)' : '', value: el.humidity || '-' },
- { id: 4, label: '巷道温度', dw: el.humidity ? '(℃)' : '', value: el.temperature || '-' },
- { id: 3, label: '是否报警', dw: '', value: el.warnFlag == '0' ? '正常' : el.warnFlag == 1 ? '报警' : el.warnFlag == 2 ? '断开' : '未监测' },
- ],
- })
- });
- }
- }
- }
- onMounted(() => {
- getMenuList()
- getWindDeviceList()
- })
- 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;
- .top-dust {
- display: flex;
- justify-content: space-between;
- height: 50%;
- margin-bottom: 15px;
- background: url('../../../../../assets/images/fire/border.png') no-repeat center;
- background-size: 100% 100%;
- .alarm-menu {
- height: 100%;
- width: 15%;
- padding: 10px;
- box-sizing: border-box;
- .card-btn {
- width: 100%;
- height: 100%;
- overflow-y: auto;
- .btn {
- position: relative;
- width: 81%;
- height: 24%;
- margin-bottom: 6%;
- 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: 14px;
- color:
- text-align: center;
- transform: translate(-50%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- bottom: 11px;
- font-size: 12px;
- color:
- text-align: center;
- transform: translate(-50%, 0);
- }
- }
- .btn1 {
- position: relative;
- width: 100%;
- height: 24%;
- margin-bottom: 6%;
- 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: 14px;
- color:
- text-align: center;
- transform: translate(-62%, 0);
- }
- .warn {
- width: 100%;
- position: absolute;
- left: 50%;
- bottom: 11px;
- font-size: 14px;
- color:
- text-align: center;
- transform: translate(-60%, 0);
- }
- }
- }
- }
- .dust-content {
- display: flex;
- justify-content: space-between;
- height: 100%;
- width: 85%;
- padding: 10px 0px;
- box-sizing: border-box;
- .content-left {
- width: 280px;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- align-items: flex-start;
- overflow-y: auto;
- overflow-x: hidden;
- .content-left-item {
- position: relative;
- width: 272px;
- height: 173px;
- flex-shrink: 0;
- background: url('../../../../../assets/images/fire/dust-choice.png') no-repeat center;
- background-size: 100% 100%;
- margin: 5px 0px;
- .content-title {
- width: 85%;
- position: absolute;
- top: 2px;
- left: 50%;
- transform: translate(-55%, 0);
- font-size: 14px;
- color:
- text-align: center
- }
- .content-items {
- position: absolute;
- left: 50%;
- transform: translate(-54%, 0);
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 240px;
- height: 26px;
- color:
- font-size: 14px;
- padding: 0px 5px;
- box-sizing: border-box;
- background: url('../../../../../assets/images/fire/dust-content.png') no-repeat center;
- background-size: 100% 100%;
- &:nth-child(2) {
- top: 32px;
- }
- &:nth-child(3) {
- top: 67px;
- }
- &:nth-child(4) {
- top: 102px;
- }
- &:nth-child(5) {
- top: 136px;
- }
- }
- }
- .content-left-item1 {
- position: relative;
- width: 250px;
- height: 173px;
- flex-shrink: 0;
- background: url('../../../../../assets/images/fire/dust-choice1.png') no-repeat center;
- background-size: 100% 100%;
- margin: 5px 0px;
- .content-title {
- width: 85%;
- position: absolute;
- top: 2px;
- left: 50%;
- transform: translate(-50%, 0);
- font-size: 14px;
- color:
- text-align: center
- }
- .content-items {
- position: absolute;
- left: 50%;
- transform: translate(-54%, 0);
- display: flex;
- justify-content: space-between;
- align-items: center;
- width: 215px;
- height: 26px;
- color:
- font-size: 14px;
- padding: 0px 5px;
- box-sizing: border-box;
- background: url('../../../../../assets/images/fire/dust-content.png') no-repeat center;
- background-size: 100% 100%;
- &:nth-child(2) {
- top: 32px;
- }
- &:nth-child(3) {
- top: 67px;
- }
- &:nth-child(4) {
- top: 102px;
- }
- &:nth-child(5) {
- top: 136px;
- }
- }
- }
- }
- .content-right {
- width: calc(100% - 280px);
- height: 100%;
- .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:
- }
- }
- .echart-boxd {
- width: 100%;
- height: calc(100% - 40px);
- }
- }
- }
- }
- .bot-dust {
- height: calc(50% - 15px);
- background: url('../../../../../assets/images/fire/border.png') no-repeat center;
- background-size: 100% 100%;
- padding: 10px;
- box-sizing: border-box;
- .bot-area {
- height: 100%;
- padding: 10px;
- background: url('../../../../../assets/images/fire/bj1.png') no-repeat center;
- background-size: 100% 100%;
- box-sizing: border-box;
- .title-b {
- height: 30px;
- margin-bottom: 10px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .text-b {
- font-family: 'douyuFont';
- font-size: 14px;
- color:
- }
- }
- .content-b {
- height: calc(100% - 40px);
- display: flex;
- justify-content: flex-start;
- align-items: flex-start;
- flex-wrap: wrap;
- overflow-y: auto;
- .card-b {
- position: relative;
- width: 24%;
- height: 128px;
- margin: 0px 9px 10px 9px;
- background: url(/src/assets/images/fire/bot-area.png) no-repeat center;
- background-size: 100% 100%;
- .item-l {
- position: absolute;
- left: 32px;
- top: 50%;
- transform: translate(0, -50%);
- width: 89px;
- height: 98px;
- background: url('../../../../../assets/images/fire/bot-area1.png') no-repeat center;
- .label-l {
- width: 100%;
- position: absolute;
- top: 7px;
- color:
- font-size: 12px;
- text-align: center;
- }
- .value-l {
- width: 100%;
- position: absolute;
- top: 50px;
- font-family: 'douyuFont';
- font-size: 14px;
- color:
- text-align: center;
- }
- }
- .item-r {
- position: absolute;
- left: 132px;
- top: 50%;
- transform: translate(0, -50%);
- height: 128px;
- padding: 5px 0px;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- box-sizing: border-box;
- .content-r {
- display: flex;
- span {
- font-size: 14px;
- color:
- &:first-child {
- display: inline-block;
- width: 68px;
- }
- &:last-child {
- display: inline-block;
- width: calc(100% - 68px);
- color:
- overflow: hidden;
- white-space: nowrap;
- /* 不换行 */
- /* 超出部分隐藏 */
- text-overflow: ellipsis;
- /* 使用省略符号 */
- }
- }
- .status-f {
- color:
- }
- .status-l {
- color:
- }
- }
- }
- }
- }
- }
- }
- }
- </style>
|