123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510 |
- <template>
- <view class="container">
- <u-navbar :title="titleName" :safeAreaInsetTop="true" left-icon="" @leftClick="menuShow">
- <view class="u-nav-slot" slot="left" v-if="!isShowDetail">
- <u-icon name="list" size="20"> </u-icon>
- </view>
- </u-navbar>
-
- <view class="main" v-if="isShowDetail">
- <view class="flcard" v-if="isShow1">
- <view class="typeBar">
- <view class="icon-vent">
- <text class="text-style">通风监测预警</text>
- <u-icon name="eye" @click="getDetail('vent')"></u-icon>
- </view>
- <u-icon @click="toggleIsShow1" name="arrow-up"></u-icon>
- </view>
- </view>
- <view class="flcard" v-else>
- <view class="typeBar">
- <text class="text-style">通风监测预警</text>
- <u-icon @click="toggleIsShow1" name="arrow-down"></u-icon>
- </view>
- </view>
- <view class="flcard" v-show="isShow1">
- <view class="datacard demo-layout bg-purple-light">
- <view style="margin-top: 10rpx">
- <text class="text-style1">{{ windData.zongjinfeng }}</text>
- </view>
- <view style="margin-top: 10rpx">总进风量(m³/min):</view>
- </view>
- <view class="datacard demo-layout bg-purple-light">
- <view style="margin-top: 10rpx">
- <text class="text-style1">{{ windData.zonghuifeng }}</text>
- </view>
- <view style="margin-top: 10rpx">总回风量(m³/min):</view>
- </view>
- <view class="datacard demo-layout bg-purple-light">
- <view style="margin-top: 10rpx">
- <text class="text-style1">{{ xufengliang }}</text>
- </view>
- <view style="margin-top: 10rpx">总需风量(m³/min):</view>
- </view>
- </view>
- <view class="flcard" v-if="isShow2">
- <view class="typeBar">
- <view class="icon-vent">
- <text class="text-style">火灾监测预警</text>
- <u-icon name="eye" @click="getDetail('fire')"></u-icon>
- </view>
- <u-icon @click="toggleIsShow2" name="arrow-up"></u-icon>
- </view>
- </view>
- <view class="flcard" v-else>
- <view class="typeBar">
- <text class="text-style">火灾监测预警</text>
- <u-icon @click="toggleIsShow2" name="arrow-down"></u-icon>
- </view>
- </view>
- <view class="flcard" v-show="isShow2">
- <view class="firecontainer">
- <view class="title">
- <span class="firetext">内因火灾</span>
- </view>
- <view class="firecard fire-style">
- <view v-for="(item, index) in internalInfo" :key="index" class="fire-item"
- v-if="item && Object.keys(item).length > 0">
- <view style="margin-top: 20rpx">
- <text :class="item.Maxlevel > 0 ? 'red-text-style' : 'text-style1'">{{ item.value }}</text>
- <view style="margin-top: 10rpx">{{ item.name }}</view>
- </view>
- </view>
- </view>
- </view>
- <view class="firecontainer">
- <view class="title">
- <span class="firetext">外因火灾</span>
- </view>
- <view class="firecard fire-style">
- <view v-for="(item, index) in externalInfo" :key="index" class="fire-item">
- <view style="margin-top: 20rpx">
- <text :class="item.Maxlevel > 0 ? 'red-text-style' : 'text-style1'">{{ item.value }}</text>
- <view style="margin-top: 10rpx">{{ item.name }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="flcard" v-if="isShow3">
- <view class="typeBar">
- <view class="icon-vent">
- <text class="text-style">粉尘监测预警</text>
- <u-icon name="eye" @click="getDetail('dust')"></u-icon>
- </view>
- <u-icon @click="toggleIsShow3" name="arrow-up"></u-icon>
- </view>
- </view>
- <view class="flcard" v-else>
- <view class="typeBar">
- <text class="text-style">粉尘监测预警</text>
- <u-icon @click="toggleIsShow3" name="arrow-down"></u-icon>
- </view>
- </view>
- <view class="flcard" v-show="isShow3">
- <view class="firecard fire-style">
- <view v-for="(value, key) in dustData" :key="key" class="fire-item">
- <view style="margin-top: 20rpx">
- <image src="/static/warndata/alarm.svg" class="icon-style"
- :style="{ backgroundColor: key === 'alarm' ? 'red' : key }"></image>
- <span style="margin-top: 10rpx">
- {{ dustMap[key] }} :{{ value }}</span>
- </view>
- </view>
- </view>
- </view>
- <view class="flcard" v-if="isShow4">
- <view class="typeBar">
- <view class="icon-vent">
- <text class="text-style">瓦斯监测预警</text>
- <u-icon name="eye" @click="getDetail('gas')"></u-icon>
- </view>
- <u-icon @click="toggleIsShow4" name="arrow-up"></u-icon>
- </view>
- </view>
- <view class="flcard" v-else>
- <view class="typeBar">
- <text class="text-style">瓦斯监测预警</text>
- <u-icon @click="toggleIsShow4" name="arrow-down"></u-icon>
- </view>
- </view>
- <view class="flcard" v-show="isShow4">
- <view class="firecontainer">
- <view class="title">
- <span class="firetext" v-if="gasDevice.length > 0">安全监测系统监测点</span>
- </view>
- <view class="gascard" v-for="(item, index) in gasDevice">
- <view style="margin-top: 20rpx">
- <text class="text-style1">{{ item.gasNumber }}</text>
- <view style="margin: 10rpx">{{ item.systemname }}</view>
- </view>
- </view>
- </view>
- <view class="firecontainer">
- <view class="title">
- <span class="firetext" v-if="gasDevice.length > 0">瓦斯抽采系统监测点</span>
- </view>
- <view class="gascontainer">
- <view class="gascard" v-for="(item, index) in gasDevice">
- <view style="margin-top: 20rpx">
- <text class="text-style1">{{ item.pumpNumber }}</text>
- <view style="margin: 10rpx">{{ item.systemname }}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="flcard" v-if="isShow5">
- <view class="typeBar">
- <view class="icon-vent">
- <text class="text-style">设备监测预警</text>
- <u-icon name="eye" @click="getDetail('device')"></u-icon>
- </view>
- <u-icon @click="toggleIsShow5" name="arrow-up"></u-icon>
- </view>
- </view>
- <view class="flcard" v-else>
- <view class="typeBar">
- <text class="text-style">设备监测预警</text>
- <u-icon @click="toggleIsShow5" name="arrow-down"></u-icon>
- </view>
- </view>
- <view class="flcard demo-layout bg-purple-light" v-show="isShow5">
- <view class="deviceCard">
- <view class="item-container" v-for="(item, index) in devicekindData" :key="index"
- :style="{ backgroundImage: itemBackground(item) }">
- <view class="item">
- <text style="margin-right: 10px">{{ item.name }}</text>
- <text>{{ item.status }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="main" v-else>
- <component :is="detailComponent"></component>
- </view>
- </view>
- </template>
- <script>
- import api from "@/api/api";
- import ventDetail from './components/vent-detail.vue'
- import deviceDetail from './components/device-detail.vue'
- import fireDetail from './components/fire-detail.vue'
- import dustDetail from './components/dust-detail.vue'
- import gasDetail from './components/gas-detail.vue'
- export default {
- props: {},
- watch: {},
- data() {
- return {
- titleName:'预警分析',
- isShowDetail: true,
- detailComponent: '',
- windData: {},
- devicekindData: [],
- fireData: [],
- gasData: [],
- dustData: [],
- gasDevice: [],
- externalInfo: [],
- internalInfo: [],
- xufengliang: "", //总需风量
- imageMap: {
- atomizing: "atomizing.png",
- ballvalve: "ballvalve.png",
- dedustefan: "dedustefan.png",
- drilling: "drilling.png",
- dustdev: "dustdev.png",
- fanlocal: "fanlocal.png",
- fanmain: "fanmain.png",
- forcFan: "forcFan.png",
- gasmonitor: "gasmonitor.png",
- gate: "gate.png",
- location: "location.png",
- nitrogen: "nitrogen.png",
- pulping: "pulping.png",
- pump: "pump.png",
- rebroadcast: "rebroadcast.png",
- safetymonitor: "safetymonitor.png",
- spary: "spary.png",
- unit: "unit.png",
- window: "window.png",
- windrect: "windrect.png",
- wintest: "wintest.png",
- },
- dustMap: {
- alarm: "报警",
- blue: "低风险",
- orange: "重大风险",
- red: "较大风险",
- yellow: "一般风险",
- },
- isShow1: true,
- isShow2: true,
- isShow3: false,
- isShow4: false,
- isShow5: false,
- };
- },
- mounted() {
- this.getWranInfo();
- },
- methods: {
-
- //获取预警信息
- getWranInfo() {
- new Promise((resolve, reject) => {
- api
- .getWarnInfo()
- .then((response) => {
- if (response.data.code == 200) {
- this.windData = response.data.result.ventInfo;
- this.devicekindData = response.data.result.info.devicekindInfo;
- this.fireData = response.data.result.info.sysInfo.fireS;
- this.externalInfo = this.fireData.summaryInfo.external;
- this.internalInfo = this.fireData.summaryInfo.internal;
- this.gasData = response.data.result.info.sysInfo.gasS;
- this.gasDevice = this.gasData.devices;
- this.xufengliang = this.windData.sysdata.xufengliang;
- this.dustData = response.data.result.info.sysInfo.dustS.levels;
- } else {
- reject(response);
- }
- })
- .catch((error) => {
- console.log("catch===>response", response);
- reject(error);
- });
- });
- },
- //返回监测首页
- menuShow() {
- this.isShowDetail = true
- },
- //跳转监测详情
- getDetail(data) {
- this.isShowDetail = false
- switch (data) {
- case 'vent':
- this.titleName='通风监测预警'
- this.detailComponent = ventDetail
- break;
- case 'device':
- this.titleName='设备监测预警'
- this.detailComponent = deviceDetail
- break;
- case 'fire':
- this.titleName='火灾监测预警'
- this.detailComponent = fireDetail
- break;
- case 'dust':
- this.titleName='粉尘监测预警'
- this.detailComponent = dustDetail
- break;
- case 'gas':
- this.titleName='瓦斯监测预警'
- this.detailComponent = gasDetail
- break;
- }
- },
- toggleIsShow1() {
- this.isShow1 = !this.isShow1; // 切换 isShow 的值
- },
- toggleIsShow2() {
- this.isShow2 = !this.isShow2; // 切换 isShow 的值
- },
- toggleIsShow3() {
- this.isShow3 = !this.isShow3; // 切换 isShow 的值
- },
- toggleIsShow4() {
- this.isShow4 = !this.isShow4; // 切换 isShow 的值
- },
- toggleIsShow5() {
- this.isShow5 = !this.isShow5; // 切换 isShow 的值
- },
- },
- computed: {
- itemBackground() {
- return (item) => {
- const defaultImage = "unit.png";
- const imageName = this.imageMap[item.code] || defaultImage;
- return `url('/static/warndata/${imageName}')`;
- };
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .container {
- display: flex;
- flex-direction: column;
- }
- .main {
- // margin-top: 100rpx;
- display: flex;
- flex-direction: column;
- flex: 1;
- width: 100%;
- margin-top: 45px;
- /* 内容区域顶部留出导航栏的高度 */
- }
- .text-style {
- font-weight: bold;
- }
- .flcard {
- padding: 20rpx;
- background-color: #ffffff;
- margin-bottom: 5rpx;
- }
- .datacard {
- width: 32.5%;
- margin: 1px;
- float: left;
- height: 100rpx;
- text-align: center;
- border-radius: 10px;
- background: url(/static/model/windM3.png),
- linear-gradient(to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08));
- }
- .datacard1 {
- width: 100%;
- margin: 2px;
- float: left;
- height: 200rpx;
- text-align: center;
- border-radius: 10px;
- background: linear-gradient(to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08));
- }
- .title {
- position: relative;
- width: 100%;
- height: 50rpx;
- background: url(/static/warndata/title.png);
- background-repeat: no-repeat;
- background-size: 100% 100%;
- display: flex;
- /* 将父级元素设置为 Flex 容器 */
- align-items: center;
- /* 垂直居中子元素 */
- }
- .firecard {
- width: 100%;
- margin: 1px;
- float: left;
- text-align: center;
- border-radius: 10px;
- margin-top: 10px;
- background: linear-gradient(to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08));
- background-repeat: repeat;
- }
- .deviceCard {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- margin-top: 10rpx;
- }
- .item-container {
- height: 100px;
- /* 设置容器高度,根据需要进行调整 */
- background-size: 100% 60%;
- /* 设置背景图片尺寸,根据需要进行调整 */
- background-repeat: no-repeat;
- /* 设置背景图片不重复,根据需要进行调整 */
- }
- .item {
- margin-left: 70px;
- margin-top: 36px;
- }
- .firetext {
- margin: 20px;
- }
- .text-style1 {
- color: #3787fe;
- font-weight: bold;
- font-size: large;
- }
- .red-text-style1 {
- color: #ff0000;
- font-weight: bold;
- font-size: large;
- }
- .firecontainer {
- margin-top: 10px;
- }
- .fire-style {
- display: flex;
- flex-wrap: wrap;
- }
- .fire-item {
- width: calc(33.33% - 20px);
- margin: 16rpx;
- box-sizing: border-box;
- }
- .gascontainer {
- display: flex;
- }
- .gascard {
- width: calc(33.33% - 20px);
- margin: 1px;
- float: left;
- text-align: center;
- border-radius: 10px;
- margin: 10px;
- background: url(/static/warndata/work.png),
- linear-gradient(to right,
- rgba(55, 135, 254, 0.08),
- rgba(4, 184, 255, 0.08),
- rgba(60, 161, 237, 0.08));
- }
- .icon-style {
- margin-right: 8px;
- width: 13px;
- height: 13px;
- border-radius: 4px;
- }
- .typeBar {
- display: flex;
- justify-content: space-between;
- .icon-vent {
- display: flex;
- .u-icon--right {
- margin: 0px 5px;
- }
- }
- }
- </style>
|