数据库表导出,支持修改用户密码

This commit is contained in:
暮光:城中城
2019-08-11 23:13:13 +08:00
parent 883540488b
commit f9173925ab
69 changed files with 13327 additions and 597 deletions

View 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>

View File

@@ -0,0 +1,12 @@
var URL = {
};
var URL1 = {};
export default {
URL, URL1
};

View 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
};

View File

@@ -0,0 +1,12 @@
const user = {
isLogin: true,
};
const vue = {};
const fullscreen = false;
export default {
vue,
user,
fullscreen,
}

View 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);
},
}

View 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
});
},
};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View 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>

View 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;
}
});

View 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>

View 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;

View File

@@ -0,0 +1,2 @@
import Vue from 'vue'
import ElementUI from 'element-ui'

View 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>

View 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>

View File

@@ -0,0 +1,4 @@
<template>
<router-view></router-view>
</template>