index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. this.chartInit()
  51. },
  52. methods: {
  53. buildOption (config, data) {
  54. const dataSourseList = []
  55. data.data.forEach(item => {
  56. dataSourseList.push({ name: item[config.dataSource.dimensionField || 'name'], value: item[config.dataSource.metricField || 'sum(num)'] })
  57. })
  58. config.option = {
  59. ...config.option,
  60. data: dataSourseList
  61. }
  62. return config
  63. },
  64. updateData () {
  65. this.getCurrentOption().then(({ data, config }) => {
  66. const _config = this.buildOption(config, data)
  67. this.option.data = _config.option.data
  68. this.updateKey++
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .light-theme{
  76. background-color: #FFFFFF;
  77. color: #000000;
  78. }
  79. .auto-theme{
  80. background-color: rgba(0,0,0,0);
  81. }
  82. .dark-theme{
  83. background-color:rgb(31, 31, 31) ;
  84. }
  85. .bs-design-wrap{
  86. position: relative;
  87. width: 100%;
  88. height: 100%;
  89. background-color: transparent;
  90. border-radius: 4px;
  91. box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1);
  92. box-sizing: border-box;
  93. }
  94. .title-box{
  95. height: 40px;
  96. padding: 10px 10px 0 0;
  97. box-sizing: border-box;
  98. .title {
  99. font-size: 14px;
  100. color: #333;
  101. font-weight: bold;
  102. border-left: 3px solid var(--bs-el-color-primary);
  103. padding-left: 16px;
  104. }
  105. .target-value{
  106. overflow-y: auto;
  107. height: 60px;
  108. font-weight: bold;
  109. width: 100%;
  110. font-size: 20px;
  111. color: #333;
  112. padding: 16px 0 0 22px;
  113. box-sizing: border-box;
  114. }
  115. }
  116. .el-icon-warning{
  117. color: #FFD600;
  118. }
  119. .title-hover{
  120. &:hover{
  121. cursor: move;
  122. }
  123. }
  124. .ranking-box{
  125. padding: 10px;
  126. }
  127. /*滚动条样式*/
  128. /deep/::-webkit-scrollbar {
  129. width: 4px;
  130. border-radius: 4px;
  131. height: 4px;
  132. }
  133. /deep/::-webkit-scrollbar-thumb {
  134. background: #dddddd !important;
  135. border-radius: 10px;
  136. }
  137. </style>