BasicInformationDetail.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <div class="firstdiv">
  3. <img
  4. style="float: left; margin-left: 40px; margin-top: 90px;width:50vh;height:25vh;"
  5. src="../../../assets/img/WindturbineDetailPages/变桨.png"
  6. object-fit="fill"
  7. />
  8. <div class="twodiv">
  9. <table>
  10. <tr>
  11. <th>温度信息</th>
  12. </tr>
  13. <tr v-for="itm in temperatureInfo" :key="itm">
  14. <td>{{ itm.name }}</td>
  15. <td>{{ itm.value }}</td>
  16. <td>{{ itm.unit }}</td>
  17. </tr>
  18. </table>
  19. <table v-if="pitchInfo.length > 0">
  20. <tr>
  21. <th>变桨信息</th>
  22. </tr>
  23. <tr v-for="itm in pitchInfo" :key="itm">
  24. <td>{{ itm.name }}</td>
  25. <td>{{ itm.value }}</td>
  26. <td>{{ itm.unit }}</td>
  27. </tr>
  28. </table>
  29. </div>
  30. <div class="onediv">
  31. <table>
  32. <tr>
  33. <th>基本信息</th>
  34. </tr>
  35. <tr v-for="itm in generalInfo" :key="itm">
  36. <td>{{ itm.name }}</td>
  37. <td>{{ itm.value }}</td>
  38. <td>{{ itm.unit }}</td>
  39. </tr>
  40. </table>
  41. <table>
  42. <tr>
  43. <th>电网信息</th>
  44. </tr>
  45. <tr v-for="itm in powerGridInfo" :key="itm">
  46. <td>{{ itm.name }}</td>
  47. <td>{{ itm.value }}</td>
  48. <td>{{ itm.unit }}</td>
  49. </tr>
  50. </table>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. import BackgroundData from "../../../assets/script/BackgroundData";
  56. export default {
  57. name: "BasicInformationDetail",
  58. data() {
  59. return {
  60. BasicInfo: {},
  61. temperatureInfo: new Array() /* 温度信息 */,
  62. pitchInfo: new Array() /* 变桨信息 */,
  63. generalInfo: new Array() /* 基本信息 */,
  64. powerGridInfo: new Array() /* 电网信息 */,
  65. };
  66. },
  67. methods: {
  68. start(bi) {
  69. this.BasicInfo = bi;
  70. this.bindData();
  71. this.refreshData();
  72. this.refreshTimer = setInterval(this.refreshData, 3000);
  73. },
  74. end() {
  75. clearInterval(this.refreshTimer);
  76. },
  77. /* 刷新数据 */
  78. refreshData() {
  79. var bg = BackgroundData.getInstance();
  80. bg.initWinturbineBaseData(this.BasicInfo, this.onMessage);
  81. },
  82. /* 获得数据 */
  83. onMessage(msg) {
  84. this.BasicInfo.BasicInfo.forEach((element) => {
  85. element.param.forEach((im) => {
  86. var val = msg[im.code];
  87. if (typeof val !== "undefined") {
  88. if (im.unit == "万度") {
  89. im.value = (val.doubleValue / 10000).toFixed(2);
  90. } else {
  91. im.value = val.doubleValue.toFixed(2);
  92. }
  93. }
  94. });
  95. });
  96. console.log(msg);
  97. },
  98. bindData() {
  99. this.BasicInfo.BasicInfo.forEach((element) => {
  100. if (element.tag == "基本信息") {
  101. this.generalInfo = element.param;
  102. } else if (element.tag == "温度信息") {
  103. this.temperatureInfo = element.param;
  104. } else if (element.tag == "电网信息") {
  105. this.powerGridInfo = element.param;
  106. } else if (element.tag == "桨叶信息") {
  107. this.pitchInfo = element.param;
  108. }
  109. });
  110. },
  111. },
  112. };
  113. </script>
  114. <style scoped>
  115. .firstdiv {
  116. height: 49vh;
  117. }
  118. .onediv {
  119. float: right;
  120. margin-right: 30px;
  121. }
  122. .twodiv {
  123. float: right;
  124. margin-right: 30px;
  125. }
  126. td:nth-child(1) {
  127. height: 25px;
  128. width: 130px;
  129. text-align: right;
  130. }
  131. td:nth-child(2) {
  132. width: 78px;
  133. text-align: right;
  134. color: rgb(5, 176, 71);
  135. }
  136. td:nth-child(3) {
  137. text-align: center;
  138. width: 30px;
  139. }
  140. tr:nth-child(1) {
  141. font-size: 20px;
  142. width: 90px;
  143. text-align: right;
  144. }
  145. th {
  146. height: 40px;
  147. }
  148. table{
  149. margin-top: 30px;
  150. }
  151. </style>