index.vue 3.0 KB

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