Quellcode durchsuchen

feat:修复业务组件数据回显问题

liu.shiyi vor 1 Jahr
Ursprung
Commit
9f7dc56519
2 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen
  1. 2 0
      data-room-ui/example/main.js
  2. 4 3
      data-room-ui/packages/BizComponent/Preview.vue

+ 2 - 0
data-room-ui/example/main.js

@@ -13,8 +13,10 @@ import * as $dataRoomAxios from 'data-room-ui/js/utils/http.js'
 import { registerConfig } from '@gcpaas/data-room-ui'
 import remoteComponents from '@/remoteComponents/exports.js'
 import customDatasetComponents from '@/customDatasetComponents/exports.js'
+import { Column } from '@antv/g2plot';
 // import customPlots from '@/customPlots/exports'
 Vue.use(ElementUI, { size: 'mini' })
+Vue.prototype.Column = Column
 registerConfig(
   {
     routers: {

+ 4 - 3
data-room-ui/packages/BizComponent/Preview.vue

@@ -85,7 +85,7 @@ export default {
         const data = await getBizComponentInfo(this.$route.query?.code)
         this.vueContentInner = data.vueContent
         this.settingContentInner = data.settingContent
-        this.dataFormatting(this.config)
+       this.config = this.dataFormatting(this.config)
         this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(this.vueContentInner))
         this.loading = false
       }
@@ -105,7 +105,7 @@ export default {
     // 尝试渲染远程文件或远程字符串
     getRemoteComponent () {
       this.loading = true
-      this.dataFormatting(this.config, { success: false })
+      this.config = this.dataFormatting(this.config, { success: false })
       this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(this.vueContentInner))
       this.loading = false
     },
@@ -115,6 +115,7 @@ export default {
      */
     // 将config.setting的配置转化为option里的配置,这里之所以将转化的方法提出来,是因为在改变维度指标和样式的时候都需要转化
     transformSettingToOption (config, type) {
+
       let option = null
       config.setting.forEach(set => {
         if (set.optionField) {
@@ -154,7 +155,7 @@ export default {
         config.option.data = data
       } else {
         // 数据返回失败则赋前端的模拟数据
-        config.option.data = this.plotList?.find(plot => plot.name === config.name)?.option?.data
+        config.option.data = this.plotList?.find(plot => plot.name === config.name)?.option?.data || config.option.data
       }
       return config
     },