From 36cd4c4d4270eb9d536d20c7b0af2cb255dc04b7 Mon Sep 17 00:00:00 2001 From: "hong.yang" Date: Thu, 31 Aug 2023 09:14:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=EF=BC=8C=E6=8F=90=E4=BE=9BES?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DataSetManagement/src/ScriptEditForm.vue | 123 +++++++++++++++--- 1 file changed, 106 insertions(+), 17 deletions(-) diff --git a/data-room-ui/packages/DataSetManagement/src/ScriptEditForm.vue b/data-room-ui/packages/DataSetManagement/src/ScriptEditForm.vue index 7b5826c1..dfc83fe8 100644 --- a/data-room-ui/packages/DataSetManagement/src/ScriptEditForm.vue +++ b/data-room-ui/packages/DataSetManagement/src/ScriptEditForm.vue @@ -179,12 +179,17 @@ class="sql-config" >
- + + ES案例 + +
+ +
确定 + +
+ +
+ + + 关闭 + 使用该案例 + +
@@ -642,7 +679,38 @@ export default { paramsListCopy: [], isSet: false, // 参数是否配置状态 passTest: false, - fieldDesc: null // 字段描述 + fieldDesc: null, // 字段描述 + exampleVisible: false, + currentExample: '', + exampleList: { + es: `import com.gccloud.dataset.utils.ElasticsearchDsService; + +def dsl = ''' +{ + "query":{ + "match_all":{} + } +} +''' +def host = "127.0.0.1" +int port = 9200 +def username = "elastic" +def password = "pwd" +def path = "/_search" + +/** + * query方法的参数说明: + * host es的ip + * port es的端口 + * username es的用户名,如果没有可以不填 + * password es的密码,如果没有可以不填 + * path es的查询路径 + * dsl 查询的dsl,示例见上面 + * return 查询结果,List格式 + */ +return ElasticsearchDsService.query(host, port, username, password, path, dsl); +` + } } }, computed: { @@ -906,7 +974,19 @@ export default { treeFilter (value, data) { if (!value) return true return data.name.indexOf(value) !== -1 - } + }, + /** + * 获取脚本案例 + */ + example(type) { + this.exampleVisible = true + this.currentExample = this.exampleList[type] + console.log(this.currentExample) + }, + useExample() { + this.dataForm.script = this.currentExample + this.exampleVisible = false + }, } } @@ -954,15 +1034,24 @@ export default { // .codeStyle { // border: 1px solid #EBEEF5; // } -::v-deep .CodeMirror { - height: 180px !important; - font-family: Helvetica, Tahoma; - // .CodeMirror-scroll { - // background: #fff; - // .CodeMirror-gutters { - // background: #f6f7fb; - // } - // } +.code-out { + ::v-deep .CodeMirror { + height: 180px ; + font-family: Helvetica, Tahoma; + // .CodeMirror-scroll { + // background: #fff; + // .CodeMirror-gutters { + // background: #f6f7fb; + // } + // } + } +} + +.code-inner { + ::v-deep .CodeMirror { + height: 400px ; + font-family: Helvetica, Tahoma; + } } .no-border {