index.vue 3.1 KB

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