card-1.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="card-1">
  3. <div class="card-icon svg-icon svg-shadow" :class="'svg-icon-' + color">
  4. <svg-icon :svgid="shieldIcon" />
  5. </div>
  6. <div class="card-info">
  7. <div class="card-title">
  8. {{ title }}
  9. </div>
  10. <div class="card-value">
  11. <span class="value-text">
  12. {{ value }}
  13. </span>
  14. <span class="svg-icon" :class="'svg-icon-' + color">
  15. <svg-icon class="increase-icon" :svgid="IncreaseIcon" />
  16. </span>
  17. </div>
  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. align-items: center;
  67. .card-icon svg {
  68. width: 36px;
  69. height: 36px;
  70. }
  71. .card-info {
  72. flex: auto;
  73. align-self: center;
  74. margin-left: 8px;
  75. .card-title {
  76. width: 100%;
  77. font-size: 12px;
  78. color: @font-color;
  79. }
  80. .card-value {
  81. margin-top: 4px;
  82. font-size: 16px;
  83. .value-text {
  84. margin-right: 0.741vh;
  85. font-family: @font-family-num;
  86. }
  87. .increase-icon {
  88. width: 1.1111vh;
  89. height: 1.1111vh;
  90. }
  91. }
  92. .card-text {
  93. font-size: @fontsize;
  94. }
  95. }
  96. }
  97. </style>