index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div
  3. :class="`bs-indexCard`"
  4. style="width: 100%;height: 100%;position: relative;"
  5. >
  6. <div
  7. :style="{
  8. 'background-color':customize.bgColor,
  9. 'border-radius':customize.borderRadius + 'px',
  10. border:`${customize.borderWidth}px solid ${customize.borderColor}`,
  11. }"
  12. class="content"
  13. >
  14. <div
  15. class="content-right-first"
  16. :style="{
  17. 'font-size': customize.firstSize + 'px',
  18. 'height':customize.firstSize + 'px',
  19. color:customize.firstColor,
  20. 'font-weight':customize.firstWeight,
  21. 'margin-bottom':customize.lineDistance +'px'
  22. }"
  23. >
  24. {{ tableData?tableData:'' }}
  25. </div>
  26. <div
  27. :style="{
  28. 'font-size': customize.secondSize + 'px',
  29. 'height':customize.secondSize + 'px',
  30. color:customize.secondColor,
  31. 'font-weight':customize.secondWeight,
  32. }"
  33. class="content-right-second"
  34. >
  35. {{ customize.secondLine }}
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script>
  41. // import commonMixins from '../../../js/mixins/commonMixins'
  42. // import paramsMixins from '../../../js/mixins/paramsMixins'
  43. export default {
  44. name: 'Card',
  45. components: {},
  46. // mixins: [paramsMixins, commonMixins],
  47. props: {
  48. // 卡片的属性
  49. config: {
  50. type: Object,
  51. default: () => ({})
  52. }
  53. },
  54. data () {
  55. return {
  56. customClass: {}
  57. }
  58. },
  59. watch: {},
  60. mounted () {
  61. // this.chartInit()
  62. },
  63. computed: {
  64. option () {
  65. return this.config?.option
  66. },
  67. optionData () {
  68. return this.option?.data || []
  69. },
  70. customize () {
  71. return this.option?.customize
  72. },
  73. tableData () {
  74. let dataList = ''
  75. if (this.optionData instanceof Array && this.optionData.length > 0) {
  76. dataList = this.option?.yField
  77. ? this.optionData[0][this.option.yField]
  78. : this.optionData[0]?.value
  79. } else {
  80. dataList = this.optionData ? this.optionData[this.option.yField] : ''
  81. }
  82. return dataList
  83. }
  84. },
  85. methods: { }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .content{
  90. display: flex;
  91. flex-direction: column;
  92. height: 100%;
  93. width: 100%;
  94. text-align: center;
  95. justify-content: center;
  96. .content-right-first{
  97. width: 100%;
  98. text-align: center;
  99. padding-bottom: 5px;
  100. }
  101. .content-right-second{
  102. width: 100%;
  103. text-align: center;
  104. }
  105. }
  106. </style>