index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <div
  3. v-loading="config.loading"
  4. element-loading-text="数据加载中"
  5. style="width: 100%;height: 100%"
  6. class="bs-design-wrap"
  7. >
  8. <dv-scroll-ranking-board
  9. :key="updateKey"
  10. class="ranking-box"
  11. :class="{'light-theme':customTheme === 'light','auto-theme':customTheme =='dark'}"
  12. :config="option"
  13. @click="rowClick"
  14. />
  15. </div>
  16. </template>
  17. <script>
  18. import DvScrollRankingBoard from '@jiaminghi/data-view/lib/components/scrollRankingBoard/src/main.vue'
  19. import '@jiaminghi/data-view/lib/components/scrollRankingBoard/src/main.css'
  20. import { refreshComponentMixin } from 'data-room-ui/js/mixins/refreshComponent'
  21. import commonMixins from 'data-room-ui/js/mixins/commonMixins'
  22. import paramsMixins from 'data-room-ui/js/mixins/paramsMixins'
  23. import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
  24. export default {
  25. name: 'ScrollRankingBoard',
  26. components: {
  27. DvScrollRankingBoard
  28. },
  29. mixins: [refreshComponentMixin, paramsMixins, commonMixins, linkageMixins],
  30. props: {
  31. // 卡片的属性
  32. config: {
  33. type: Object,
  34. default: () => ({})
  35. }
  36. },
  37. data () {
  38. return {
  39. updateKey: 0
  40. }
  41. },
  42. computed: {
  43. option: {
  44. get () {
  45. return { ...this.config.customize, data: this.config.option.data }
  46. },
  47. set (value) {}
  48. }
  49. },
  50. watch: {
  51. },
  52. mounted () {
  53. },
  54. methods: {
  55. // 点击事件
  56. rowClick (row) {
  57. this.linkage(row)
  58. },
  59. dataFormatting (config, data) {
  60. const dataSourseList = []
  61. data.data.forEach(item => {
  62. dataSourseList.push({ name: item[config.dataSource.dimensionField || 'name'], value: item[config.dataSource.metricField || 'sum(num)'] })
  63. })
  64. config.option = {
  65. ...config.option,
  66. data: dataSourseList
  67. }
  68. return config
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .light-theme{
  75. background-color: #FFFFFF;
  76. color: #000000;
  77. }
  78. .auto-theme{
  79. background-color: rgba(0,0,0,0);
  80. }
  81. .dark-theme{
  82. background-color:rgb(31, 31, 31) ;
  83. }
  84. .bs-design-wrap{
  85. position: relative;
  86. padding: 0 16px;
  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>