index.vue 4.1 KB

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