warndata.vue 15 KB

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