ProblemArea.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* 问题区 */
  2. <template>
  3. <gy-card
  4. title="问题区"
  5. area-style="problem"
  6. circle-style="green"
  7. content-style="89"
  8. @parentRun="run"
  9. >
  10. <MatrixCard title="故障" :datas="ls.malfunction"></MatrixCard>
  11. <MatrixCard title="维护" :datas="ls.maintain"></MatrixCard>
  12. <MatrixCard title="离线" :datas="ls.offline"></MatrixCard>
  13. <MatrixCard title="挂牌" :datas="ls.lockd"></MatrixCard>
  14. </gy-card>
  15. </template>
  16. <script>
  17. import MatrixCard from "./windturbine/MatrixCard.vue";
  18. import MessageBridge from "../../assets/script/MessageBridge";
  19. export default {
  20. name: "ProblemArea",
  21. components: {
  22. MatrixCard,
  23. },
  24. props: {},
  25. data() {
  26. return {
  27. ls: {
  28. maintain: { key: "维护", value: [] },
  29. malfunction: { key: "故障", value: [] },
  30. offline: { key: "离线", value: [] },
  31. lockd: { key: "挂牌", value: [] },
  32. },
  33. datas: new Array(),
  34. };
  35. },
  36. computed: {
  37. },
  38. created: function () {
  39. this.initData();
  40. },
  41. methods: {
  42. initData: function () {
  43. var mb = MessageBridge.getInstance();
  44. var vs = [{ key: "/topic/windturbine", action: this.windturbineMessage }];
  45. mb.register(vs);
  46. },
  47. windturbineMessage(msg) {
  48. var ll = {
  49. maintain: { key: "维护", value: [] },
  50. malfunction: { key: "故障", value: [] },
  51. offline: { key: "离线", value: [] },
  52. lockd: { key: "挂牌", value: [] },
  53. }
  54. var mmsg = JSON.parse(msg);
  55. for (var id in mmsg) {
  56. var val = mmsg[id];
  57. if (val.status == 6) {
  58. // 维护
  59. ll.maintain.value.push(val);
  60. } else if (val.status == 7) {
  61. // 离线
  62. ll.offline.value.push(val);
  63. } else if (val.status == 5) {
  64. // 故障
  65. ll.malfunction.value.push(val);
  66. }
  67. if (val.lockValue > 0) {
  68. // 挂牌
  69. ll.lockd.value.push(val);
  70. }
  71. }
  72. this.ls=ll;
  73. },
  74. },
  75. };
  76. </script>