SQL编辑器自动提示优化,拖动改变左侧菜单宽度,一些展示优化

This commit is contained in:
暮光:城中城
2021-08-07 10:00:29 +08:00
parent 51f74f60c3
commit 1dece8845d
15 changed files with 288 additions and 205 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-db.png><title>数据库文档管理</title><link href=css/chunk-vendors.8924efc6.css rel=preload as=style><link href=css/index.bb15836f.css rel=preload as=style><link href=js/chunk-vendors.c63802ce.js rel=preload as=script><link href=js/index.73fd47e8.js rel=preload as=script><link href=css/chunk-vendors.8924efc6.css rel=stylesheet><link href=css/index.bb15836f.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-db-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.c63802ce.js></script><script src=js/index.73fd47e8.js></script></body></html>
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-db.png><title>数据库文档管理</title><link href=css/chunk-vendors.8924efc6.css rel=preload as=style><link href=css/index.2a7107f3.css rel=preload as=style><link href=js/chunk-vendors.333ced1f.js rel=preload as=script><link href=js/index.03a22649.js rel=preload as=script><link href=css/chunk-vendors.8924efc6.css rel=stylesheet><link href=css/index.2a7107f3.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-db-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.333ced1f.js></script><script src=js/index.03a22649.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1938,7 +1938,7 @@
},
"asn1.js": {
"version": "4.10.1",
"resolved": "https://registry.npm.taobao.org/asn1.js/download/asn1.js-4.10.1.tgz",
"resolved": "http://registry.npm.taobao.org/asn1.js/download/asn1.js-4.10.1.tgz",
"integrity": "sha1-ucK/WAXx5kqt7tbfOiv6+1pz9aA=",
"dev": true,
"requires": {
@@ -1959,7 +1959,7 @@
"dependencies": {
"inherits": {
"version": "2.0.1",
"resolved": "https://registry.npm.taobao.org/inherits/download/inherits-2.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Finherits%2Fdownload%2Finherits-2.0.1.tgz",
"resolved": "http://registry.npm.taobao.org/inherits/download/inherits-2.0.1.tgz",
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=",
"dev": true
},
@@ -2101,7 +2101,7 @@
},
"babel-helper-vue-jsx-merge-props": {
"version": "2.0.3",
"resolved": "https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"resolved": "http://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/download/babel-helper-vue-jsx-merge-props-2.0.3.tgz",
"integrity": "sha1-Iq69OzOQIyjlEyk6jkmSs4T58bY="
},
"babel-loader": {
@@ -2140,7 +2140,7 @@
},
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"resolved": "http://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
@@ -2273,7 +2273,7 @@
},
"bn.js": {
"version": "4.11.8",
"resolved": "https://registry.npm.taobao.org/bn.js/download/bn.js-4.11.8.tgz",
"resolved": "http://registry.npm.taobao.org/bn.js/download/bn.js-4.11.8.tgz",
"integrity": "sha1-LN4J617jQfSEdGuwMJsyU7GxRC8=",
"dev": true
},
@@ -3056,7 +3056,7 @@
},
"color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcolor-convert%2Fdownload%2Fcolor-convert-1.9.3.tgz",
"resolved": "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz",
"integrity": "sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=",
"dev": true,
"requires": {
@@ -3713,7 +3713,7 @@
},
"deepmerge": {
"version": "1.5.2",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz?cache=0&sync_timestamp=1572279812893&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdeepmerge%2Fdownload%2Fdeepmerge-1.5.2.tgz",
"resolved": "https://registry.npm.taobao.org/deepmerge/download/deepmerge-1.5.2.tgz",
"integrity": "sha1-EEmdhohEza1P7ghC34x/bwyVp1M="
},
"default-gateway": {
@@ -4068,13 +4068,13 @@
},
"domain-browser": {
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/domain-browser/download/domain-browser-1.2.0.tgz?cache=0&sync_timestamp=1574051269386&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdomain-browser%2Fdownload%2Fdomain-browser-1.2.0.tgz",
"resolved": "http://registry.npm.taobao.org/domain-browser/download/domain-browser-1.2.0.tgz",
"integrity": "sha1-PTH1AZGmdJ3RN1p/Ui6CPULlTto=",
"dev": true
},
"domelementtype": {
"version": "1.3.1",
"resolved": "https://registry.npm.taobao.org/domelementtype/download/domelementtype-1.3.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdomelementtype%2Fdownload%2Fdomelementtype-1.3.1.tgz",
"resolved": "http://registry.npm.taobao.org/domelementtype/download/domelementtype-1.3.1.tgz",
"integrity": "sha1-0EjESzew0Qp/Kj1f7j9DM9eQSB8=",
"dev": true
},
@@ -4219,7 +4219,7 @@
},
"emojis-list": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/emojis-list/download/emojis-list-2.1.0.tgz",
"resolved": "http://registry.npm.taobao.org/emojis-list/download/emojis-list-2.1.0.tgz",
"integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=",
"dev": true
},
@@ -4707,7 +4707,7 @@
},
"faye-websocket": {
"version": "0.10.0",
"resolved": "https://registry.npm.taobao.org/faye-websocket/download/faye-websocket-0.10.0.tgz",
"resolved": "http://registry.npm.taobao.org/faye-websocket/download/faye-websocket-0.10.0.tgz",
"integrity": "sha1-TkkvjQTftviQA1B/btvy1QHnxvQ=",
"dev": true,
"requires": {
@@ -5572,7 +5572,7 @@
},
"glob-parent": {
"version": "3.1.0",
"resolved": "https://registry.npm.taobao.org/glob-parent/download/glob-parent-3.1.0.tgz?cache=0&sync_timestamp=1569136652060&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fglob-parent%2Fdownload%2Fglob-parent-3.1.0.tgz",
"resolved": "https://registry.npm.taobao.org/glob-parent/download/glob-parent-3.1.0.tgz",
"integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=",
"dev": true,
"requires": {
@@ -5676,7 +5676,7 @@
},
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npm.taobao.org/has-ansi/download/has-ansi-2.0.0.tgz",
"resolved": "http://registry.npm.taobao.org/has-ansi/download/has-ansi-2.0.0.tgz",
"integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=",
"dev": true,
"requires": {
@@ -5747,7 +5747,7 @@
},
"hash-sum": {
"version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/hash-sum/download/hash-sum-1.0.2.tgz",
"resolved": "http://registry.npm.taobao.org/hash-sum/download/hash-sum-1.0.2.tgz",
"integrity": "sha1-M7QHd3VMZDJXPBIMw4CLvRDUfwQ=",
"dev": true
},
@@ -5986,7 +5986,7 @@
},
"http-proxy-middleware": {
"version": "0.19.1",
"resolved": "https://registry.npm.taobao.org/http-proxy-middleware/download/http-proxy-middleware-0.19.1.tgz",
"resolved": "http://registry.npm.taobao.org/http-proxy-middleware/download/http-proxy-middleware-0.19.1.tgz",
"integrity": "sha1-GDx9xKoUeRUDBkmMIQza+WCApDo=",
"dev": true,
"requires": {
@@ -6195,13 +6195,13 @@
},
"ipaddr.js": {
"version": "1.9.0",
"resolved": "https://registry.npm.taobao.org/ipaddr.js/download/ipaddr.js-1.9.0.tgz",
"resolved": "http://registry.npm.taobao.org/ipaddr.js/download/ipaddr.js-1.9.0.tgz",
"integrity": "sha1-N9905DCg5HVQ/lSi3v4w2KzZX2U=",
"dev": true
},
"is-absolute-url": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/is-absolute-url/download/is-absolute-url-2.1.0.tgz?cache=0&sync_timestamp=1569736493122&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-absolute-url%2Fdownload%2Fis-absolute-url-2.1.0.tgz",
"resolved": "https://registry.npm.taobao.org/is-absolute-url/download/is-absolute-url-2.1.0.tgz",
"integrity": "sha1-UFMN+4T8yap9vnhS6Do3uTufKqY=",
"dev": true
},
@@ -6248,7 +6248,7 @@
},
"is-buffer": {
"version": "1.1.6",
"resolved": "https://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz?cache=0&sync_timestamp=1569905495687&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fis-buffer%2Fdownload%2Fis-buffer-1.1.6.tgz",
"resolved": "http://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz",
"integrity": "sha1-76ouqdqg16suoTqXsritUf776L4=",
"dev": true
},
@@ -6473,7 +6473,7 @@
},
"isarray": {
"version": "1.0.0",
"resolved": "https://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz?cache=0&sync_timestamp=1562592096220&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fisarray%2Fdownload%2Fisarray-1.0.0.tgz",
"resolved": "http://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
"dev": true
},
@@ -7104,7 +7104,7 @@
},
"memory-fs": {
"version": "0.4.1",
"resolved": "https://registry.npm.taobao.org/memory-fs/download/memory-fs-0.4.1.tgz?cache=0&sync_timestamp=1570537491040&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmemory-fs%2Fdownload%2Fmemory-fs-0.4.1.tgz",
"resolved": "http://registry.npm.taobao.org/memory-fs/download/memory-fs-0.4.1.tgz",
"integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=",
"dev": true,
"requires": {
@@ -7589,7 +7589,7 @@
},
"normalize-wheel": {
"version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz",
"resolved": "https://registry.npm.taobao.org/normalize-wheel/download/normalize-wheel-1.0.1.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnormalize-wheel%2Fdownload%2Fnormalize-wheel-1.0.1.tgz",
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
},
"npm-run-path": {
@@ -7863,7 +7863,7 @@
},
"p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npm.taobao.org/p-limit/download/p-limit-1.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-limit%2Fdownload%2Fp-limit-1.3.0.tgz",
"resolved": "http://registry.npm.taobao.org/p-limit/download/p-limit-1.3.0.tgz",
"integrity": "sha1-uGvV8MJWkJEcdZD8v8IBDVSzzLg=",
"dev": true,
"requires": {
@@ -7976,7 +7976,7 @@
},
"pascalcase": {
"version": "0.1.1",
"resolved": "https://registry.npm.taobao.org/pascalcase/download/pascalcase-0.1.1.tgz",
"resolved": "http://registry.npm.taobao.org/pascalcase/download/pascalcase-0.1.1.tgz",
"integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=",
"dev": true
},
@@ -8024,7 +8024,7 @@
},
"path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-0.1.7.tgz?cache=0&sync_timestamp=1574278262588&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fpath-to-regexp%2Fdownload%2Fpath-to-regexp-0.1.7.tgz",
"resolved": "http://registry.npm.taobao.org/path-to-regexp/download/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=",
"dev": true
},
@@ -8652,7 +8652,7 @@
},
"postcss-value-parser": {
"version": "3.3.1",
"resolved": "https://registry.npm.taobao.org/postcss-value-parser/download/postcss-value-parser-3.3.1.tgz",
"resolved": "http://registry.npm.taobao.org/postcss-value-parser/download/postcss-value-parser-3.3.1.tgz",
"integrity": "sha1-n/giVH4okyE88cMO+lGsX9G6goE=",
"dev": true
},
@@ -8896,13 +8896,13 @@
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz",
"resolved": "https://registry.npm.taobao.org/qs/download/qs-6.5.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fqs%2Fdownload%2Fqs-6.5.2.tgz",
"integrity": "sha1-yzroBuh0BERYTvFUzo7pjUA/PjY=",
"dev": true
},
"query-string": {
"version": "4.3.4",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-4.3.4.tgz?cache=0&sync_timestamp=1573620418700&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fquery-string%2Fdownload%2Fquery-string-4.3.4.tgz",
"resolved": "https://registry.npm.taobao.org/query-string/download/query-string-4.3.4.tgz",
"integrity": "sha1-u7aTucqRXCMlFbIosaArYJBD2+s=",
"dev": true,
"requires": {
@@ -9008,7 +9008,7 @@
},
"readdirp": {
"version": "2.2.1",
"resolved": "https://registry.npm.taobao.org/readdirp/download/readdirp-2.2.1.tgz?cache=0&sync_timestamp=1571011714883&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Freaddirp%2Fdownload%2Freaddirp-2.2.1.tgz",
"resolved": "https://registry.npm.taobao.org/readdirp/download/readdirp-2.2.1.tgz",
"integrity": "sha1-DodiKjMlqjPokihcr4tOhGUppSU=",
"dev": true,
"requires": {
@@ -9356,12 +9356,12 @@
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz?cache=0&sync_timestamp=1562377642757&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-buffer%2Fdownload%2Fsafe-buffer-5.1.2.tgz",
"resolved": "http://registry.npm.taobao.org/safe-buffer/download/safe-buffer-5.1.2.tgz",
"integrity": "sha1-mR7GnSluAxN0fVm9/St0XDX4go0="
},
"safe-regex": {
"version": "1.1.0",
"resolved": "https://registry.npm.taobao.org/safe-regex/download/safe-regex-1.1.0.tgz?cache=0&sync_timestamp=1571687334026&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsafe-regex%2Fdownload%2Fsafe-regex-1.1.0.tgz",
"resolved": "http://registry.npm.taobao.org/safe-regex/download/safe-regex-1.1.0.tgz",
"integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=",
"dev": true,
"requires": {
@@ -10061,7 +10061,7 @@
},
"stream-http": {
"version": "2.8.3",
"resolved": "https://registry.npm.taobao.org/stream-http/download/stream-http-2.8.3.tgz",
"resolved": "http://registry.npm.taobao.org/stream-http/download/stream-http-2.8.3.tgz",
"integrity": "sha1-stJCRpKIpaJ+xP6JM6z2I95lFPw=",
"dev": true,
"requires": {
@@ -10519,7 +10519,7 @@
"dependencies": {
"commander": {
"version": "2.19.0",
"resolved": "https://registry.npm.taobao.org/commander/download/commander-2.19.0.tgz?cache=0&sync_timestamp=1573464045808&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.19.0.tgz",
"resolved": "https://registry.npm.taobao.org/commander/download/commander-2.19.0.tgz",
"integrity": "sha1-9hmKqE5bg8RgVLlN3tv+1e6f8So=",
"dev": true
},
@@ -10938,7 +10938,7 @@
},
"wangeditor": {
"version": "3.1.1",
"resolved": "http://registry.npm.taobao.org/wangeditor/download/wangeditor-3.1.1.tgz",
"resolved": "https://registry.npm.taobao.org/wangeditor/download/wangeditor-3.1.1.tgz",
"integrity": "sha1-+9PB1JdpI8nt67hbKdMLNVEq0Dk="
},
"watchpack": {

View File

@@ -4,7 +4,7 @@
<router-view></router-view>
</template>
<el-container v-else>
<el-aside style="background: #fafafa;">
<el-aside style="background: #fafafa;" :style="{ width: rightAsideWidth + 'px' }">
<div style="padding: 10px;height: 100%;box-sizing: border-box;">
<div style="margin-bottom: 10px;">
<el-select v-model="choiceDatasourceGroup" @change="sourceGroupChangeEvents" size="small" filterable placeholder="请先选择分组" style="width: 100%;">
@@ -55,6 +55,11 @@
</el-tree>
</div>
</el-aside>
<div ref="rightResize" class="right-resize">
<el-tooltip class="item" effect="dark" content="拖动改变侧边栏宽度" placement="left">
<i ref="rightResizeBar">...</i>
</el-tooltip>
</div>
<el-container>
<el-header>
<span class="header-right-user-name">{{userSelfInfo.userName}}</span>
@@ -100,6 +105,7 @@
databaseList: [],
databaseListLoading: false,
databaseExpandedKeys: [],
rightAsideWidth: 300,
}
},
computed: {
@@ -113,6 +119,7 @@
mounted: function () {
this.getSelfUserInfo();
this.loadDatasourceList();
this.dragChangeRightAsideWidth();
},
methods: {
userSettingDropdown(command) {
@@ -259,6 +266,35 @@
this.databaseExpandedKeys = [param.host];
});
},
dragChangeRightAsideWidth: function() {
// 保留this引用
let resize = this.$refs.rightResize;
let resizeBar = this.$refs.rightResizeBar;
resize.onmousedown = e => {
let startX = e.clientX;
// 颜色改变提醒
resize.style.background = "#ccc";
resizeBar.style.background = "#aaa";
resize.left = resize.offsetLeft;
document.onmousemove = e2 => {
// 计算并应用位移量
let endX = e2.clientX;
let moveLen = startX - endX;
if ((moveLen < 0 && this.rightAsideWidth < 600) || (moveLen > 0 && this.rightAsideWidth > 200)) {
startX = endX;
this.rightAsideWidth -= moveLen;
}
};
document.onmouseup = () => {
// 颜色恢复
resize.style.background = "#fafafa";
resizeBar.style.background = "#ccc";
document.onmousemove = null;
document.onmouseup = null;
};
return false;
};
}
}
}
</script>
@@ -288,4 +324,23 @@
.el-tree-node__content{}
.el-tree-node__content .el-icon-more{margin-left: 5px;color: #606266;font-size: 12px; display: none;padding: 2px 5px;}
.el-tree-node__content:hover .el-icon-more{display: inline-block;}
.right-resize {
width: 5px;
height: 100%;
cursor: w-resize;
background: #fafafa;
}
.right-resize i{
margin-top: 300px;
width: 5px;
height: 35px;
display: inline-block;
word-wrap: break-word;
word-break: break-all;
line-height: 8px;
border-radius: 5px;
background: #ccc;
color: #888;
}
</style>

View File

@@ -10,6 +10,7 @@ export default {
tableInfo: {},
columnInfo: {},
lastCallbackArr: [],
isAutocomplete: false,
change(source) {
this.source = source;
this.lastCallbackArr = [];
@@ -51,23 +52,34 @@ export default {
}
}
},
startAutocomplete(editor) {
this.isAutocomplete = true;
editor.execCommand("startAutocomplete");
},
async getCompletions(editor, session, pos, prefix, callback) {
let callbackArr = [];
let lineStr = session.getLine(pos.row).substring(0, pos.column - 1);
let endPos = this.isAutocomplete ? pos.column : pos.column - 1;
let lineStr = session.getLine(pos.row).substring(0, endPos);
this.isAutocomplete = false;
console.log("Executor.vue getCompletionssourceId" + JSON.stringify(this.source) + ' lineStr' + lineStr, pos);
if (!!this.source.tableName) {
// 如果指定了表名,则只提示字段,其他都不用管,用在表数据查看页面
callbackArr = await this.getAssignTableColumns(this.source.dbName, this.source.tableName);
callback(null, callbackArr);
} else if (lineStr.endsWith("from ") || lineStr.endsWith("join ")) {
} else if (lineStr.endsWith("from ") || lineStr.endsWith("join ") || lineStr.endsWith("into ")
|| lineStr.endsWith("update ") || lineStr.endsWith("table ")) {
// 获取库和表
callbackArr = this.getDatabasesAndTables();
this.lastCallbackArr = callbackArr;
callback(null, callbackArr);
} else if (lineStr.endsWith(".")) {
// 获取表和字段
callbackArr = await this.getTablesAndColumns(lineStr);
this.lastCallbackArr = callbackArr;
callback(null, callbackArr);
} else if (lineStr.endsWith("select ") || lineStr.endsWith("where ") || lineStr.endsWith("and ") || lineStr.endsWith("or ")) {
} else if (lineStr.endsWith("select ") || lineStr.endsWith("where ") || lineStr.endsWith("and ")
|| lineStr.endsWith("or ") || lineStr.endsWith("set ")) {
// 获取字段
callbackArr = await this.getTableColumns(session, pos);
this.lastCallbackArr = callbackArr;
callback(null, callbackArr);

View File

@@ -0,0 +1,3 @@
.ace_editor.ace_autocomplete{
width: 400px;
}

View File

@@ -6,6 +6,7 @@ import 'brace/mode/json';
import 'brace/snippets/json';
import 'brace/theme/monokai';
import completer from './DatabaseCompleter'
import './index.css';
export default {
render: function (h) {
@@ -92,6 +93,13 @@ export default {
// console.log('change content' + content);
// editor.execCommand("startAutocomplete");
});
editor.commands.addCommand({
name: "start-autocomplete",
bindKey: {win: "Alt-Enter", mac: "Alt-Enter"},
exec: function (editor) {
completer.startAutocomplete(editor);
}
});
if (vm.options) {
editor.setOptions(vm.options);
}

View File

@@ -54,7 +54,7 @@
methods: {
initQueryParam(to) {
this.vueQueryParam = to.query;
let newName = {key: this.$route.fullPath, val: '库-' + this.vueQueryParam.dbName};
let newName = {key: this.$route.fullPath, val: this.vueQueryParam.dbName};
this.$store.commit('global/addTableName', newName);
},
searchSubmit() {

View File

@@ -3,9 +3,14 @@
<el-tabs v-model="tabActiveName" @tab-click="tabActiveNameChange">
<el-tab-pane label="表字段" name="columns">
<div v-loading="columnListLoading">
<div style="text-align: right; margin-bottom: 10px;">
<el-row type="flex" class="row-bg" justify="space-between" style="margin-bottom: 10px;">
<el-col>
<span style="color: #888;vertical-align: middle;">表名{{tableStatusInfo.name}}</span>
</el-col>
<el-col style="width: 200px;text-align: right;">
<el-button size="small" plain type="primary" @click="showCreateTableDdl" style="margin-left: 10px;" icon="el-icon-magic-stick">DDL</el-button>
</div>
</el-col>
</el-row>
<el-table :data="columnList" stripe border style="width: 100%; margin-bottom: 5px;">
<el-table-column prop="name" label="字段名" width="220"></el-table-column>
<el-table-column label="自增" width="50">
@@ -177,7 +182,7 @@
tableInfo.inEdit = 0;
tableInfo.newDesc = tableInfo.description;
this.tableInfo = tableInfo;
let newName = {key: this.$route.fullPath, val: '表-' + tableInfo.tableName};
let newName = {key: this.$route.fullPath, val: tableInfo.tableName};
this.$store.commit('global/addTableName', newName);
this.columnListLoading = false;
});

View File

@@ -108,7 +108,7 @@
methods: {
initQueryParam(to) {
this.vueQueryParam = to.query;
let newName = {key: this.$route.fullPath, val: '函数管理-' + this.vueQueryParam.dbName};
let newName = {key: this.$route.fullPath, val: '函数管理'};
this.$store.commit('global/addTableName', newName);
},
handleCurrentChange(to) {

View File

@@ -108,7 +108,7 @@
methods: {
initQueryParam(to) {
this.vueQueryParam = to.query;
let newName = {key: this.$route.fullPath, val: '编辑函数-' + this.vueQueryParam.procName};
let newName = {key: this.$route.fullPath, val: '编辑函数'};
this.$store.commit('global/addTableName', newName);
},
sqlExecutorInit(editor) {