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

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

@@ -1,32 +1,32 @@
<template>
<div id="app">
<template v-if="fullscreen">
<router-view></router-view>
</template>
<el-container v-else>
<el-aside style="background: #fafafa;">
<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%;">
<div id="app">
<template v-if="fullscreen">
<router-view></router-view>
</template>
<el-container v-else>
<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%;">
<el-option value="" label="全部分组"></el-option>
<el-option v-for="item in datasourceGroupList" :key="item" :value="item"></el-option>
</el-select>
<el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" size="small" filterable placeholder="请先选择数据源" style="width: 100%;margin-top: 10px;">
<el-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</div>
<el-menu :router="true" class="el-menu-vertical" style="height: auto;">
<el-menu-item index="/data/datasourceManage"><i class="el-icon-coin"></i>数据源管理</el-menu-item>
<el-menu-item index="/data/executor"><i class="el-icon-video-play"></i>SQL执行器</el-menu-item>
<el-submenu index="1">
<template slot="title">
<i class="el-icon-s-platform"></i>
<span slot="title">管理工具</span>
</template>
<el-menu-item index="/data/export"><i class="el-icon-finished"></i>数据库表导出</el-menu-item>
<el-menu-item index="/data/transferData"><i class="el-icon-document-copy"></i>数据互导工具</el-menu-item>
</el-submenu>
</el-menu>
</el-select>
<el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" size="small" filterable placeholder="请先选择数据源" style="width: 100%;margin-top: 10px;">
<el-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select>
</div>
<el-menu :router="true" class="el-menu-vertical" style="height: auto;">
<el-menu-item index="/data/datasourceManage"><i class="el-icon-coin"></i>数据源管理</el-menu-item>
<el-menu-item index="/data/executor"><i class="el-icon-video-play"></i>SQL执行器</el-menu-item>
<el-submenu index="1">
<template slot="title">
<i class="el-icon-s-platform"></i>
<span slot="title">管理工具</span>
</template>
<el-menu-item index="/data/export"><i class="el-icon-finished"></i>数据库表导出</el-menu-item>
<el-menu-item index="/data/transferData"><i class="el-icon-document-copy"></i>数据互导工具</el-menu-item>
</el-submenu>
</el-menu>
<el-tree :props="defaultProps" :data="databaseList" @node-click="handleNodeClick"
ref="databaseTree" highlight-current empty-text=""
:default-expanded-keys="databaseExpandedKeys"
@@ -46,62 +46,68 @@
<el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-coin" :command="{command: 'procedure', node: node}">函数管理</el-dropdown-item>
<el-dropdown-item icon="el-icon-refresh" :command="{command: 'refresh', node: node}">刷新</el-dropdown-item>
<!-- <el-dropdown-item icon="el-icon-upload2" :command="{command: 'upload', node: node}">导入</el-dropdown-item>-->
<!-- <el-dropdown-item icon="el-icon-download" :command="{command: 'download', node: node}">导出</el-dropdown-item>-->
<!-- <el-dropdown-item icon="el-icon-upload2" :command="{command: 'upload', node: node}">导入</el-dropdown-item>-->
<!-- <el-dropdown-item icon="el-icon-download" :command="{command: 'download', node: node}">导出</el-dropdown-item>-->
</el-dropdown-menu>
</el-dropdown>
</span>
</div>
</el-tree>
</div>
</el-aside>
<el-container>
<el-header>
<span class="header-right-user-name">{{userSelfInfo.userName}}</span>
<el-dropdown @command="userSettingDropdown" trigger="click">
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="console">控制台</el-dropdown-item>
<el-dropdown-item command="aboutDoc" divided>关于</el-dropdown-item>
<el-dropdown-item command="myInfo">我的资料</el-dropdown-item>
<el-dropdown-item command="userSignOut">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-header>
<el-main style="padding: 0;">
</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>
<el-dropdown @command="userSettingDropdown" trigger="click">
<i class="el-icon-setting" style="margin-right: 15px; font-size: 16px;cursor: pointer;color: #fff;"> </i>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="console">控制台</el-dropdown-item>
<el-dropdown-item command="aboutDoc" divided>关于</el-dropdown-item>
<el-dropdown-item command="myInfo">我的资料</el-dropdown-item>
<el-dropdown-item command="userSignOut">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-header>
<el-main style="padding: 0;">
<router-view @initLoadDataList="initLoadDataList"
@loadDatasourceList="loadDatasourceList">
</router-view>
</el-main>
</el-container>
</el-container>
</el-container>
<about-dialog ref="aboutDialog"></about-dialog>
</div>
</div>
</template>
<script>
import userApi from './common/api/user'
import datasourceApi from './common/api/datasource'
import aboutDialog from './views/common/AboutDialog'
import userApi from './common/api/user'
import datasourceApi from './common/api/datasource'
import aboutDialog from './views/common/AboutDialog'
export default {
data() {
return {
isCollapse: false,
userSelfInfo: {},
// 数据源相关
datasourceOptions: [],
datasourceList: [],
export default {
data() {
return {
isCollapse: false,
userSelfInfo: {},
// 数据源相关
datasourceOptions: [],
datasourceList: [],
datasourceGroupList: [],
choiceDatasourceId: "",
choiceDatasourceId: "",
choiceDatasourceGroup: "",
defaultProps: {children: 'children', label: 'name'},
// 页面展示相关
databaseList: [],
defaultProps: {children: 'children', label: 'name'},
// 页面展示相关
databaseList: [],
databaseListLoading: false,
databaseExpandedKeys: [],
}
},
databaseExpandedKeys: [],
rightAsideWidth: 300,
}
},
computed: {
fullscreen () {
return this.$store.state.global.fullscreen;
@@ -110,35 +116,36 @@
components: {
'about-dialog': aboutDialog
},
mounted: function () {
mounted: function () {
this.getSelfUserInfo();
this.loadDatasourceList();
this.dragChangeRightAsideWidth();
},
methods: {
userSettingDropdown(command) {
console.log("command:" + command);
if (command == 'userSignOut') {
this.userSignOut();
} else if (command == 'aboutDoc') {
methods: {
userSettingDropdown(command) {
console.log("command:" + command);
if (command == 'userSignOut') {
this.userSignOut();
} else if (command == 'aboutDoc') {
this.$refs.aboutDialog.show();
} else if (command == 'myInfo') {
this.$router.push({path: '/user/myInfo'});
} else if (command == 'console') {
} else if (command == 'myInfo') {
this.$router.push({path: '/user/myInfo'});
} else if (command == 'console') {
window.open(process.env.VUE_APP_BASE_API, '_blank');
} else {
} else {
this.$message.warning("功能暂未开放");
}
},
userSignOut() {
userApi.userLogout().then(() => {
location.reload();
});
},
getSelfUserInfo() {
userApi.getSelfUserInfo().then(json=>{
this.userSelfInfo = json.data;
});
},
}
},
userSignOut() {
userApi.userLogout().then(() => {
location.reload();
});
},
getSelfUserInfo() {
userApi.getSelfUserInfo().then(json=>{
this.userSelfInfo = json.data;
});
},
sourceGroupChangeEvents() {
let datasourceOptions = [];
this.datasourceList.forEach(item => {
@@ -149,33 +156,33 @@
this.datasourceOptions = datasourceOptions;
this.choiceDatasourceId = '';
this.databaseList = [];
},
datasourceChangeEvents() {
},
datasourceChangeEvents() {
let choiceSource = this.datasourceList.find(item => item.id == this.choiceDatasourceId);
this.loadDatabaseList(this.choiceDatasourceId, choiceSource.name);
},
handleNodeClick(node) {
console.log("点击节点:", node);
// 执行器里面点击库表不跳转页面
// if (this.$router.currentRoute.path == "/data/executor") {
// return;
// }
if (node.type == 1) {
this.nowClickPath = {sourceId: this.choiceDatasourceId, host: node.host, dbName: node.dbName, tableName: node.tableName};
this.$router.push({path: '/table/database', query: this.nowClickPath});
} else if (node.type == 2) {
this.nowClickPath = {sourceId: this.choiceDatasourceId, host: node.host, dbName: node.dbName, tableName: node.tableName};
this.$router.push({path: '/table/info', query: this.nowClickPath});
}
},
handleNodeExpand(node) {
if (node.children.length > 0 && node.children[0].needLoad) {
console.log("加载节点:", node);
if (node.type == 1) {
},
handleNodeClick(node) {
console.log("点击节点:", node);
// 执行器里面点击库表不跳转页面
// if (this.$router.currentRoute.path == "/data/executor") {
// return;
// }
if (node.type == 1) {
this.nowClickPath = {sourceId: this.choiceDatasourceId, host: node.host, dbName: node.dbName, tableName: node.tableName};
this.$router.push({path: '/table/database', query: this.nowClickPath});
} else if (node.type == 2) {
this.nowClickPath = {sourceId: this.choiceDatasourceId, host: node.host, dbName: node.dbName, tableName: node.tableName};
this.$router.push({path: '/table/info', query: this.nowClickPath});
}
},
handleNodeExpand(node) {
if (node.children.length > 0 && node.children[0].needLoad) {
console.log("加载节点:", node);
if (node.type == 1) {
this.loadGetTableList(node);
}
}
},
}
}
},
databaseActionDropdown(param) {
if (param.command == 'refresh') {
param.node.loading = true;
@@ -191,26 +198,26 @@
this.$message.warning("暂未支持的选项");
}
},
loadGetTableList(node, callback) {
datasourceApi.tableList({sourceId: this.choiceDatasourceId, dbName: node.dbName}).then(json => {
let pathIndex = [];
let result = json.data || [];
for (let i = 0; i < result.length; i++) {
let item = {
id: node.host + "_" + node.dbName + "_" + result[i].tableName, host: node.host,
dbName: node.dbName, tableName: result[i].tableName, name: result[i].tableName, type: 2,
comment: result[i].tableComment
};
// item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载
pathIndex.push(item);
}
node.children = pathIndex;
if (typeof callback == 'function') {
callback(pathIndex);
}
});
},
loadDatasourceList() {
loadGetTableList(node, callback) {
datasourceApi.tableList({sourceId: this.choiceDatasourceId, dbName: node.dbName}).then(json => {
let pathIndex = [];
let result = json.data || [];
for (let i = 0; i < result.length; i++) {
let item = {
id: node.host + "_" + node.dbName + "_" + result[i].tableName, host: node.host,
dbName: node.dbName, tableName: result[i].tableName, name: result[i].tableName, type: 2,
comment: result[i].tableComment
};
// item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载
pathIndex.push(item);
}
node.children = pathIndex;
if (typeof callback == 'function') {
callback(pathIndex);
}
});
},
loadDatasourceList() {
datasourceApi.datasourceList({}).then(json => {
this.datasourceList = json.data || [];
if (this.datasourceList.length <= 0) {
@@ -218,12 +225,12 @@
}
let datasourceOptions = [];
this.datasourceList.forEach(item => datasourceOptions.push({label: item.name, value: item.id}));
this.datasourceOptions = datasourceOptions;
this.datasourceOptions = datasourceOptions;
let datasourceGroupList = [];
this.datasourceList.filter(item => !!item.groupName).forEach(item => datasourceGroupList.push(item.groupName));
this.datasourceGroupList = Array.from(new Set(datasourceGroupList));
});
},
},
loadDatabaseList(sourceId, host) {
return new Promise((resolve, reject) => {
this.databaseList = [];
@@ -249,43 +256,91 @@
this.databaseListLoading = false;
});
});
},
initLoadDataList(param) {
if (this.databaseList.length > 0) {
return;
}
},
initLoadDataList(param) {
if (this.databaseList.length > 0) {
return;
}
this.choiceDatasourceId = parseInt(param.sourceId);
this.loadDatabaseList(param.sourceId, param.host).then(() => {
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>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#app, .el-container, .el-menu {
height: 100%;
}
html, body {
margin: 0;
padding: 0;
height: 100%;
}
#app, .el-container, .el-menu {
height: 100%;
}
.el-header {
background-color: #1D4E89 !important;
}
.database-list-tree{background-color: #fafafa;overflow-x: auto;min-height: 150px;}
.database-list-tree .el-loading-mask{background-color: #fafafa;}
.database-list-tree .el-tree-node>.el-tree-node__children {
overflow: unset;
}
.header-right-user-name{color: #fff;padding-right: 5px;}
.el-menu-vertical{border-right: 0;background: #fafafa;}
.el-menu-vertical .el-menu{background: #fafafa;}
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
.database-list-tree{background-color: #fafafa;overflow-x: auto;min-height: 150px;}
.database-list-tree .el-loading-mask{background-color: #fafafa;}
.database-list-tree .el-tree-node>.el-tree-node__children {
overflow: unset;
}
.header-right-user-name{color: #fff;padding-right: 5px;}
.el-menu-vertical{border-right: 0;background: #fafafa;}
.el-menu-vertical .el-menu{background: #fafafa;}
.el-header {background-color: #409EFF; color: #333; line-height: 40px; text-align: right;height: 40px !important;}
.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-button size="small" plain type="primary" @click="showCreateTableDdl" style="margin-left: 10px;" icon="el-icon-magic-stick">DDL</el-button>
</div>
<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>
</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) {