ProblemArea.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /* 问题区 */
  2. <template>
  3. <gy-card
  4. title="问题区"
  5. area-style="problem"
  6. circle-style="green"
  7. content-style="89"
  8. @parentRun="run"
  9. @contextmenu="contextmenu"
  10. >
  11. <ProblemMatrixCard title="故障" :type="5"></ProblemMatrixCard>
  12. <ProblemMatrixCard title="维护" :type="6"></ProblemMatrixCard>
  13. <ProblemMatrixCard title="离线" :type="7"></ProblemMatrixCard>
  14. <ProblemMatrixCard title="挂牌" :type="-1"></ProblemMatrixCard>
  15. </gy-card>
  16. </template>
  17. <script>
  18. import ProblemMatrixCard from "./windturbine/problem/ProblemMatrixCard.vue";
  19. import BackgroundData from "../../assets/script/BackgroundData";
  20. export default {
  21. name: "ProblemArea",
  22. components: {
  23. ProblemMatrixCard,
  24. },
  25. props: {},
  26. data() {
  27. return {
  28. ls: {
  29. maintain: { key: "维护", value: [] },
  30. malfunction: { key: "故障", value: [] },
  31. offline: { key: "离线", value: [] },
  32. lockd: { key: "挂牌", value: [] },
  33. },
  34. };
  35. },
  36. computed: {},
  37. created: function () {
  38. this.initData();
  39. },
  40. methods: {
  41. /* 右键菜单 */
  42. contextmenu() {
  43. const { remote } = require("electron");
  44. var that = this;
  45. const menuTemplate = [
  46. {
  47. label: "标注",
  48. click() {
  49. that.menuClicked({ type: "marking" });
  50. },
  51. },
  52. {
  53. label: "挂牌",
  54. submenu: [
  55. {
  56. label: "检修",
  57. click() {
  58. that.menuClicked({ type: "lock", value: 8 });
  59. },
  60. },
  61. {
  62. label: "故障维修",
  63. click() {
  64. that.menuClicked({ type: "lock", value: 7 });
  65. },
  66. },
  67. {
  68. label: "场内受累检修",
  69. click() {
  70. that.menuClicked({ type: "lock", value: 2 });
  71. },
  72. },
  73. {
  74. label: "场内受累故障",
  75. click() {
  76. that.menuClicked({ type: "lock", value: 3 });
  77. },
  78. },
  79. {
  80. label: "场外受累电网",
  81. click() {
  82. that.menuClicked({ type: "lock", value: 4 });
  83. },
  84. },
  85. {
  86. label: "场外受累天气",
  87. click() {
  88. that.menuClicked({ type: "lock", value: 5 });
  89. },
  90. },
  91. ],
  92. },
  93. {
  94. label: "取消挂牌",
  95. click() {
  96. that.menuClicked({ type: "unlock" });
  97. },
  98. },
  99. ];
  100. const menu = remote.Menu.buildFromTemplate(menuTemplate);
  101. menu.popup(remote.getCurrentWindow());
  102. },
  103. menuClicked(msg) {
  104. var bd = BackgroundData.getInstance();
  105. if (!bd.LoginUser) {
  106. bd.showdialog("提示", "控制出现错误:", "未登录");
  107. return;
  108. }
  109. if (msg.type == "lock") {
  110. // 挂牌
  111. } else if (msg.type == "unlock") {
  112. // 取消挂牌
  113. } else if (msg.type == "marking") {
  114. // 标注
  115. }
  116. },
  117. },
  118. };
  119. </script>