index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <div class="dataItem" :style="{ background: item.bgColor, padding: item.padding, alignItems: item.type === 'circle' && 'baseline' }">
  3. <div v-if="item" class=" flex-center-start">
  4. <div v-if="item.type === 'circle'" class="circle" :style="{ background: item.color }" />
  5. <addIcon v-else :inner-color="item.innerColor" :out-color="item.outColor" />
  6. <div class="textWord ellipsis">
  7. <div>
  8. <span :style="{color: item.labelColor ? item.labelColor : '#666'}">{{ item.label }}</span>
  9. <span class="title isHove" @click.stop="$emit('subCountListClick', { index: 1, subIndex: 0})">{{ item.title }}</span>
  10. <span>{{ item.titleUnit }}</span>
  11. <span v-if="item.remark" class="remark">({{ item.remark }})</span>
  12. </div>
  13. <!-- <div class="ellipsis" v-html="subTitle" /> -->
  14. <div class="subTitleName">
  15. <span v-if="item.subTitleUnit === 'rate'">
  16. <span>环比:</span>
  17. <span :class="Number(item.subTitle) > 0 ? 'item-up isHove' : 'item-down isHove'" @click.stop="$emit('subCountListClick', { index: 0, subIndex: 0})">
  18. <i v-if="Number(item.subTitle) > 0" class="el-icon-caret-top" />
  19. <i v-else class="el-icon-caret-bottom" />
  20. {{ item.subTitle }}%
  21. </span>
  22. </span>
  23. <span v-else style="font-weight: 600" v-html="item.subTitle" />
  24. </div>
  25. </div>
  26. </div>
  27. <div v-if="item.subListCountList" class="subCountList">
  28. <div v-for="(subItem, subItemIndex) in item.subListCountList" :key="subItemIndex" class="subCountItem" @click.stop="$emit('subCountListClick', { index: subItemIndex + 1, subIndex: 0})">
  29. <span v-for="(subItemItem, subItemIndexIndex) in subItem" :key="subItemIndex + subItemIndexIndex">
  30. <span>{{ subItemItem.label }}</span><span>{{ subItemItem.beforeLabel }}</span>&nbsp;&nbsp;<span class="isHove title" @click.stop="$emit('subCountListClick', { index: subItemIndex + 1, subIndex: subItemIndexIndex})">{{ subItemItem.countStr }}{{ subItemItem.unit }}</span>&nbsp;&nbsp;<span>{{ subItemItem.afterLabel }}</span>
  31. </span>
  32. </div>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. import addIcon from '@/components/addIcon'
  38. export default {
  39. components: {
  40. addIcon
  41. },
  42. props: {
  43. item: {
  44. type: Object,
  45. required: false,
  46. default: () => {}
  47. },
  48. type: {
  49. type: String,
  50. required: false,
  51. default: 'addIcon'
  52. }
  53. }
  54. }
  55. </script>
  56. <style scoped lang='less'>
  57. .dataItem {
  58. border-radius: 6px;
  59. padding: 8px 6px;
  60. color: #666;
  61. .circle {
  62. width: 6px;
  63. height: 6px;
  64. border-radius: 3px;
  65. }
  66. .textWord {
  67. padding-left: 4px;
  68. width: 90%;
  69. .remark {
  70. font-size: 12px;
  71. }
  72. .title {
  73. color: #333;
  74. font-size: 14px;
  75. font-weight: 600;
  76. }
  77. .subTitleName {
  78. color: #999;
  79. font-size: 12px;
  80. .item-up {
  81. color:#F32850;
  82. font-weight: 600;
  83. }
  84. .item-down {
  85. //color:#9FFF39
  86. color:#7Ed321;
  87. font-weight: 600;
  88. }
  89. }
  90. }
  91. .subCountList {
  92. font-size: 12px;
  93. color: #666;
  94. font-weight: 500;
  95. margin-top: 10px;
  96. .subCountItem {
  97. margin-bottom: 1px;
  98. cursor: pointer;
  99. &:last-child{
  100. margin-bottom: 0;
  101. }
  102. }
  103. }
  104. }
  105. </style>