数据库表导出,支持修改用户密码
This commit is contained in:
@@ -96,6 +96,9 @@
|
||||
<el-form-item label="邮箱">
|
||||
<el-input v-model="editUserForm.email"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="新密码">
|
||||
<el-input v-model="editUserForm.password" placeholder="为空代表不修改密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="editUserForm.delFlag" :active-value="0" active-text="正常" :inactive-value="2" inactive-text="停用"></el-switch>
|
||||
</el-form-item>
|
||||
|
||||
3
zyplayer-doc-ui/db-open-ui/.babelrc
Normal file
3
zyplayer-doc-ui/db-open-ui/.babelrc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["vue-app"]
|
||||
}
|
||||
5
zyplayer-doc-ui/db-open-ui/.gitignore
vendored
Normal file
5
zyplayer-doc-ui/db-open-ui/.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
.DS_Store
|
||||
node_modules/
|
||||
dist/
|
||||
npm-debug.log
|
||||
.idea
|
||||
9
zyplayer-doc-ui/db-open-ui/Makefile
Normal file
9
zyplayer-doc-ui/db-open-ui/Makefile
Normal file
@@ -0,0 +1,9 @@
|
||||
.PHONY: dist build
|
||||
install:
|
||||
@npm install
|
||||
|
||||
dev: install
|
||||
@npm run dev
|
||||
|
||||
build:
|
||||
@npm run build
|
||||
28
zyplayer-doc-ui/db-open-ui/README.md
Normal file
28
zyplayer-doc-ui/db-open-ui/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# zyplayer-doc-db项目的开放文档UI
|
||||
|
||||
## 环境要求
|
||||
|
||||
`Node >= 6`
|
||||
|
||||
|
||||
## 开始
|
||||
|
||||
``` bash
|
||||
# 执行下面的命令初始化
|
||||
yarn
|
||||
```
|
||||
|
||||
## 开发环境
|
||||
|
||||
``` bash
|
||||
# 执行下面的命令后即可到 localhost:8010 看到页面
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 打包
|
||||
|
||||
``` bash
|
||||
# 开发完成后执行打包命令,然后复制dist目录里的文件到zyplayer-doc-manage项目的webjars目录下即可
|
||||
# 打包前记得修改zyplayer-doc-ui/manage-ui/src/common/config/apimix.js里的HOST接口地址
|
||||
npm run build
|
||||
```
|
||||
7702
zyplayer-doc-ui/db-open-ui/package-lock.json
generated
Normal file
7702
zyplayer-doc-ui/db-open-ui/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
40
zyplayer-doc-ui/db-open-ui/package.json
Normal file
40
zyplayer-doc-ui/db-open-ui/package.json
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"name": "console-ui",
|
||||
"description": "console-ui",
|
||||
"author": "yi.shyang@ele.me",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "webpack-dev-server --inline --hot --env.dev",
|
||||
"build": "rimraf dist && webpack -p --progress --hide-modules"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.18.0",
|
||||
"element-ui": "^2.10.0",
|
||||
"vue": "^2.5.16",
|
||||
"vue-axios": "^2.1.4",
|
||||
"vue-router": "^3.0.6",
|
||||
"wangeditor": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.6.0",
|
||||
"babel-core": "^6.24.1",
|
||||
"babel-loader": "^6.4.0",
|
||||
"babel-preset-vue-app": "^1.2.0",
|
||||
"css-loader": "^0.27.0",
|
||||
"file-loader": "^0.10.1",
|
||||
"html-webpack-plugin": "^2.24.1",
|
||||
"postcss-loader": "^1.3.3",
|
||||
"rimraf": "^2.6.3",
|
||||
"style-loader": "^0.13.2",
|
||||
"url-loader": "^0.5.8",
|
||||
"vue-loader": "^13.3.0",
|
||||
"vue-template-compiler": "^2.5.16",
|
||||
"webpack": "^2.4.1",
|
||||
"webpack-dev-server": "^2.4.2",
|
||||
"axios": "^0.18.0",
|
||||
"vue-axios": "^2.1.4"
|
||||
}
|
||||
}
|
||||
5
zyplayer-doc-ui/db-open-ui/postcss.config.js
Normal file
5
zyplayer-doc-ui/db-open-ui/postcss.config.js
Normal file
@@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
plugins: [
|
||||
require('autoprefixer')()
|
||||
]
|
||||
}
|
||||
175
zyplayer-doc-ui/db-open-ui/src/App.vue
Normal file
175
zyplayer-doc-ui/db-open-ui/src/App.vue
Normal file
@@ -0,0 +1,175 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<template v-if="global.fullscreen">
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
<el-container v-else>
|
||||
<el-aside>
|
||||
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
|
||||
<el-tree :props="defaultProps" :data="databaseList" @node-click="handleNodeClick"
|
||||
ref="databaseTree" highlight-current draggable
|
||||
:default-expanded-keys="databaseExpandedKeys"
|
||||
node-key="id" @node-expand="handleNodeExpand"
|
||||
style="background-color: #fafafa;">
|
||||
<span slot-scope="{node, data}">
|
||||
<span v-if="data.needLoad"><i class="el-icon-loading"></i></span>
|
||||
<span v-else>{{node.label}}</span>
|
||||
</span>
|
||||
</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="aboutDoc">关于</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</el-header>
|
||||
<el-main style="padding: 0;">
|
||||
<router-view></router-view>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
<!--关于弹窗-->
|
||||
<el-dialog title="关于zyplayer-doc" :visible.sync="aboutDialogVisible" width="600px">
|
||||
<el-form>
|
||||
<el-form-item label="项目地址:">
|
||||
<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc</a>
|
||||
</el-form-item>
|
||||
<el-form-item label="开发人员:">
|
||||
<a target="_blank" href="http://zyplayer.com">暮光:城中城</a>
|
||||
</el-form-item>
|
||||
<template v-if="upgradeInfo.lastVersion">
|
||||
<el-form-item label="当前版本:">{{upgradeInfo.nowVersion}}</el-form-item>
|
||||
<el-form-item label="最新版本:">{{upgradeInfo.lastVersion}}</el-form-item>
|
||||
<el-form-item label="升级地址:">
|
||||
<a target="_blank" :href="upgradeInfo.upgradeUrl">{{upgradeInfo.upgradeUrl}}</a>
|
||||
</el-form-item>
|
||||
<el-form-item label="升级内容:">{{upgradeInfo.upgradeContent}}</el-form-item>
|
||||
</template>
|
||||
<el-form-item label="">
|
||||
欢迎加群讨论,QQ群号:466363173,欢迎提交需求,欢迎使用和加入开发!
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import global from './common/config/global'
|
||||
import toast from './common/lib/common/toast'
|
||||
|
||||
var app;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isCollapse: false,
|
||||
aboutDialogVisible: false,
|
||||
userSelfInfo: {},
|
||||
// 数据源相关
|
||||
datasourceOptions: [],
|
||||
datasourceList: [],
|
||||
choiceDatasource: "",
|
||||
defaultProps: {children: 'children', label: 'name'},
|
||||
// 页面展示相关
|
||||
nowDatasourceShow: {},
|
||||
databaseList: [],
|
||||
databaseExpandedKeys: [],
|
||||
// 升级信息
|
||||
upgradeInfo: {},
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
global.vue.$app = this;
|
||||
this.loadDatasourceList();
|
||||
},
|
||||
methods: {
|
||||
userSettingDropdown(command) {
|
||||
console.log("command:" + command);
|
||||
if (command == 'aboutDoc') {
|
||||
app.aboutDialogVisible = true;
|
||||
} else {
|
||||
toast.notOpen();
|
||||
}
|
||||
},
|
||||
datasourceChangeEvents() {
|
||||
app.nowDatasourceShow = this.choiceDatasource;
|
||||
app.loadDatabaseList(this.choiceDatasource);
|
||||
},
|
||||
handleNodeClick(node) {
|
||||
console.log("点击节点:", node);
|
||||
if (node.type == 2) {
|
||||
this.nowClickPath = {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) {
|
||||
app.loadGetTableList(node);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadGetTableList(node, callback) {
|
||||
var pathIndex = [];
|
||||
var result = docDbDatabase.tableList || [];
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
var item = {
|
||||
id: result[i].tableName, host: "",
|
||||
dbName: "", tableName: result[i].tableName, name: result[i].tableName, type: 2
|
||||
};
|
||||
// item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载
|
||||
pathIndex.push(item);
|
||||
}
|
||||
node.children = pathIndex;
|
||||
if (typeof callback == 'function') {
|
||||
callback(pathIndex);
|
||||
}
|
||||
},
|
||||
loadDatasourceList() {
|
||||
app.datasourceOptions = [{label: "数据源", value: ""}];
|
||||
this.datasourceChangeEvents();
|
||||
},
|
||||
loadDatabaseList(host, callback) {
|
||||
var pathIndex = [];
|
||||
|
||||
pathIndex.push({
|
||||
id: "1", host: host, dbName: "数据库表",
|
||||
name: "数据库表", type: 1, children: [{label: '', needLoad: true}]
|
||||
});
|
||||
app.databaseList = pathIndex;
|
||||
if (typeof callback == 'function') {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
initLoadDataList(host, dbName) {
|
||||
if (app.databaseList.length > 0) {
|
||||
return;
|
||||
}
|
||||
this.loadDatabaseList(host, function () {
|
||||
app.databaseExpandedKeys = [host];
|
||||
});
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
#app, .el-container, .el-menu {
|
||||
height: 100%;
|
||||
}
|
||||
.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;}
|
||||
</style>
|
||||
12
zyplayer-doc-ui/db-open-ui/src/common/config/apilist.js
Normal file
12
zyplayer-doc-ui/db-open-ui/src/common/config/apilist.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var URL = {
|
||||
};
|
||||
|
||||
var URL1 = {};
|
||||
|
||||
export default {
|
||||
URL, URL1
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
45
zyplayer-doc-ui/db-open-ui/src/common/config/apimix.js
Normal file
45
zyplayer-doc-ui/db-open-ui/src/common/config/apimix.js
Normal file
@@ -0,0 +1,45 @@
|
||||
import apilist from './apilist'
|
||||
|
||||
var href = window.location.href;
|
||||
|
||||
var _fn = {
|
||||
href: href,
|
||||
HOST: './',
|
||||
HOST1: './',
|
||||
|
||||
mixUrl: function (host, url) {
|
||||
var p;
|
||||
if (!host || !url || _fn.isEmptyObject(url)) {
|
||||
return;
|
||||
}
|
||||
url.HOST = host;
|
||||
for (p in url) {
|
||||
if (url[p].indexOf('http') == -1) {
|
||||
url[p] = host + url[p];
|
||||
}
|
||||
}
|
||||
return url;
|
||||
},
|
||||
//判断是否空对象
|
||||
isEmptyObject: function (obj) { //判断空对象
|
||||
if (typeof obj === "object" && !(obj instanceof Array)) {
|
||||
var hasProp = false;
|
||||
for (var prop in obj) {
|
||||
hasProp = true;
|
||||
break;
|
||||
}
|
||||
if (hasProp) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var apilist1 = _fn.mixUrl(_fn.HOST, apilist.URL);
|
||||
var apilist2 = _fn.mixUrl(_fn.HOST1, apilist.URL1);
|
||||
|
||||
export default {
|
||||
apilist1, apilist2
|
||||
};
|
||||
|
||||
12
zyplayer-doc-ui/db-open-ui/src/common/config/global.js
Normal file
12
zyplayer-doc-ui/db-open-ui/src/common/config/global.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const user = {
|
||||
isLogin: true,
|
||||
};
|
||||
const vue = {};
|
||||
const fullscreen = false;
|
||||
|
||||
export default {
|
||||
vue,
|
||||
user,
|
||||
fullscreen,
|
||||
}
|
||||
|
||||
113
zyplayer-doc-ui/db-open-ui/src/common/lib/common/common.js
Normal file
113
zyplayer-doc-ui/db-open-ui/src/common/lib/common/common.js
Normal file
@@ -0,0 +1,113 @@
|
||||
import Qs from 'qs'
|
||||
import global from '../../config/global'
|
||||
import apimix from '../../config/apimix'
|
||||
|
||||
export default {
|
||||
data: {
|
||||
accessToken: '',
|
||||
},
|
||||
setAccessToken: function (token) {
|
||||
this.data.accessToken = token;
|
||||
},
|
||||
getAccessToken: function () {
|
||||
if (!this.data.accessToken) {
|
||||
var arr, reg = new RegExp("(^| )accessToken=([^;]*)(;|$)");
|
||||
if (arr = document.cookie.match(reg)) {
|
||||
this.data.accessToken = unescape(arr[2]);
|
||||
}
|
||||
}
|
||||
return this.data.accessToken;
|
||||
},
|
||||
validateResult: function (res, callback) {
|
||||
if (!!res.message) {
|
||||
global.vue.$message('请求错误:' + res.message);
|
||||
} else if (res.data.errCode == 400) {
|
||||
global.vue.$message('请先登录');
|
||||
var href = encodeURIComponent(window.location.href);
|
||||
// if (global.vue.$router.currentRoute.path != '/user/login') {
|
||||
// global.vue.$router.push({path: '/user/login', query: {redirect: href}});
|
||||
// }
|
||||
window.location = apimix.apilist1.HOST + "#/user/login?redirect=" + href;
|
||||
} else if (res.data.errCode == 402) {
|
||||
global.vue.$router.push("/common/noAuth");
|
||||
} else if (res.data.errCode !== 200) {
|
||||
global.vue.$message(res.data.errMsg || "未知错误");
|
||||
} else {
|
||||
if (typeof callback == 'function') {
|
||||
callback(res.data);
|
||||
}
|
||||
}
|
||||
},
|
||||
post: function (url, param, callback) {
|
||||
param = param || {};
|
||||
param.accessToken = this.getAccessToken();
|
||||
global.vue.axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
data: Qs.stringify(param),
|
||||
withCredentials: true,
|
||||
}).then((res) => {
|
||||
console.log("ok", res);
|
||||
this.validateResult(res, callback);
|
||||
}).catch((res) => {
|
||||
console.log("error", res);
|
||||
this.validateResult(res);
|
||||
});
|
||||
},
|
||||
postNonCheck: function (url, param, callback) {
|
||||
param = param || {};
|
||||
param.accessToken = this.getAccessToken();
|
||||
global.vue.axios({
|
||||
method: "post",
|
||||
url: url,
|
||||
headers: {'Content-type': 'application/x-www-form-urlencoded'},
|
||||
data: Qs.stringify(param),
|
||||
withCredentials: true,
|
||||
}).then((res) => {
|
||||
console.log("ok", res);
|
||||
if (typeof callback == 'function') {
|
||||
callback(res.data);
|
||||
}
|
||||
}).catch((res) => {
|
||||
console.log("error", res);
|
||||
if (typeof callback == 'function') {
|
||||
callback(res.data);
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 返回不为空的字符串,为空返回def
|
||||
*/
|
||||
getNotEmptyStr(str, def) {
|
||||
if (isEmpty(str)) {
|
||||
return isEmpty(def) ? "" : def;
|
||||
}
|
||||
return str;
|
||||
},
|
||||
/**
|
||||
* 是否是空对象
|
||||
* @param obj
|
||||
* @returns
|
||||
*/
|
||||
isEmptyObject(obj) {
|
||||
return isEmpty(obj) || $.isEmptyObject(obj);
|
||||
},
|
||||
/**
|
||||
* 是否是空字符串
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
isEmpty(str) {
|
||||
return (str == "" || str == null || str == undefined);
|
||||
},
|
||||
/**
|
||||
* 是否不是空字符串
|
||||
* @param str
|
||||
* @returns
|
||||
*/
|
||||
isNotEmpty(str) {
|
||||
return !isEmpty(str);
|
||||
},
|
||||
}
|
||||
|
||||
40
zyplayer-doc-ui/db-open-ui/src/common/lib/common/toast.js
Normal file
40
zyplayer-doc-ui/db-open-ui/src/common/lib/common/toast.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import global from '../../config/global'
|
||||
|
||||
/**
|
||||
* 提示工具类
|
||||
* @author
|
||||
* @since 2017年5月7日
|
||||
*/
|
||||
export default {
|
||||
notOpen: function () {
|
||||
global.vue.$message({
|
||||
message: '该功能暂未开放,敬请期待!',
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
success: function (msg, time) {
|
||||
global.vue.$message({
|
||||
message: msg,
|
||||
duration: time || 3000,
|
||||
type: 'success',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
warn: function (msg, time) {
|
||||
global.vue.$message({
|
||||
message: msg,
|
||||
duration: time || 3000,
|
||||
type: 'warning',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
error: function (msg, time) {
|
||||
global.vue.$message({
|
||||
message: msg,
|
||||
duration: time || 3000,
|
||||
type: 'error',
|
||||
showClose: true
|
||||
});
|
||||
},
|
||||
};
|
||||
4
zyplayer-doc-ui/db-open-ui/src/common/lib/jquery/jquery-3.1.0.min.js
vendored
Normal file
4
zyplayer-doc-ui/db-open-ui/src/common/lib/jquery/jquery-3.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-ui/db-open-ui/src/common/lib/jquery/qrcode.min.js
vendored
Normal file
1
zyplayer-doc-ui/db-open-ui/src/common/lib/jquery/qrcode.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
zyplayer-doc-ui/db-open-ui/src/index.html
Normal file
16
zyplayer-doc-ui/db-open-ui/src/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>数据库文档管理</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script>
|
||||
var docDbDatabase = {"columnList":{"config_info_tag":[{"description":"id","name":"id","nullable":"0","type":"bigint(20)"},{"description":"data_id","name":"data_id","nullable":"0","type":"varchar(255)"},{"description":"group_id","name":"group_id","nullable":"0","type":"varchar(128)"},{"description":"tenant_id","name":"tenant_id","nullable":"1","type":"varchar(128)"},{"description":"tag_id","name":"tag_id","nullable":"0","type":"varchar(128)"},{"description":"app_name","name":"app_name","nullable":"1","type":"varchar(128)"},{"description":"content","name":"content","nullable":"0","type":"longtext"},{"description":"md5","name":"md5","nullable":"1","type":"varchar(32)"},{"description":"创建时间","name":"gmt_create","nullable":"0","type":"datetime"},{"description":"修改时间","name":"gmt_modified","nullable":"0","type":"datetime"},{"description":"source user","name":"src_user","nullable":"1","type":"text"},{"description":"source ip","name":"src_ip","nullable":"1","type":"varchar(20)"}]},"tableList":[{"description":"config_info_tag","tableName":"config_info_tag"}]}
|
||||
</script>
|
||||
</html>
|
||||
|
||||
59
zyplayer-doc-ui/db-open-ui/src/main.js
Normal file
59
zyplayer-doc-ui/db-open-ui/src/main.js
Normal file
@@ -0,0 +1,59 @@
|
||||
import Vue from 'vue'
|
||||
import ElementUI from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
import App from './App.vue'
|
||||
|
||||
import global from './common/config/global'
|
||||
import apimix from './common/config/apimix'
|
||||
import common from './common/lib/common/common'
|
||||
import toast from './common/lib/common/toast'
|
||||
|
||||
import VueRouter from 'vue-router'
|
||||
import routes from './routes'
|
||||
import axios from 'axios'
|
||||
import VueAxios from 'vue-axios'
|
||||
|
||||
Vue.use(ElementUI);
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(VueAxios, axios);
|
||||
|
||||
// 全局参数
|
||||
Vue.prototype.global = global;
|
||||
// 接口列表
|
||||
Vue.prototype.apilist1 = apimix.apilist1;
|
||||
Vue.prototype.apilist2 = apimix.apilist1;
|
||||
// 公用方法
|
||||
Vue.prototype.common = common;
|
||||
Vue.prototype.toast = toast;
|
||||
|
||||
const router = new VueRouter({routes});
|
||||
// 路由跳转时判断处理
|
||||
router.beforeEach((to, from, next) => {
|
||||
if (to.meta.title) {
|
||||
document.title = to.meta.title
|
||||
}
|
||||
global.fullscreen = !!to.meta.fullscreen;
|
||||
/* 判断该路由是否需要登录权限 */
|
||||
if (to.matched.some(record => record.meta.requireAuth)) {
|
||||
if (global.user.isLogin) {
|
||||
next();
|
||||
} else {
|
||||
next({path: '/login'});
|
||||
}
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
render(h) {
|
||||
var app = h(App);
|
||||
global.vue = app.context;
|
||||
return app;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
14
zyplayer-doc-ui/db-open-ui/src/open-doc-db.html
Normal file
14
zyplayer-doc-ui/db-open-ui/src/open-doc-db.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>数据库文档管理</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script src="./database.js"></script>
|
||||
</html>
|
||||
|
||||
27
zyplayer-doc-ui/db-open-ui/src/routes.js
Normal file
27
zyplayer-doc-ui/db-open-ui/src/routes.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import Home from './views/home/Home.vue'
|
||||
|
||||
import TableInfo from './views/table/Info.vue'
|
||||
import TableRouterView from './views/table/RouterView.vue'
|
||||
|
||||
let routes = [
|
||||
{
|
||||
path: '/home',
|
||||
component: Home,
|
||||
name: '主页',
|
||||
meta: {
|
||||
requireAuth: true,
|
||||
}
|
||||
}, {
|
||||
path: '/table',
|
||||
name: '表信息',
|
||||
component: TableRouterView,
|
||||
children: [
|
||||
{path: 'info', name: '表信息',component: TableInfo},
|
||||
]
|
||||
}, {
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
}
|
||||
];
|
||||
|
||||
export default routes;
|
||||
2
zyplayer-doc-ui/db-open-ui/src/vendor.js
Normal file
2
zyplayer-doc-ui/db-open-ui/src/vendor.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import Vue from 'vue'
|
||||
import ElementUI from 'element-ui'
|
||||
30
zyplayer-doc-ui/db-open-ui/src/views/home/Home.vue
Normal file
30
zyplayer-doc-ui/db-open-ui/src/views/home/Home.vue
Normal file
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<div style="padding: 10px;">
|
||||
<div style="max-width: 1200px;margin: 20px auto;">
|
||||
<div style="text-align: center;">欢迎使用ヾ(๑╹◡╹)ノ"</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import toast from '../../common/lib/common/toast'
|
||||
import global from '../../common/config/global'
|
||||
|
||||
var app;
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
||||
|
||||
70
zyplayer-doc-ui/db-open-ui/src/views/table/Info.vue
Normal file
70
zyplayer-doc-ui/db-open-ui/src/views/table/Info.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div class="table-info-vue">
|
||||
<el-card style="margin: 10px;">
|
||||
<div slot="header" class="clearfix">字段信息</div>
|
||||
<div style="padding: 10px;" v-loading="columnListLoading">
|
||||
<el-table :data="columnList" stripe border style="width: 100%; margin-bottom: 5px;">
|
||||
<el-table-column prop="name" label="字段名" width="200"></el-table-column>
|
||||
<el-table-column label="自增" width="50">
|
||||
<template slot-scope="scope">{{scope.row.isidentity ? '是' : '否'}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="type" label="类型" width="150"></el-table-column>
|
||||
<el-table-column prop="length" label="长度" width="80"></el-table-column>
|
||||
<el-table-column label="NULL" width="60">
|
||||
<template slot-scope="scope">{{scope.row.nullable ? '允许' : '不允许'}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="主键" width="50">
|
||||
<template slot-scope="scope">{{scope.row.ispramary ? '是' : '否'}}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="注释">
|
||||
<template slot-scope="scope">
|
||||
<div class="description">{{scope.row.description}}</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var app;
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
columnListLoading: false,
|
||||
vueQueryParam: {},
|
||||
columnList: [],
|
||||
tableInfo: [],
|
||||
};
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
this.initQueryParam(to);
|
||||
next();
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
this.initQueryParam(this.$route);
|
||||
},
|
||||
methods: {
|
||||
initQueryParam(to) {
|
||||
this.vueQueryParam = to.query;
|
||||
setTimeout(function () {
|
||||
var columnList = docDbDatabase.columnList[app.vueQueryParam.tableName] || [];
|
||||
for (var i = 0; i < columnList.length; i++) {
|
||||
columnList[i].newDesc = columnList[i].description;
|
||||
}
|
||||
app.columnList = columnList;
|
||||
}, 200);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.table-info-vue .el-form-item{margin-bottom: 5px;}
|
||||
.table-info-vue .edit-table-desc{color: #409EFF;}
|
||||
.table-info-vue .description{}
|
||||
.table-info-vue .el-table td, .table-info-vue .el-table th{padding: 5px 0;}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
75
zyplayer-doc-ui/db-open-ui/webpack.config.js
Normal file
75
zyplayer-doc-ui/db-open-ui/webpack.config.js
Normal file
@@ -0,0 +1,75 @@
|
||||
const resolve = require('path').resolve;
|
||||
const webpack = require('webpack');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const url = require('url');
|
||||
const publicPath = '';
|
||||
|
||||
module.exports = (options = {}) => ({
|
||||
entry: {
|
||||
vendor: './src/vendor',
|
||||
index: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: resolve(__dirname, 'dist'),
|
||||
filename: options.dev ? '[name].js' : 'open-doc-db-[name].js?[chunkhash]',
|
||||
chunkFilename: '[id].js?[chunkhash]',
|
||||
publicPath: options.dev ? '/assets/' : publicPath
|
||||
},
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.vue$/,
|
||||
use: ['vue-loader']
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
use: ['babel-loader'],
|
||||
exclude: /node_modules/
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: ['style-loader', 'css-loader', 'postcss-loader']
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/,
|
||||
use: [{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 800000
|
||||
}
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
names: ['vendor', 'manifest']
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: options.dev ? 'src/index.html':'src/open-doc-db.html',
|
||||
filename: options.dev ? 'index.html':'open-doc-db.html',
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': resolve(__dirname, 'src')
|
||||
},
|
||||
extensions: ['.js', '.vue', '.json', '.css']
|
||||
},
|
||||
devServer: {
|
||||
host: 'local.zyplayer.com',
|
||||
port: 8010,
|
||||
proxy: {
|
||||
'/api/': {
|
||||
target: 'http://local.zyplayer.com:8080',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/api': ''
|
||||
}
|
||||
}
|
||||
},
|
||||
historyApiFallback: {
|
||||
index: url.parse(options.dev ? '/assets/' : publicPath).pathname
|
||||
}
|
||||
},
|
||||
devtool: options.dev ? '#eval-source-map' : '#source-map'
|
||||
});
|
||||
4078
zyplayer-doc-ui/db-open-ui/yarn.lock
Normal file
4078
zyplayer-doc-ui/db-open-ui/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,26 +1,4 @@
|
||||
# zyplayer-doc-manage项目的UI
|
||||
|
||||
## 常见问题
|
||||
|
||||
1、命令行要进入这个文件夹才能执行命令:
|
||||
|
||||
zyplayer-doc/zyplayer-doc-ui/manage-ui
|
||||
|
||||
2、增加host,否则run不起来:
|
||||
|
||||
在文件 C:\Windows\System32\drivers\etc\hosts 末尾增加:
|
||||
|
||||
127.0.0.1 local.zyplayer.com
|
||||
|
||||
## 配置文件
|
||||
|
||||
1、这里可以配置接口请求的域名,可使用本地、线上,测试通过后就会打包到zyplayer-doc-wiki项目里面使用
|
||||
|
||||
zyplayer-doc-ui/manage-ui/src/common/config/apimix.js
|
||||
|
||||
2、这里可以配置启动后访问的地址,建议不改
|
||||
|
||||
zyplayer-doc-ui/manage-ui/webpack.config.js
|
||||
# zyplayer-doc-db项目的UI
|
||||
|
||||
## 环境要求
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<span slot="title">系统管理</span>
|
||||
</template>
|
||||
<el-menu-item index="/data/datasourceManage"><i class="el-icon-coin"></i>数据源管理</el-menu-item>
|
||||
<el-menu-item index="/data/export"><i class="el-icon-finished"></i>数据库表导出</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-menu>
|
||||
<el-tree :props="defaultProps" :data="databaseList" @node-click="handleNodeClick"
|
||||
|
||||
@@ -9,6 +9,7 @@ import TableDatabase from './views/table/Database.vue'
|
||||
import TableRouterView from './views/table/RouterView.vue'
|
||||
|
||||
import DataDatasourceManage from './views/data/DatasourceManage.vue'
|
||||
import DataExport from './views/data/Export.vue'
|
||||
import DataRouterView from './views/data/RouterView.vue'
|
||||
|
||||
import CommonNoAuth from './views/common/NoAuth.vue'
|
||||
@@ -43,6 +44,7 @@ let routes = [
|
||||
component: DataRouterView,
|
||||
children: [
|
||||
{path: 'datasourceManage', name: '数据源管理',component: DataDatasourceManage},
|
||||
{path: 'export', name: '数据库导出',component: DataExport},
|
||||
]
|
||||
}, {
|
||||
path: '/common',
|
||||
|
||||
114
zyplayer-doc-ui/db-ui/src/views/data/Export.vue
Normal file
114
zyplayer-doc-ui/db-ui/src/views/data/Export.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div style="padding: 10px;height: 100%;box-sizing: border-box;background: #fafafa;">
|
||||
<el-card style="margin: 10px;">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>数据库表导出</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 10px;">
|
||||
<el-select v-model="choiceDatasource" @change="datasourceChangeEvents" filterable placeholder="请选择数据源">
|
||||
<el-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
<el-select v-model="choiceDatabase" @change="databaseChangeEvents" filterable placeholder="请选择数据库">
|
||||
<el-option v-for="item in databaseList" :key="item.dbName" :label="item.dbName" :value="item.dbName"></el-option>
|
||||
</el-select>
|
||||
<el-button v-on:click="exportChoiceTable" type="primary" style="margin-left: 20px;">导出选中的表</el-button>
|
||||
<a target="_blank" title="点击查看如何使用" href="http://doc.zyplayer.com/zyplayer-doc-manage/open-wiki.html?pageId=117&space=23f3f59a60824d21af9f7c3bbc9bc3cb"><i class="el-icon-info" style="color: #999;"></i></a>
|
||||
</div>
|
||||
<el-table :data="tableList" stripe border @selection-change="handleSelectionChange" style="width: 100%; margin-bottom: 5px;">
|
||||
<el-table-column type="selection" width="55"></el-table-column>
|
||||
<el-table-column prop="tableName" label="表名"></el-table-column>
|
||||
<el-table-column prop="tableComment" label="表注释"></el-table-column>
|
||||
</el-table>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
var app;
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// 数据源相关
|
||||
datasourceOptions: [],
|
||||
datasourceList: [],
|
||||
choiceDatasource: "",
|
||||
choiceDatabase: "",
|
||||
choiceTable: "",
|
||||
// 页面展示相关
|
||||
nowDatasourceShow: {},
|
||||
databaseList: [],
|
||||
tableList: [],
|
||||
selectTables: [],
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
this.loadDatasourceList();
|
||||
},
|
||||
methods: {
|
||||
datasourceChangeEvents() {
|
||||
app.nowDatasourceShow = this.choiceDatasource;
|
||||
app.loadDatabaseList(this.choiceDatasource);
|
||||
},
|
||||
databaseChangeEvents() {
|
||||
app.loadGetTableList();
|
||||
},
|
||||
exportChoiceTable() {
|
||||
if (this.selectTables.length <= 0) {
|
||||
app.$message.info("请选择需要导出的表");
|
||||
return;
|
||||
}
|
||||
var tableNames = "";
|
||||
for (var i = 0; i < this.selectTables.length; i++) {
|
||||
if (tableNames !== "") {
|
||||
tableNames += ",";
|
||||
}
|
||||
tableNames += this.selectTables[i].tableName;
|
||||
}
|
||||
window.open("zyplayer-doc-db/doc-db/exportDatabase?host=" + this.choiceDatasource
|
||||
+ "&dbName=" + this.choiceDatabase
|
||||
+ "&tableNames=" + tableNames);
|
||||
},
|
||||
loadGetTableList() {
|
||||
this.common.post(this.apilist1.tableList, {host: this.choiceDatasource, dbName: this.choiceDatabase}, function (json) {
|
||||
app.tableList = json.data || [];
|
||||
});
|
||||
},
|
||||
loadDatasourceList() {
|
||||
this.common.post(this.apilist1.datasourceList, {}, function (json) {
|
||||
app.datasourceList = json.data || [];
|
||||
var datasourceOptions = [];
|
||||
for (var i = 0; i < app.datasourceList.length; i++) {
|
||||
datasourceOptions.push({
|
||||
label: app.datasourceList[i].cnName, value: app.datasourceList[i].host
|
||||
});
|
||||
}
|
||||
app.datasourceOptions = datasourceOptions;
|
||||
});
|
||||
},
|
||||
loadDatabaseList() {
|
||||
this.common.post(this.apilist1.databaseList, {host: this.choiceDatasource}, function (json) {
|
||||
app.databaseList = json.data || [];
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectTables = val;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
.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;}
|
||||
</style>
|
||||
@@ -3,7 +3,7 @@
|
||||
<div style="max-width: 1200px;margin: 20px auto;">
|
||||
<el-card style="margin: 10px;">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>数据源管理</span>
|
||||
<span>ES数据源管理</span>
|
||||
<el-button style="float: right;margin-left: 5px;" :loading="loadDataListLoading" v-on:click="getDatasourceList" plain icon="el-icon-refresh" size="small">刷新</el-button>
|
||||
<el-button style="float: right;" v-on:click="addDatasource" type="primary" icon="el-icon-circle-plus-outline" size="small">新增</el-button>
|
||||
</div>
|
||||
@@ -21,7 +21,7 @@
|
||||
</el-card>
|
||||
</div>
|
||||
<!--增加数据源弹窗-->
|
||||
<el-dialog :inline="true" :title="newDatasource.id>0?'编辑数据源':'新增数据源'" :visible.sync="datasourceDialogVisible" width="650px">
|
||||
<el-dialog :inline="true" :title="newDatasource.id>0?'编辑ES数据源':'新增ES数据源'" :visible.sync="datasourceDialogVisible" width="650px">
|
||||
<el-form label-width="120px">
|
||||
<el-form-item label="名字:">
|
||||
<el-input v-model="newDatasource.name" placeholder="中文名字"></el-input>
|
||||
|
||||
@@ -123,6 +123,10 @@
|
||||
loadDatasourceList() {
|
||||
this.common.post(this.apilist1.manageDatasourceList, {}, function (json) {
|
||||
app.datasourceOptions = json.data || [];
|
||||
if (app.datasourceOptions.length > 0) {
|
||||
app.executeParam.id = app.datasourceOptions[0].id;
|
||||
app.loadIndexList();
|
||||
}
|
||||
});
|
||||
},
|
||||
loadIndexList() {
|
||||
|
||||
Reference in New Issue
Block a user