index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div
  3. style="width: 100%;height: 100%"
  4. class="bs-design-wrap"
  5. >
  6. <dv-scroll-board
  7. :key="updateKey"
  8. :class="{'light-theme':customTheme === 'light','auto-theme':customTheme =='auto','dark-theme':customTheme =='dark'}"
  9. :config="option"
  10. />
  11. </div>
  12. </template>
  13. <script>
  14. import DvScrollBoard from '@jiaminghi/data-view/lib/components/scrollBoard/src/main.vue'
  15. import '@jiaminghi/data-view/lib/components/scrollBoard/src/main.css'
  16. import { refreshComponentMixin } from 'packages/js/mixins/refreshComponent'
  17. import commonMixins from 'packages/js/mixins/commonMixins'
  18. import paramsMixins from 'packages/js/mixins/paramsMixins'
  19. import linkageMixins from 'packages/js/mixins/linkageMixins'
  20. export default {
  21. name: 'ScrollBoard',
  22. components: {
  23. DvScrollBoard
  24. },
  25. mixins: [refreshComponentMixin, paramsMixins, commonMixins, linkageMixins],
  26. props: {
  27. // 卡片的属性
  28. config: {
  29. type: Object,
  30. default: () => ({})
  31. }
  32. },
  33. data () {
  34. return {
  35. }
  36. },
  37. computed: {
  38. option: {
  39. get () {
  40. return { ...this.config.customize, data: this.config.option?.data, header: this.config.option?.header, columnWidth: this.config.option?.columnWidth, align: this.config.option?.align }
  41. },
  42. set () {}
  43. }
  44. },
  45. watch: {
  46. },
  47. mounted () {
  48. this.chartInit()
  49. },
  50. methods: {
  51. dataFormatting (config, data) {
  52. const header = []
  53. const dataList = []
  54. const alignList = []
  55. const widthList = []
  56. if (config.customize.columnConfig.length === 0) {
  57. const key = []
  58. for (const i in data.columnData) {
  59. header.push(data.columnData[i].remark)
  60. key.push(i)
  61. }
  62. data.data.forEach((item) => {
  63. const arr = []
  64. header.forEach((x, index) => {
  65. arr.push(item[key[index]])
  66. })
  67. dataList.push(arr)
  68. })
  69. } else {
  70. const key = []
  71. config.customize.columnConfig.forEach(item => {
  72. header.push(item.name)
  73. key.push(item.code)
  74. alignList.push(item.align)
  75. widthList.push(item.width)
  76. })
  77. data.data.forEach((item) => {
  78. const arr = []
  79. header.forEach((x, index) => {
  80. arr.push(item[key[index]])
  81. })
  82. dataList.push(arr)
  83. })
  84. if (config.customize.index) {
  85. if (alignList.length === header.length) {
  86. alignList.unshift('center')
  87. }
  88. if (widthList.length === header.length) {
  89. widthList.unshift('100')
  90. }
  91. } else {
  92. if (alignList.length !== header.length) {
  93. alignList.shift()
  94. }
  95. if (widthList.length !== header.length) {
  96. widthList.shift()
  97. }
  98. }
  99. }
  100. config.option = {
  101. ...config.option,
  102. data: dataList,
  103. header: header,
  104. columnWidth: [...widthList],
  105. align: [...alignList]
  106. }
  107. return config
  108. }
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .light-theme{
  114. background-color: #FFFFFF;
  115. color: #000000;
  116. }
  117. .auto-theme{
  118. background-color: rgba(0,0,0,0);
  119. }
  120. .dark-theme{
  121. background-color:rgb(31, 31, 31) ;
  122. }
  123. .bs-design-wrap{
  124. position: relative;
  125. width: 100%;
  126. height: 100%;
  127. background-color: transparent;
  128. border-radius: 4px;
  129. box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1);
  130. box-sizing: border-box;
  131. }
  132. .title-box{
  133. height: 40px;
  134. padding: 10px 10px 0 0;
  135. box-sizing: border-box;
  136. .title {
  137. font-size: 14px;
  138. color: #333;
  139. font-weight: bold;
  140. border-left: 3px solid var(--bs-el-color-primary);
  141. padding-left: 16px;
  142. }
  143. .target-value{
  144. overflow-y: auto;
  145. height: 60px;
  146. font-weight: bold;
  147. width: 100%;
  148. font-size: 20px;
  149. color: #333;
  150. padding: 16px 0 0 22px;
  151. box-sizing: border-box;
  152. }
  153. }
  154. .el-icon-warning{
  155. color: #FFD600;
  156. }
  157. .title-hover{
  158. &:hover{
  159. cursor: move;
  160. }
  161. }
  162. /*滚动条样式*/
  163. /deep/::-webkit-scrollbar {
  164. width: 4px;
  165. border-radius: 4px;
  166. height: 4px;
  167. }
  168. /deep/::-webkit-scrollbar-thumb {
  169. background: #dddddd !important;
  170. border-radius: 10px;
  171. }
  172. </style>