index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. 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. ::v-deep ::-webkit-scrollbar {
  129. width: 4px;
  130. border-radius: 4px;
  131. height: 4px;
  132. }
  133. ::v-deep ::-webkit-scrollbar-thumb {
  134. background: #dddddd !important;
  135. border-radius: 10px;
  136. }
  137. </style>