power-review-home.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. :value="item.value"
  9. :max="item.max"
  10. height="10vh"
  11. @click="openDialog(item.dialogTitle)"
  12. />
  13. </Col>
  14. </Row>
  15. </div>
  16. </template>
  17. <script>
  18. import Col from "@/components/coms/grid/col.vue";
  19. import Row from "../../../components/coms/grid/row.vue";
  20. import DashPieChart from "@/components/chart/pie/dash-pie-chart.vue";
  21. import { FindGroupRealtime } from "@/api/home/home.js";
  22. import dayjs from "dayjs";
  23. export default {
  24. components: {
  25. Row,
  26. Col,
  27. DashPieChart,
  28. },
  29. data() {
  30. return {
  31. // 功率复核数据
  32. PowerLoad: [],
  33. valuelist: [
  34. {
  35. value: "value1",
  36. name: "清洁能源",
  37. },
  38. {
  39. value: "value2",
  40. name: "风电功率详情",
  41. },
  42. {
  43. value: "value3",
  44. name: "光伏功率详情",
  45. },
  46. ],
  47. wpId: "",
  48. };
  49. },
  50. props: {
  51. data: {
  52. type: Array,
  53. default: () => [],
  54. },
  55. id: {
  56. type: String,
  57. defaylt: "",
  58. },
  59. },
  60. mounted() {
  61. this.PowerLoad = this.data;
  62. this.wpId = this.id;
  63. },
  64. methods: {
  65. openDialog(dialogTitle) {
  66. let data = {
  67. wpId: this.wpId,
  68. };
  69. let obj = this.valuelist.find((item) => item.name == dialogTitle);
  70. FindGroupRealtime(data).then(({ data }) => {
  71. this.$emit("chartClick", {
  72. dialogTitle,
  73. // dialogType,
  74. data: data.map((item) => {
  75. return {
  76. dateTime: dayjs()
  77. .startOf("date")
  78. .add(item.hours, "hour")
  79. .format("MM-DD HH:mm"),
  80. value: item[obj.value],
  81. };
  82. }),
  83. });
  84. });
  85. },
  86. },
  87. watch: {
  88. data(res) {
  89. this.PowerLoad = res;
  90. },
  91. id(res) {
  92. this.wpId = res;
  93. },
  94. },
  95. };
  96. </script>
  97. <style lang="less" scoped>
  98. .power-review {
  99. padding: 15px 10px 10px 10px;
  100. }
  101. .col + .col {
  102. margin-left: 0px;
  103. }
  104. </style>