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 lang="scss" scoped>
  308. .container {
  309. display: flex;
  310. flex-direction: column;
  311. }
  312. .main {
  313. display: flex;
  314. flex-direction: column;
  315. flex: 1;
  316. width: 100%;
  317. padding-top: 40px; /* 内容区域顶部留出导航栏的高度 */
  318. }
  319. .text-style {
  320. font-weight: bold;
  321. }
  322. .flcard {
  323. padding: 20rpx;
  324. background-color: #ffffff;
  325. margin-bottom: 5rpx;
  326. }
  327. .datacard {
  328. width: 32.5%;
  329. margin: 1px;
  330. float: left;
  331. height: 100rpx;
  332. text-align: center;
  333. border-radius: 10px;
  334. background: url(/static/model/windM3.png),
  335. linear-gradient(
  336. to right,
  337. rgba(55, 135, 254, 0.08),
  338. rgba(4, 184, 255, 0.08),
  339. rgba(60, 161, 237, 0.08)
  340. );
  341. }
  342. .datacard1 {
  343. width: 100%;
  344. margin: 2px;
  345. float: left;
  346. height: 200rpx;
  347. text-align: center;
  348. border-radius: 10px;
  349. background: linear-gradient(
  350. to right,
  351. rgba(55, 135, 254, 0.08),
  352. rgba(4, 184, 255, 0.08),
  353. rgba(60, 161, 237, 0.08)
  354. );
  355. }
  356. .title {
  357. width: 100%;
  358. height: 50rpx;
  359. background: url(/static/warndata/title.png);
  360. background-repeat: no-repeat;
  361. background-size: 100% 100%;
  362. display: flex; /* 将父级元素设置为 Flex 容器 */
  363. align-items: center; /* 垂直居中子元素 */
  364. }
  365. .firecard {
  366. width: 100%;
  367. margin: 1px;
  368. float: left;
  369. text-align: center;
  370. border-radius: 10px;
  371. margin-top: 10px;
  372. background: linear-gradient(
  373. to right,
  374. rgba(55, 135, 254, 0.08),
  375. rgba(4, 184, 255, 0.08),
  376. rgba(60, 161, 237, 0.08)
  377. );
  378. background-repeat: repeat;
  379. }
  380. .deviceCard {
  381. display: grid;
  382. grid-template-columns: repeat(2, 1fr);
  383. margin-top: 10rpx;
  384. }
  385. .item-container {
  386. height: 100px; /* 设置容器高度,根据需要进行调整 */
  387. background-size: 100% 60%; /* 设置背景图片尺寸,根据需要进行调整 */
  388. background-repeat: no-repeat; /* 设置背景图片不重复,根据需要进行调整 */
  389. }
  390. .item {
  391. margin-left: 70px;
  392. margin-top: 36px;
  393. }
  394. .firetext {
  395. margin: 20px;
  396. }
  397. .text-style1 {
  398. color: #3787fe;
  399. font-weight: bold;
  400. font-size: large;
  401. }
  402. .red-text-style1 {
  403. color: #ff0000;
  404. font-weight: bold;
  405. font-size: large;
  406. }
  407. .firecontainer {
  408. margin-top: 10px;
  409. }
  410. .fire-style {
  411. display: flex;
  412. flex-wrap: wrap;
  413. }
  414. .fire-item {
  415. width: calc(33.33% - 20px);
  416. margin: 16rpx;
  417. box-sizing: border-box;
  418. }
  419. .gascontainer {
  420. display: flex;
  421. }
  422. .gascard {
  423. width: calc(33.33% - 20px);
  424. margin: 1px;
  425. float: left;
  426. text-align: center;
  427. border-radius: 10px;
  428. margin: 10px;
  429. background: url(/static/warndata/work.png),
  430. linear-gradient(
  431. to right,
  432. rgba(55, 135, 254, 0.08),
  433. rgba(4, 184, 255, 0.08),
  434. rgba(60, 161, 237, 0.08)
  435. );
  436. }
  437. .icon-style {
  438. margin-right: 8px;
  439. width: 13px;
  440. height: 13px;
  441. border-radius: 4px;
  442. }
  443. .typeBar {
  444. display: flex;
  445. justify-content: space-between;
  446. }
  447. </style>