power-review-home.vue 3.2 KB

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