warndata.vue 15 KB

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