IndicatorItem.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!--
  2. * @Author: your name
  3. * @Date: 2021-11-22 14:25:49
  4. * @LastEditTime: 2022-01-06 10:07:24
  5. * @LastEditors: Please set LastEditors
  6. * @Description: 重点指标的 item
  7. * @FilePath: \hyyfScreen\src\views\Production\board\IndicatorItem.vue
  8. -->
  9. <template>
  10. <div class="indicator-item" @click="clickItem">
  11. <div class="left">
  12. <h2>{{ title }}</h2>
  13. <span>{{ subtitle }}</span>
  14. </div>
  15. <div class="center">
  16. <indicator-chart
  17. :id="id"
  18. :ifPositive="ifPositive"
  19. :data="data"
  20. ></indicator-chart>
  21. </div>
  22. <div class="right">
  23. <h3>{{ titleNum + (percent ? "%" : "") }}</h3>
  24. <span class="num-common" :class="ifPositive ? 'positive' : 'negative'">
  25. {{ subtitleNum }}
  26. </span>
  27. </div>
  28. </div>
  29. </template>
  30. <script>
  31. import IndicatorChart from "./IndicatorChart.vue";
  32. export default {
  33. props: {
  34. title: {
  35. type: String,
  36. required: true,
  37. },
  38. subtitle: {
  39. type: String,
  40. required: true,
  41. },
  42. titleNum: {
  43. type: String,
  44. required: true,
  45. },
  46. subtitleNum: {
  47. type: String,
  48. required: true,
  49. },
  50. ifPositive: {
  51. type: Boolean,
  52. required: true,
  53. },
  54. id: {
  55. type: Number,
  56. required: true,
  57. },
  58. data: {
  59. type: Object,
  60. required: true,
  61. },
  62. percent: {
  63. type: Boolean,
  64. required: true,
  65. },
  66. },
  67. components: {
  68. IndicatorChart,
  69. },
  70. methods: {
  71. clickItem() {
  72. this.$emit("clickItem");
  73. },
  74. },
  75. };
  76. </script>
  77. <style scoped>
  78. .indicator-item {
  79. display: flex;
  80. flex-direction: row;
  81. justify-content: space-around;
  82. border-bottom: 2px solid rgb(56, 55, 55);
  83. padding: 20px 0;
  84. }
  85. .left {
  86. width: 27%;
  87. }
  88. .left > h2 {
  89. font-size: 23px;
  90. }
  91. .left > span {
  92. font-size: 15px;
  93. color: #ccc;
  94. }
  95. .center {
  96. width: 50%;
  97. }
  98. .right {
  99. width: 20%;
  100. }
  101. .right > h3 {
  102. font-size: 20px;
  103. }
  104. .num-common {
  105. display: inline-block;
  106. font-size: 20px;
  107. width: 100px;
  108. height: 28px;
  109. line-height: 28px;
  110. border-radius: 8px;
  111. }
  112. .positive {
  113. background-color: red;
  114. }
  115. .negative {
  116. background-color: green;
  117. }
  118. </style>