diff --git a/data-room-ui/packages/BizComponent/Preview.vue b/data-room-ui/packages/BizComponent/Preview.vue index fd6a2db2..062d85c7 100644 --- a/data-room-ui/packages/BizComponent/Preview.vue +++ b/data-room-ui/packages/BizComponent/Preview.vue @@ -90,7 +90,7 @@ export default { getBizComponentInfo(this.$route.query?.code).then(data => { this.vueContentInner = data.vueContent this.settingContentInner = data.settingContent - this.buildOption(this.config) + this.dataFormatting(this.config) this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(this.vueContentInner)) }).finally(() => { this.loading = false @@ -111,7 +111,7 @@ export default { // 尝试渲染远程文件或远程字符串 getRemoteComponent () { this.loading = true - this.buildOption(this.config) + this.dataFormatting(this.config) this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(this.vueContentInner)) this.loading = false }, @@ -119,7 +119,7 @@ export default { * 组件的配置 * @returns {Promise} */ - buildOption (config, data) { + dataFormatting (config, data) { config = _.cloneDeep(config) // 遍历config.setting,将config.setting中的值赋值给config.option中对应的optionField config.setting.forEach(set => { diff --git a/data-room-ui/packages/RemoteComponents/index.vue b/data-room-ui/packages/RemoteComponents/index.vue index c311f7a6..3ed56ea5 100644 --- a/data-room-ui/packages/RemoteComponents/index.vue +++ b/data-room-ui/packages/RemoteComponents/index.vue @@ -75,7 +75,7 @@ export default { const settingContent = data.settingContent if (!this.config?.option?.data) { this.resolveStrSetting(settingContent) - this.config = this.buildOption(this.config, { success: false }) + this.config = this.dataFormatting(this.config, { success: false }) } this.remoteComponent = remoteVueLoader('data:text/plain,' + encodeURIComponent(vueContent)) @@ -132,22 +132,16 @@ export default { */ updateChart () { if (this.isPreview) { - this.getCurrentOption().then(({ data, config }) => { - if (data.success) { - // 成功后更新数据 - config = this.buildOption(config, data) - this.changeChartConfig(config) - } - }) + this.changeDataByCode() } else { - this.updateChartData(this.config) + this.changeData(this.config) } }, /** * 组件的配置 * @returns {Promise} */ - buildOption (config, data) { + dataFormatting (config, data) { config = _.cloneDeep(config) // 遍历config.setting,将config.setting中的值赋值给config.option中对应的optionField config.setting.forEach(set => {