power-plan.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <div class="power-plan">
  3. <!-- <tab @select="selectionItemClick" :data="currTabs" class="power-plan-tab" /> -->
  4. <row
  5. style="margin-top: 47px"
  6. @click="
  7. openDialog(
  8. '计划电量完成详情',
  9. 'genreset/findProjectPlanPower',
  10. 'doneLineChart'
  11. )
  12. "
  13. >
  14. <Col :span="12">
  15. <!-- <percent-card-2 :title="'月完成率' + parseInt((planData.yfdl / planData.yfdljh) * 100) + '%'" TotalText="实际" ActualText="计划" :TotalValue="planData.yfdl" :ActualValue="planData.yfdljh" :percent="planData.ywcl" /> -->
  16. <percent-card-2
  17. :title="''"
  18. TotalText="月实际"
  19. ActualText="月计划"
  20. :TotalValue="planData.yfdl"
  21. :ActualValue="planData.yfdljh"
  22. :percent="planData.ywcl"
  23. />
  24. </Col>
  25. <Col :span="12">
  26. <!-- <percent-card-2 :title="'年完成率' + parseInt((planData.nfdl / planData.nfdljh) * 100) + '%'" TotalText="实际" ActualText="计划" :TotalValue="planData.nfdl" :ActualValue="planData.nfdljh" :percent="planData.nwcl" /> -->
  27. <percent-card-2
  28. :title="''"
  29. TotalText="年实际"
  30. ActualText="年计划"
  31. :TotalValue="planData.nfdl"
  32. :ActualValue="planData.nfdljh"
  33. :percent="planData.nwcl"
  34. />
  35. </Col>
  36. </row>
  37. </div>
  38. </template>
  39. <script>
  40. import Col from "@/components/coms/grid/col.vue";
  41. import Row from "@/components/coms/grid/row.vue";
  42. import Tab from "@/components/coms/tabs/tab.vue";
  43. import PercentCard2 from "../../../components/coms/cards/percent-card-2.vue";
  44. import api from "@api/cockpit/matrix/index.js";
  45. export default {
  46. components: { Row, Col, Tab, PercentCard2 },
  47. data() {
  48. return {
  49. planData: {},
  50. wpId: "",
  51. showTitle: "",
  52. // tab项
  53. tabs: [
  54. {
  55. id: "1",
  56. text: "",
  57. },
  58. ],
  59. // 月计划完成率
  60. monthPlan: {
  61. plan: 100,
  62. actual: 40,
  63. },
  64. // 年计划完成率
  65. yearPlan: {
  66. plan: 100,
  67. actual: 25,
  68. },
  69. };
  70. },
  71. props: {
  72. showSingle: {
  73. type: Boolean,
  74. default: false,
  75. },
  76. data: {
  77. type: Object,
  78. default: () => {},
  79. },
  80. id: {
  81. type: String,
  82. default: "",
  83. },
  84. title: {
  85. type: String,
  86. default: "",
  87. },
  88. },
  89. computed: {
  90. currTabs() {
  91. if (this.showSingle) {
  92. return [
  93. {
  94. id: "1",
  95. text: "风电",
  96. },
  97. ];
  98. } else return this.tabs;
  99. },
  100. },
  101. mounted() {
  102. this.wpId = this.id;
  103. this.tabs[0].text = this.title;
  104. },
  105. methods: {
  106. selectionItemClick(item) {
  107. // 点击tab选项 模拟数据变化
  108. // 动态改变子组件数据变化
  109. this.monthPlan = {
  110. plan: 100,
  111. actual: 25,
  112. };
  113. this.yearPlan = {
  114. plan: 100,
  115. actual: 45,
  116. };
  117. },
  118. openDialog(dialogTitle, subUrl, dialogType) {
  119. let data = {
  120. id: this.wpId,
  121. };
  122. api.findInfo(subUrl, data).then((res) => {
  123. let key = [
  124. {
  125. key: "value1",
  126. title: "月计划发电量",
  127. },
  128. {
  129. key: "value2",
  130. title: "年计划发电量",
  131. },
  132. {
  133. key: "value3",
  134. title: "月发电量",
  135. },
  136. {
  137. key: "value4",
  138. title: "年发电量",
  139. },
  140. ];
  141. let doneLineChartData = {
  142. // 图表所用单位
  143. units: [""],
  144. value: [],
  145. };
  146. key.forEach((keyEle, keyIndex) => {
  147. doneLineChartData.value.push({
  148. title: keyEle.title,
  149. yAxisIndex: 0, // 使用单位
  150. value: [],
  151. });
  152. res.data.forEach((ele) => {
  153. doneLineChartData.value[keyIndex].value.push({
  154. text: ele.name,
  155. value: ele[keyEle.key],
  156. });
  157. });
  158. });
  159. this.$emit("chartClick", {
  160. dialogTitle,
  161. dialogType,
  162. data: doneLineChartData,
  163. });
  164. });
  165. },
  166. },
  167. watch: {
  168. data(res) {
  169. this.planData = res;
  170. },
  171. id(res) {
  172. this.wpId = res;
  173. },
  174. title(res) {
  175. this.tabs[0].text = res;
  176. },
  177. },
  178. };
  179. </script>
  180. <style lang="less">
  181. .power-plan {
  182. padding: 0 1.481vh;
  183. .power-plan-tab {
  184. margin-bottom: 2.222vh;
  185. }
  186. }
  187. </style>