gasCard.vue 2.6 KB

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