warndata.vue 13 KB

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