warndata.vue 15 KB

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