index.vue 4.3 KB

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