fire-detail-mb.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. <template>
  2. <!-- 内因火灾-密闭监测 -->
  3. <view class="fire-detail-mb">
  4. <view class="top-area">
  5. <view class="top-card">
  6. <view
  7. class="card-box"
  8. v-for="(item, index) in topCardList.slice(0, 3)"
  9. :key="index"
  10. >
  11. <view class="box-item">
  12. <view class="item-icon">
  13. <image class="icon-img" :src="item.icon" mode="aspectFit"></image>
  14. </view>
  15. <view class="item-info">
  16. <view
  17. class="box-val"
  18. :class="{ 'is-normal': item.value == '正常' }"
  19. >{{ item.value }}</view
  20. >
  21. <view class="box-name">{{ item.name }}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="top-card1">
  27. <view
  28. class="card-box"
  29. v-for="(item, index) in topCardList.slice(3)"
  30. :key="index"
  31. >
  32. <view class="box-item">
  33. <view class="item-icon">
  34. <image class="icon-img" :src="item.icon" mode="aspectFit"></image>
  35. </view>
  36. <view class="item-info">
  37. <view
  38. class="box-val"
  39. :class="{ 'is-normal': item.value == '正常' }"
  40. >{{ item.value }}</view
  41. >
  42. <view class="box-name">{{ item.name }}</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bot-area">
  49. <view class="bot-title">
  50. <view style="font-weight: bold">采空区密闭参数</view>
  51. </view>
  52. <view
  53. class="bot-content"
  54. v-for="(item, index) in botContentList"
  55. :key="index"
  56. >
  57. <view class="content-title"
  58. >{{ item.title }}{{ item.dw ? " (" + item.dw + ")" : "" }}</view
  59. >
  60. <view class="content-item-box">
  61. <view class="content-item">
  62. <view class="item-l">
  63. <view class="item-icon">
  64. <image
  65. class="icon-img"
  66. :src="item.icon"
  67. mode="aspectFit"
  68. ></image>
  69. </view>
  70. <view class="item-info">
  71. <view class="item-value">{{ item.value }}</view>
  72. <view class="item-label">浓度</view>
  73. </view>
  74. </view>
  75. <view class="item-c">
  76. <view class="item-icon">
  77. <image
  78. class="icon-img"
  79. src="/static/warndata/shijian.svg"
  80. mode="aspectFit"
  81. ></image>
  82. </view>
  83. <view class="item-info">
  84. <view class="item-value is-nowrap">{{ item.time }}</view>
  85. <view class="item-label">时间</view>
  86. </view>
  87. </view>
  88. <view class="item-r">
  89. <view class="item-icon">
  90. <image
  91. class="icon-img"
  92. src="/static/warndata/weizhi.svg"
  93. mode="aspectFit"
  94. ></image>
  95. </view>
  96. <view class="item-info">
  97. <view class="item-value">{{ item.address }}</view>
  98. <view class="item-label">位置</view>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="echartbox1">
  104. <LineChart
  105. v-if="item.title == 'O₂'"
  106. type="area"
  107. :chartData="option1"
  108. :chartOpts="areaOpts"
  109. :style="{
  110. width: '100%',
  111. }"
  112. />
  113. <LineChart
  114. v-if="item.title == 'C₂H₄'"
  115. type="area"
  116. :chartData="option2"
  117. :chartOpts="areaOpts"
  118. :style="{ width: '100%' }"
  119. />
  120. <LineChart
  121. v-if="item.title == 'CO'"
  122. type="area"
  123. :chartData="option3"
  124. :chartOpts="areaOpts"
  125. :style="{ width: '100%' }"
  126. />
  127. <LineChart
  128. v-if="item.title == 'CH₄'"
  129. type="area"
  130. :chartData="option4"
  131. :chartOpts="areaOpts"
  132. :style="{ width: '100%' }"
  133. />
  134. <LineChart
  135. v-if="item.title == 'CO₂'"
  136. type="area"
  137. :chartData="option5"
  138. :chartOpts="areaOpts"
  139. :style="{ width: '100%' }"
  140. />
  141. <LineChart
  142. v-if="item.title == 'C₂H₂'"
  143. type="area"
  144. :chartData="option6"
  145. :chartOpts="areaOpts"
  146. :style="{ width: '100%' }"
  147. />
  148. </view>
  149. <view class="echartbox2">
  150. <warnZb
  151. :resetIndex="index"
  152. :widthV="widthV"
  153. :heightV="heightV"
  154. :coordDw="coordDw"
  155. :widthCanvas="widthCanvas"
  156. :heightCanvas="heightCanvas"
  157. :warnLevel="warnLevel"
  158. ></warnZb>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </template>
  164. <script>
  165. import api from "@/api/api";
  166. import warnZb from "./warn-zb.vue";
  167. export default {
  168. name: "fireDetailMb",
  169. components: {
  170. warnZb,
  171. },
  172. props: {
  173. detailMb: {
  174. type: Object,
  175. default: () => {
  176. return {};
  177. },
  178. },
  179. },
  180. data() {
  181. return {
  182. option1: {},
  183. option2: {},
  184. option3: {},
  185. option4: {},
  186. option5: {},
  187. option6: {},
  188. widthV: "85%",
  189. heightV: "85%",
  190. coordDw: [16, 42],
  191. widthCanvas: "302px",
  192. heightCanvas: "194px",
  193. myChart: null,
  194. xData: [],
  195. yData: [],
  196. legendName: "",
  197. axisDw: "",
  198. cardList: [
  199. { name: "平均温度(℃)", value: 0 },
  200. { name: "位置", value: "" },
  201. { name: "时间", value: "" },
  202. ],
  203. cardList1: [
  204. { name: "煤自燃阶段", value: "" },
  205. { name: "预警等级", value: "" },
  206. ],
  207. botContentList: [
  208. {
  209. title: "O₂",
  210. value: 0,
  211. time: "",
  212. address: "",
  213. dw: "%",
  214. icon: "/static/warndata/O₂.svg",
  215. },
  216. {
  217. title: "C₂H₄",
  218. value: 0,
  219. time: "",
  220. address: "",
  221. dw: "ppm",
  222. icon: "/static/warndata/C2H4.svg",
  223. },
  224. {
  225. title: "CO",
  226. value: 0,
  227. time: "",
  228. address: "",
  229. dw: "ppm",
  230. icon: "/static/warndata/CO.svg",
  231. },
  232. {
  233. title: "CH₄",
  234. value: 0,
  235. time: "",
  236. address: "",
  237. dw: "ppm",
  238. icon: "/static/warndata/CH4.svg",
  239. },
  240. {
  241. title: "CO₂",
  242. value: 0,
  243. time: "",
  244. address: "",
  245. dw: "%",
  246. icon: "/static/warndata/CO2.svg",
  247. },
  248. {
  249. title: "C₂H₂",
  250. value: 0,
  251. time: "",
  252. address: "",
  253. dw: "ppm",
  254. icon: "/static/warndata/zhibiao.svg",
  255. },
  256. ],
  257. };
  258. },
  259. computed: {
  260. warnLevel: function () {
  261. return this.cardList1[1].value;
  262. },
  263. //顶部卡片:位置、平均温度、预警等级、煤自燃阶段、时间
  264. topCardList() {
  265. return [
  266. { ...this.cardList[1], icon: "/static/warndata/weizhi.svg" },
  267. { ...this.cardList[0], icon: "/static/warndata/pingjun-wendu.svg" },
  268. { ...this.cardList1[1], icon: "/static/warndata/yujing-dengji.svg" },
  269. { ...this.cardList1[0], icon: "/static/warndata/meiziran-jieduan.svg" },
  270. { ...this.cardList[2], icon: "/static/warndata/shijian.svg" },
  271. ];
  272. },
  273. //曲线通用配置:曲线下方渐变填充 + 横轴标签抽稀
  274. areaOpts() {
  275. return {
  276. xAxis: {
  277. disableGrid: true,
  278. labelCount: 3,
  279. fontSize: 10,
  280. },
  281. extra: {
  282. area: {
  283. type: "curve",
  284. opacity: 0.35,
  285. addLine: true,
  286. width: 2,
  287. gradient: true,
  288. activeType: "hollow",
  289. },
  290. },
  291. };
  292. },
  293. },
  294. watch: {
  295. detailMb: {
  296. handler(newM, oldM) {
  297. console.log(newM, "newM--------------");
  298. let that = this;
  299. that.xData = [];
  300. that.yData = [];
  301. if (JSON.stringify(newM) != "{}") {
  302. if (newM.bundletube.length != 0) {
  303. that.cardList[0].value = newM.temperature[0]
  304. ? newM.temperature[0].readData.temperature
  305. : "--";
  306. that.cardList[1].value = newM.bundletube[0].strinstallpos || "--";
  307. that.cardList[2].value = newM.bundletube[0].readTime || "--";
  308. that.cardList1[0].value = newM.bundletube[0].syswarnLevel_des;
  309. that.cardList1[1].value = newM.bundletube[0].syswarnLevel_str;
  310. that.botContentList[0].value = newM.bundletube[0].readData.o2val;
  311. that.botContentList[1].value = newM.bundletube[0].readData.ch2val;
  312. that.botContentList[2].value = newM.bundletube[0].readData.coval;
  313. that.botContentList[3].value = newM.bundletube[0].readData.chval;
  314. that.botContentList[4].value = newM.bundletube[0].readData.co2val;
  315. that.botContentList[5].value = newM.bundletube[0].readData.gasval;
  316. that.botContentList.forEach((el, index) => {
  317. el.time = newM.bundletube[0].readTime;
  318. el.address = newM.bundletube[0].strinstallpos;
  319. if (el.title == "O₂") {
  320. that.xData = newM.bundletube[0].history.map((x) =>
  321. that.formatAxisTime(x.time)
  322. );
  323. that.yData = newM.bundletube[0].history.map((y) => y.o2val);
  324. that.legendName = "O₂";
  325. that.axisDw = "%";
  326. } else if (el.title == "C₂H₄") {
  327. that.xData = newM.bundletube[0].history.map((x) =>
  328. that.formatAxisTime(x.time)
  329. );
  330. that.yData = newM.bundletube[0].history.map((y) => y.ch2val);
  331. that.legendName = "C₂H₄";
  332. that.axisDw = "ppm";
  333. } else if (el.title == "CO") {
  334. that.xData = newM.bundletube[0].history.map((x) =>
  335. that.formatAxisTime(x.time)
  336. );
  337. that.yData = newM.bundletube[0].history.map((y) => y.coval);
  338. that.legendName = "CO";
  339. that.axisDw = "ppm";
  340. } else if (el.title == "CH₄") {
  341. that.xData = newM.bundletube[0].history.map((x) =>
  342. that.formatAxisTime(x.time)
  343. );
  344. that.yData = newM.bundletube[0].history.map((y) => y.chval);
  345. that.legendName = "CH₄";
  346. that.axisDw = "ppm";
  347. } else if (el.title == "CO₂") {
  348. that.xData = newM.bundletube[0].history.map((x) =>
  349. that.formatAxisTime(x.time)
  350. );
  351. that.yData = newM.bundletube[0].history.map((y) => y.co2val);
  352. that.legendName = "CO₂";
  353. that.axisDw = "%";
  354. } else if (el.title == "C₂H₂") {
  355. that.xData = newM.bundletube[0].history.map((x) =>
  356. that.formatAxisTime(x.time)
  357. );
  358. that.yData = newM.bundletube[0].history.map((y) => y.gasval);
  359. that.legendName = "C₂H₂";
  360. that.axisDw = "ppm";
  361. }
  362. that.initChartH(el);
  363. });
  364. } else {
  365. that.cardList[0].value = 0;
  366. that.cardList[1].value = "--";
  367. that.cardList[2].value = "--";
  368. that.cardList1[0].value = "--";
  369. that.cardList1[1].value = "--";
  370. that.botContentList[0].value = "--";
  371. that.botContentList[1].value = "--";
  372. that.botContentList[2].value = "--";
  373. that.botContentList[3].value = "--";
  374. that.botContentList[4].value = "--";
  375. that.botContentList[5].value = "--";
  376. that.botContentList.forEach((el, index) => {
  377. el.time = "--";
  378. that.xData = [];
  379. that.yData = [];
  380. that.initChartH(el);
  381. });
  382. }
  383. }
  384. },
  385. immediate: true,
  386. deep: true,
  387. },
  388. },
  389. mounted() {},
  390. methods: {
  391. //横轴时间格式化,避免标签太长叠在一起
  392. formatAxisTime(time) {
  393. if (typeof time != "string") {
  394. return time;
  395. }
  396. //2024-03-11 17:58:11 -> 03-11 17:58
  397. return time.length > 16 ? time.slice(5, 16) : time;
  398. },
  399. initChartH(el) {
  400. switch (el.title) {
  401. case "O₂":
  402. return (this.option1 = {
  403. categories: this.xData.slice(-3) || [],
  404. series: [
  405. {
  406. name: el.title,
  407. data: this.yData.slice(-3) || [],
  408. },
  409. ],
  410. });
  411. case "C₂H₄":
  412. return (this.option2 = {
  413. categories: this.xData.slice(-3) || [],
  414. series: [
  415. {
  416. name: el.title,
  417. data: this.yData.slice(-3) || [],
  418. },
  419. ],
  420. });
  421. case "CO":
  422. return (this.option3 = {
  423. categories: this.xData.slice(-3) || [],
  424. series: [
  425. {
  426. name: el.title,
  427. data: this.yData.slice(-3) || [],
  428. },
  429. ],
  430. });
  431. case "CH₄":
  432. return (this.option4 = {
  433. categories: this.xData.slice(-3) || [],
  434. series: [
  435. {
  436. name: el.title,
  437. data: this.yData.slice(-3) || [],
  438. },
  439. ],
  440. });
  441. case "CO₂":
  442. return (this.option5 = {
  443. categories: this.xData.slice(-3) || [],
  444. series: [
  445. {
  446. name: el.title,
  447. data: this.yData.slice(-3) || [],
  448. },
  449. ],
  450. });
  451. case "C₂H₂":
  452. return (this.option6 = {
  453. categories: this.xData.slice(-3) || [],
  454. series: [
  455. {
  456. name: el.title,
  457. data: this.yData.slice(-3) || [],
  458. },
  459. ],
  460. });
  461. }
  462. },
  463. },
  464. };
  465. </script>
  466. <style lang="scss" scoped>
  467. .fire-detail-mb {
  468. width: 100%;
  469. height: 100%;
  470. // box-sizing: border-box;
  471. // overflow-y: auto;
  472. .top-area {
  473. width: 100%;
  474. padding: 10px;
  475. background-color: #f9f9fb;
  476. border: 1px solid #fff;
  477. margin-bottom: 12px;
  478. box-sizing: border-box;
  479. .top-card {
  480. width: 100%;
  481. height: 70px;
  482. margin-bottom: 10px;
  483. display: flex;
  484. justify-content: space-between;
  485. align-items: center;
  486. .card-box {
  487. width: calc((100% - 20px) / 3);
  488. height: 100%;
  489. border-radius: 10px;
  490. background: linear-gradient(
  491. to bottom,
  492. rgba(175, 195, 252, 0.6) 0%,
  493. rgba(175, 195, 252, 0.1) 100%
  494. );
  495. .box-item {
  496. width: 100%;
  497. height: 100%;
  498. padding: 0px 6px;
  499. box-sizing: border-box;
  500. display: flex;
  501. align-items: center;
  502. .item-icon {
  503. position: relative;
  504. flex-shrink: 0;
  505. width: 28px;
  506. height: 28px;
  507. border-radius: 8px;
  508. display: flex;
  509. align-items: center;
  510. justify-content: center;
  511. background: linear-gradient(135deg, #80b4ff, #347df3);
  512. //图标后面叠一层浅蓝方块
  513. .icon-img {
  514. position: relative;
  515. width: 15px;
  516. height: 15px;
  517. filter: brightness(0) invert(1);
  518. }
  519. }
  520. .item-info {
  521. flex: 1;
  522. min-width: 0px;
  523. padding-left: 6px;
  524. display: flex;
  525. flex-direction: column;
  526. justify-content: center;
  527. }
  528. }
  529. }
  530. }
  531. .top-card1 {
  532. width: 100%;
  533. height: 70px;
  534. display: flex;
  535. justify-content: space-between;
  536. align-items: center;
  537. .card-box {
  538. height: 100%;
  539. border-radius: 10px;
  540. background: linear-gradient(
  541. to bottom,
  542. rgba(175, 195, 252, 0.6) 0%,
  543. rgba(175, 195, 252, 0.1) 100%
  544. );
  545. //时间卡片宽一些,保证日期时间一行显示
  546. &:nth-child(1) {
  547. width: 40%;
  548. }
  549. &:nth-child(2) {
  550. width: calc(60% - 8px);
  551. }
  552. .box-item {
  553. width: 100%;
  554. height: 100%;
  555. padding: 0px 6px;
  556. box-sizing: border-box;
  557. display: flex;
  558. align-items: center;
  559. .item-icon {
  560. position: relative;
  561. flex-shrink: 0;
  562. width: 28px;
  563. height: 28px;
  564. border-radius: 8px;
  565. display: flex;
  566. align-items: center;
  567. justify-content: center;
  568. background: linear-gradient(135deg, #80b4ff, #347df3);
  569. .icon-img {
  570. position: relative;
  571. width: 15px;
  572. height: 15px;
  573. filter: brightness(0) invert(1);
  574. }
  575. }
  576. .item-info {
  577. flex: 1;
  578. min-width: 0px;
  579. padding-left: 6px;
  580. display: flex;
  581. flex-direction: column;
  582. justify-content: center;
  583. }
  584. }
  585. }
  586. }
  587. .box-item .box-val {
  588. font-size: 13px;
  589. font-weight: bold;
  590. line-height: 16px;
  591. color: #2b7cff;
  592. white-space: nowrap;
  593. }
  594. .box-item .box-val.is-normal {
  595. color: #39b54a;
  596. }
  597. .box-item .box-name {
  598. margin-top: 2px;
  599. font-size: 11px;
  600. line-height: 14px;
  601. color: #000;
  602. }
  603. }
  604. .bot-area {
  605. width: 100%;
  606. padding: 0px 10px;
  607. background-color: #f9f9fb;
  608. border: 1px solid #fff;
  609. margin-bottom: 2px;
  610. box-sizing: border-box;
  611. .bot-title {
  612. height: 28px;
  613. margin-bottom: 5px;
  614. display: flex;
  615. justify-content: space-between;
  616. align-items: center;
  617. font-size: 14px;
  618. font-weight: 600;
  619. color: #000;
  620. }
  621. .bot-content {
  622. margin-bottom: 15px;
  623. .content-title {
  624. height: 26px;
  625. line-height: 26px;
  626. padding: 0px 20px;
  627. font-size: 13px;
  628. font-weight: 600;
  629. color: #000;
  630. background: url("/static/warndata/1-1.png") no-repeat;
  631. background-size: 100% 100%;
  632. }
  633. .content-item-box {
  634. padding: 5px 0px;
  635. .content-item {
  636. height: 56px;
  637. display: flex;
  638. justify-content: space-between;
  639. align-items: center;
  640. margin-bottom: 5px;
  641. .item-l,
  642. .item-c,
  643. .item-r {
  644. height: 100%;
  645. box-sizing: border-box;
  646. display: flex;
  647. align-items: center;
  648. padding: 0px 6px;
  649. border-radius: 10px;
  650. background: linear-gradient(
  651. 135deg,
  652. rgba(55, 135, 254, 0.12) 0%,
  653. rgba(4, 184, 255, 0.08) 100%
  654. );
  655. .item-icon {
  656. position: relative;
  657. flex-shrink: 0;
  658. width: 28px;
  659. height: 28px;
  660. border-radius: 8px;
  661. display: flex;
  662. align-items: center;
  663. justify-content: center;
  664. background: linear-gradient(135deg, #80b4ff, #347df3);
  665. .icon-img {
  666. position: relative;
  667. width: 15px;
  668. height: 15px;
  669. filter: brightness(0) invert(1);
  670. }
  671. }
  672. .item-info {
  673. flex: 1;
  674. min-width: 0px;
  675. padding-left: 6px;
  676. display: flex;
  677. flex-direction: column;
  678. justify-content: center;
  679. }
  680. }
  681. //时间卡片宽一些,保证日期时间一行显示
  682. .item-c {
  683. width: calc(50% - 5px);
  684. }
  685. .item-l,
  686. .item-r {
  687. width: calc(25% - 5px);
  688. }
  689. .item-value {
  690. font-size: 11px;
  691. font-weight: bold;
  692. line-height: 16px;
  693. color: #2b7cff;
  694. word-break: break-all;
  695. }
  696. .item-value.is-nowrap {
  697. white-space: nowrap;
  698. }
  699. .item-label {
  700. margin-top: 2px;
  701. font-size: 11px;
  702. line-height: 15px;
  703. color: #000;
  704. }
  705. }
  706. }
  707. .echartbox1 {
  708. width: 100%;
  709. height: 220px;
  710. margin-bottom: 10px;
  711. }
  712. .echartbox2 {
  713. width: 100%;
  714. height: 240px;
  715. }
  716. }
  717. }
  718. }
  719. </style>