fire-detail-out.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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. <LineChart :chartData="option" :style="{ width: '100%' }"></LineChart>
  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
  30. class="head-item"
  31. v-for="(items, index) in headList"
  32. :key="index"
  33. >{{ items.title }}</view
  34. >
  35. </view>
  36. <view class="table-head" v-else>
  37. <view
  38. class="head-item1"
  39. v-for="(items, index) in headList1"
  40. :key="index"
  41. >{{ items.title }}
  42. </view>
  43. </view>
  44. <view class="table-content">
  45. <view
  46. class="content-tr"
  47. v-if="item.title == '烟雾传感器监测'"
  48. v-for="(ite, ind) in tableDataYw"
  49. :key="ind"
  50. >
  51. <view class="content-td td">{{ ite.strinstallpos }}</view>
  52. <view class="content-td td1">{{ ite.val }}</view>
  53. <view class="content-td td2">{{ ite.warnLevel_str }}</view>
  54. <view class="content-td td3">{{ ite.readTime }}</view>
  55. </view>
  56. <view
  57. class="content-tr"
  58. v-if="item.title == '一氧化碳传感器监测'"
  59. v-for="(ite, ind) in tableDataCo"
  60. :key="ind"
  61. >
  62. <view class="content-td td">{{ ite.strinstallpos }}</view>
  63. <view class="content-td td1">{{ ite.warnLevel_str }}</view>
  64. <view class="content-td td2">{{ ite.readTime }}</view>
  65. </view>
  66. <view
  67. class="content-tr"
  68. v-if="item.title == '自动喷淋灭火装置监测'"
  69. v-for="(ite, ind) in tableDataPl"
  70. :key="ind"
  71. >
  72. <view class="content-td td">{{ ite.strinstallpos }}</view>
  73. <view class="content-td td1">{{ ite.warnLevel_str }}</view>
  74. <view class="content-td td2">{{ ite.readTime }}</view>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. </template>
  82. <script>
  83. import api from "@/api/api";
  84. export default {
  85. name: "fireDetailOut",
  86. props: {
  87. detailWy: {
  88. type: Object,
  89. default: () => {
  90. return {};
  91. },
  92. },
  93. },
  94. data() {
  95. return {
  96. option: "",
  97. myChart: null,
  98. xData: [],
  99. yData: [],
  100. cardList: [
  101. { name: "最高温度()", value: 0 },
  102. { name: "最低温度()", value: 0 },
  103. { name: "平均温度()", value: 0 },
  104. { name: "状态", value: "正常" },
  105. ],
  106. botList: [
  107. { title: "烟雾传感器监测" },
  108. { title: "一氧化碳传感器监测" },
  109. { title: "自动喷淋灭火装置监测" },
  110. ],
  111. headList: [
  112. { title: "设备名称" },
  113. { title: "值" },
  114. { title: "状态" },
  115. { title: "时间" },
  116. ],
  117. headList1: [{ title: "设备名称" }, { title: "状态" }, { title: "时间" }],
  118. tableDataYw: [],
  119. tableDataCo: [],
  120. tableDataPl: [],
  121. };
  122. },
  123. watch: {
  124. detailWy: {
  125. handler(newW, oldW) {
  126. console.log(newW, "newW--------------");
  127. let that = this;
  128. that.xData = [];
  129. that.yData = [];
  130. if (JSON.stringify(newW) != "{}") {
  131. if (newW.fiber.length != 0) {
  132. that.cardList[0].value = newW.fiber[0].readData.fmax;
  133. that.cardList[1].value = newW.fiber[0].readData.fmin;
  134. that.cardList[2].value = newW.fiber[0].readData.favg;
  135. that.cardList[3].value = newW.fiber[0].warnFlag
  136. ? "存在风险"
  137. : "正常";
  138. JSON.parse(newW.fiber[0].readData.fibreTemperature).forEach(
  139. (el) => {
  140. that.xData.push(el.pos);
  141. that.yData.push(el.value);
  142. this.initChart();
  143. }
  144. );
  145. } else {
  146. that.cardList[0].value = "--";
  147. that.cardList[1].value = "--";
  148. that.cardList[2].value = "--";
  149. that.cardList[3].value = "正常";
  150. }
  151. if (newW.smoke.length != 0) {
  152. that.tableDataYw = newW.smoke.map((el) => {
  153. return {
  154. strinstallpos: el.strinstallpos,
  155. val: el.readData.smokeval,
  156. warnLevel_str:
  157. el.warnLevel_str == "正常" ? "低风险" : el.warnLevel_str,
  158. readTime: el.readTime,
  159. };
  160. });
  161. } else {
  162. that.tableDataYw = [];
  163. }
  164. if (newW.co.length != 0) {
  165. that.tableDataCo = newW.co;
  166. } else {
  167. that.tableDataCo = [];
  168. }
  169. if (newW.spray.length != 0) {
  170. that.tableDataPl = newW.spray;
  171. } else {
  172. that.tableDataPl = [];
  173. }
  174. }
  175. },
  176. immediate: true,
  177. deep: true,
  178. },
  179. },
  180. mounted() {},
  181. methods: {
  182. //初始化echarts实例
  183. initChart() {
  184. this.option = {
  185. categories: this.xData.slice(-10) || [],
  186. series: [
  187. {
  188. name: "当前温度",
  189. data: this.yData.slice(-10) || [],
  190. },
  191. ],
  192. };
  193. },
  194. },
  195. computed: {},
  196. };
  197. </script>
  198. <style lang="scss" scoped>
  199. .fire-detail-out {
  200. width: 100%;
  201. height: 100%;
  202. // box-sizing: border-box;
  203. // overflow-y: auto;
  204. .top-area {
  205. width: 100%;
  206. padding: 10px;
  207. background-color: #fff;
  208. margin-bottom: 2px;
  209. box-sizing: border-box;
  210. .top-card {
  211. width: 100%;
  212. display: flex;
  213. justify-content: flex-start;
  214. align-items: flex-start;
  215. flex-wrap: wrap;
  216. .card-box {
  217. width: calc(50% - 5px);
  218. height: 60px;
  219. border-radius: 5px;
  220. background: linear-gradient(
  221. to right,
  222. rgba(55, 135, 254, 0.08),
  223. rgba(4, 184, 255, 0.08),
  224. rgba(60, 161, 237, 0.08)
  225. );
  226. &:nth-child(1) {
  227. margin-bottom: 10px;
  228. margin-right: 5px;
  229. }
  230. &:nth-child(2) {
  231. margin-bottom: 10px;
  232. margin-left: 5px;
  233. }
  234. &:nth-child(3) {
  235. margin-right: 5px;
  236. }
  237. &:nth-child(4) {
  238. margin-left: 5px;
  239. }
  240. }
  241. .card-box:nth-child(1) .box-item {
  242. display: flex;
  243. flex-direction: column;
  244. justify-content: center;
  245. align-items: flex-start;
  246. width: 100%;
  247. height: 100%;
  248. padding: 0px 15px;
  249. background: url("/static/zgwd.png") no-repeat right;
  250. background-size: auto 80%;
  251. }
  252. .card-box:nth-child(2) .box-item {
  253. display: flex;
  254. flex-direction: column;
  255. justify-content: center;
  256. align-items: flex-start;
  257. width: 100%;
  258. height: 100%;
  259. padding: 0px 15px;
  260. background: url("/static/zdwd.png") no-repeat right;
  261. background-size: auto 80%;
  262. }
  263. .card-box:nth-child(3) .box-item {
  264. display: flex;
  265. flex-direction: column;
  266. justify-content: center;
  267. align-items: flex-start;
  268. width: 100%;
  269. height: 100%;
  270. padding: 0px 15px;
  271. background: url("/static/pjwd.png") no-repeat right;
  272. background-size: auto 80%;
  273. }
  274. .card-box:nth-child(4) .box-item {
  275. display: flex;
  276. flex-direction: column;
  277. justify-content: center;
  278. align-items: flex-start;
  279. width: 100%;
  280. height: 100%;
  281. padding: 0px 15px;
  282. background: url("/static/zt.png") no-repeat right;
  283. background-size: auto 80%;
  284. }
  285. }
  286. .box-item .box-val {
  287. height: 28px;
  288. line-height: 28px;
  289. color: #0eb4fc;
  290. font-weight: bold;
  291. }
  292. .box-item .box-name {
  293. font-size: 12px;
  294. }
  295. }
  296. .center-area {
  297. width: 100%;
  298. padding: 10px;
  299. background-color: #fff;
  300. margin-bottom: 2px;
  301. box-sizing: border-box;
  302. .bot-title {
  303. height: 28px;
  304. margin-bottom: 5px;
  305. display: flex;
  306. justify-content: space-between;
  307. align-items: center;
  308. }
  309. .echartBox {
  310. width: 100%;
  311. height: 220px;
  312. }
  313. }
  314. .bot-area {
  315. width: 100%;
  316. padding: 10px;
  317. background-color: #fff;
  318. margin-bottom: 2px;
  319. box-sizing: border-box;
  320. .bot-title {
  321. height: 28px;
  322. margin-bottom: 5px;
  323. display: flex;
  324. justify-content: space-between;
  325. align-items: center;
  326. }
  327. .bot-content {
  328. width: 100%;
  329. height: 240px;
  330. .h-table {
  331. width: 100%;
  332. height: 100%;
  333. border: 1px solid #0eb4fc;
  334. .table-head {
  335. display: flex;
  336. justify-content: space-between;
  337. align-items: center;
  338. height: 36px;
  339. border-bottom: 1px solid #0eb4fc;
  340. .head-item {
  341. font-size: 12px;
  342. color: #0eb4fc;
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. font-weight: bold;
  347. &:nth-child(1) {
  348. width: 30%;
  349. }
  350. &:nth-child(2) {
  351. width: 20%;
  352. }
  353. &:nth-child(3) {
  354. width: 20%;
  355. }
  356. &:nth-child(4) {
  357. width: 30%;
  358. }
  359. }
  360. .head-item1 {
  361. font-size: 12px;
  362. color: #0eb4fc;
  363. display: flex;
  364. justify-content: center;
  365. align-items: center;
  366. font-weight: bold;
  367. &:nth-child(1) {
  368. width: 30%;
  369. }
  370. &:nth-child(2) {
  371. width: 30%;
  372. }
  373. &:nth-child(3) {
  374. width: 40%;
  375. }
  376. }
  377. }
  378. .table-content {
  379. height: calc(100% - 36px);
  380. overflow-y: auto;
  381. .content-tr {
  382. height: 80px;
  383. display: flex;
  384. justify-content: space-between;
  385. align-items: center;
  386. &:nth-child(odd) {
  387. background-color: #f3faff;
  388. }
  389. &:nth-child(even) {
  390. background-color: #e8f5ff;
  391. }
  392. .content-td {
  393. height: 100%;
  394. font-size: 12px;
  395. display: flex;
  396. justify-content: center;
  397. align-items: center;
  398. text-align: center;
  399. }
  400. .td {
  401. width: 30%;
  402. }
  403. .td1 {
  404. width: 20%;
  405. }
  406. .td2 {
  407. width: 20%;
  408. }
  409. .td3 {
  410. width: 30%;
  411. }
  412. }
  413. }
  414. }
  415. }
  416. }
  417. }
  418. </style>