RenderCard2.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!--
  2. * @description: 渲染组件
  3. * @Date: 2022-08-18 09:42:45
  4. * @Author: xingheng
  5. -->
  6. <template>
  7. <div class="render-item-wrap">
  8. <component
  9. :is="resolveComponentType(config.type)"
  10. :id="`${config.code}`"
  11. :ref="config.code"
  12. :key="config.key"
  13. :config="config"
  14. @styleHandler="styleHandler"
  15. />
  16. </div>
  17. </template>
  18. <script>
  19. // import commonMixins from 'data-room-ui/js/mixins/commonMixins'
  20. import { mapMutations } from 'vuex'
  21. import { resolveComponentType } from 'data-room-ui/js/utils'
  22. import pcComponent from 'data-room-ui/js/utils/componentImport'
  23. import { dataInit, destroyedEvent } from 'data-room-ui/js/utils/eventBus'
  24. import CustomComponent from '../PlotRender/index.vue'
  25. import Svgs from '../Svgs/index.vue'
  26. import EchartsComponent from '../EchartsRender/index.vue'
  27. import RemoteComponent from 'data-room-ui/RemoteComponents/index.vue'
  28. import Map from 'data-room-ui/BasicComponents/Map/index.vue'
  29. import FlyMap from 'data-room-ui/BasicComponents/FlyMap/index.vue'
  30. import candlestick from 'data-room-ui/BasicComponents/Candlestick/index.vue'
  31. const components = {}
  32. for (const key in pcComponent) {
  33. if (Object.hasOwnProperty.call(pcComponent, key)) {
  34. components[key] = pcComponent[key]
  35. }
  36. }
  37. export default {
  38. name: 'RenderCard',
  39. // mixins: [commonMixins],
  40. components: {
  41. ...components,
  42. CustomComponent,
  43. Svgs,
  44. Map,
  45. FlyMap,
  46. candlestick,
  47. RemoteComponent,
  48. EchartsComponent
  49. },
  50. props: {
  51. // 卡片的属性
  52. config: {
  53. type: Object,
  54. default: () => ({})
  55. },
  56. ruleKey: {
  57. type: Number,
  58. default: 0
  59. }
  60. },
  61. data () {
  62. return {}
  63. },
  64. computed: {},
  65. mounted () {
  66. // 调用初始化方法
  67. dataInit(this)
  68. },
  69. beforeDestroy () {
  70. destroyedEvent()
  71. },
  72. methods: {
  73. ...mapMutations('bigScreen', [
  74. 'changeChartConfig'
  75. ]),
  76. resolveComponentType,
  77. // 切换主题时针对远程组件触发样式修改的方法
  78. styleHandler (config) {
  79. this.$emit('styleHandler', config)
  80. }
  81. // // 打开右侧面板
  82. // openRightPanel () {
  83. // this.$emit('openRightPanel', this.currentChart)
  84. // }
  85. }
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. .render-item-wrap {
  90. width: 100%;
  91. height: 100%;
  92. display: flex;
  93. overflow: hidden;
  94. box-sizing: border-box;
  95. }
  96. </style>