RenderCard.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. />
  15. </div>
  16. </template>
  17. <script>
  18. // import commonMixins from 'data-room-ui/js/mixins/commonMixins'
  19. import { mapMutations } from 'vuex'
  20. import { resolveComponentType } from 'data-room-ui/js/utils'
  21. import pcComponent from 'data-room-ui/js/utils/componentImport'
  22. import { dataInit, destroyedEvent } from 'data-room-ui/js/utils/eventBus'
  23. import CustomComponent from '../PlotRender/index.vue'
  24. import Svgs from '../Svgs/index.vue'
  25. import RemoteComponent from 'data-room-ui/RemoteComponents/index.vue'
  26. const components = {}
  27. for (const key in pcComponent) {
  28. if (Object.hasOwnProperty.call(pcComponent, key)) {
  29. components[key] = pcComponent[key]
  30. }
  31. }
  32. export default {
  33. name: 'RenderCard',
  34. // mixins: [commonMixins],
  35. components: {
  36. ...components,
  37. CustomComponent,
  38. Svgs,
  39. RemoteComponent
  40. },
  41. props: {
  42. // 卡片的属性
  43. config: {
  44. type: Object,
  45. default: () => ({})
  46. },
  47. ruleKey: {
  48. type: Number,
  49. default: 0
  50. }
  51. },
  52. data () {
  53. return {}
  54. },
  55. computed: {},
  56. mounted () {
  57. // 调用初始化方法
  58. dataInit(this)
  59. },
  60. beforeDestroy () {
  61. destroyedEvent()
  62. },
  63. methods: {
  64. ...mapMutations('bigScreen', [
  65. 'changeChartConfig'
  66. ]),
  67. resolveComponentType
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. .render-item-wrap {
  73. width: 100%;
  74. height: 100%;
  75. display: flex;
  76. overflow: hidden;
  77. box-sizing: border-box;
  78. }
  79. </style>