warndata.vue 10 KB

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