warndata.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. <template>
  2. <view class="container">
  3. <u-navbar
  4. :title="titleName"
  5. :bgStatusImage="backPic0"
  6. :bgImage="backPic"
  7. :safeAreaInsetTop="true"
  8. left-icon=""
  9. @leftClick="menuShow"
  10. >
  11. <view class="u-nav-slot" slot="left" v-if="!isShowDetail">
  12. <u-icon name="arrow-left" size="20"> </u-icon>
  13. </view>
  14. </u-navbar>
  15. <view>
  16. <view class="main" v-if="isShowDetail">
  17. <view class="flcard" v-if="isShow1">
  18. <view class="typeBar">
  19. <view class="icon-vent">
  20. <text class="text-style">通风监测预警</text>
  21. </view>
  22. <u-icon @click="toggleIsShow1" name="arrow-up-fill"></u-icon>
  23. </view>
  24. </view>
  25. <view class="flcard" v-else>
  26. <view class="typeBar">
  27. <text class="text-style">通风监测预警</text>
  28. <u-icon @click="toggleIsShow1" name="arrow-down-fill"></u-icon>
  29. </view>
  30. </view>
  31. <view class="flcard" @click="getDetail('vent')" v-show="isShow1">
  32. <view class="datacard demo-layout bg-purple-light">
  33. <view style="margin-top: 10rpx">
  34. <text class="text-style1">{{ windData.zongjinfeng }}</text>
  35. </view>
  36. <view style="margin-top: 10rpx">总进风量(m³/min):</view>
  37. </view>
  38. <view class="datacard demo-layout bg-purple-light">
  39. <view style="margin-top: 10rpx">
  40. <text class="text-style1">{{ windData.zonghuifeng }}</text>
  41. </view>
  42. <view style="margin-top: 10rpx">总回风量(m³/min):</view>
  43. </view>
  44. <view class="datacard demo-layout bg-purple-light">
  45. <view style="margin-top: 10rpx">
  46. <text class="text-style1">{{ xufengliang }}</text>
  47. </view>
  48. <view style="margin-top: 10rpx">总需风量(m³/min):</view>
  49. </view>
  50. </view>
  51. <view class="flcard" v-if="isShow2">
  52. <view class="typeBar">
  53. <view class="icon-vent">
  54. <text class="text-style">火灾监测预警</text>
  55. </view>
  56. <u-icon @click="toggleIsShow2" name="arrow-up-fill"></u-icon>
  57. </view>
  58. </view>
  59. <view class="flcard" v-else>
  60. <view class="typeBar">
  61. <text class="text-style">火灾监测预警</text>
  62. <u-icon @click="toggleIsShow2" name="arrow-down-fill"></u-icon>
  63. </view>
  64. </view>
  65. <view class="flcard" v-show="isShow2" @click="getDetail('fire')">
  66. <view class="firecontainer">
  67. <view class="title">
  68. <span class="firetext">内因火灾</span>
  69. </view>
  70. <view class="fire-style">
  71. <view
  72. v-for="(item, index) in internalInfo"
  73. :key="index"
  74. class="fire-item1"
  75. v-if="item && Object.keys(item).length > 0"
  76. >
  77. <view class="firecard">
  78. <text
  79. :class="
  80. item.Maxlevel > 0 ? 'red-text-style' : 'text-style1'
  81. "
  82. >{{ item.value
  83. }}{{
  84. item.code === "o2val" ||
  85. item.code === "co2val" ||
  86. item.code === "ch4val" ||
  87. item.code === "smokeval"
  88. ? "(%)"
  89. : item.code === "fmax" ||
  90. item.code === "temperature" ||
  91. item.code === "fireval"
  92. ? "(℃)"
  93. : "(ppm)"
  94. }}
  95. </text>
  96. <view style="margin-top: 10rpx">{{ item.monitorcode }}</view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="firecontainer">
  102. <view class="title">
  103. <span class="firetext">外因火灾</span>
  104. </view>
  105. <view class="fire-style">
  106. <view
  107. v-for="(item, index) in externalInfo"
  108. :key="index"
  109. class="fire-item1"
  110. >
  111. <view class="firecard">
  112. <text
  113. :class="
  114. item.Maxlevel > 0 ? 'red-text-style' : 'text-style1'
  115. "
  116. >{{ item.value
  117. }}{{
  118. item.code === "o2val" ||
  119. item.code === "co2val" ||
  120. item.code === "ch4val" ||
  121. item.code === "smokeval"
  122. ? "(%)"
  123. : item.code === "fmax" ||
  124. item.code === "temperature" ||
  125. item.code === "fireval"
  126. ? "(℃)"
  127. : "(ppm)"
  128. }}
  129. </text>
  130. <view style="margin-top: 10rpx">{{ item.monitorcode }}</view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. <view class="flcard" v-if="isShow3">
  137. <view class="typeBar">
  138. <view class="icon-vent">
  139. <text class="text-style">粉尘监测预警</text>
  140. </view>
  141. <u-icon @click="toggleIsShow3" name="arrow-up-fill"></u-icon>
  142. </view>
  143. </view>
  144. <view class="flcard" v-else>
  145. <view class="typeBar">
  146. <text class="text-style">粉尘监测预警</text>
  147. <u-icon @click="toggleIsShow3" name="arrow-down-fill"></u-icon>
  148. </view>
  149. </view>
  150. <view class="flcard" v-show="isShow3" @click="getDetail('dust')">
  151. <view class="datacard demo-layout bg-purple-light">
  152. <view style="margin-top: 10rpx">
  153. <text class="text-style1">{{ dustTotalcount }}</text>
  154. </view>
  155. <view style="margin-top: 10rpx">测点数量:</view>
  156. </view>
  157. <view class="datacard demo-layout bg-purple-light">
  158. <view style="margin-top: 10rpx">
  159. <text class="text-style1">{{ dustLevelstatus }}</text>
  160. </view>
  161. <view style="margin-top: 10rpx">当前状态:</view>
  162. </view>
  163. </view>
  164. <view class="flcard" v-if="isShow4">
  165. <view class="typeBar">
  166. <view class="icon-vent">
  167. <text class="text-style">瓦斯监测预警</text>
  168. </view>
  169. <u-icon @click="toggleIsShow4" name="arrow-up-fill"></u-icon>
  170. </view>
  171. </view>
  172. <view class="flcard" v-else>
  173. <view class="typeBar">
  174. <text class="text-style">瓦斯监测预警</text>
  175. <u-icon @click="toggleIsShow4" name="arrow-down-fill"></u-icon>
  176. </view>
  177. </view>
  178. <view class="flcard" v-show="isShow4" @click="getDetail('gas')">
  179. <view class="firecontainer">
  180. <view class="title">
  181. <span class="firetext" v-if="gasDevice.length > 0"
  182. >安全监测系统监测点</span
  183. >
  184. </view>
  185. <view
  186. class="gascard"
  187. v-for="(item, index) in gasDevice"
  188. :key="index"
  189. >
  190. <view style="margin-top: 20rpx">
  191. <text class="text-style1">{{ item.gasNumber }}</text>
  192. <view style="margin: 10rpx">{{ item.systemname }}</view>
  193. </view>
  194. </view>
  195. </view>
  196. <view class="firecontainer">
  197. <view class="title">
  198. <span class="firetext" v-if="gasDevice.length > 0"
  199. >瓦斯抽采系统监测点</span
  200. >
  201. </view>
  202. <view class="gascontainer">
  203. <view
  204. class="gascard"
  205. v-for="(item, index) in gasDevice"
  206. :key="index"
  207. >
  208. <view style="margin-top: 20rpx">
  209. <text class="text-style1">{{ item.pumpNumber }}</text>
  210. <view style="margin: 10rpx">{{ item.systemname }}</view>
  211. </view>
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. <view class="flcard" v-if="isShow5">
  217. <view class="typeBar">
  218. <view class="icon-vent">
  219. <text class="text-style">设备监测预警</text>
  220. </view>
  221. <u-icon @click="toggleIsShow5" name="arrow-up-fill"></u-icon>
  222. </view>
  223. </view>
  224. <view class="flcard" v-else>
  225. <view class="typeBar">
  226. <text class="text-style">设备监测预警</text>
  227. <u-icon @click="toggleIsShow5" name="arrow-down-fill"></u-icon>
  228. </view>
  229. </view>
  230. <view
  231. class="flcard demo-layout bg-purple-light"
  232. v-show="isShow5"
  233. @click="getDetail('device')"
  234. >
  235. <view class="deviceCard">
  236. <view
  237. class="item-container"
  238. v-for="(item, index) in devicekindData"
  239. :key="index"
  240. :style="{ backgroundImage: itemBackground(item) }"
  241. >
  242. <view class="item">
  243. <text style="margin-right: 10px">{{ item.name }}</text>
  244. <text>{{ item.status }}</text>
  245. </view>
  246. </view>
  247. </view>
  248. </view>
  249. </view>
  250. <view class="main" v-else>
  251. <ventDetail v-if="Type == 'vent'"></ventDetail>
  252. <deviceDetail v-if="Type == 'device'"></deviceDetail>
  253. <fireDetail v-if="Type == 'fire'"></fireDetail>
  254. <dustDetail v-if="Type == 'dust'"></dustDetail>
  255. <gasDetail v-if="Type == 'gas'"></gasDetail>
  256. </view>
  257. </view>
  258. </view>
  259. </template>
  260. <script>
  261. import api from "@/api/api";
  262. import ventDetail from "./components/vent-detail.vue";
  263. import deviceDetail from "./components/device-detail.vue";
  264. import fireDetail from "./components/fire-detail.vue";
  265. import dustDetail from "./components/dust-detail.vue";
  266. import gasDetail from "./components/gas-detail.vue";
  267. export default {
  268. props: {},
  269. watch: {},
  270. data() {
  271. return {
  272. backPic0: "url(/static/topnavbar0.png)",
  273. backPic: "url(../../static/topnavbar.png)",
  274. titleName: "预警分析",
  275. isShowDetail: true,
  276. detailComponent: null,
  277. windData: {},
  278. devicekindData: [],
  279. fireData: [],
  280. gasData: [],
  281. dustData: [],
  282. dustTotalcount: 0,
  283. dustLevelstatus: "",
  284. gasDevice: [],
  285. externalInfo: [],
  286. internalInfo: [],
  287. xufengliang: "", //总需风量
  288. imageMap: {
  289. atomizing: "atomizing.png",
  290. ballvalve: "ballvalve.png",
  291. dedustefan: "dedustefan.png",
  292. drilling: "drilling.png",
  293. dustdev: "dustdev.png",
  294. fanlocal: "fanlocal.png",
  295. fanmain: "fanmain.png",
  296. forcFan: "forcFan.png",
  297. gasmonitor: "gasmonitor.png",
  298. gate: "gate.png",
  299. location: "location.png",
  300. nitrogen: "nitrogen.png",
  301. pulping: "pulping.png",
  302. pump: "pump.png",
  303. rebroadcast: "rebroadcast.png",
  304. safetymonitor: "safetymonitor.png",
  305. spary: "spary.png",
  306. unit: "unit.png",
  307. window: "window.png",
  308. windrect: "windrect.png",
  309. wintest: "wintest.png",
  310. },
  311. dustMap: {
  312. alarm: "报警",
  313. blue: "低风险",
  314. orange: "重大风险",
  315. red: "较大风险",
  316. yellow: "一般风险",
  317. },
  318. isShow1: true,
  319. isShow2: true,
  320. isShow3: false,
  321. isShow4: false,
  322. isShow5: false,
  323. Type: "", // 当前点击的类型
  324. };
  325. },
  326. mounted() {
  327. this.$nextTick(() => {
  328. this.getWarnInfo();
  329. });
  330. },
  331. components: {
  332. ventDetail,
  333. deviceDetail,
  334. fireDetail,
  335. dustDetail,
  336. gasDetail,
  337. },
  338. methods: {
  339. //获取预警信息
  340. getWarnInfo() {
  341. return new Promise((resolve, reject) => {
  342. api
  343. .getWarnInfo()
  344. .then((response) => {
  345. if (response.data.code == 200) {
  346. this.windData = response.data.result.ventInfo;
  347. this.devicekindData = response.data.result.info.devicekindInfo;
  348. this.fireData = response.data.result.info.sysInfo.fireS;
  349. const externalInfo1 = this.fireData.summaryInfo.external;
  350. const internalInfo1 = this.fireData.summaryInfo.internal;
  351. for (let key in externalInfo1) {
  352. if (!externalInfo1.hasOwnProperty(key)) continue;
  353. const item = externalInfo1[key];
  354. // 跳过空对象(如 ch4val: {})
  355. if (Object.keys(item).length === 0) continue;
  356. if (item.code == "coval") {
  357. item.monitorcode = "一氧化碳";
  358. } else if (item.code == "ch4val") {
  359. item.monitorcode = "甲烷";
  360. } else if (item.code == "o2val") {
  361. item.monitorcode = "氧气";
  362. } else if (item.code == "co2val") {
  363. item.monitorcode = "二氧化碳";
  364. } else if (item.code == "fmax") {
  365. item.monitorcode = "温度";
  366. } else if (item.code == "chval") {
  367. item.monitorcode = "乙炔";
  368. } else if (item.code == "ch2val") {
  369. item.monitorcode = "乙烯";
  370. } else if (item.code == "temperature") {
  371. item.monitorcode = "温度";
  372. } else if (item.code == "gasval") {
  373. item.monitorcode = "瓦斯";
  374. } else if (item.code == "fireval") {
  375. item.monitorcode = "温度";
  376. } else if (item.code == "smokeval") {
  377. item.monitorcode = "烟雾";
  378. }
  379. }
  380. for (let key in internalInfo1) {
  381. if (!internalInfo1.hasOwnProperty(key)) continue;
  382. const item = internalInfo1[key];
  383. // 跳过空对象(如 ch4val: {})
  384. if (Object.keys(item).length === 0) continue;
  385. if (item.code == "coval") {
  386. item.monitorcode = "一氧化碳";
  387. } else if (item.code == "ch4val") {
  388. item.monitorcode = "甲烷";
  389. } else if (item.code == "o2val") {
  390. item.monitorcode = "氧气";
  391. } else if (item.code == "co2val") {
  392. item.monitorcode = "二氧化碳";
  393. } else if (item.code == "chval") {
  394. item.monitorcode = "乙炔";
  395. } else if (item.code == "ch2val") {
  396. item.monitorcode = "乙烯";
  397. } else if (item.code == "fmax") {
  398. item.monitorcode = "温度";
  399. } else if (item.code == "temperature") {
  400. item.monitorcode = "温度";
  401. } else if (item.code == "gasval") {
  402. item.monitorcode = "瓦斯";
  403. } else if (item.code == "fireval") {
  404. item.monitorcode = "温度";
  405. } else if (item.code == "smokeval") {
  406. item.monitorcode = "烟雾";
  407. }
  408. }
  409. this.externalInfo = externalInfo1;
  410. this.internalInfo = internalInfo1;
  411. this.gasData = response.data.result.info.sysInfo.gasS;
  412. this.gasDevice = this.gasData.devices;
  413. this.xufengliang = this.windData.sysdata.xufengliang;
  414. this.dustTotalcount =
  415. response.data.result.info.devicekindInfo.dusting.totalcount;
  416. this.dustLevelstatus =
  417. response.data.result.info.devicekindInfo.dusting.levelstatus;
  418. } else {
  419. reject(response);
  420. }
  421. })
  422. .catch((error) => {
  423. console.log("catch===>response", response);
  424. reject(error);
  425. });
  426. });
  427. },
  428. //返回监测首页
  429. menuShow() {
  430. this.isShowDetail = true;
  431. },
  432. //跳转监测详情
  433. getDetail(data) {
  434. this.isShowDetail = false;
  435. this.Type = data; // 将当前点击的类型存储到 Type 中
  436. },
  437. toggleIsShow1() {
  438. this.isShow1 = !this.isShow1; // 切换 isShow 的值
  439. },
  440. toggleIsShow2() {
  441. this.isShow2 = !this.isShow2; // 切换 isShow 的值
  442. },
  443. toggleIsShow3() {
  444. this.isShow3 = !this.isShow3; // 切换 isShow 的值
  445. },
  446. toggleIsShow4() {
  447. this.isShow4 = !this.isShow4; // 切换 isShow 的值
  448. },
  449. toggleIsShow5() {
  450. this.isShow5 = !this.isShow5; // 切换 isShow 的值
  451. },
  452. },
  453. computed: {
  454. itemBackground() {
  455. return (item) => {
  456. const defaultImage = "unit.png";
  457. const imageName = this.imageMap[item.code] || defaultImage;
  458. return `url('/static/warndata/${imageName}')`;
  459. };
  460. },
  461. },
  462. };
  463. </script>
  464. <style lang="scss" scoped>
  465. .container {
  466. display: flex;
  467. flex-direction: column;
  468. }
  469. .main {
  470. margin-top: 80px;
  471. display: flex;
  472. flex-direction: column;
  473. flex: 1;
  474. width: 100%;
  475. margin-top: 45px;
  476. background: #f1f5f6;
  477. /* 内容区域顶部留出导航栏的高度 */
  478. }
  479. .text-style {
  480. font-weight: bold;
  481. }
  482. .flcard {
  483. padding: 20rpx;
  484. background-color: #ffffff;
  485. margin-bottom: 5rpx;
  486. }
  487. .datacard {
  488. width: 32.5%;
  489. margin: 1px;
  490. float: left;
  491. height: 100rpx;
  492. text-align: center;
  493. border-radius: 10px;
  494. background: url(/static/model/windM3.png),
  495. linear-gradient(
  496. to right,
  497. rgba(55, 135, 254, 0.08),
  498. rgba(4, 184, 255, 0.08),
  499. rgba(60, 161, 237, 0.08)
  500. );
  501. }
  502. .datacard1 {
  503. width: 100%;
  504. margin: 2px;
  505. float: left;
  506. height: 200rpx;
  507. text-align: center;
  508. border-radius: 10px;
  509. background: linear-gradient(
  510. to right,
  511. rgba(55, 135, 254, 0.08),
  512. rgba(4, 184, 255, 0.08),
  513. rgba(60, 161, 237, 0.08)
  514. );
  515. }
  516. .title {
  517. position: relative;
  518. width: 100%;
  519. height: 50rpx;
  520. background: url(/static/warndata/title.png);
  521. background-repeat: no-repeat;
  522. background-size: 100% 100%;
  523. display: flex;
  524. /* 将父级元素设置为 Flex 容器 */
  525. align-items: center;
  526. /* 垂直居中子元素 */
  527. }
  528. .firecard {
  529. width: 100%;
  530. padding: 10px;
  531. float: left;
  532. text-align: center;
  533. border-radius: 10px;
  534. background: linear-gradient(
  535. to right,
  536. rgba(55, 135, 254, 0.08),
  537. rgba(4, 184, 255, 0.08),
  538. rgba(60, 161, 237, 0.08)
  539. );
  540. background-repeat: repeat;
  541. }
  542. .deviceCard {
  543. display: grid;
  544. grid-template-columns: repeat(2, 1fr);
  545. margin-top: 10rpx;
  546. }
  547. .item-container {
  548. height: 100px;
  549. /* 设置容器高度,根据需要进行调整 */
  550. background-size: 100% 60%;
  551. /* 设置背景图片尺寸,根据需要进行调整 */
  552. background-repeat: no-repeat;
  553. /* 设置背景图片不重复,根据需要进行调整 */
  554. }
  555. .item {
  556. margin-left: 70px;
  557. margin-top: 36px;
  558. }
  559. .firetext {
  560. margin: 20px;
  561. }
  562. .text-style1 {
  563. color: #3787fe;
  564. font-weight: bold;
  565. font-size: 16px;
  566. }
  567. .red-text-style1 {
  568. color: #ff0000;
  569. font-weight: bold;
  570. font-size: 16px;
  571. }
  572. .firecontainer {
  573. margin-top: 10px;
  574. }
  575. .fire-style {
  576. display: flex;
  577. flex-wrap: wrap;
  578. }
  579. .fire-item {
  580. width: calc(33.33% - 20px);
  581. margin: 16rpx;
  582. box-sizing: border-box;
  583. }
  584. .fire-item1 {
  585. width: 45%;
  586. margin: 16rpx;
  587. box-sizing: border-box;
  588. }
  589. .gascontainer {
  590. display: flex;
  591. }
  592. .gascard {
  593. width: calc(33.33% - 20px);
  594. margin: 1px;
  595. float: left;
  596. text-align: center;
  597. border-radius: 10px;
  598. margin: 10px;
  599. background: url(/static/warndata/work.png),
  600. linear-gradient(
  601. to right,
  602. rgba(55, 135, 254, 0.08),
  603. rgba(4, 184, 255, 0.08),
  604. rgba(60, 161, 237, 0.08)
  605. );
  606. }
  607. .icon-style {
  608. margin-right: 8px;
  609. width: 13px;
  610. height: 13px;
  611. border-radius: 4px;
  612. }
  613. .typeBar {
  614. display: flex;
  615. justify-content: space-between;
  616. .icon-vent {
  617. display: flex;
  618. .u-icon--right {
  619. margin: 0px 5px;
  620. }
  621. }
  622. }
  623. </style>