From 2c679f9013a5e0da493e8c4c245453176cb7361d Mon Sep 17 00:00:00 2001 From: "wu.jian2" Date: Sun, 25 Jun 2023 20:57:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E9=9B=86=EF=BC=8C=E6=B2=A1=E6=9C=89=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=83=85=E5=86=B5=E4=B8=8B=E5=87=BA?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../packages/DataSetManagement/src/index.vue | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) 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 () {