gasCard.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div>
  3. <top-header></top-header>
  4. <div class="mainbox">
  5. <div class="gas-container">
  6. <!-- <div class="return-back">返回</div> -->
  7. <return-back></return-back>
  8. <h3>可燃气体监控实时信息</h3>
  9. <p>更新时间:2021-06-15 13:25:00</p>
  10. <div>
  11. <ul class="cardTabs">
  12. <li @click="Inv = 0" :class="{ active: Inv === 0 }">数据列表</li>
  13. <li @click="Inv = 1" :class="{ active: Inv === 1 }">数据可视化</li>
  14. </ul>
  15. <div class="tabBox">
  16. <div>
  17. <div v-if="Inv == 1" class="lineChart gas-data">
  18. <line-chart></line-chart>
  19. </div>
  20. <table v-if="Inv == 0">
  21. <tr>
  22. <th>名称</th>
  23. <th>设备位置</th>
  24. <th>浓度</th>
  25. <th>告警状态</th>
  26. </tr>
  27. <tr>
  28. <td>{{ getData.DeviceType }}</td>
  29. <td>位置BBBBBB</td>
  30. <td>0.00%LEL</td>
  31. <td>正常</td>
  32. </tr>
  33. <!-- <tr>
  34. <td>一氧化碳</td>
  35. <td>位置CCCCC</td>
  36. <td>0.00%LEL</td>
  37. <td>正常</td>
  38. </tr>
  39. <tr>
  40. <td>一氧化碳</td>
  41. <td>位置AAAAAAA</td>
  42. <td>0.00%LEL</td>
  43. <td>正常</td>
  44. </tr> -->
  45. </table>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import topHeader from "@/components/topHeader";
  55. import lineChart from "./components/lineChart";
  56. import returnBack from "@/components/returnBack";
  57. export default {
  58. name: "index",
  59. components: {
  60. topHeader,
  61. returnBack,
  62. lineChart,
  63. },
  64. data() {
  65. return {
  66. Inv: 0,
  67. DeviceID: "",
  68. getData: {},
  69. StationID: "",
  70. };
  71. },
  72. watch: {
  73. "$store.state.wsInfo"(val) {
  74. this.messageHandle(val);
  75. },
  76. },
  77. computed: {
  78. },
  79. created() {
  80. this.DeviceID = this.$route.query.DeviceID;
  81. this.StationID = this.$store.state.StationID;
  82. console.log("DeviceID");
  83. console.log(this.DeviceID);
  84. this.global.sendWs({
  85. CMD: "getDeviceDetail",
  86. StationID: this.StationID,
  87. // StationID: "7c9c30af-6132-43d1-98fb-020395183094",
  88. DeviceID: this.DeviceID,
  89. });
  90. },
  91. methods: {
  92. messageHandle(e) {
  93. if (e.data.search("{") != -1) {
  94. const redata = JSON.parse(e.data);
  95. if (redata.CMD == "getDeviceDetail") {
  96. console.log("redata.RESULT");
  97. console.log(redata.RESULT.Device);
  98. this.getData = redata.RESULT.Device;
  99. }
  100. }
  101. },
  102. },
  103. };
  104. </script>
  105. <!-- Add "scoped" attribute to limit CSS to this component only -->
  106. <style scoped>
  107. </style>