From d189ee7c22329f72848ddc111397d2a30cc0ac5a Mon Sep 17 00:00:00 2001 From: "meilin.huang" <954537473@qq.com> Date: Tue, 14 Feb 2023 11:44:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mayfly_go_web/src/views/ops/db/SqlExec.vue | 16 +- .../src/views/ops/db/component/DbTable.vue | 323 ++++++++++++++++++ .../src/views/ops/db/component/tab/Query.vue | 186 ++-------- .../views/ops/db/component/tab/TableData.vue | 215 ++---------- mayfly_go_web/src/views/ops/db/db.ts | 2 +- 5 files changed, 378 insertions(+), 364 deletions(-) create mode 100644 mayfly_go_web/src/views/ops/db/component/DbTable.vue diff --git a/mayfly_go_web/src/views/ops/db/SqlExec.vue b/mayfly_go_web/src/views/ops/db/SqlExec.vue index 79398fea..3b16639d 100644 --- a/mayfly_go_web/src/views/ops/db/SqlExec.vue +++ b/mayfly_go_web/src/views/ops/db/SqlExec.vue @@ -116,7 +116,7 @@ const loadTableData = async (inst: any, schema: string, tableName: string) => { tab.dbType = inst.type; tab.db = schema; tab.type = TabType.TableData; - tab.other = { + tab.params = { table: tableName } state.tabs.set(label, tab) @@ -136,7 +136,7 @@ const addQueryTab = async (inst: any, db: string, sqlName: string = '') => { } else { let count = 1; state.tabs.forEach((v) => { - if (v.type == TabType.Query && !v.other.sqlName) { + if (v.type == TabType.Query && !v.params.sqlName) { count++; } }) @@ -153,7 +153,7 @@ const addQueryTab = async (inst: any, db: string, sqlName: string = '') => { tab.dbType = inst.type; tab.db = db; tab.type = TabType.Query; - tab.other = { + tab.params = { sqlName: sqlName, dbs: instanceTreeRef.value.getSchemas(dbId) } @@ -258,7 +258,7 @@ const registerSqlCompletionItemProvider = () => { const tokens = textBeforePointer.trim().split(/\s+/) const lastToken = tokens[tokens.length - 1].toLowerCase() - const dbs = nowTab.other && nowTab.other.dbs; + const dbs = nowTab.params && nowTab.params.dbs; // console.log("光标前文本:=>" + textBeforePointerMulti) // console.log("最后输入的:=>" + lastToken) @@ -290,14 +290,6 @@ const registerSqlCompletionItemProvider = () => { if (tableInfo.tableName) { let table = tableInfo.tableName let db = tableInfo.dbName; - // // 取出表名并提示 - // let dbs = state.monacoOptions.dbTables[dbId + db] - // let columns = dbs ? (dbs[table] || []) : []; - // if ((!columns || columns.length === 0) && db) { - // state.monacoOptions.dbTables[dbId + db] = await loadHintTables(dbId, db) - // dbs = state.monacoOptions.dbTables[dbId + db] - // columns = dbs ? (dbs[table] || []) : []; - // } // 取出表名并提示 let dbHits = await dbInst.loadDbHints(db) let columns = dbHits[table] diff --git a/mayfly_go_web/src/views/ops/db/component/DbTable.vue b/mayfly_go_web/src/views/ops/db/component/DbTable.vue new file mode 100644 index 00000000..b01dec6c --- /dev/null +++ b/mayfly_go_web/src/views/ops/db/component/DbTable.vue @@ -0,0 +1,323 @@ + + + + + diff --git a/mayfly_go_web/src/views/ops/db/component/tab/Query.vue b/mayfly_go_web/src/views/ops/db/component/tab/Query.vue index 99aa20f9..133397a3 100644 --- a/mayfly_go_web/src/views/ops/db/component/tab/Query.vue +++ b/mayfly_go_web/src/views/ops/db/component/tab/Query.vue @@ -51,33 +51,28 @@ 导出 - + 提交 - + 取消 - - - - - + diff --git a/mayfly_go_web/src/views/ops/db/component/tab/TableData.vue b/mayfly_go_web/src/views/ops/db/component/tab/TableData.vue index 56ee36a5..7a32ba7f 100644 --- a/mayfly_go_web/src/views/ops/db/component/tab/TableData.vue +++ b/mayfly_go_web/src/views/ops/db/component/tab/TableData.vue @@ -28,13 +28,11 @@ - + 提交 - - + + 取消 @@ -65,22 +63,12 @@ - - - - - - + + + @@ -115,16 +103,16 @@