warndata.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <view class="container">
  3. <u-navbar :title="titleName" :safeAreaInsetTop="true" left-icon="" @leftClick="menuShow">
  4. <view class="u-nav-slot" slot="left" v-if="!isShowDetail">
  5. <u-icon name="list" size="20"> </u-icon>
  6. </view>
  7. </u-navbar>
  8. <view class="main" v-if="isShowDetail">
  9. <view class="flcard" v-if="isShow1">
  10. <view class="typeBar">
  11. <view class="icon-vent">
  12. <text class="text-style">通风监测预警</text>
  13. <u-icon name="eye" @click="getDetail('vent')"></u-icon>
  14. </view>
  15. <u-icon @click="toggleIsShow1" name="arrow-up"></u-icon>
  16. </view>
  17. </view>
  18. <view class="flcard" v-else>
  19. <view class="typeBar">
  20. <text class="text-style">通风监测预警</text>
  21. <u-icon @click="toggleIsShow1" name="arrow-down"></u-icon>
  22. </view>
  23. </view>
  24. <view class="flcard" v-show="isShow1">
  25. <view class="datacard demo-layout bg-purple-light">
  26. <view style="margin-top: 10rpx">
  27. <text class="text-style1">{{ windData.zongjinfeng }}</text>
  28. </view>
  29. <view style="margin-top: 10rpx">总进风量(m³/min):</view>
  30. </view>
  31. <view class="datacard demo-layout bg-purple-light">
  32. <view style="margin-top: 10rpx">
  33. <text class="text-style1">{{ windData.zonghuifeng }}</text>
  34. </view>
  35. <view style="margin-top: 10rpx">总回风量(m³/min):</view>
  36. </view>
  37. <view class="datacard demo-layout bg-purple-light">
  38. <view style="margin-top: 10rpx">
  39. <text class="text-style1">{{ xufengliang }}</text>
  40. </view>
  41. <view style="margin-top: 10rpx">总需风量(m³/min):</view>
  42. </view>
  43. </view>
  44. <view class="flcard" v-if="isShow2">
  45. <view class="typeBar">
  46. <view class="icon-vent">
  47. <text class="text-style">火灾监测预警</text>
  48. <u-icon name="eye" @click="getDetail('fire')"></u-icon>
  49. </view>
  50. <u-icon @click="toggleIsShow2" name="arrow-up"></u-icon>
  51. </view>
  52. </view>
  53. <view class="flcard" v-else>
  54. <view class="typeBar">
  55. <text class="text-style">火灾监测预警</text>
  56. <u-icon @click="toggleIsShow2" name="arrow-down"></u-icon>
  57. </view>
  58. </view>
  59. <view class="flcard" v-show="isShow2">
  60. <view class="firecontainer">
  61. <view class="title">
  62. <span class="firetext">内因火灾</span>
  63. </view>
  64. <view class="firecard fire-style">
  65. <view v-for="(item, index) in internalInfo" :key="index" class="fire-item"
  66. v-if="item && Object.keys(item).length > 0">
  67. <view style="margin-top: 20rpx">
  68. <text :class="item.Maxlevel > 0 ? 'red-text-style' : 'text-style1'">{{ item.value }}</text>
  69. <view style="margin-top: 10rpx">{{ item.name }}</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="firecontainer">
  75. <view class="title">
  76. <span class="firetext">外因火灾</span>
  77. </view>
  78. <view class="firecard fire-style">
  79. <view v-for="(item, index) in externalInfo" :key="index" class="fire-item">
  80. <view style="margin-top: 20rpx">
  81. <text :class="item.Maxlevel > 0 ? 'red-text-style' : 'text-style1'">{{ item.value }}</text>
  82. <view style="margin-top: 10rpx">{{ item.name }}</view>
  83. </view>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="flcard" v-if="isShow3">
  89. <view class="typeBar">
  90. <view class="icon-vent">
  91. <text class="text-style">粉尘监测预警</text>
  92. <u-icon name="eye" @click="getDetail('dust')"></u-icon>
  93. </view>
  94. <u-icon @click="toggleIsShow3" name="arrow-up"></u-icon>
  95. </view>
  96. </view>
  97. <view class="flcard" v-else>
  98. <view class="typeBar">
  99. <text class="text-style">粉尘监测预警</text>
  100. <u-icon @click="toggleIsShow3" name="arrow-down"></u-icon>
  101. </view>
  102. </view>
  103. <view class="flcard" v-show="isShow3">
  104. <view class="firecard fire-style">
  105. <view v-for="(value, key) in dustData" :key="key" class="fire-item">
  106. <view style="margin-top: 20rpx">
  107. <image src="/static/warndata/alarm.svg" class="icon-style"
  108. :style="{ backgroundColor: key === 'alarm' ? 'red' : key }"></image>
  109. <span style="margin-top: 10rpx">
  110. {{ dustMap[key] }} :{{ value }}</span>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. <view class="flcard" v-if="isShow4">
  116. <view class="typeBar">
  117. <view class="icon-vent">
  118. <text class="text-style">瓦斯监测预警</text>
  119. <u-icon name="eye" @click="getDetail('gas')"></u-icon>
  120. </view>
  121. <u-icon @click="toggleIsShow4" name="arrow-up"></u-icon>
  122. </view>
  123. </view>
  124. <view class="flcard" v-else>
  125. <view class="typeBar">
  126. <text class="text-style">瓦斯监测预警</text>
  127. <u-icon @click="toggleIsShow4" name="arrow-down"></u-icon>
  128. </view>
  129. </view>
  130. <view class="flcard" v-show="isShow4">
  131. <view class="firecontainer">
  132. <view class="title">
  133. <span class="firetext" v-if="gasDevice.length > 0">安全监测系统监测点</span>
  134. </view>
  135. <view class="gascard" v-for="(item, index) in gasDevice">
  136. <view style="margin-top: 20rpx">
  137. <text class="text-style1">{{ item.gasNumber }}</text>
  138. <view style="margin: 10rpx">{{ item.systemname }}</view>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="firecontainer">
  143. <view class="title">
  144. <span class="firetext" v-if="gasDevice.length > 0">瓦斯抽采系统监测点</span>
  145. </view>
  146. <view class="gascontainer">
  147. <view class="gascard" v-for="(item, index) in gasDevice">
  148. <view style="margin-top: 20rpx">
  149. <text class="text-style1">{{ item.pumpNumber }}</text>
  150. <view style="margin: 10rpx">{{ item.systemname }}</view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. <view class="flcard" v-if="isShow5">
  157. <view class="typeBar">
  158. <view class="icon-vent">
  159. <text class="text-style">设备监测预警</text>
  160. <u-icon name="eye" @click="getDetail('device')"></u-icon>
  161. </view>
  162. <u-icon @click="toggleIsShow5" name="arrow-up"></u-icon>
  163. </view>
  164. </view>
  165. <view class="flcard" v-else>
  166. <view class="typeBar">
  167. <text class="text-style">设备监测预警</text>
  168. <u-icon @click="toggleIsShow5" name="arrow-down"></u-icon>
  169. </view>
  170. </view>
  171. <view class="flcard demo-layout bg-purple-light" v-show="isShow5">
  172. <view class="deviceCard">
  173. <view class="item-container" v-for="(item, index) in devicekindData" :key="index"
  174. :style="{ backgroundImage: itemBackground(item) }">
  175. <view class="item">
  176. <text style="margin-right: 10px">{{ item.name }}</text>
  177. <text>{{ item.status }}</text>
  178. </view>
  179. </view>
  180. </view>
  181. </view>
  182. </view>
  183. <view class="main" v-else>
  184. <component :is="detailComponent"></component>
  185. </view>
  186. </view>
  187. </template>
  188. <script>
  189. import api from "@/api/api";
  190. import ventDetail from './components/vent-detail.vue'
  191. import deviceDetail from './components/device-detail.vue'
  192. import fireDetail from './components/fire-detail.vue'
  193. import dustDetail from './components/dust-detail.vue'
  194. import gasDetail from './components/gas-detail.vue'
  195. export default {
  196. props: {},
  197. watch: {},
  198. data() {
  199. return {
  200. titleName:'预警分析',
  201. isShowDetail: true,
  202. detailComponent: '',
  203. windData: {},
  204. devicekindData: [],
  205. fireData: [],
  206. gasData: [],
  207. dustData: [],
  208. gasDevice: [],
  209. externalInfo: [],
  210. internalInfo: [],
  211. xufengliang: "", //总需风量
  212. imageMap: {
  213. atomizing: "atomizing.png",
  214. ballvalve: "ballvalve.png",
  215. dedustefan: "dedustefan.png",
  216. drilling: "drilling.png",
  217. dustdev: "dustdev.png",
  218. fanlocal: "fanlocal.png",
  219. fanmain: "fanmain.png",
  220. forcFan: "forcFan.png",
  221. gasmonitor: "gasmonitor.png",
  222. gate: "gate.png",
  223. location: "location.png",
  224. nitrogen: "nitrogen.png",
  225. pulping: "pulping.png",
  226. pump: "pump.png",
  227. rebroadcast: "rebroadcast.png",
  228. safetymonitor: "safetymonitor.png",
  229. spary: "spary.png",
  230. unit: "unit.png",
  231. window: "window.png",
  232. windrect: "windrect.png",
  233. wintest: "wintest.png",
  234. },
  235. dustMap: {
  236. alarm: "报警",
  237. blue: "低风险",
  238. orange: "重大风险",
  239. red: "较大风险",
  240. yellow: "一般风险",
  241. },
  242. isShow1: true,
  243. isShow2: true,
  244. isShow3: false,
  245. isShow4: false,
  246. isShow5: false,
  247. };
  248. },
  249. mounted() {
  250. this.getWranInfo();
  251. },
  252. components:{
  253. ventDetail,
  254. deviceDetail,
  255. fireDetail,
  256. dustDetail,
  257. gasDetail
  258. },
  259. methods: {
  260. //获取预警信息
  261. getWranInfo() {
  262. new Promise((resolve, reject) => {
  263. api
  264. .getWarnInfo()
  265. .then((response) => {
  266. if (response.data.code == 200) {
  267. this.windData = response.data.result.ventInfo;
  268. this.devicekindData = response.data.result.info.devicekindInfo;
  269. this.fireData = response.data.result.info.sysInfo.fireS;
  270. this.externalInfo = this.fireData.summaryInfo.external;
  271. this.internalInfo = this.fireData.summaryInfo.internal;
  272. this.gasData = response.data.result.info.sysInfo.gasS;
  273. this.gasDevice = this.gasData.devices;
  274. this.xufengliang = this.windData.sysdata.xufengliang;
  275. this.dustData = response.data.result.info.sysInfo.dustS.levels;
  276. } else {
  277. reject(response);
  278. }
  279. })
  280. .catch((error) => {
  281. console.log("catch===>response", response);
  282. reject(error);
  283. });
  284. });
  285. },
  286. //返回监测首页
  287. menuShow() {
  288. this.isShowDetail = true
  289. },
  290. //跳转监测详情
  291. getDetail(data) {
  292. this.isShowDetail = false
  293. switch (data) {
  294. case 'vent':
  295. this.titleName='通风监测预警'
  296. this.detailComponent = ventDetail
  297. break;
  298. case 'device':
  299. this.titleName='设备监测预警'
  300. this.detailComponent = deviceDetail
  301. break;
  302. case 'fire':
  303. this.titleName='火灾监测预警'
  304. this.detailComponent = fireDetail
  305. break;
  306. case 'dust':
  307. this.titleName='粉尘监测预警'
  308. this.detailComponent = dustDetail
  309. break;
  310. case 'gas':
  311. this.titleName='瓦斯监测预警'
  312. this.detailComponent = gasDetail
  313. break;
  314. }
  315. },
  316. toggleIsShow1() {
  317. this.isShow1 = !this.isShow1; // 切换 isShow 的值
  318. },
  319. toggleIsShow2() {
  320. this.isShow2 = !this.isShow2; // 切换 isShow 的值
  321. },
  322. toggleIsShow3() {
  323. this.isShow3 = !this.isShow3; // 切换 isShow 的值
  324. },
  325. toggleIsShow4() {
  326. this.isShow4 = !this.isShow4; // 切换 isShow 的值
  327. },
  328. toggleIsShow5() {
  329. this.isShow5 = !this.isShow5; // 切换 isShow 的值
  330. },
  331. },
  332. computed: {
  333. itemBackground() {
  334. return (item) => {
  335. const defaultImage = "unit.png";
  336. const imageName = this.imageMap[item.code] || defaultImage;
  337. return `url('/static/warndata/${imageName}')`;
  338. };
  339. },
  340. },
  341. };
  342. </script>
  343. <style lang="scss" scoped>
  344. .container {
  345. display: flex;
  346. flex-direction: column;
  347. }
  348. .main {
  349. // margin-top: 100rpx;
  350. display: flex;
  351. flex-direction: column;
  352. flex: 1;
  353. width: 100%;
  354. margin-top: 45px;
  355. /* 内容区域顶部留出导航栏的高度 */
  356. }
  357. .text-style {
  358. font-weight: bold;
  359. }
  360. .flcard {
  361. padding: 20rpx;
  362. background-color: #ffffff;
  363. margin-bottom: 5rpx;
  364. }
  365. .datacard {
  366. width: 32.5%;
  367. margin: 1px;
  368. float: left;
  369. height: 100rpx;
  370. text-align: center;
  371. border-radius: 10px;
  372. background: url(/static/model/windM3.png),
  373. linear-gradient(to right,
  374. rgba(55, 135, 254, 0.08),
  375. rgba(4, 184, 255, 0.08),
  376. rgba(60, 161, 237, 0.08));
  377. }
  378. .datacard1 {
  379. width: 100%;
  380. margin: 2px;
  381. float: left;
  382. height: 200rpx;
  383. text-align: center;
  384. border-radius: 10px;
  385. background: linear-gradient(to right,
  386. rgba(55, 135, 254, 0.08),
  387. rgba(4, 184, 255, 0.08),
  388. rgba(60, 161, 237, 0.08));
  389. }
  390. .title {
  391. position: relative;
  392. width: 100%;
  393. height: 50rpx;
  394. background: url(/static/warndata/title.png);
  395. background-repeat: no-repeat;
  396. background-size: 100% 100%;
  397. display: flex;
  398. /* 将父级元素设置为 Flex 容器 */
  399. align-items: center;
  400. /* 垂直居中子元素 */
  401. }
  402. .firecard {
  403. width: 100%;
  404. margin: 1px;
  405. float: left;
  406. text-align: center;
  407. border-radius: 10px;
  408. margin-top: 10px;
  409. background: linear-gradient(to right,
  410. rgba(55, 135, 254, 0.08),
  411. rgba(4, 184, 255, 0.08),
  412. rgba(60, 161, 237, 0.08));
  413. background-repeat: repeat;
  414. }
  415. .deviceCard {
  416. display: grid;
  417. grid-template-columns: repeat(2, 1fr);
  418. margin-top: 10rpx;
  419. }
  420. .item-container {
  421. height: 100px;
  422. /* 设置容器高度,根据需要进行调整 */
  423. background-size: 100% 60%;
  424. /* 设置背景图片尺寸,根据需要进行调整 */
  425. background-repeat: no-repeat;
  426. /* 设置背景图片不重复,根据需要进行调整 */
  427. }
  428. .item {
  429. margin-left: 70px;
  430. margin-top: 36px;
  431. }
  432. .firetext {
  433. margin: 20px;
  434. }
  435. .text-style1 {
  436. color: #3787fe;
  437. font-weight: bold;
  438. font-size: large;
  439. }
  440. .red-text-style1 {
  441. color: #ff0000;
  442. font-weight: bold;
  443. font-size: large;
  444. }
  445. .firecontainer {
  446. margin-top: 10px;
  447. }
  448. .fire-style {
  449. display: flex;
  450. flex-wrap: wrap;
  451. }
  452. .fire-item {
  453. width: calc(33.33% - 20px);
  454. margin: 16rpx;
  455. box-sizing: border-box;
  456. }
  457. .gascontainer {
  458. display: flex;
  459. }
  460. .gascard {
  461. width: calc(33.33% - 20px);
  462. margin: 1px;
  463. float: left;
  464. text-align: center;
  465. border-radius: 10px;
  466. margin: 10px;
  467. background: url(/static/warndata/work.png),
  468. linear-gradient(to right,
  469. rgba(55, 135, 254, 0.08),
  470. rgba(4, 184, 255, 0.08),
  471. rgba(60, 161, 237, 0.08));
  472. }
  473. .icon-style {
  474. margin-right: 8px;
  475. width: 13px;
  476. height: 13px;
  477. border-radius: 4px;
  478. }
  479. .typeBar {
  480. display: flex;
  481. justify-content: space-between;
  482. .icon-vent {
  483. display: flex;
  484. .u-icon--right {
  485. margin: 0px 5px;
  486. }
  487. }
  488. }
  489. </style>