index.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div
  3. style="width: 100%;height: 100%"
  4. class="bs-design-wrap"
  5. >
  6. <dv-scroll-ranking-board
  7. :key="updateKey"
  8. class="ranking-box"
  9. :class="{'light-theme':customTheme === 'light','auto-theme':customTheme =='auto','dark-theme':customTheme =='dark'}"
  10. :config="option"
  11. />
  12. </div>
  13. </template>
  14. <script>
  15. import DvScrollRankingBoard from '@jiaminghi/data-view/lib/components/scrollRankingBoard/src/main.vue'
  16. import '@jiaminghi/data-view/lib/components/scrollRankingBoard/src/main.css'
  17. import { refreshComponentMixin } from 'packages/js/mixins/refreshComponent'
  18. import commonMixins from 'packages/js/mixins/commonMixins'
  19. import paramsMixins from 'packages/js/mixins/paramsMixins'
  20. import linkageMixins from 'packages/js/mixins/linkageMixins'
  21. export default {
  22. name: 'ScrollRankingBoard',
  23. components: {
  24. DvScrollRankingBoard
  25. },
  26. mixins: [refreshComponentMixin, paramsMixins, commonMixins, linkageMixins],
  27. props: {
  28. // 卡片的属性
  29. config: {
  30. type: Object,
  31. default: () => ({})
  32. }
  33. },
  34. data () {
  35. return {
  36. updateKey: 0
  37. }
  38. },
  39. computed: {
  40. option: {
  41. get () {
  42. return { ...this.config.customize, data: this.config.option.data }
  43. },
  44. set (value) {}
  45. }
  46. },
  47. watch: {
  48. },
  49. mounted () {
  50. },
  51. methods: {
  52. dataFormatting (config, data) {
  53. const dataSourseList = []
  54. data.data.forEach(item => {
  55. dataSourseList.push({ name: item[config.dataSource.dimensionField || 'name'], value: item[config.dataSource.metricField || 'sum(num)'] })
  56. })
  57. config.option = {
  58. ...config.option,
  59. data: dataSourseList
  60. }
  61. return config
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss" scoped>
  67. .light-theme{
  68. background-color: #FFFFFF;
  69. color: #000000;
  70. }
  71. .auto-theme{
  72. background-color: rgba(0,0,0,0);
  73. }
  74. .dark-theme{
  75. background-color:rgb(31, 31, 31) ;
  76. }
  77. .bs-design-wrap{
  78. position: relative;
  79. width: 100%;
  80. height: 100%;
  81. background-color: transparent;
  82. border-radius: 4px;
  83. box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1);
  84. box-sizing: border-box;
  85. }
  86. .title-box{
  87. height: 40px;
  88. padding: 10px 10px 0 0;
  89. box-sizing: border-box;
  90. .title {
  91. font-size: 14px;
  92. color: #333;
  93. font-weight: bold;
  94. border-left: 3px solid var(--bs-el-color-primary);
  95. padding-left: 16px;
  96. }
  97. .target-value{
  98. overflow-y: auto;
  99. height: 60px;
  100. font-weight: bold;
  101. width: 100%;
  102. font-size: 20px;
  103. color: #333;
  104. padding: 16px 0 0 22px;
  105. box-sizing: border-box;
  106. }
  107. }
  108. .el-icon-warning{
  109. color: #FFD600;
  110. }
  111. .title-hover{
  112. &:hover{
  113. cursor: move;
  114. }
  115. }
  116. .ranking-box{
  117. padding: 10px;
  118. }
  119. /*滚动条样式*/
  120. /deep/::-webkit-scrollbar {
  121. width: 4px;
  122. border-radius: 4px;
  123. height: 4px;
  124. }
  125. /deep/::-webkit-scrollbar-thumb {
  126. background: #dddddd !important;
  127. border-radius: 10px;
  128. }
  129. </style>