percent-card-2.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div class="percent-card">
  3. <div class="card-chart">
  4. <percent-bar
  5. width="5.926vh"
  6. height="5.926vh"
  7. :value="percent"
  8. :color="color"
  9. />
  10. <div class="card-title gray">{{ title }}</div>
  11. </div>
  12. <div class="card-info">
  13. <div class="card-value">
  14. <span class="value-text gray">{{ TotalText }}</span>
  15. <span class="white">{{ TotalValue }}</span>
  16. </div>
  17. <div class="card-value">
  18. <span class="value-text gray">{{ ActualText }}</span>
  19. <span class="white">{{ ActualValue }}</span>
  20. </div>
  21. </div>
  22. </div>
  23. </template>
  24. <script>
  25. // 百分比card2
  26. // 使用位置 驾驶舱首页 计划电量完成情况 中的百分比卡片
  27. import PercentBar from "../../chart/bar/percent-bar.vue";
  28. export default {
  29. created() {
  30. },
  31. components: {
  32. PercentBar,
  33. },
  34. props: {
  35. title: {
  36. type: String,
  37. default: "月计划完成率",
  38. },
  39. TotalText: {
  40. type: String,
  41. default: "实际",
  42. },
  43. TotalValue: {
  44. type: Number,
  45. String,
  46. default: 0,
  47. },
  48. ActualText: {
  49. type: String,
  50. default: "计划",
  51. },
  52. ActualValue: {
  53. type: Number,
  54. String,
  55. default: 0,
  56. },
  57. color: {
  58. type: String,
  59. default: "green",
  60. },
  61. },
  62. computed: {
  63. percent() {
  64. return this.TotalValue=== 0? 0 :parseInt((this.TotalValue / this.ActualValue) * 100);
  65. },
  66. },
  67. };
  68. </script>
  69. <style lang="less" scoped>
  70. .percent-card {
  71. display: flex;
  72. .card-chart {
  73. flex: 1 1 5.926vh;
  74. }
  75. .card-title {
  76. text-align: center;
  77. width: 100%;
  78. margin-top: 1.481vh;
  79. font-size: 12px;
  80. }
  81. .card-info {
  82. flex: auto;
  83. align-self: center;
  84. margin-left: 0.741vh;
  85. margin-top: -2.2222vh;
  86. .card-value {
  87. font-size: @fontsize-s;
  88. font-weight: 600;
  89. margin-bottom: 1.1111vh;
  90. white-space: nowrap;
  91. .value-text {
  92. margin-right: 0.741vh;
  93. font-family: @font-family-num;
  94. }
  95. }
  96. .card-text {
  97. font-size: @fontsize;
  98. }
  99. }
  100. }
  101. </style>