warndata.vue 13 KB

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