warndata.vue 15 KB

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