warndata.vue 13 KB

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