fire-detail-mb.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  1. <template>
  2. <!-- 内因火灾-密闭监测 -->
  3. <view class="fire-detail-mb">
  4. <view class="top-area">
  5. <view class="top-card">
  6. <view class="card-box" v-for="(item, index) in cardList" :key="index">
  7. <view class="box-item">
  8. <view class="box-val">{{ item.value }}</view>
  9. <view class="box-name">{{ item.name }}</view>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="top-card1">
  14. <view class="card-box" v-for="(item, index) in cardList1" :key="index">
  15. <view class="box-item">
  16. <view class="box-val">{{ item.value }}</view>
  17. <view class="box-name">{{ item.name }}</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="bot-area">
  23. <view class="bot-title">
  24. <view style="font-weight: bold">采空区密闭参数</view>
  25. </view>
  26. <view
  27. class="bot-content"
  28. v-for="(item, index) in botContentList"
  29. :key="index"
  30. >
  31. <view class="content-title">{{ item.title }}</view>
  32. <view class="content-item-box">
  33. <view class="content-item">
  34. <view class="item-l">
  35. <view class="item-value">{{ item.nd }}</view>
  36. <view class="item-label">浓度</view>
  37. </view>
  38. <view class="item-line"></view>
  39. <view class="item-c">
  40. <view class="item-value">{{ item.time }}</view>
  41. <view class="item-label">时间</view>
  42. </view>
  43. <view class="item-line"></view>
  44. <view class="item-r">
  45. <view class="item-value">{{ item.address }}</view>
  46. <view class="item-label">位置</view>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="echartbox1">
  51. <LineChart
  52. v-if="item.title == 'O₂'"
  53. :chartData="option1"
  54. :style="{
  55. width: '100%',
  56. }"
  57. />
  58. <LineChart
  59. v-if="item.title == 'C₂H₄'"
  60. :chartData="option2"
  61. :style="{ width: '100%' }"
  62. />
  63. <LineChart
  64. v-if="item.title == 'CO'"
  65. :chartData="option3"
  66. :style="{ width: '100%' }"
  67. />
  68. <LineChart
  69. v-if="item.title == 'CH₄'"
  70. :chartData="option4"
  71. :style="{ width: '100%' }"
  72. />
  73. <LineChart
  74. v-if="item.title == 'CO₂'"
  75. :chartData="option5"
  76. :style="{ width: '100%' }"
  77. />
  78. <LineChart
  79. v-if="item.title == 'C₂H₂'"
  80. :chartData="option6"
  81. :style="{ width: '100%' }"
  82. />
  83. </view>
  84. <view class="echartbox2">
  85. <warnZb
  86. :resetIndex="index"
  87. :widthV="widthV"
  88. :heightV="heightV"
  89. :coordDw="coordDw"
  90. :widthCanvas="widthCanvas"
  91. :heightCanvas="heightCanvas"
  92. :warnLevel="warnLevel"
  93. ></warnZb>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. import api from "@/api/api";
  101. import warnZb from "./warn-zb.vue";
  102. export default {
  103. name: "fireDetailMb",
  104. components: {
  105. warnZb,
  106. },
  107. props: {
  108. detailMb: {
  109. type: Object,
  110. default: () => {
  111. return {};
  112. },
  113. },
  114. },
  115. data() {
  116. return {
  117. option1: {},
  118. option2: {},
  119. option3: {},
  120. option4: {},
  121. option5: {},
  122. option6: {},
  123. widthV: "85%",
  124. heightV: "85%",
  125. coordDw: [16, 42],
  126. widthCanvas: "302px",
  127. heightCanvas: "194px",
  128. myChart: null,
  129. xData: [],
  130. yData: [],
  131. legendName: "",
  132. axisDw: "",
  133. cardList: [
  134. { name: "平均温度()", value: 0 },
  135. { name: "位置", value: "" },
  136. { name: "时间", value: "" },
  137. ],
  138. cardList1: [
  139. { name: "煤自燃阶段", value: "" },
  140. { name: "预警等级", value: "" },
  141. ],
  142. botContentList: [
  143. { title: "O₂", value: 0, time: "", address: "" },
  144. { title: "C₂H₄", value: 0, time: "", address: "" },
  145. { title: "CO", value: 0, time: "", address: "" },
  146. { title: "CH₄", value: 0, time: "", address: "" },
  147. { title: "CO₂", value: 0, time: "", address: "" },
  148. { title: "C₂H₂", value: 0, time: "", address: "" },
  149. ],
  150. };
  151. },
  152. computed: {
  153. warnLevel: function () {
  154. return this.cardList1[1].value;
  155. },
  156. },
  157. watch: {
  158. detailMb: {
  159. handler(newM, oldM) {
  160. console.log(newM, "newM--------------");
  161. let that = this;
  162. that.xData = [];
  163. that.yData = [];
  164. if (JSON.stringify(newM) != "{}") {
  165. if (newM.bundletube.length != 0) {
  166. that.cardList[0].value = newM.temperature[0]
  167. ? newM.temperature[0].readData.temperature
  168. : "--";
  169. that.cardList[1].value = newM.bundletube[0].strinstallpos || "--";
  170. that.cardList[2].value = newM.bundletube[0].readTime || "--";
  171. that.cardList1[0].value = newM.bundletube[0].syswarnLevel_des;
  172. that.cardList1[1].value = newM.bundletube[0].syswarnLevel_str;
  173. that.botContentList[0].value = newM.bundletube[0].readData.o2val;
  174. that.botContentList[1].value = newM.bundletube[0].readData.ch2val;
  175. that.botContentList[2].value = newM.bundletube[0].readData.coval;
  176. that.botContentList[3].value = newM.bundletube[0].readData.chval;
  177. that.botContentList[4].value = newM.bundletube[0].readData.co2val;
  178. that.botContentList[5].value = newM.bundletube[0].readData.gasval;
  179. that.botContentList.forEach((el, index) => {
  180. el.time = newM.bundletube[0].readTime;
  181. el.address = newM.bundletube[0].strinstallpos;
  182. if (el.title == "O₂") {
  183. that.xData = newM.bundletube[0].history.map((x) => x.time);
  184. that.yData = newM.bundletube[0].history.map((y) => y.o2val);
  185. that.legendName = "O₂";
  186. that.axisDw = "%";
  187. } else if (el.title == "C₂H₄") {
  188. that.xData = newM.bundletube[0].history.map((x) => x.time);
  189. that.yData = newM.bundletube[0].history.map((y) => y.ch2val);
  190. that.legendName = "C₂H₄";
  191. that.axisDw = "ppm";
  192. } else if (el.title == "CO") {
  193. that.xData = newM.bundletube[0].history.map((x) => x.time);
  194. that.yData = newM.bundletube[0].history.map((y) => y.coval);
  195. that.legendName = "CO";
  196. that.axisDw = "ppm";
  197. } else if (el.title == "CH₄") {
  198. that.xData = newM.bundletube[0].history.map((x) => x.time);
  199. that.yData = newM.bundletube[0].history.map((y) => y.chval);
  200. that.legendName = "CH₄";
  201. that.axisDw = "ppm";
  202. } else if (el.title == "CO₂") {
  203. that.xData = newM.bundletube[0].history.map((x) => x.time);
  204. that.yData = newM.bundletube[0].history.map((y) => y.co2val);
  205. that.legendName = "CO₂";
  206. that.axisDw = "%";
  207. } else if (el.title == "C₂H₂") {
  208. that.xData = newM.bundletube[0].history.map((x) => x.time);
  209. that.yData = newM.bundletube[0].history.map((y) => y.gasval);
  210. that.legendName = "C₂H₂";
  211. that.axisDw = "ppm";
  212. }
  213. that.initChartH(el);
  214. });
  215. } else {
  216. that.cardList[0].value = 0;
  217. that.cardList[1].value = "--";
  218. that.cardList[2].value = "--";
  219. that.cardList1[0].value = "--";
  220. that.cardList1[1].value = "--";
  221. that.botContentList[0].value = "--";
  222. that.botContentList[1].value = "--";
  223. that.botContentList[2].value = "--";
  224. that.botContentList[3].value = "--";
  225. that.botContentList[4].value = "--";
  226. that.botContentList[5].value = "--";
  227. that.botContentList.forEach((el, index) => {
  228. el.time = "--";
  229. that.xData = [];
  230. that.yData = [];
  231. that.initChartH(el);
  232. });
  233. }
  234. }
  235. },
  236. immediate: true,
  237. deep: true,
  238. },
  239. },
  240. mounted() {},
  241. methods: {
  242. initChartH(el) {
  243. switch (el.title) {
  244. case "O₂":
  245. return (this.option1 = {
  246. categories: this.xData.slice(-3) || [],
  247. series: [
  248. {
  249. name: el.title,
  250. data: this.yData.slice(-3) || [],
  251. },
  252. ],
  253. });
  254. case "C₂H₄":
  255. return (this.option2 = {
  256. categories: this.xData.slice(-3) || [],
  257. series: [
  258. {
  259. name: el.title,
  260. data: this.yData.slice(-3) || [],
  261. },
  262. ],
  263. });
  264. case "CO":
  265. return (this.option3 = {
  266. categories: this.xData.slice(-3) || [],
  267. series: [
  268. {
  269. name: el.title,
  270. data: this.yData.slice(-3) || [],
  271. },
  272. ],
  273. });
  274. case "CH₄":
  275. return (this.option4 = {
  276. categories: this.xData.slice(-3) || [],
  277. series: [
  278. {
  279. name: el.title,
  280. data: this.yData.slice(-3) || [],
  281. },
  282. ],
  283. });
  284. case "CO₂":
  285. return (this.option5 = {
  286. categories: this.xData.slice(-3) || [],
  287. series: [
  288. {
  289. name: el.title,
  290. data: this.yData.slice(-3) || [],
  291. },
  292. ],
  293. });
  294. case "C₂H₂":
  295. return (this.option6 = {
  296. categories: this.xData.slice(-3) || [],
  297. series: [
  298. {
  299. name: el.title,
  300. data: this.yData.slice(-3) || [],
  301. },
  302. ],
  303. });
  304. }
  305. },
  306. },
  307. };
  308. </script>
  309. <style lang="scss" scoped>
  310. .fire-detail-mb {
  311. width: 100%;
  312. height: 100%;
  313. // box-sizing: border-box;
  314. // overflow-y: auto;
  315. .top-area {
  316. width: 100%;
  317. padding: 10px;
  318. background-color: #fff;
  319. margin-bottom: 2px;
  320. box-sizing: border-box;
  321. .top-card {
  322. width: 100%;
  323. height: 70px;
  324. margin-bottom: 10px;
  325. display: flex;
  326. justify-content: space-between;
  327. align-items: center;
  328. .card-box {
  329. width: 32%;
  330. height: 100%;
  331. border-radius: 5px;
  332. background: linear-gradient(
  333. to right,
  334. rgba(55, 135, 254, 0.08),
  335. rgba(4, 184, 255, 0.08),
  336. rgba(60, 161, 237, 0.08)
  337. );
  338. }
  339. .card-box:nth-child(1) .box-item {
  340. display: flex;
  341. flex-direction: column;
  342. justify-content: center;
  343. align-items: flex-start;
  344. width: 100%;
  345. height: 100%;
  346. padding: 0px 15px;
  347. background: url("/static/address.png") no-repeat right;
  348. background-size: 40% 80%;
  349. }
  350. .card-box:nth-child(2) .box-item {
  351. display: flex;
  352. flex-direction: column;
  353. justify-content: center;
  354. align-items: flex-start;
  355. width: 100%;
  356. height: 100%;
  357. padding: 0px 15px;
  358. background: url("/static/pjwd.png") no-repeat right;
  359. background-size: 40% 80%;
  360. }
  361. .card-box:nth-child(3) .box-item {
  362. display: flex;
  363. flex-direction: column;
  364. justify-content: center;
  365. align-items: flex-start;
  366. width: 100%;
  367. height: 100%;
  368. padding: 0px 15px;
  369. background: url("/static/yjdj.png") no-repeat right;
  370. background-size: 40% 80%;
  371. }
  372. }
  373. .top-card1 {
  374. width: 100%;
  375. height: 70px;
  376. display: flex;
  377. justify-content: space-between;
  378. align-items: center;
  379. .card-box {
  380. width: 49%;
  381. height: 100%;
  382. border-radius: 5px;
  383. background: linear-gradient(
  384. to right,
  385. rgba(55, 135, 254, 0.08),
  386. rgba(4, 184, 255, 0.08),
  387. rgba(60, 161, 237, 0.08)
  388. );
  389. }
  390. .card-box:nth-child(1) .box-item {
  391. display: flex;
  392. flex-direction: column;
  393. justify-content: center;
  394. align-items: flex-start;
  395. width: 100%;
  396. height: 100%;
  397. padding: 0px 15px;
  398. background: url("/static/mzrjd.png") no-repeat right;
  399. background-size: 40% 80%;
  400. }
  401. .card-box:nth-child(2) .box-item {
  402. display: flex;
  403. flex-direction: column;
  404. justify-content: center;
  405. align-items: flex-start;
  406. width: 100%;
  407. height: 100%;
  408. padding: 0px 15px;
  409. background: url("/static/time.png") no-repeat right;
  410. background-size: 40% 80%;
  411. }
  412. }
  413. .box-item .box-val {
  414. // height: 28px;
  415. // line-height: 28px;
  416. color: #0eb4fc;
  417. font-weight: bold;
  418. margin-bottom: 5px;
  419. }
  420. .box-item .box-name {
  421. font-size: 12px;
  422. }
  423. }
  424. .bot-area {
  425. width: 100%;
  426. padding: 0px 10px;
  427. background-color: #fff;
  428. margin-bottom: 2px;
  429. box-sizing: border-box;
  430. .bot-title {
  431. height: 28px;
  432. margin-bottom: 5px;
  433. display: flex;
  434. justify-content: space-between;
  435. align-items: center;
  436. }
  437. .bot-content {
  438. margin-bottom: 15px;
  439. .content-title {
  440. height: 26px;
  441. line-height: 26px;
  442. padding: 0px 20px;
  443. font-size: 12px;
  444. background: url("/static/warndata/title.png") no-repeat;
  445. background-size: 100% 100%;
  446. }
  447. .content-item-box {
  448. padding: 5px 0px;
  449. .content-item {
  450. height: 50px;
  451. display: flex;
  452. justify-content: space-between;
  453. align-items: center;
  454. background: linear-gradient(
  455. to right,
  456. rgba(55, 135, 254, 0.08),
  457. rgba(4, 184, 255, 0.08),
  458. rgba(60, 161, 237, 0.08)
  459. );
  460. border-radius: 10px;
  461. margin-bottom: 5px;
  462. .item-l {
  463. width: calc(25% - 2px);
  464. height: 100%;
  465. display: flex;
  466. flex-direction: column;
  467. justify-content: center;
  468. align-items: center;
  469. }
  470. .item-c {
  471. width: calc(50% - 4px);
  472. height: 100%;
  473. display: flex;
  474. flex-direction: column;
  475. justify-content: center;
  476. align-items: center;
  477. }
  478. .item-line {
  479. width: 4px;
  480. height: 70%;
  481. border-left: 2px solid;
  482. border-image: linear-gradient(
  483. to bottom,
  484. transparent,
  485. rgba(140, 203, 254, 1),
  486. transparent
  487. )
  488. 1 1 1;
  489. }
  490. .item-r {
  491. width: calc(25% - 2px);
  492. height: 100%;
  493. display: flex;
  494. flex-direction: column;
  495. justify-content: center;
  496. align-items: center;
  497. }
  498. .item-value {
  499. height: 20px;
  500. line-height: 20px;
  501. color: #0eb4fc;
  502. font-weight: bold;
  503. }
  504. .item-label {
  505. font-size: 12px;
  506. }
  507. }
  508. }
  509. .echartbox1 {
  510. width: 100%;
  511. height: 220px;
  512. margin-bottom: 10px;
  513. }
  514. .echartbox2 {
  515. width: 100%;
  516. height: 240px;
  517. }
  518. }
  519. }
  520. }
  521. </style>