diff --git a/data-room-ui/packages/DataSetManagement/src/index.vue b/data-room-ui/packages/DataSetManagement/src/index.vue index 68c79302..50462cd7 100644 --- a/data-room-ui/packages/DataSetManagement/src/index.vue +++ b/data-room-ui/packages/DataSetManagement/src/index.vue @@ -137,7 +137,7 @@ show-overflow-tooltip > item?.datasetType === type).componentName) + this.componentData = this.getComponents(this.datasetTypeList.find(item => item?.datasetType === type)?.componentName) ?? '' this.datasetName = name this.typeId = typeId this.isEdit = true @@ -428,19 +427,19 @@ export default { this.isEdit = true }, showOperate (datasetType) { - return this.getComponents(this.datasetTypeList.find(type => type.datasetType === datasetType).componentName)?.config?.showOperate ?? true + return this.getComponents(this.datasetTypeList.find(type => type.datasetType === datasetType)?.componentName)?.config?.showOperate ?? true }, getComponents (componentName) { - const components = Object.values(this.$options.components) - let remoteComponentData = null - if (window.BS_CONFIG?.customDatasetComponents.length > 0) { + if (window.BS_CONFIG?.customDatasetComponents && window.BS_CONFIG?.customDatasetComponents.length > 0) { + const components = Object.values(this.$options.components) + let remoteComponentData = null // 获取远程组件 remoteComponentData = window.BS_CONFIG?.customDatasetComponents.find(item => item.config.componentName === componentName) - } - return { - component: components.find(component => component.name === componentName) || remoteComponentData?.vueFile, - config: remoteComponentData?.config || null, - key: new Date().getTime() + return { + component: components.find(component => component.name === componentName) || remoteComponentData?.vueFile, + config: remoteComponentData?.config || null, + key: new Date().getTime() + } } }, // 初始化 @@ -465,10 +464,12 @@ export default { { name: 'JSON数据集', datasetType: 'json', componentName: 'JsonEditForm' }, { name: '脚本数据集', datasetType: 'script', componentName: 'ScriptEditForm' } ] - // 将获得到的远程数据集进行组装 - window.BS_CONFIG?.customDatasetComponents.forEach((item) => { - this.datasetTypeList.push({ name: item.config.name, datasetType: item.config.datasetType, componentName: item.config.componentName }) - }) + if (window.BS_CONFIG?.customDatasetComponents && window.BS_CONFIG?.customDatasetComponents.length > 0) { + // 将获得到的远程数据集进行组装 + window.BS_CONFIG?.customDatasetComponents.forEach((item) => { + this.datasetTypeList.push({ name: item.config.name, datasetType: item.config.datasetType, componentName: item.config.componentName }) + }) + } }, // 新增数据集 addDataset () {