fire-detail-ckq.vue 16 KB

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