From 8963169f9438c4244b7d99d99e7d14ff26ea6693 Mon Sep 17 00:00:00 2001 From: "wu.jian2" Date: Mon, 26 Jun 2023 16:45:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=AE=9A=E4=B9=89JS=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=B7=BB=E5=8A=A0=E5=8A=A8=E6=80=81=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jsDataSet/index.vue | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) 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 = ''