power-plan.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <template>
  2. <div class="power-plan">
  3. <tab @select="selectionItemClick" :data="tabs" class="power-plan-tab" />
  4. <row>
  5. <Col :span="12">
  6. <percent-card-2 :title="'月完成率' + parseInt((planData.yfdl / planData.yfdljh * 100)) + '%'" TotalText="实际"
  7. ActualText="计划" :TotalValue="planData.yfdl" :ActualValue="planData.yfdljh" :percent="planData.ywcl" />
  8. </Col>
  9. <Col :span="12">
  10. <percent-card-2 :title="'年完成率' + parseInt((planData.nfdl / planData.nfdljh * 100)) + '%'" TotalText="实际"
  11. ActualText="计划" :TotalValue="planData.nfdl" :ActualValue="planData.nfdljh" :percent="planData.nwcl" />
  12. </Col>
  13. </row>
  14. </div>
  15. </template>
  16. <script>
  17. import Col from "@/components/coms/grid/col.vue";
  18. import Row from "@/components/coms/grid/row.vue";
  19. import Tab from "@/components/coms/tabs/tab.vue";
  20. import PercentCard2 from "../../../components/coms/cards/percent-card-2.vue";
  21. export default {
  22. components: { Row, Col, Tab, PercentCard2 },
  23. data () {
  24. return {
  25. planData: {},
  26. // tab项
  27. tabs: [
  28. {
  29. id: "1",
  30. text: "风电"
  31. }
  32. ],
  33. // 月计划完成率
  34. monthPlan: {
  35. plan: 100,
  36. actual: 40,
  37. },
  38. // 年计划完成率
  39. yearPlan: {
  40. plan: 100,
  41. actual: 25,
  42. },
  43. };
  44. },
  45. props: {
  46. data: {
  47. type: Object,
  48. default: () => { }
  49. }
  50. },
  51. mounted () {
  52. this.planData = this.data;
  53. },
  54. methods: {
  55. selectionItemClick (item) {
  56. // 点击tab选项 模拟数据变化
  57. // 动态改变子组件数据变化
  58. this.monthPlan = {
  59. plan: 100,
  60. actual: 25,
  61. };
  62. this.yearPlan = {
  63. plan: 100,
  64. actual: 45,
  65. };
  66. },
  67. },
  68. watch: {
  69. data (res) {
  70. this.planData = res;
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="less">
  76. .power-plan {
  77. padding: 0 1.481vh;
  78. .power-plan-tab {
  79. margin-bottom: 2.222vh;
  80. }
  81. }
  82. </style>