card-1.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="card-1">
  3. <div class="card-info">
  4. <div class="card-icon svg-icon svg-shadow" :class="'svg-icon-' + color">
  5. <svg-icon :svgid="shieldIcon" />
  6. </div>
  7. <div class="card-value">
  8. <span class="svg-icon" :class="'svg-icon-' + color">
  9. <svg-icon class="increase-icon" :svgid="IncreaseIcon" />
  10. </span>
  11. <span class="value-text">
  12. {{ value }}
  13. </span>
  14. </div>
  15. </div>
  16. <div class="card-title">
  17. {{ title }}
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. // 百分比card2
  23. // 使用位置 驾驶舱首页 计划电量完成情况 中的百分比卡片
  24. import SvgIcon from "../icon/svg-icon.vue";
  25. export default {
  26. components: {
  27. SvgIcon,
  28. },
  29. props: {
  30. // 标题
  31. title: {
  32. type: String,
  33. default: "及时并网增发电量",
  34. },
  35. // 是否增加 true 增加 false 降低
  36. // 判断图标 及 显示颜色
  37. isIncrease: {
  38. type: Boolean,
  39. default: true,
  40. },
  41. // 值
  42. value: {
  43. type: Number,
  44. default: 100,
  45. },
  46. },
  47. computed: {
  48. percent() {
  49. return (this.ActualValue / this.TotalValue) * 100;
  50. },
  51. IncreaseIcon() {
  52. return this.isIncrease ? "svg-arrow-up-1" : "svg-arrow-dpwn-1";
  53. },
  54. shieldIcon() {
  55. return this.isIncrease ? "svg-shield-right" : "svg-shield-error";
  56. },
  57. color() {
  58. return this.isIncrease ? "green" : "yellow";
  59. },
  60. },
  61. };
  62. </script>
  63. <style lang="less">
  64. .card-1 {
  65. display: flex;
  66. flex-direction: column;
  67. .card-icon svg {
  68. width: 36px;
  69. height: 36px;
  70. }
  71. .card-info {
  72. display: flex;
  73. flex-direction: row;
  74. align-items: center;
  75. .card-icon svg {
  76. width: 36px;
  77. height: 36px;
  78. }
  79. .card-value {
  80. margin-top: 4px;
  81. font-size: 16px;
  82. display: flex;
  83. flex-direction: column;
  84. align-items: center;
  85. justify-content: center;
  86. margin-left: 5px;
  87. .value-text {
  88. margin-right: 10px;
  89. font-family: @font-family-num;
  90. }
  91. .increase-icon {
  92. width: 1.1111vh;
  93. height: 1.1111vh;
  94. }
  95. }
  96. }
  97. .card-title {
  98. width: 100%;
  99. font-size: 12px;
  100. color: @font-color;
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. margin-top: 5px;
  105. }
  106. }
  107. </style>