warndata.vue 15 KB

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