index.vue 3.0 KB

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