diff --git a/data-room-ui/example/customDatasetComponents/jsDataSet/index.vue b/data-room-ui/example/customDatasetComponents/jsDataSet/index.vue index 816b8b34..bbb5f0c9 100644 --- a/data-room-ui/example/customDatasetComponents/jsDataSet/index.vue +++ b/data-room-ui/example/customDatasetComponents/jsDataSet/index.vue @@ -140,7 +140,7 @@
执行 @@ -152,9 +152,9 @@ :span="8" >
- +
输出字段 @@ -606,8 +606,11 @@ export default { const javascript = this.dataForm.config.script let scriptMethod = null try { + const scriptAfterReplacement = javascript.replace(/\${(.*?)}/g, (match, p) => { + return `'${this.dataForm.config.paramsList.find(param => param.name === p).value}'` + }) // eslint-disable-next-line no-new-func - scriptMethod = new Function(javascript) + scriptMethod = new Function(scriptAfterReplacement) } catch (error) { this.passTest = false this.$message.error('脚本执行错误,请检查脚本') @@ -671,15 +674,15 @@ export default { } }, // 执行事件 - toExecute () { - // if (this.dataForm.config.paramsList.length) { - // this.isSet = false - // this.paramsVisible = true - // } else { - // 无参数,直接执行脚本 - this.scriptExecute() - // } - }, + // toExecute () { + // if (this.dataForm.config.paramsList.length) { + // this.isSet = false + // this.paramsVisible = true + // } else { + // 无参数,直接执行脚本 + // this.scriptExecute() + // } + // }, // 清空分类 clearType () { this.typeName = ''