fix:修复数据库schema提示

This commit is contained in:
刘宗洋
2023-06-13 15:57:08 +08:00
parent 570db453d7
commit 4f08975df2
2 changed files with 13 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
<div> <div>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<el-button type="primary" icon="plus" @click="addQueryTab({ id: nowDbInst.id }, state.db)" <el-button type="primary" icon="plus" @click="addQueryTab({ id: nowDbInst.id, dbs: nowDbInst.databases }, state.db)"
size="small">新建查询</el-button> size="small">新建查询</el-button>
</el-col> </el-col>
<el-col :span="20" v-if="state.db"> <el-col :span="20" v-if="state.db">
@@ -245,8 +245,8 @@ const nodeClick = async (data: any) => {
const nodeKey = data.key; const nodeKey = data.key;
const dataType = data.type; const dataType = data.type;
// 点击数据库,修改当前数据库信息 // 点击数据库,修改当前数据库信息
if (dataType === NodeType.Db || dataType === NodeType.SqlMenu || dataType === NodeType.TableMenu) { if (dataType === NodeType.Db || dataType === NodeType.SqlMenu || dataType === NodeType.TableMenu || dataType === NodeType.DbInst) {
changeSchema({ id: params.id, name: params.name, type: params.type, tagPath: params.tagPath }, params.db); changeSchema({ id: params.id, name: params.name, type: params.type, tagPath: params.tagPath, databases: params.database}, params.db);
return; return;
} }
@@ -492,7 +492,7 @@ const registerSqlCompletionItemProvider = () => {
const lastToken = tokens[tokens.length - 1].toLowerCase() const lastToken = tokens[tokens.length - 1].toLowerCase()
const secondToken = tokens.length >2 && tokens[tokens.length - 2].toLowerCase() || '' const secondToken = tokens.length >2 && tokens[tokens.length - 2].toLowerCase() || ''
const dbs = nowTab.params && nowTab.params.dbs; const dbs = nowTab.params?.dbs?.split(' ') || [];
// console.log("光标前文本:=>" + textBeforePointerMulti) // console.log("光标前文本:=>" + textBeforePointerMulti)
// console.log("最后输入的:=>" + lastToken) // console.log("最后输入的:=>" + lastToken)
if (lastToken.indexOf('.') > -1 || secondToken.indexOf('.') > -1) { if (lastToken.indexOf('.') > -1 || secondToken.indexOf('.') > -1) {

View File

@@ -30,6 +30,9 @@ export class DbInst {
*/ */
dbs: Map<string, Db> = new Map() dbs: Map<string, Db> = new Map()
/** 数据库schema多个用空格隔开 */
databases: string
/** /**
* 默认查询分页数量 * 默认查询分页数量
*/ */
@@ -216,6 +219,7 @@ export class DbInst {
dbInst.id = inst.id; dbInst.id = inst.id;
dbInst.name = inst.name; dbInst.name = inst.name;
dbInst.type = inst.type; dbInst.type = inst.type;
dbInst.databases = inst.databases;
dbInstCache.set(dbInst.id, dbInst); dbInstCache.set(dbInst.id, dbInst);
return dbInst; return dbInst;