fire-detail-out.vue 13 KB

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