gjzb-pie-chart.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <!-- 功率复核 PowerLoad -->
  3. <div
  4. v-for="item in PowerLoad"
  5. :key="item"
  6. style="width: 30%; height: 100%"
  7. class="power-item"
  8. >
  9. <dash-pie-chart
  10. :title="item.title"
  11. :unit="item.unit"
  12. :value="item.value"
  13. :max="item.max"
  14. height="100%"
  15. width="100%"
  16. :color="type == 0 || type == -1 ? 'green' : 'orange'"
  17. @click="openDialog(item.dialogTitle, item.unit)"
  18. />
  19. <div class="title"></div>
  20. </div>
  21. </template>
  22. <script>
  23. import Col from "@/components/coms/grid/col.vue";
  24. // import Row from "../../../components/coms/grid/row.vue";
  25. import DashPieChart from "@/views/Home/components/home/dash-pie-chart.vue";
  26. import { FindGroupRealtime } from "@/api/home/home.js";
  27. import dayjs from "dayjs";
  28. export default {
  29. components: {
  30. // Row,
  31. Col,
  32. DashPieChart,
  33. },
  34. data() {
  35. return {
  36. // 功率复核数据
  37. PowerLoad: [],
  38. valuelist: [
  39. {
  40. value: "SSZGL",
  41. name: "清洁能源实时功率详情",
  42. code: "value1",
  43. sign: 1,
  44. },
  45. {
  46. value: "SSZGL",
  47. name: "风电实时功率详情",
  48. code: "value2",
  49. sign: 1,
  50. },
  51. {
  52. value: "SSZGL",
  53. name: "光伏实时功率详情",
  54. code: "value3",
  55. sign: 1,
  56. },
  57. {
  58. value: "SSPJFS",
  59. name: "实时风速",
  60. code: "value4",
  61. },
  62. {
  63. value: "RPJGZD",
  64. name: "光照强度",
  65. code: "value6",
  66. },
  67. {
  68. value: "SSZGL",
  69. name: "实际功率",
  70. code: "value1",
  71. },
  72. {
  73. value: "FNLYL",
  74. name: "风能利用率",
  75. code: "value7",
  76. },
  77. {
  78. value: "FNLYL",
  79. name: "光能利用率",
  80. code: "value7",
  81. },
  82. ],
  83. wpId: "",
  84. };
  85. },
  86. props: {
  87. type: {
  88. type: Number,
  89. default: 0,
  90. },
  91. data: {
  92. type: Array,
  93. default: () => [],
  94. },
  95. id: {
  96. type: String,
  97. defaylt: "",
  98. },
  99. },
  100. mounted() {
  101. this.PowerLoad = this.data;
  102. this.wpId = this.id;
  103. },
  104. methods: {
  105. openDialog(dialogTitle, unit) {
  106. let obj = this.valuelist.find((item) => item.name == dialogTitle);
  107. let params = {
  108. wpId: this.wpId,
  109. uniformCode: obj.value,
  110. };
  111. FindGroupRealtime(params).then(({ data }) => {
  112. this.$emit("chartClick", {
  113. dialogTitle,
  114. // dialogType,
  115. data: data.map((item) => {
  116. return {
  117. dateTime: dayjs(item.time).format("MM-DD HH:mm"),
  118. value: item[obj.code],
  119. };
  120. }),
  121. chartName: obj.sign ? "实际功率" : obj.dialogTitle,
  122. unit,
  123. });
  124. });
  125. },
  126. },
  127. watch: {
  128. data(res) {
  129. this.PowerLoad = res;
  130. },
  131. id(res) {
  132. this.wpId = res;
  133. },
  134. },
  135. };
  136. </script>
  137. <style lang="less" scoped>
  138. .power-item {
  139. flex: 1;
  140. }
  141. .power-item + .power-item {
  142. margin-left: 0.3vw; //10px
  143. }
  144. .power-review {
  145. padding: 15px 10px 10px 10px;
  146. }
  147. .col + .col {
  148. margin-left: 0px;
  149. }
  150. </style>