fire-detail-out.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. <template>
  2. <!-- 外因火灾 -->
  3. <view class="fire-detail-out">
  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>
  14. <view class="center-area">
  15. <view class="bot-title">
  16. <view style="font-weight: bold;">光钎测温系统温度实时监测</view>
  17. </view>
  18. <view class="echartBox">
  19. <canvas id="myChart" :style="{ width: '100%', height: '220px' }"></canvas>
  20. </view>
  21. </view>
  22. <view class="bot-area" v-for="(item, index) in botList" :key="index">
  23. <view class="bot-title">
  24. <view style="font-weight: bold;">{{ item.title }}</view>
  25. </view>
  26. <view class="bot-content">
  27. <view class="h-table">
  28. <view class="table-head" v-if="item.title == '烟雾传感器监测'">
  29. <view class="head-item" v-for="(items, index) in headList" :key="index">{{ items.title }}</view>
  30. </view>
  31. <view class="table-head" v-else>
  32. <view class="head-item1" v-for="(items, index) in headList1" :key="index">{{ items.title }}
  33. </view>
  34. </view>
  35. <view class="table-content">
  36. <view class="content-tr" v-if="item.title == '烟雾传感器监测'" v-for="(ite, ind) in tableDataYw"
  37. :key="ind">
  38. <view class="content-td td">{{ ite.strinstallpos }}</view>
  39. <view class="content-td td1">{{ ite.val }}</view>
  40. <view class="content-td td2">{{ ite.warnLevel_str }}</view>
  41. <view class="content-td td3">{{ ite.readTime }}</view>
  42. </view>
  43. <view class="content-tr" v-if="item.title == '一氧化碳传感器监测'" v-for="(ite, ind) in tableDataCo"
  44. :key="ind">
  45. <view class="content-td td">{{ ite.strinstallpos }}</view>
  46. <view class="content-td td1">{{ ite.warnLevel_str }}</view>
  47. <view class="content-td td2">{{ ite.readTime }}</view>
  48. </view>
  49. <view class="content-tr" v-if="item.title == '自动喷淋灭火装置监测'" v-for="(ite, ind) in tableDataPl"
  50. :key="ind">
  51. <view class="content-td td">{{ ite.strinstallpos }}</view>
  52. <view class="content-td td1">{{ ite.warnLevel_str }}</view>
  53. <view class="content-td td2">{{ ite.readTime }}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import api from "@/api/api";
  63. export default {
  64. name: 'fireDetailOut',
  65. props: {
  66. detailWy: {
  67. type: Object,
  68. default: () => {
  69. return {}
  70. }
  71. }
  72. },
  73. data() {
  74. return {
  75. myChart: null,
  76. xData: [],
  77. yData: [],
  78. cardList: [
  79. { name: '最高温度()', value: 0 },
  80. { name: '最低温度()', value: 0 },
  81. { name: '平均温度()', value: 0 },
  82. { name: '状态', value: '正常' },
  83. ],
  84. botList: [
  85. { title: '烟雾传感器监测' },
  86. { title: '一氧化碳传感器监测' },
  87. { title: '自动喷淋灭火装置监测' },
  88. ],
  89. headList: [
  90. { title: '设备名称' },
  91. { title: '值' },
  92. { title: '状态' },
  93. { title: '时间' },
  94. ],
  95. headList1: [
  96. { title: '设备名称' },
  97. { title: '状态' },
  98. { title: '时间' },
  99. ],
  100. tableDataYw: [],
  101. tableDataCo: [],
  102. tableDataPl: [],
  103. };
  104. },
  105. watch: {
  106. detailWy: {
  107. handler(newW, oldW) {
  108. console.log(newW, 'newW--------------')
  109. let that = this
  110. that.xData = []
  111. that.yData = []
  112. if (JSON.stringify(newW) != '{}') {
  113. if (newW.fiber.length != 0) {
  114. that.cardList[0].value = newW.fiber[0].readData.fmax;
  115. that.cardList[1].value = newW.fiber[0].readData.fmin;
  116. that.cardList[2].value = newW.fiber[0].readData.favg;
  117. that.cardList[3].value = newW.fiber[0].warnFlag ? '存在风险' : '正常';
  118. JSON.parse(newW.fiber[0].readData.fibreTemperature).forEach((el) => {
  119. that.xData.push(el.pos);
  120. that.yData.push(el.value);
  121. });
  122. that.initChart()
  123. } else {
  124. that.cardList[0].value = '--';
  125. that.cardList[1].value = '--';
  126. that.cardList[2].value = '--';
  127. that.cardList[3].value = '正常';
  128. }
  129. if (newW.smoke.length != 0) {
  130. that.tableDataYw = newW.smoke.map((el) => {
  131. return {
  132. strinstallpos: el.strinstallpos,
  133. val: el.readData.smokeval,
  134. warnLevel_str: el.warnLevel_str == '正常' ? '低风险' : el.warnLevel_str,
  135. readTime: el.readTime,
  136. }
  137. });
  138. } else {
  139. that.tableDataYw = []
  140. }
  141. if (newW.co.length != 0) {
  142. that.tableDataCo = newW.co
  143. } else {
  144. that.tableDataCo = []
  145. }
  146. if (newW.spray.length != 0) {
  147. that.tableDataPl = newW.spray
  148. } else {
  149. that.tableDataPl = []
  150. }
  151. }
  152. },
  153. immediate: true,
  154. deep: true
  155. }
  156. },
  157. mounted() {
  158. },
  159. methods: {
  160. //初始化echarts实例
  161. initChart() {
  162. let canvas = document.getElementById('myChart');
  163. this.myChart = this.$echarts.init(canvas)
  164. let option = {
  165. grid: {
  166. top: '20%',
  167. left: '4%',
  168. bottom: '4%',
  169. right: '2%',
  170. containLabel: true,
  171. },
  172. tooltip: {
  173. trigger: 'item',
  174. backgroundColor: 'rgba(0, 0, 0, .6)',
  175. textStyle: {
  176. color: '#fff',
  177. fontSize: 12,
  178. },
  179. },
  180. legend: {
  181. // align: 'center',
  182. right: 'center',
  183. top: '0%',
  184. type: 'plain',
  185. textStyle: {
  186. color: '#0eb4fc',
  187. fontSize: 12,
  188. },
  189. // icon:'rect',
  190. itemGap: 25,
  191. itemWidth: 20,
  192. icon: 'path://M0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z',
  193. data: [
  194. {
  195. name: '当前温度',
  196. },
  197. ],
  198. },
  199. xAxis: [
  200. {
  201. type: 'category',
  202. boundaryGap: false,
  203. axisLabel: {
  204. // formatter: '{value}',
  205. fontSize: 12,
  206. margin: 10,
  207. textStyle: {
  208. color: '#b3b8cc',
  209. },
  210. formatter: function (params) {
  211. let newParamsName = '' // 最终拼接成的字符串
  212. let paramsNameNumber = params.length // 实际标签的个数
  213. let provideNumber = 10 // 每行能显示的字的个数
  214. let rowNumber = Math.ceil(paramsNameNumber / provideNumber) // 换行的话,需要显示几行,向上取整
  215. /**
  216. * 判断标签的个数是否大于规定的个数, 如果大于,则进行换行处理 如果不大于,即等于或小于,就返回原标签
  217. */
  218. // 条件等同于rowNumber>1
  219. if (paramsNameNumber > provideNumber) {
  220. /** 循环每一行,p表示行 */
  221. for (var p = 0; p < rowNumber; p++) {
  222. var tempStr = '' // 表示每一次截取的字符串
  223. var start = p * provideNumber // 开始截取的位置
  224. var end = start + provideNumber // 结束截取的位置
  225. // 此处特殊处理最后一行的索引值
  226. if (p == rowNumber - 1) {
  227. // 最后一次不换行
  228. tempStr = params.substring(start, paramsNameNumber)
  229. } else {
  230. // 每一次拼接字符串并换行
  231. tempStr = params.substring(start, end) + '\n'
  232. }
  233. newParamsName += tempStr // 最终拼成的字符串
  234. }
  235. } else {
  236. // 将旧标签的值赋给新标签
  237. newParamsName = params
  238. }
  239. //将最终的字符串返回
  240. return newParamsName
  241. }
  242. },
  243. axisLine: {
  244. lineStyle: {
  245. color: '#f1f5f6',
  246. },
  247. },
  248. axisTick: {
  249. show: false,
  250. },
  251. data: this.xData || [],
  252. },
  253. ],
  254. yAxis: [
  255. {
  256. boundaryGap: false,
  257. type: 'value',
  258. max: 2000,
  259. axisLabel: {
  260. textStyle: {
  261. color: '#b3b8cc',
  262. },
  263. formatter: '{value}'
  264. },
  265. name: '(­°C)',
  266. nameTextStyle: {
  267. color: '#b3b8cc',
  268. fontSize: 12,
  269. lineHeight: 0,
  270. },
  271. splitLine: {
  272. lineStyle: {
  273. color: '#f1f5f6',
  274. },
  275. },
  276. axisLine: {
  277. show: true,
  278. lineStyle: {
  279. color: '#f1f5f6',
  280. },
  281. },
  282. axisTick: {
  283. show: false,
  284. },
  285. },
  286. {
  287. boundaryGap: false,
  288. type: 'value',
  289. max: 2000,
  290. axisLabel: {
  291. textStyle: {
  292. color: '#b3b8cc',
  293. },
  294. formatter: '{value}'
  295. },
  296. name: '(­°C)',
  297. nameTextStyle: {
  298. color: '#fff',
  299. fontSize: 12,
  300. lineHeight: 10,
  301. },
  302. splitLine: {
  303. lineStyle: {
  304. color: '#f1f5f6',
  305. },
  306. },
  307. axisLine: {
  308. show: true,
  309. lineStyle: {
  310. color: '#f1f5f6',
  311. },
  312. },
  313. axisTick: {
  314. show: false,
  315. },
  316. },
  317. ],
  318. series: [
  319. {
  320. name: '当前温度',
  321. type: 'line',
  322. smooth: true,
  323. showSymbol: true,
  324. symbolSize: 8,
  325. zlevel: 3,
  326. itemStyle: {
  327. color: '#19a3df',
  328. borderColor: '#a3c8d8',
  329. },
  330. lineStyle: {
  331. normal: {
  332. width: 2,
  333. color: '#19a3df',
  334. },
  335. },
  336. data: this.yData || [],
  337. },
  338. ],
  339. };
  340. this.myChart.setOption(option)
  341. window.addEventListener('resize', () => {
  342. this.myChart.resize()
  343. })
  344. },
  345. },
  346. computed: {},
  347. };
  348. </script>
  349. <style lang="scss" scoped>
  350. .fire-detail-out {
  351. width: 100%;
  352. height: 100%;
  353. // box-sizing: border-box;
  354. // overflow-y: auto;
  355. .top-area {
  356. width: 100%;
  357. padding: 10px;
  358. background-color: #FFF;
  359. margin-bottom: 2px;
  360. box-sizing: border-box;
  361. .top-card {
  362. width: 100%;
  363. display: flex;
  364. justify-content: flex-start;
  365. align-items: flex-start;
  366. flex-wrap: wrap;
  367. .card-box {
  368. width: calc(50% - 5px);
  369. height: 60px;
  370. border-radius: 5px;
  371. background: linear-gradient(to right, rgba(55, 135, 254, 0.08), rgba(4, 184, 255, 0.08), rgba(60, 161, 237, 0.08));
  372. &:nth-child(1) {
  373. margin-bottom: 10px;
  374. margin-right: 5px;
  375. }
  376. &:nth-child(2) {
  377. margin-bottom: 10px;
  378. margin-left: 5px;
  379. }
  380. &:nth-child(3) {
  381. margin-right: 5px;
  382. }
  383. &:nth-child(4) {
  384. margin-left: 5px;
  385. }
  386. }
  387. .card-box:nth-child(1) .box-item {
  388. display: flex;
  389. flex-direction: column;
  390. justify-content: center;
  391. align-items: flex-start;
  392. width: 100%;
  393. height: 100%;
  394. padding: 0px 15px;
  395. background: url('/static/zgwd.png') no-repeat right;
  396. background-size: auto 80%;
  397. }
  398. .card-box:nth-child(2) .box-item {
  399. display: flex;
  400. flex-direction: column;
  401. justify-content: center;
  402. align-items: flex-start;
  403. width: 100%;
  404. height: 100%;
  405. padding: 0px 15px;
  406. background: url('/static/zdwd.png') no-repeat right;
  407. background-size: auto 80%;
  408. }
  409. .card-box:nth-child(3) .box-item {
  410. display: flex;
  411. flex-direction: column;
  412. justify-content: center;
  413. align-items: flex-start;
  414. width: 100%;
  415. height: 100%;
  416. padding: 0px 15px;
  417. background: url('/static/pjwd.png') no-repeat right;
  418. background-size: auto 80%;
  419. }
  420. .card-box:nth-child(4) .box-item {
  421. display: flex;
  422. flex-direction: column;
  423. justify-content: center;
  424. align-items: flex-start;
  425. width: 100%;
  426. height: 100%;
  427. padding: 0px 15px;
  428. background: url('/static/zt.png') no-repeat right;
  429. background-size: auto 80%;
  430. }
  431. }
  432. .box-item .box-val {
  433. height: 28px;
  434. line-height: 28px;
  435. color: #0eb4fc;
  436. font-weight: bold;
  437. }
  438. .box-item .box-name {
  439. font-size: 12px;
  440. }
  441. }
  442. .center-area {
  443. width: 100%;
  444. padding: 10px;
  445. background-color: #FFF;
  446. margin-bottom: 2px;
  447. box-sizing: border-box;
  448. .bot-title {
  449. height: 28px;
  450. margin-bottom: 5px;
  451. display: flex;
  452. justify-content: space-between;
  453. align-items: center;
  454. }
  455. .echartBox {
  456. width: 100%;
  457. height: 220px;
  458. }
  459. }
  460. .bot-area {
  461. width: 100%;
  462. padding: 10px;
  463. background-color: #FFF;
  464. margin-bottom: 2px;
  465. box-sizing: border-box;
  466. .bot-title {
  467. height: 28px;
  468. margin-bottom: 5px;
  469. display: flex;
  470. justify-content: space-between;
  471. align-items: center;
  472. }
  473. .bot-content {
  474. width: 100%;
  475. height: 240px;
  476. .h-table {
  477. width: 100%;
  478. height: 100%;
  479. border: 1px solid #0eb4fc;
  480. .table-head {
  481. display: flex;
  482. justify-content: space-between;
  483. align-items: center;
  484. height: 36px;
  485. border-bottom: 1px solid #0eb4fc;
  486. .head-item {
  487. font-size: 12px;
  488. color: #0eb4fc;
  489. display: flex;
  490. justify-content: center;
  491. align-items: center;
  492. font-weight: bold;
  493. &:nth-child(1) {
  494. width: 30%;
  495. }
  496. &:nth-child(2) {
  497. width: 20%;
  498. }
  499. &:nth-child(3) {
  500. width: 20%;
  501. }
  502. &:nth-child(4) {
  503. width: 30%;
  504. }
  505. }
  506. .head-item1 {
  507. font-size: 12px;
  508. color: #0eb4fc;
  509. display: flex;
  510. justify-content: center;
  511. align-items: center;
  512. font-weight: bold;
  513. &:nth-child(1) {
  514. width: 30%;
  515. }
  516. &:nth-child(2) {
  517. width: 30%;
  518. }
  519. &:nth-child(3) {
  520. width: 40%;
  521. }
  522. }
  523. }
  524. .table-content {
  525. height: calc(100% - 36px);
  526. overflow-y: auto;
  527. .content-tr {
  528. height: 32px;
  529. display: flex;
  530. justify-content: space-between;
  531. align-items: center;
  532. &:nth-child(odd) {
  533. background-color: #f3faff;
  534. }
  535. &:nth-child(even) {
  536. background-color: #e8f5ff;
  537. }
  538. .content-td {
  539. height: 100%;
  540. font-size: 12px;
  541. display: flex;
  542. justify-content: center;
  543. align-items: center;
  544. text-align: center;
  545. }
  546. .td {
  547. width: 30%;
  548. }
  549. .td1 {
  550. width: 20%;
  551. }
  552. .td2 {
  553. width: 20%;
  554. }
  555. .td3 {
  556. width: 30%;
  557. }
  558. }
  559. }
  560. }
  561. }
  562. }
  563. }
  564. </style>