BasicInformationDetail.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. props:{
  59. alarms:Object,
  60. },
  61. data() {
  62. return {
  63. BasicInfo: {},
  64. temperatureInfo: new Array() /* 温度信息 */,
  65. pitchInfo: new Array() /* 变桨信息 */,
  66. generalInfo: new Array() /* 基本信息 */,
  67. powerGridInfo: new Array() /* 电网信息 */,
  68. };
  69. },
  70. methods: {
  71. start(bi) {
  72. this.BasicInfo = bi;
  73. this.bindData();
  74. this.refreshData();
  75. this.refreshTimer = setInterval(this.refreshData, 3000);
  76. },
  77. end() {
  78. clearInterval(this.refreshTimer);
  79. },
  80. /* 刷新数据 */
  81. refreshData() {
  82. var bg = BackgroundData.getInstance();
  83. bg.initWinturbineBaseData(this.BasicInfo, this.onMessage);
  84. },
  85. /* 获得数据 */
  86. onMessage(msg) {
  87. this.BasicInfo.BasicInfo.forEach((element) => {
  88. element.param.forEach((im) => {
  89. var val = msg[im.code];
  90. if (typeof val !== "undefined") {
  91. if (im.unit == "万度") {
  92. im.value = (val.doubleValue / 10000).toFixed(2);
  93. } else {
  94. im.value = val.doubleValue.toFixed(2);
  95. }
  96. }
  97. });
  98. });
  99. console.log(msg);
  100. },
  101. bindData() {
  102. this.BasicInfo.BasicInfo.forEach((element) => {
  103. if (element.tag == "基本信息") {
  104. this.generalInfo = element.param;
  105. } else if (element.tag == "温度信息") {
  106. this.temperatureInfo = element.param;
  107. } else if (element.tag == "电网信息") {
  108. this.powerGridInfo = element.param;
  109. } else if (element.tag == "桨叶信息") {
  110. this.pitchInfo = element.param;
  111. }
  112. });
  113. },
  114. },
  115. };
  116. </script>
  117. <style scoped>
  118. .firstdiv {
  119. height: 50vh;
  120. }
  121. .onediv {
  122. float: right;
  123. margin-right: 30px;
  124. }
  125. .twodiv {
  126. float: right;
  127. margin-right: 30px;
  128. }
  129. td:nth-child(1) {
  130. height: 25px;
  131. width: 130px;
  132. text-align: right;
  133. }
  134. td:nth-child(2) {
  135. width: 78px;
  136. text-align: right;
  137. color: rgb(5, 176, 71);
  138. }
  139. td:nth-child(3) {
  140. text-align: center;
  141. width: 30px;
  142. }
  143. tr:nth-child(1) {
  144. font-size: 20px;
  145. width: 90px;
  146. text-align: right;
  147. }
  148. th {
  149. height: 40px;
  150. }
  151. table{
  152. margin-top: 30px;
  153. }
  154. </style>