改为使用vue-cli打包,修改所有的请求方式,优化页面间的交互,增加数据源分组

This commit is contained in:
暮光:城中城
2020-05-23 12:21:23 +08:00
parent adadffa0cd
commit 88686f84f4
63 changed files with 8421 additions and 8773 deletions

View File

@@ -69,6 +69,11 @@ public class DbDatasource implements Serializable {
*/ */
private String name; private String name;
/**
* 数据源分组
*/
private String groupName;
public Long getId() { public Long getId() {
return id; return id;
} }
@@ -155,4 +160,12 @@ public class DbDatasource implements Serializable {
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
} }

View File

@@ -84,14 +84,9 @@ public class DatabaseDocController {
List<Long> userAuthDbIds = userAuthList.stream().map(val -> NumberUtils.toLong(val.getAuthCustomSuffix().replace(DocAuthConst.DB, ""))).collect(Collectors.toList()); List<Long> userAuthDbIds = userAuthList.stream().map(val -> NumberUtils.toLong(val.getAuthCustomSuffix().replace(DocAuthConst.DB, ""))).collect(Collectors.toList());
wrapper.in("id", userAuthDbIds); wrapper.in("id", userAuthDbIds);
} }
wrapper.select("id", "name", "group_name");
List<DbDatasource> datasourceList = dbDatasourceService.list(wrapper); List<DbDatasource> datasourceList = dbDatasourceService.list(wrapper);
List<DatabaseFactoryBean> dataSourceList = datasourceList.stream().map(val -> { return DocDbResponseJson.ok(datasourceList);
DatabaseFactoryBean bean = new DatabaseFactoryBean();
bean.setCnName(val.getName());
bean.setId(val.getId());
return bean;
}).collect(Collectors.toList());
return DocDbResponseJson.ok(dataSourceList);
} }
/** /**

View File

@@ -15,6 +15,7 @@ public class DatabaseFactoryBean {
private String url; private String url;
private String dbName; private String dbName;
private String cnName; private String cnName;
private String groupName;
private DatabaseProduct databaseProduct; private DatabaseProduct databaseProduct;
public Long getId() { public Long getId() {
@@ -33,6 +34,14 @@ public class DatabaseFactoryBean {
this.cnName = cnName; this.cnName = cnName;
} }
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public static enum DatabaseProduct { public static enum DatabaseProduct {
MYSQL, SQLSERVER, ORACLE MYSQL, SQLSERVER, ORACLE
} }

View File

@@ -92,11 +92,11 @@ public class TransferDataServer {
boolean querySelect = DocUserUtil.haveCustomAuth(DbAuthType.SELECT.getName(), DocAuthConst.DB + transferTask.getQueryDatasourceId()); boolean querySelect = DocUserUtil.haveCustomAuth(DbAuthType.SELECT.getName(), DocAuthConst.DB + transferTask.getQueryDatasourceId());
boolean queryUpdate = DocUserUtil.haveCustomAuth(DbAuthType.UPDATE.getName(), DocAuthConst.DB + transferTask.getQueryDatasourceId()); boolean queryUpdate = DocUserUtil.haveCustomAuth(DbAuthType.UPDATE.getName(), DocAuthConst.DB + transferTask.getQueryDatasourceId());
if (!manageAuth && !querySelect && !queryUpdate) { if (!manageAuth && !querySelect && !queryUpdate) {
throw new ConfirmException("没有数据源的查询权限,创建任务失败"); throw new ConfirmException("没有查询数据源的查询权限,创建任务失败");
} }
boolean storageUpdate = DocUserUtil.haveCustomAuth(DbAuthType.UPDATE.getName(), DocAuthConst.DB + transferTask.getStorageDatasourceId()); boolean storageUpdate = DocUserUtil.haveCustomAuth(DbAuthType.UPDATE.getName(), DocAuthConst.DB + transferTask.getStorageDatasourceId());
if (!manageAuth && !storageUpdate) { if (!manageAuth && !storageUpdate) {
throw new ConfirmException("没有数据源的写入权限,创建任务失败"); throw new ConfirmException("没有目标数据源的写入权限,创建任务失败");
} }
dbTransferTaskService.resetExecuteInfo(taskId); dbTransferTaskService.resetExecuteInfo(taskId);
// 提交任务 // 提交任务
@@ -135,13 +135,11 @@ public class TransferDataServer {
ExecuteResult countResult = sqlExecutor.execute(executeParam); ExecuteResult countResult = sqlExecutor.execute(executeParam);
if (CollectionUtils.isEmpty(countResult.getResult())) { if (CollectionUtils.isEmpty(countResult.getResult())) {
String executeInfo = String.format("[%s] 获取总条数失败", DateTime.now().toString()); String executeInfo = String.format("[%s] 获取总条数失败", DateTime.now().toString());
logger.error(executeInfo);
dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.ERROR.getCode(), executeInfo); dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.ERROR.getCode(), executeInfo);
return; return;
} }
Object transferCount = countResult.getResult().get(0).get("counts"); Object transferCount = countResult.getResult().get(0).get("counts");
String executeInfo = String.format("[%s] 待处理总条数:%s查询总条数耗时%sms", DateTime.now().toString(), transferCount, System.currentTimeMillis() - executeStartTime); String executeInfo = String.format("[%s] 待处理总条数:%s查询总条数耗时%sms", DateTime.now().toString(), transferCount, System.currentTimeMillis() - executeStartTime);
logger.info(executeInfo);
dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.EXECUTING.getCode(), executeInfo); dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.EXECUTING.getCode(), executeInfo);
} else { } else {
String executeInfo = String.format("[%s] 未开启查询总条数,跳过条数查询", DateTime.now().toString()); String executeInfo = String.format("[%s] 未开启查询总条数,跳过条数查询", DateTime.now().toString());
@@ -149,7 +147,6 @@ public class TransferDataServer {
} }
AtomicLong readCount = new AtomicLong(0L); AtomicLong readCount = new AtomicLong(0L);
executeParam.setSql(querySql); executeParam.setSql(querySql);
// executeParam.setSql("select sleep(10)");
ExecuteResult executeResult = sqlExecutor.execute(factoryBean, executeParam, resultMap -> { ExecuteResult executeResult = sqlExecutor.execute(factoryBean, executeParam, resultMap -> {
selectResultList.add(resultMap); selectResultList.add(resultMap);
if (readCount.incrementAndGet() % executeCountLogNum == 0) { if (readCount.incrementAndGet() % executeCountLogNum == 0) {
@@ -167,7 +164,6 @@ public class TransferDataServer {
} }
if (StringUtils.isNotBlank(executeResult.getErrMsg())) { if (StringUtils.isNotBlank(executeResult.getErrMsg())) {
String executeInfo = String.format("[%s] 执行出错:%s", DateTime.now().toString(), executeResult.getErrMsg()); String executeInfo = String.format("[%s] 执行出错:%s", DateTime.now().toString(), executeResult.getErrMsg());
logger.error(executeInfo);
dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.ERROR.getCode(), executeInfo); dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.ERROR.getCode(), executeInfo);
} else { } else {
String executeInfo = String.format("[%s] 任务执行成功,处理总条数:%s总耗时%sms", DateTime.now().toString(), readCount.get(), System.currentTimeMillis() - executeStartTime); String executeInfo = String.format("[%s] 任务执行成功,处理总条数:%s总耗时%sms", DateTime.now().toString(), readCount.get(), System.currentTimeMillis() - executeStartTime);

View File

@@ -0,0 +1 @@
#app,.el-container,.el-menu{height:100%}.database-list-tree{background-color:#fafafa}.database-list-tree .el-tree-node>.el-tree-node__children{overflow:unset}.login-container{border-radius:5px;-moz-border-radius:5px;background-clip:padding-box;margin:0 auto;width:350px;padding:35px 35px 15px 35px;background:#fff;border:1px solid #eaeaea;-webkit-box-shadow:0 0 25px #cac6c6;box-shadow:0 0 25px #cac6c6}.title{margin:0 auto 40px auto;text-align:center;color:#505458}.remember{margin:0 0 35px 0}.my-info-vue .box-card{margin:10px}.table-info-vue .el-dialog__body{padding:0 20px 10px}.table-info-vue .el-form-item{margin-bottom:5px}.table-info-vue .edit-table-desc{cursor:pointer;color:#409eff}.table-info-vue .description{cursor:pointer}.table-info-vue .el-table td,.table-info-vue .el-table th{padding:5px 0}.table-info-vue .status-info-row{padding:8px 0}.table-info-vue .status-info-row .label{width:80px;display:inline-block;text-align:right;color:#606266}.table-database-vue .el-table td,.table-database-vue .el-table th{padding:5px 0}body,html{margin:0;padding:0;height:100%}.header-right-user-name{color:#fff;padding-right:5px}.el-menu-vertical{border-right:0}.el-menu-vertical,.el-menu-vertical .el-menu{background:#fafafa}.el-header{background-color:#409eff;color:#333;line-height:40px;text-align:right;height:40px!important}.data-transfer-vue .el-button+.el-button{margin-left:4px}.data-executor-vue .ace-monokai .ace_print-margin{display:none}.data-executor-vue .el-card__body{padding:10px}.data-executor-vue .el-table td,.el-table th{padding:6px 0}.data-executor-vue .execute-result-table .el-input__inner{height:25px;line-height:25px;padding:0 5px}.data-executor-vue .execute-result-table .el-textarea__inner{height:27px;min-height:27px;line-height:25px;padding:0 5px;resize:none}.data-executor-vue .execute-use-time{font-size:12px;margin-right:10px}.data-executor-vue-out .el-tabs__nav-scroll{padding-left:20px}.data-executor-vue-out .el-button+.el-button{margin-left:0}.data-executor-vue-out .el-table__body-wrapper{height:calc(100vh - 180px);overflow-y:auto}

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,2 +0,0 @@
!function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var r=window.webpackJsonp;window.webpackJsonp=function(t,c,u){for(var i,a,f,l=0,s=[];l<t.length;l++)a=t[l],o[a]&&s.push(o[a][0]),o[a]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);for(r&&r(t,c,u);s.length;)s.shift()();if(u)for(l=0;l<u.length;l++)f=n(n.s=u[l]);return f};var t={},o={2:0};n.e=function(e){function r(){i.onerror=i.onload=null,clearTimeout(a);var n=o[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),o[e]=void 0)}var t=o[e];if(0===t)return new Promise(function(e){e()});if(t)return t[2];var c=new Promise(function(n,r){t=o[e]=[n,r]});t[2]=c;var u=document.getElementsByTagName("head")[0],i=document.createElement("script");i.type="text/javascript",i.charset="utf-8",i.async=!0,i.timeout=12e4,n.nc&&i.setAttribute("nonce",n.nc),i.src=n.p+""+e+".js?"+{0:"e961123b6de8434b2cc2",1:"93ce942e3bdbc7dd3435"}[e];var a=setTimeout(r,12e4);return i.onerror=i.onload=r,u.appendChild(i),c},n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:t})},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=doc-db-manifest.js.map?df9e1a3cc72f1a225176

View File

@@ -1,218 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<!--无论发布在哪、如何修改源码,请勿删除本行原作者信息,感谢-->
<meta name="author" content="开发者列表暮光城中城项目地址https://gitee.com/zyplayer/zyplayer-doc" />
<title>数据库文档</title>
<link rel="shortcut icon" href="webjars/doc-db/img/api.ico"/>
<link rel="stylesheet" href="webjars/zui/css/zui.min.css" />
<link rel="stylesheet" href="webjars/zui/css/zui-theme.min.css">
<link rel="stylesheet" href="webjars/zui/lib/chosen/chosen.min.css" />
<link rel="stylesheet" href="webjars/doc-db/css/doc-db.css" />
</head>
<body>
<div class="container">
<div class="row choise-db">
<div class="col-md-3">
<select id="choiseHost" data-placeholder="选择一个连接" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-3">
<select id="choiseDatabase" data-placeholder="选择一个数据库" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-3">
<select id="choiseTable" data-placeholder="选择一张表" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-3">
<button class="btn btn-primary" type="button" id="fuzzySearchBtn">模糊查询</button>
<button class="btn btn-primary" type="button" id="exportBtn">导出</button>
<button class="btn" type="button" id="showEchartsBtn">显示表关系图</button>
</div>
</div>
<div class="table-info">
<div style="height: 35px;line-height: 35px;">
表名:<span class="table-name"></span>
<button class="btn pull-right" type="button" id="aboutBtn" style="margin-right: 30px;">关于</button>
</div>
<div class="desc">
<div id="tableDescShow">
<span class="table-desc"></span>
<i class="icon icon-edit" title="编辑表注释"></i>
</div>
<textarea id="tableDescInput" rows="2" class="form-control"></textarea>
</div>
</div>
<div class="table-columns">
<table class="table table-bordered table-striped table-hover" id="tableCloumnsTable">
<thead>
<tr><th>字段名</th><th>自增</th><th>类型</th><th>长度</th><th>NULL</th><th>主键</th><th>注释</th></tr>
</thead>
<tbody></tbody>
</table>
</div>
<div id="tableRelationBox" class="hide" style="width: 100%;height:100px;">
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<p>
Tips本关系图不是通过外键生成所以需要在字段注释最后按规则添加外键关系才能生成图表支持的格式有<br/>
1、T:表XXX(字段注释)T:user_info<br/>
2、T:表.关联IDXXX(字段注释)T:user_info.id<br/>
3、T:库.表.关联IDXXX(字段注释)T:order_db.user_info.id<br/>
实验功能,有更好的建议或展示方式欢迎<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">提交建议</a>
</p>
</div>
<div id="tableRelationCharts" style="width: 100%;height:100%;margin-bottom: 50px;"></div>
</div>
<!-- 模糊查询 -->
<div class="modal fade" id="fuzzySearchModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
</button>
<h4 class="modal-title">通过字段名或释义模糊查询</h4>
</div>
<div class="modal-body">
<div class="row choise-db">
<div class="col-md-3">
<select id="choiseFuzzyHost" data-placeholder="选择一个连接" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-3">
<select id="choiseFuzzyDatabase" data-placeholder="选择一个数据库" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-4">
<input id="searchText" type="text" class="form-control" placeholder="搜索内容,字段名或注释">
</div>
<div class="col-md-2">
<button id="doSearch" class="btn btn-primary" type="button">查询 <i class="icon icon-spin icon-spinner-snake hidden"></i></button>
</div>
</div>
<div class="modal-table-box">
<table class="table table-bordered table-striped table-hover" id="fuzzySearchTable">
<thead>
<tr><th>表名</th><th>字段名</th><th>注释</th></tr>
</thead>
<tbody></tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- 导出弹出框 -->
<div class="modal fade" id="exportModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
</button>
<h4 class="modal-title">导出数据库文档</h4>
</div>
<div class="modal-body">
<div class="row choise-db">
<div class="col-md-3">
<select id="choiseExportHost" data-placeholder="选择一个连接" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-3">
<select id="choiseExportDatabase" data-placeholder="选择一个数据库" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
<div class="col-md-6">
<button id="doExport" class="btn btn-primary" type="button">确认导出 <i class="icon icon-spin icon-spinner-snake hidden"></i></button>
<button id="checkAllTable" class="btn" type="button">全选</button>
<button id="notCheckAllTable" class="btn" type="button">全不选</button>
</div>
</div>
<div class="alert alert-danger">
请到 <a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc-db">源码处下载</a>《对外文档模板.zip》解压
然后将“确认导出”后的文件放至/js目录下文件名必须为database.js<br/>
然后双击打开目录下的doc-db.html 即可看到导出的文档
</div>
<div class="modal-table-box">
<ul id="exportUl"></ul>
</div>
</div>
</div>
</div>
</div>
<!-- 关于弹出框 -->
<div class="modal fade" id="aboutModal">
<div class="modal-dialog modal-lg" style="width: 600px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">×</span><span class="sr-only">关闭</span>
</button>
<h4 class="modal-title">关于zyplayer-doc-db</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" style="line-height: 30px;">
<div class="form-group">
<label class="col-sm-2 no-padding">项目地址:</label>
<div class="col-md-6 col-sm-10">
<a target="_blank" href="https://gitee.com/zyplayer/zyplayer-doc">zyplayer-doc</a>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 no-padding">开发人员:</label>
<div class="col-md-6 col-sm-10">
<a target="_blank" href="http://zyplayer.com">暮光:城中城</a>
</div>
</div>
<div class="form-group upgrade-info">
<label class="col-sm-2 no-padding">当前版本:</label>
<div class="col-md-10 col-sm-10" id="upgradeNowVersion"></div>
</div>
<div class="form-group upgrade-info">
<label class="col-sm-2 no-padding">最新版本:</label>
<div class="col-md-10 col-sm-10" id="upgradeLastVersion"></div>
</div>
<div class="form-group upgrade-info">
<label class="col-sm-2 no-padding">升级地址:</label>
<div class="col-md-10 col-sm-10" id="upgradeUrl"></div>
</div>
<div class="form-group upgrade-info">
<label class="col-sm-2 no-padding">升级内容:</label>
<div class="col-md-10 col-sm-10" id="upgradeContent"></div>
</div>
<div class="form-group">
<div class="col-sm-2 no-padding"></div>
<div class="col-md-10 col-sm-10">
欢迎加群讨论QQ群号466363173欢迎提交需求欢迎使用和加入开发
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="webjars/doc-db/js/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="webjars/zui/js/zui.min.js"></script>
<script type="text/javascript" src="webjars/zui/lib/chosen/chosen.min.js"></script>
<script type="text/javascript" src="webjars/doc-db/js/echarts.min.js"></script>
<script type="text/javascript" src="webjars/doc-db/js/option-table-relation.js"></script>
<script type="text/javascript" src="webjars/doc-db/js/formatjson.js"></script>
<script type="text/javascript" src="webjars/doc-db/js/toast.js"></script>
<script type="text/javascript" src="webjars/doc-db/js/common.js"></script>
<script type="text/javascript" src="webjars/doc-db/js/doc-db.js"></script>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +1 @@
<!DOCTYPE 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/app.c4f7a9c4.css rel=preload as=style><link href=css/chunk-vendors.7be40bfc.css rel=preload as=style><link href=js/app.6508421c.js rel=preload as=script><link href=js/chunk-vendors.8274a50c.js rel=preload as=script><link href=css/chunk-vendors.7be40bfc.css rel=stylesheet><link href=css/app.c4f7a9c4.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.8274a50c.js></script><script src=js/app.6508421c.js></script></body></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>
<script type="text/javascript" src="doc-db-manifest.js?df9e1a3cc72f1a225176"></script><script type="text/javascript" src="doc-db-vendor.js?93ce942e3bdbc7dd3435"></script><script type="text/javascript" src="doc-db-index.js?e961123b6de8434b2cc2"></script></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

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,271 +1,271 @@
/** /**
* 一些公用方法 * 一些公用方法
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2017年5月7日 * @since 2017年5月7日
*/ */
function serialize(value) { function serialize(value) {
if (typeof value === 'string') { if (typeof value === 'string') {
return value; return value;
} }
return JSON.stringify(value); return JSON.stringify(value);
} }
function deserialize(value) { function deserialize(value) {
if (typeof value !== 'string' || isEmpty(value)) { if (typeof value !== 'string' || isEmpty(value)) {
return undefined; return undefined;
} }
try { try {
return JSON.parse(value); return JSON.parse(value);
} catch (e) { } catch (e) {
try { try {
return eval('(' + value + ')');// 处理变态的单双引号共存字符串 return eval('(' + value + ')');// 处理变态的单双引号共存字符串
} catch (e) { } catch (e) {
return value || undefined; return value || undefined;
} }
} }
} }
function validateResult(result) { function validateResult(result) {
if (result.errCode == 200) { if (result.errCode == 200) {
return true; return true;
} else if (result.errCode == 400) { } else if (result.errCode == 400) {
var href = encodeURIComponent(window.location.href); var href = encodeURIComponent(window.location.href);
window.location = "static/manage/login.html?redirect=" + href; window.location = "static/manage/login.html?redirect=" + href;
} else { } else {
Toast.error(result.errMsg); Toast.error(result.errMsg);
} }
return false; return false;
} }
/** /**
* 返回不为空的字符串为空返回def * 返回不为空的字符串为空返回def
*/ */
function getNotEmptyStr(str, def){ function getNotEmptyStr(str, def){
if(isEmpty(str)) { if(isEmpty(str)) {
return isEmpty(def)?"":def; return isEmpty(def)?"":def;
} }
return str; return str;
} }
/** /**
* 是否是空对象 * 是否是空对象
* @param obj * @param obj
* @returns * @returns
*/ */
function isEmptyObject(obj){ function isEmptyObject(obj){
return $.isEmptyObject(obj); return $.isEmptyObject(obj);
} }
/** /**
* 是否是空字符串 * 是否是空字符串
* @param str * @param str
* @returns * @returns
*/ */
function isEmpty(str){ function isEmpty(str){
return (str == "" || str == null || str == undefined); return (str == "" || str == null || str == undefined);
} }
/** /**
* 是否是空 * 是否是空
* @param str * @param str
* @returns * @returns
*/ */
function isNull(str){ function isNull(str){
return (str == null || str == undefined); return (str == null || str == undefined);
} }
/** /**
* 是否不是空字符串 * 是否不是空字符串
* @param str * @param str
* @returns * @returns
*/ */
function isNotEmpty(str){ function isNotEmpty(str){
return !isEmpty(str); return !isEmpty(str);
} }
/** /**
* 数组转字符串,使用空格分隔 * 数组转字符串,使用空格分隔
* @param array * @param array
* @returns * @returns
*/ */
function arrToString(array){ function arrToString(array){
var temStr = ""; var temStr = "";
if(isEmpty(array)){ if(isEmpty(array)){
return temStr; return temStr;
} }
array.forEach(function(e){ array.forEach(function(e){
if(isNotEmpty(temStr)) { if(isNotEmpty(temStr)) {
temStr += " "; temStr += " ";
} }
temStr += e; temStr += e;
}); });
return temStr; return temStr;
} }
/** /**
* 数组array中是否包含str字符串 * 数组array中是否包含str字符串
* @param array * @param array
* @param str * @param str
* @returns * @returns
*/ */
function haveString(array, str){ function haveString(array, str){
if(isEmpty(array)) { if(isEmpty(array)) {
return false; return false;
} }
for (var i = 0; i < array.length; i++) { for (var i = 0; i < array.length; i++) {
if(array[i] == str) { if(array[i] == str) {
return true; return true;
} }
} }
return false; return false;
} }
/** /**
* 直接返回对象的第一个属性 * 直接返回对象的第一个属性
* @param data * @param data
* @returns * @returns
*/ */
function getObjectFirstAttribute(data) { function getObjectFirstAttribute(data) {
for ( var key in data) { for ( var key in data) {
return data[key]; return data[key];
} }
} }
/** /**
* 如果对象只有一个属性则返回第一个属性否则返回null * 如果对象只有一个属性则返回第一个属性否则返回null
* @param data * @param data
* @returns * @returns
*/ */
function getObjectFirstAttributeIfOnly(data) { function getObjectFirstAttributeIfOnly(data) {
var len = 0, value = ""; var len = 0, value = "";
for ( var key in data) { for ( var key in data) {
if (++len > 1) { if (++len > 1) {
return null; return null;
} }
value = data[key]; value = data[key];
} }
return value; return value;
} }
function postService(url, param, success=function(){}, complete=function(){}){ function postService(url, param, success=function(){}, complete=function(){}){
ajaxTemp(url, "POST", "JSON", param, function(result){ ajaxTemp(url, "POST", "JSON", param, function(result){
if (result.errCode == 400) { if (result.errCode == 400) {
var href = encodeURIComponent(window.location.href); var href = encodeURIComponent(window.location.href);
window.location = "static/manage/login.html?redirect=" + href; window.location = "static/manage/login.html?redirect=" + href;
} else if (result.errCode != "200") { } else if (result.errCode != "200") {
Toast.warn(result.errMsg); Toast.warn(result.errMsg);
} else { } else {
success(result); success(result);
} }
},function(){ },function(){
Toast.warn("请求数据失败"); Toast.warn("请求数据失败");
}, function(result){ }, function(result){
complete(result); complete(result);
}); });
} }
/** /**
* ajax处理事件模板 * ajax处理事件模板
* *
* @url 后台处理的url即action * @url 后台处理的url即action
* @dataSentType 数据发送的方式有postget方式 * @dataSentType 数据发送的方式有postget方式
* @dataReceiveType 数据接收格式有html json text等 * @dataReceiveType 数据接收格式有html json text等
* @paramsStr 传入后台的参数 * @paramsStr 传入后台的参数
* @successFunction ajax成功后执行的函数名 ajaxTemp("", "GET", "html", {}, function(){}, * @successFunction ajax成功后执行的函数名 ajaxTemp("", "GET", "html", {}, function(){},
* function(){}, ""); * function(){}, "");
*/ */
function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction, errorFunction, completeFunction, id) { function ajaxTemp(url, dataSentType, dataReceiveType, paramsStr, successFunction, errorFunction, completeFunction, id) {
$.ajax({ $.ajax({
url : url, // 后台处理程序 url : url, // 后台处理程序
sync : false, sync : false,
type : dataSentType, // 数据发送方式 type : dataSentType, // 数据发送方式
dataType : dataReceiveType, // 接受数据格式 dataType : dataReceiveType, // 接受数据格式
data : eval(paramsStr), data : eval(paramsStr),
contentType : "application/x-www-form-urlencoded; charset=UTF-8", contentType : "application/x-www-form-urlencoded; charset=UTF-8",
success : function(msg) { success : function(msg) {
if (msg.errCode == 400) { if (msg.errCode == 400) {
var href = encodeURIComponent(window.location.href); var href = encodeURIComponent(window.location.href);
window.location = "static/manage/login.html?redirect=" + href; window.location = "static/manage/login.html?redirect=" + href;
} else { } else {
if (typeof successFunction == "function") { if (typeof successFunction == "function") {
successFunction(msg, id); successFunction(msg, id);
} }
} }
}, },
beforeSend : function() { beforeSend : function() {
}, },
complete : function(msg) { complete : function(msg) {
if (msg.responseText.startWith("<!doctype html>")) { if (msg.responseText.startWith("<!doctype html>")) {
if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) { if (msg.responseText.indexOf("THIS_IS_LOGIN_PAGE_FLAG") > 0) {
Toast.error('操作失败,登录已失效,请登陆后重试', 3000); Toast.error('操作失败,登录已失效,请登陆后重试', 3000);
return; return;
} }
} }
if(typeof completeFunction == "function") { if(typeof completeFunction == "function") {
completeFunction(msg,id); completeFunction(msg,id);
} }
}, },
error : function(msg) { error : function(msg) {
if(typeof errorFunction == "function") { if(typeof errorFunction == "function") {
errorFunction(msg,id); errorFunction(msg,id);
} }
} }
}); });
} }
/** /**
* 获取cookie * 获取cookie
* @param name * @param name
* @returns * @returns
*/ */
function getCookie(name) { function getCookie(name) {
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)){ if(arr=document.cookie.match(reg)){
return unescape(arr[2]); return unescape(arr[2]);
} }
return null; return null;
} }
/** /**
* 字符串格式化 * 字符串格式化
*/ */
String.prototype.format = function(args) { String.prototype.format = function(args) {
if (arguments.length > 0) { if (arguments.length > 0) {
var result = this; var result = this;
if (arguments.length == 1 && typeof (args) == "object") { if (arguments.length == 1 && typeof (args) == "object") {
for ( var key in args) { for ( var key in args) {
var reg = new RegExp("({" + key + "})", "g"); var reg = new RegExp("({" + key + "})", "g");
result = result.replace(reg, args[key]); result = result.replace(reg, args[key]);
} }
} else { } else {
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
if (arguments[i] == undefined) { if (arguments[i] == undefined) {
return ""; return "";
} else { } else {
var reg = new RegExp("({[" + i + "]})", "g"); var reg = new RegExp("({[" + i + "]})", "g");
result = result.replace(reg, arguments[i]); result = result.replace(reg, arguments[i]);
} }
} }
} }
return result; return result;
} else { } else {
return this; return this;
} }
} }
String.prototype.endWith = function(str) { String.prototype.endWith = function(str) {
if (str == null || str == "" || this.length == 0 || str.length > this.length) { if (str == null || str == "" || this.length == 0 || str.length > this.length) {
return false; return false;
} }
return (this.substring(this.length - str.length) == str); return (this.substring(this.length - str.length) == str);
}; };
String.prototype.startWith = function(str) { String.prototype.startWith = function(str) {
if (str == null || str == "" || this.length == 0 || str.length > this.length) { if (str == null || str == "" || this.length == 0 || str.length > this.length) {
return false; return false;
} }
return (this.substr(0, str.length) == str); return (this.substr(0, str.length) == str);
}; };

View File

@@ -1,115 +1,115 @@
/** /**
* 将对象处理成json格式化和着色的html * 将对象处理成json格式化和着色的html
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2017年5月7日 * @since 2017年5月7日
*/ */
var Formatjson = { var Formatjson = {
tabStr: " ", tabStr: " ",
isArray: function(obj) { isArray: function(obj) {
return obj && typeof obj === 'object' && typeof obj.length === 'number' return obj && typeof obj === 'object' && typeof obj.length === 'number'
&& !(obj.propertyIsEnumerable('length')); && !(obj.propertyIsEnumerable('length'));
}, },
processObjectToHtmlPre: function(obj, indent, addComma, isArray, isPropertyContent) { processObjectToHtmlPre: function(obj, indent, addComma, isArray, isPropertyContent) {
var htmlStr = this.processObject(obj, indent, addComma, isArray, isPropertyContent); var htmlStr = this.processObject(obj, indent, addComma, isArray, isPropertyContent);
htmlStr = '<pre class="json">' + htmlStr + '</pre>'; htmlStr = '<pre class="json">' + htmlStr + '</pre>';
return htmlStr; return htmlStr;
}, },
processObject: function(obj, indent, addComma, isArray, isPropertyContent) { processObject: function(obj, indent, addComma, isArray, isPropertyContent) {
var html = ""; var html = "";
var comma = (addComma) ? "<span class='comma'>,</span> " : ""; var comma = (addComma) ? "<span class='comma'>,</span> " : "";
var type = typeof obj; var type = typeof obj;
var clpsHtml =""; var clpsHtml ="";
if (this.isArray(obj)) { if (this.isArray(obj)) {
if (obj.length == 0) { if (obj.length == 0) {
html += this.getRow(indent, "<span class='arrayBrace'>[ ]</span>" + comma, isPropertyContent); html += this.getRow(indent, "<span class='arrayBrace'>[ ]</span>" + comma, isPropertyContent);
} else { } else {
clpsHtml = '<span><img class="option-img" src="webjars/mg-ui/img/expanded.png" onClick="Formatjson.expImgClicked(this);" /></span><span class="collapsible">'; clpsHtml = '<span><img class="option-img" src="webjars/mg-ui/img/expanded.png" onClick="Formatjson.expImgClicked(this);" /></span><span class="collapsible">';
html += this.getRow(indent, "<span class='arrayBrace'>[</span>"+clpsHtml, isPropertyContent); html += this.getRow(indent, "<span class='arrayBrace'>[</span>"+clpsHtml, isPropertyContent);
for (var i = 0; i < obj.length; i++) { for (var i = 0; i < obj.length; i++) {
html += this.processObject(obj[i], indent + 1, i < (obj.length - 1), true, false); html += this.processObject(obj[i], indent + 1, i < (obj.length - 1), true, false);
} }
clpsHtml = "</span>"; clpsHtml = "</span>";
html += this.getRow(indent, clpsHtml + "<span class='arrayBrace'>]</span>" + comma); html += this.getRow(indent, clpsHtml + "<span class='arrayBrace'>]</span>" + comma);
} }
} else if (type == 'object' && obj == null) { } else if (type == 'object' && obj == null) {
html += this.formatLiteral("null", "", comma, indent, isArray, "null"); html += this.formatLiteral("null", "", comma, indent, isArray, "null");
} else if (type == 'object') { } else if (type == 'object') {
var numProps = 0; var numProps = 0;
for ( var prop in obj) { for ( var prop in obj) {
numProps++; numProps++;
} }
if (numProps == 0) { if (numProps == 0) {
html += this.getRow(indent, "<span class='objectBrace'>{ }</span>" + comma, isPropertyContent); html += this.getRow(indent, "<span class='objectBrace'>{ }</span>" + comma, isPropertyContent);
} else { } else {
clpsHtml = '<span><img class="option-img" src="webjars/mg-ui/img/expanded.png" onClick="Formatjson.expImgClicked(this);" /></span><span class="collapsible">'; clpsHtml = '<span><img class="option-img" src="webjars/mg-ui/img/expanded.png" onClick="Formatjson.expImgClicked(this);" /></span><span class="collapsible">';
html += this.getRow(indent, "<span class='objectBrace'>{</span>"+clpsHtml, isPropertyContent); html += this.getRow(indent, "<span class='objectBrace'>{</span>"+clpsHtml, isPropertyContent);
var j = 0; var j = 0;
for ( var prop in obj) { for ( var prop in obj) {
var processStr = '<span class="propertyName">"' + prop + '"</span>: ' + this.processObject(obj[prop], indent + 1, ++j < numProps, false, true); var processStr = '<span class="propertyName">"' + prop + '"</span>: ' + this.processObject(obj[prop], indent + 1, ++j < numProps, false, true);
html += this.getRow(indent + 1, processStr); html += this.getRow(indent + 1, processStr);
} }
clpsHtml = "</span>"; clpsHtml = "</span>";
html += this.getRow(indent, clpsHtml + "<span class='objectBrace'>}</span>" + comma); html += this.getRow(indent, clpsHtml + "<span class='objectBrace'>}</span>" + comma);
} }
} else if (type == 'number') { } else if (type == 'number') {
html += this.formatLiteral(obj, "", comma, indent, isArray, "number"); html += this.formatLiteral(obj, "", comma, indent, isArray, "number");
} else if (type == 'boolean') { } else if (type == 'boolean') {
html += this.formatLiteral(obj, "", comma, indent, isArray, "boolean"); html += this.formatLiteral(obj, "", comma, indent, isArray, "boolean");
} else if (type == 'function') { } else if (type == 'function') {
obj = this.formatFunction(indent, obj); obj = this.formatFunction(indent, obj);
html += this.formatLiteral(obj, "", comma, indent, isArray, "function"); html += this.formatLiteral(obj, "", comma, indent, isArray, "function");
} else if (type == 'undefined') { } else if (type == 'undefined') {
html += this.formatLiteral("undefined", "", comma, indent, isArray, "null"); html += this.formatLiteral("undefined", "", comma, indent, isArray, "null");
} else { } else {
html += this.formatLiteral(obj, "\"", comma, indent, isArray, "string"); html += this.formatLiteral(obj, "\"", comma, indent, isArray, "string");
} }
return html; return html;
}, },
expImgClicked: function(img){ expImgClicked: function(img){
var container = img.parentNode.nextSibling; var container = img.parentNode.nextSibling;
if(!container) return; if(!container) return;
var disp = "none"; var disp = "none";
var src = "webjars/mg-ui/img/collapsed.png"; var src = "webjars/mg-ui/img/collapsed.png";
if(container.style.display == "none"){ if(container.style.display == "none"){
disp = "inline"; disp = "inline";
src = "webjars/mg-ui/img/expanded.png"; src = "webjars/mg-ui/img/expanded.png";
} }
container.style.display = disp; container.style.display = disp;
img.src = src; img.src = src;
}, },
formatLiteral: function(literal, quote, comma, indent, isArray, style) { formatLiteral: function(literal, quote, comma, indent, isArray, style) {
if (typeof literal == 'string') { if (typeof literal == 'string') {
literal = literal.split("<").join("&lt;").split(">").join("&gt;"); literal = literal.split("<").join("&lt;").split(">").join("&gt;");
} }
var str = "<span class='" + style + "'>" + quote + literal + quote + comma + "</span>"; var str = "<span class='" + style + "'>" + quote + literal + quote + comma + "</span>";
if (isArray) { if (isArray) {
str = this.getRow(indent, str); str = this.getRow(indent, str);
} }
return str; return str;
}, },
formatFunction: function(indent, obj) { formatFunction: function(indent, obj) {
var tabs = ""; var tabs = "";
for (var i = 0; i < indent; i++) { for (var i = 0; i < indent; i++) {
tabs += this.tabStr; tabs += this.tabStr;
} }
var funcStrArray = obj.toString().split("\n"); var funcStrArray = obj.toString().split("\n");
var str = ""; var str = "";
for (var i = 0; i < funcStrArray.length; i++) { for (var i = 0; i < funcStrArray.length; i++) {
str += ((i == 0) ? "" : tabs) + funcStrArray[i] + "\n"; str += ((i == 0) ? "" : tabs) + funcStrArray[i] + "\n";
} }
return str; return str;
}, },
getRow: function(indent, data, isPropertyContent) { getRow: function(indent, data, isPropertyContent) {
var tabs = ""; var tabs = "";
for (var i = 0; i < indent && !isPropertyContent; i++) { for (var i = 0; i < indent && !isPropertyContent; i++) {
tabs += this.tabStr; tabs += this.tabStr;
} }
if (data != null && data.length > 0 && data.charAt(data.length - 1) != "\n") { if (data != null && data.length > 0 && data.charAt(data.length - 1) != "\n") {
data = data + "\n"; data = data + "\n";
} }
return tabs + data; return tabs + data;
} }
} }

View File

@@ -1,50 +1,50 @@
var tableRelationData = { var tableRelationData = {
// "name": "user_info", // "name": "user_info",
// "children": [ // "children": [
// { // {
// "name": "user_auth", // "name": "user_auth",
// "children": [] // "children": []
// },{ // },{
// "name": "group_info", // "name": "group_info",
// "children": [] // "children": []
// }] // }]
} }
var tableRelationOption = { var tableRelationOption = {
tooltip: { tooltip: {
trigger: 'item', trigger: 'item',
triggerOn: 'mousemove' triggerOn: 'mousemove'
}, },
series: [ series: [
{ {
type: 'tree', type: 'tree',
/*orient: 'vertical',*/ /*orient: 'vertical',*/
data: [tableRelationData], data: [tableRelationData],
top: '1%', top: '1%',
left: '7%', left: '7%',
bottom: '1%', bottom: '1%',
right: '20%', right: '20%',
symbolSize: 7, symbolSize: 7,
label: { label: {
normal: { normal: {
position: 'left', position: 'left',
verticalAlign: 'middle', verticalAlign: 'middle',
align: 'right', align: 'right',
fontSize: 14 fontSize: 14
} }
}, },
leaves: { leaves: {
label: { label: {
normal: { normal: {
position: 'right', position: 'right',
verticalAlign: 'middle', verticalAlign: 'middle',
align: 'left' align: 'left'
} }
} }
}, },
expandAndCollapse: true, expandAndCollapse: true,
animationDuration: 550, animationDuration: 550,
animationDurationUpdate: 750 animationDurationUpdate: 750
} }
] ]
} }

View File

@@ -1,33 +1,33 @@
/** /**
* 提示工具类 * 提示工具类
* @author 暮光:城中城 * @author 暮光:城中城
* @since 2017年5月7日 * @since 2017年5月7日
*/ */
var Toast = { var Toast = {
notOpen:function(){ notOpen:function(){
var data = { var data = {
message:"该功能暂未开放,敬请期待!", message:"该功能暂未开放,敬请期待!",
icon: 'exclamation-sign', type:"warning", icon: 'exclamation-sign', type:"warning",
}; };
this.show(data); this.show(data);
}, },
warn:function(msg, time){ warn:function(msg, time){
var data = { var data = {
message:msg,time:time, message:msg,time:time,
icon: 'exclamation-sign', type:'warning', icon: 'exclamation-sign', type:'warning',
}; };
this.show(data); this.show(data);
}, },
error:function(msg, time){ error:function(msg, time){
var data = { var data = {
message:msg,time:time, message:msg,time:time,
icon: 'exclamation-sign', type:'danger', icon: 'exclamation-sign', type:'danger',
}; };
this.show(data); this.show(data);
}, },
show:function(data){ show:function(data){
data.time = isEmpty(data.time)?2000:data.time; data.time = isEmpty(data.time)?2000:data.time;
data.placement = isEmpty(data.placement)?'top':data.placement; data.placement = isEmpty(data.placement)?'top':data.placement;
new $.zui.Messager(data.message, data).show(); new $.zui.Messager(data.message, data).show();
} }
} }

View File

@@ -0,0 +1,409 @@
--
-- !!重要说明!!
-- 1、本sql文件分为从1.0.5版本升级 和 全新的库,即增量和全量的区分,请选择性执行
-- 2、建议数据库版本5.7.25
--
-- ------------------------从1.0.5版本升级:------------------------
ALTER TABLE `db_datasource`
ADD COLUMN `group_name` varchar(50) NULL COMMENT '数据源分组名';
-- ------------------------全新的库:------------------------
/*
Navicat Premium Data Transfer
Source Server : 127.0.0.1
Source Server Type : MySQL
Source Server Version : 50724
Source Host : 127.0.0.1:3306
Source Schema : zyplayer_doc_manage
Target Server Type : MySQL
Target Server Version : 50724
File Encoding : 65001
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for auth_info
-- ----------------------------
DROP TABLE IF EXISTS `auth_info`;
CREATE TABLE `auth_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`auth_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名',
`auth_desc` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限说明',
`can_edit` tinyint(4) NULL DEFAULT 1 COMMENT '是否可编辑 0=否 1=是',
`create_uid` bigint(20) NULL DEFAULT NULL COMMENT '创建人用户ID',
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`auth_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '权限类型 0=隐藏权限 1=可使用',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 18 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '权限信息表' ROW_FORMAT = Compact;
-- ----------------------------
-- Records of auth_info
-- ----------------------------
INSERT INTO `auth_info` VALUES (3, 'AUTH_ASSIGN', '权限分配权', 0, 1, '2018-12-01 11:40:42', 1);
INSERT INTO `auth_info` VALUES (4, 'USER_MANAGE', '用户管理权', 0, 1, '2018-12-01 11:40:42', 1);
INSERT INTO `auth_info` VALUES (5, 'WIKI_EDIT_PAGE_', '编辑wiki文档', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (6, 'WIKI_VIEW_PAGE_', '查看wiki文档', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (7, 'WIKI_COMMENT_PAGE_', '评论wiki文档', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (8, 'WIKI_DELETE_PAGE_', '删除wiki文档', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (9, 'WIKI_PAGE_FILE_UPLOAD_', '上传wiki文档附件', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (10, 'WIKI_PAGE_FILE_DELETE_', '删除wiki文档附件', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (11, 'WIKI_PAGE_AUTH_MANAGE_', 'wiki权限管理', 0, 1, '2019-06-04 13:01:20', 0);
INSERT INTO `auth_info` VALUES (12, 'DB_DATASOURCE_MANAGE', 'DB数据源管理权', 0, 1, '2019-06-29 13:01:20', 1);
INSERT INTO `auth_info` VALUES (13, 'ES_DATASOURCE_MANAGE', 'ES数据源管理权', 0, 1, '2019-07-27 00:39:20', 1);
INSERT INTO `auth_info` VALUES (14, 'DB_VIEW_', '数据源查看权', 0, 1, '2019-08-18 23:25:17', 0);
INSERT INTO `auth_info` VALUES (15, 'DB_SELECT_', '数据源查询权', 0, 1, '2019-08-18 23:25:17', 0);
INSERT INTO `auth_info` VALUES (16, 'DB_UPDATE_', '数据源增删改查权', 0, 1, '2019-08-18 23:25:17', 0);
INSERT INTO `auth_info` VALUES (17, 'DB_DESC_EDIT_', '表字段注释修改权', 0, 1, '2019-08-18 23:25:17', 0);
-- ----------------------------
-- Table structure for db_datasource
-- ----------------------------
DROP TABLE IF EXISTS `db_datasource`;
CREATE TABLE `db_datasource` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`driver_class_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据源驱动类',
`source_url` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据源地址',
`source_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据源用户名',
`source_password` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据源密码',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`yn` tinyint(4) NULL DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据源名称',
`source_group` varchar(50) DEFAULT NULL COMMENT '数据源分组名',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of db_datasource
-- ----------------------------
-- ----------------------------
-- Table structure for db_favorite
-- ----------------------------
DROP TABLE IF EXISTS `db_favorite`;
CREATE TABLE `db_favorite` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏标题',
`content` varchar(10000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收藏内容',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`yn` tinyint(4) NULL DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
`datasource_id` bigint(20) NULL DEFAULT NULL COMMENT '数据源ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of db_favorite
-- ----------------------------
-- ----------------------------
-- Table structure for db_history
-- ----------------------------
DROP TABLE IF EXISTS `db_history`;
CREATE TABLE `db_history` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`content` varchar(10000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'sql内容',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`yn` tinyint(4) NULL DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
`datasource_id` bigint(20) NULL DEFAULT NULL COMMENT '数据源ID',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 135 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of db_history
-- ----------------------------
-- ----------------------------
-- Table structure for es_datasource
-- ----------------------------
DROP TABLE IF EXISTS `es_datasource`;
CREATE TABLE `es_datasource` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数据源名称',
`host_port` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '地址和端口',
`scheme` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'schemehttp或其他',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`yn` tinyint(4) NULL DEFAULT NULL COMMENT '是否有效 0=无效 1=有效',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of es_datasource
-- ----------------------------
-- ----------------------------
-- Table structure for user_auth
-- ----------------------------
DROP TABLE IF EXISTS `user_auth`;
CREATE TABLE `user_auth` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
`auth_id` bigint(20) NULL DEFAULT NULL COMMENT '权限ID',
`create_uid` bigint(20) NULL DEFAULT NULL COMMENT '创建用户ID',
`update_uid` bigint(20) NULL DEFAULT NULL COMMENT '更新用户ID',
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '是否删除 0=未删除 1=已删除',
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`auth_custom_suffix` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义权限结尾',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 73 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户权限表' ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user_auth
-- ----------------------------
INSERT INTO `user_auth` VALUES (9, 2, 1, 1, NULL, 0, '2018-12-15 22:19:59', NULL, NULL);
INSERT INTO `user_auth` VALUES (10, 2, 2, 1, NULL, 0, '2018-12-15 22:19:59', NULL, NULL);
INSERT INTO `user_auth` VALUES (11, 2, 3, 1, NULL, 0, '2018-12-15 22:19:59', NULL, NULL);
INSERT INTO `user_auth` VALUES (12, 2, 4, 1, NULL, 0, '2018-12-15 22:19:59', NULL, NULL);
INSERT INTO `user_auth` VALUES (31, 3, 1, 1, NULL, 0, '2019-06-21 15:19:51', NULL, NULL);
INSERT INTO `user_auth` VALUES (32, 3, 2, 1, NULL, 0, '2019-06-21 15:19:51', NULL, NULL);
INSERT INTO `user_auth` VALUES (33, 3, 3, 1, NULL, 0, '2019-06-21 15:19:51', NULL, NULL);
INSERT INTO `user_auth` VALUES (34, 3, 4, 1, NULL, 0, '2019-06-21 15:19:51', NULL, NULL);
INSERT INTO `user_auth` VALUES (44, 1, 3, 1, NULL, 0, '2019-08-12 13:10:11', NULL, NULL);
INSERT INTO `user_auth` VALUES (45, 1, 4, 1, NULL, 0, '2019-08-12 13:10:11', NULL, NULL);
INSERT INTO `user_auth` VALUES (46, 1, 12, 1, NULL, 0, '2019-08-12 13:10:11', NULL, NULL);
INSERT INTO `user_auth` VALUES (47, 1, 13, 1, NULL, 0, '2019-08-12 13:10:11', NULL, NULL);
-- ----------------------------
-- Table structure for user_info
-- ----------------------------
DROP TABLE IF EXISTS `user_info`;
CREATE TABLE `user_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`user_no` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户编号,用于登录等',
`password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码',
`user_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
`email` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '邮箱',
`avatar` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '头像',
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '是否删除 0=未删除 1=已删除 2=已停用',
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`create_uid` bigint(20) NULL DEFAULT NULL COMMENT '创建人用户ID',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
`sex` tinyint(4) NOT NULL DEFAULT 0 COMMENT '性别 0=女 1=男',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `idx_userNo`(`user_no`) USING BTREE COMMENT '登录用户名'
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户信息表' ROW_FORMAT = Compact;
-- ----------------------------
-- Records of user_info
-- ----------------------------
INSERT INTO `user_info` VALUES (1, 'zyplayer', 'e10adc3949ba59abbe56e057f20f883e', '暮光:城中城', '806783409@qq.com', NULL, 0, '2018-12-01 11:37:39', NULL, '2018-12-15 20:32:08', NULL, 0);
-- ----------------------------
-- Table structure for wiki_page
-- ----------------------------
DROP TABLE IF EXISTS `wiki_page`;
CREATE TABLE `wiki_page` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`space_id` bigint(20) NULL DEFAULT NULL COMMENT '空间ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名字',
`parent_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '父ID',
`node_type` tinyint(4) NULL DEFAULT 0 COMMENT '节点类型 0=有子节点 1=终节点',
`zan_num` int(11) NOT NULL DEFAULT 0 COMMENT '赞的数量',
`edit_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '编辑类型 0=可编辑 1=不允许编辑',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人ID',
`update_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人名字',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`del_flag` tinyint(4) NOT NULL DEFAULT 0 COMMENT '0=有效 1=删除',
`view_num` int(11) NOT NULL DEFAULT 0 COMMENT '阅读数',
`seq_no` int(11) NOT NULL DEFAULT 0 COMMENT '顺序',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of wiki_page
-- ----------------------------
INSERT INTO `wiki_page` VALUES (1, 1, '关于zyplayer-doc工具', 0, 0, 0, 0, 1, '暮光:城中城', '2019-03-09 14:01:41', 1, '暮光:城中城', '2019-07-16 21:00:00', 0, 42, 1);
INSERT INTO `wiki_page` VALUES (2, 1, '开发规划', 0, 0, 0, 0, 1, '暮光:城中城', '2019-03-09 14:14:02', 1, '暮光:城中城', '2019-06-14 13:30:22', 0, 122, 4);
INSERT INTO `wiki_page` VALUES (3, 1, '升级日志', 0, 0, 0, 0, 1, '暮光:城中城', '2019-03-09 14:16:20', 1, '暮光:城中城', '2019-06-14 16:49:30', 0, 29, 5);
INSERT INTO `wiki_page` VALUES (4, 1, '贡献人员列表', 0, 0, 0, 0, 1, '暮光:城中城', '2019-03-09 15:16:15', 1, '暮光:城中城', '2019-06-14 13:20:43', 0, 13, 7);
INSERT INTO `wiki_page` VALUES (5, 1, 'zyplayer-doc-swagger', 0, 0, 1, 0, 1, '暮光:城中城', '2019-03-09 15:33:14', NULL, NULL, NULL, 0, 20, 9);
INSERT INTO `wiki_page` VALUES (6, 1, '如何使用', 5, 0, 0, 0, 1, '暮光:城中城', '2019-03-09 15:33:33', 1, '暮光:城中城', '2019-03-09 15:33:46', 0, 3, 14);
INSERT INTO `wiki_page` VALUES (7, 2, '所有格式测试', 0, 0, 0, 0, 1, '暮光:城中城', '2019-03-12 12:21:26', NULL, NULL, NULL, 0, 13, 13);
-- ----------------------------
-- Table structure for wiki_page_comment
-- ----------------------------
DROP TABLE IF EXISTS `wiki_page_comment`;
CREATE TABLE `wiki_page_comment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`page_id` bigint(20) NULL DEFAULT NULL COMMENT '页面ID',
`parent_id` bigint(20) NULL DEFAULT NULL COMMENT '父评论ID',
`content` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '评论内容',
`zan_num` int(11) NOT NULL DEFAULT 0 COMMENT '赞的数量',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0=有效 1=删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of wiki_page_comment
-- ----------------------------
-- ----------------------------
-- Table structure for wiki_page_content
-- ----------------------------
DROP TABLE IF EXISTS `wiki_page_content`;
CREATE TABLE `wiki_page_content` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键自增ID',
`page_id` bigint(20) NULL DEFAULT NULL COMMENT '页面ID',
`content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '内容',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人名字',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_user_id` bigint(20) NULL DEFAULT NULL COMMENT '修改人ID',
`update_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '修改人名字',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '修改时间',
`preview` varchar(16000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '预览内容',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_page_id`(`page_id`) USING BTREE COMMENT '页面ID'
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of wiki_page_content
-- ----------------------------
INSERT INTO `wiki_page_content` VALUES (1, 1, '<p>一入开源深似海</p><br>源码地址:<a href=\"https://gitee.com/zyplayer/zyplayer-doc\" target=\"_blank\">https://gitee.com/zyplayer/zyplayer-doc</a><p>体验地址:<a href=\"http://doc.zyplayer.com/zyplayer-doc-manage/static/manage/home.html\" target=\"_blank\">http://doc.zyplayer.com/zyplayer-doc-manage/static/manage/home.html</a>&nbsp;账号zyplayer 密码123456</p><p><br></p><p>更多实用功能请提交评论或加群交流!谢谢!<br></p><p>QQ群466363173</p>tips想要编辑本文请修改表wiki_page的edit_type字段值为0才行哦~<p><br></p><p>有什么问题可以来评论本文章哦!当然,如果你是部署在你们自己本地的我肯定看不到此文章的评论</p><p>可以到本工具官网下评论此文章,我会随时去查看的!</p><p>唯一官网地址:<a href=\"http://doc.zyplayer.com\" target=\"_blank\">http://doc.zyplayer.com</a></p><p><br></p><p>欢迎提交各种变态无理的要求~</p>', 1, '暮光:城中城', '2019-03-09 14:01:41', 1, '暮光:城中城', '2019-07-12 18:11:44', '一入开源深似海源码地址https://gitee.com/zyplayer/zyplayer-doc体验地址http://doc.zyplayer.com/zyplayer-doc-manage/static/manage/home.html&nbsp;账号zyplayer 密码123456更多实用功能请提交评论或加群交流谢谢QQ群466363173tips想要编辑本文请修改表wiki_page的edit_type字段值为0才行哦~有什么问题可以来评论本文章哦当然如果你是部署在你们自己本地的我肯定看不到此文章的评论可以到本工具官网下评论此文章我会随时去查看的唯一官网地址http://doc.zyplayer.com欢迎提交各种变态无理的要求~');
INSERT INTO `wiki_page_content` VALUES (2, 2, '<p>zyplayer-doc-manage</p><p>1、首页做大的调整优化希望使用element重构一下</p><p>2、人员导入方案权限优化人员管理细化</p><p>&nbsp;</p><p>zyplayer-doc-wiki</p><p><prefira code\';font-size:10.5pt;\"=\"\">1<spancourier new\';\"=\"\"></spancourier></prefira></p><p><prefira code\';font-size:10.5pt;\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\">2<spancourier new\';\"=\"\">、</spancourier></spancourier></spancourier></prefira>支持把一个空间里的文档一键同步到git<spancourier new\';\"=\"\">的wiki上统一管理文档</spancourier></p><p><spancourier new\';\"=\"\">3</spancourier></p><p>4</p><p>5</p><p>6</p><p>7访</p><p>8url动态变动</p><p>9https://www.kancloud.cn</p><p><br></p><p></p><p>PR</p><p><a href=\"https://gitee.com/zyplayer/zyplayer-doc\" target=\"_blank\">https://gitee.com/zyplayer/zyplayer-doc</a></p><p><br></p><p></p><p>QQ群466363173</p>', 1, '', '2019-03-09 14:14:02', 1, '', '2019-06-14 13:30:22', 'zyplayer-doc-manage1使element重构一下2&nbsp;zyplayer-doc-wiki12git的wiki上3456...');
INSERT INTO `wiki_page_content` VALUES (3, 3, '<p><span style=\"color: rgb(249, 150, 59);\">V1.0.1 2019-03-09</span></p><p>1zyplayer-doc-wiki模块</p><ul><li><br></li><li><br></li><li>wiki顺序<br></li><li></li></ul><p><prefira code\';font-size:10.5pt;\"=\"\">2<spancourier new\';\"=\"\">、dubbo<spancourier new\';\"=\"\">使dubbo2.7.0</spancourier></spancourier></prefira></p><p><prefira code\';font-size:10.5pt;\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\">3<spancourier new\';\"=\"\">、框架进行了大的拆分,表修改较多</spancourier></spancourier></spancourier></prefira></p><p><prefira code\';font-size:10.5pt;\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\">4<spancourier new\';\"=\"\"></spancourier></spancourier></spancourier></spancourier></prefira></p><p><prefira code\';font-size:10.5pt;\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\">5<spancourier new\';\"=\"\"></spancourier></spancourier></spancourier></spancourier></spancourier></prefira></p><p><prefira code\';font-size:10.5pt;\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><spancourier new\';\"=\"\"><br></spancourier></spancourier></spancourier></spancourier></spancourier></prefira></p><p><span style=\"color: rgb(249, 150, 59);\">V1.0.0 2019-02-15</span><br></p><p></p><p>1zyplayer-doc-swaggerswagger接口文档展示方案使访<br>2zyplayer-doc-dubbodubbo服务的自动扫描线zookeepernacos注册中心的服务扫描<br>3zyplayer-doc-db/mysql和sqlserver数据库<br>4zyplayer-doc-managespring boot项目spring security做权限管理</p>', 1, '', '2019-03-09 14:16:20', 1, '', '2019-06-14 16:49:30', 'V1.0.1 2019-03-091zyplayer-doc-wiki模块支持空间隔离支持附件上传拖动可以改变wiki顺序基本的文档创建2dubbo文档支持使用元数据生成参数和返回值dubbo2.7.0345V1.0.0 2019-02-151zyplayer-doc-swagge...');
INSERT INTO `wiki_page_content` VALUES (4, 4, '<p></p><p><a href=\"http://www.zyplayer.com\" target=\"_blank\"></a><br></p>', 1, '', '2019-03-09 15:16:15', 1, '', '2019-06-14 13:20:43', '');
INSERT INTO `wiki_page_content` VALUES (5, 5, '<p>zyplayer-doc-swagger 使</p>', 1, '', '2019-03-09 15:33:14', NULL, NULL, NULL, NULL);
INSERT INTO `wiki_page_content` VALUES (6, 6, '<p></p>', 1, '', '2019-03-09 15:33:33', 1, '', '2019-03-09 15:33:46', NULL);
INSERT INTO `wiki_page_content` VALUES (7, 7, '<h2>H2</h2><p><span style=\"font-weight: bold;\"></span></p><p><span style=\"font-size: xx-large;\"></span><span style=\"font-weight: bold;\"><br></span></p><p><span style=\"font-family: 宋体;\"></span>&nbsp;</p><p><span style=\"font-style: italic;\"></span></p><p><span style=\"text-decoration-line: underline;\">线线线</span><span style=\"font-style: italic;\"><br></span></p><p><span style=\"text-decoration-line: line-through;\">线线线</span><span style=\"text-decoration-line: underline;\"><br></span></p><p><span style=\"color: rgb(249, 150, 59);\"></span><span style=\"text-decoration-line: line-through;\"><br></span></p><p><span style=\"background-color: rgb(194, 79, 74);\"></span></p><p><a href=\"http://www.baidu.com/\" target=\"_blank\"></a><br></p><ol><li></li><li>xxx</li><li>xxx</li></ol><ul><li></li><li>xxx</li><li>xxx</li></ul><p style=\"text-align: center;\"></p><p style=\"text-align: right;\"></p><blockquote style=\"font-size: medium;\">xxxxx</blockquote><p><img src=\"http://img.t.sinajs.cn/t4/appstyle/expression/ext/normal/50/pcmoren_huaixiao_org.png\" alt=\"[坏笑]\"><br></p><p></p><table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tbody><tr><th>&nbsp;ID</th><th>&nbsp;</th><th>&nbsp;</th><th>&nbsp;</th><th>&nbsp;</th></tr><tr><td>&nbsp;xx</td><td>&nbsp;xx</td><td>&nbsp;xx</td><td>&nbsp;xx</td><td>&nbsp;xx</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table><p><br></p><pre><code>public static void main(String[] args) {<br> System.out.println(\"hello world\");<br>}</code></pre><p><br></p>', 1, '', '2019-03-12 12:21:26', NULL, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for wiki_page_file
-- ----------------------------
DROP TABLE IF EXISTS `wiki_page_file`;
CREATE TABLE `wiki_page_file` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`page_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`file_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`file_url` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'URL',
`uuid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'UUID',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`update_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`update_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`del_flag` tinyint(4) NULL DEFAULT 0 COMMENT '0= 1=',
`download_num` int(11) NOT NULL DEFAULT 0 COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `uk_uuid`(`uuid`) USING BTREE COMMENT 'ID'
) ENGINE = InnoDB AUTO_INCREMENT = 15 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of wiki_page_file
-- ----------------------------
-- ----------------------------
-- Table structure for wiki_page_history
-- ----------------------------
DROP TABLE IF EXISTS `wiki_page_history`;
CREATE TABLE `wiki_page_history` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`page_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`content` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`del_flag` tinyint(4) NOT NULL DEFAULT 0 COMMENT ' 0= 1=',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_page_id`(`page_id`) USING BTREE COMMENT 'ID索引'
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for wiki_page_zan
-- ----------------------------
DROP TABLE IF EXISTS `wiki_page_zan`;
CREATE TABLE `wiki_page_zan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`page_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`comment_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`yn` tinyint(4) NULL DEFAULT NULL COMMENT ' 0= 1=',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for wiki_space
-- ----------------------------
DROP TABLE IF EXISTS `wiki_space`;
CREATE TABLE `wiki_space` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`type` tinyint(4) NULL DEFAULT 1 COMMENT ' 1= 2= 3=',
`space_explain` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`edit_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT ' 0= 1=',
`tree_lazy_load` tinyint(4) NOT NULL DEFAULT 0 COMMENT ' 0= 1=',
`open_doc` tinyint(4) NOT NULL DEFAULT 0 COMMENT ' 0= 1=',
`uuid` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'UUID',
`create_user_id` bigint(20) NULL DEFAULT NULL COMMENT 'ID',
`create_user_name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`del_flag` tinyint(4) NOT NULL DEFAULT 0 COMMENT ' 0= 1=',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of wiki_space
-- ----------------------------
INSERT INTO `wiki_space` VALUES (1, 'zyplayer-doc交流专用', 1, '', 0, 0, 1, '23f3f59a60824d21af9f7c3bbc9bc3cb', 1, '', '2019-03-09 13:59:14', 0);
INSERT INTO `wiki_space` VALUES (2, '', 2, '', 0, 0, 0, '91995a9a67bf45db9b5e58266517393e', 1, '', '2019-03-09 14:24:30', 0);
-- ----------------------------
-- Table structure for zyplayer_storage
-- ----------------------------
DROP TABLE IF EXISTS `zyplayer_storage`;
CREATE TABLE `zyplayer_storage` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`doc_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '',
`doc_value` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '',
`creation_time` datetime(0) NULL DEFAULT NULL COMMENT '',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `key`(`doc_key`) USING BTREE COMMENT 'key唯一索引'
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '' ROW_FORMAT = Compact;
DROP TABLE IF EXISTS `db_transfer_task`;
CREATE TABLE `db_transfer_task` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`name` varchar(100) DEFAULT NULL COMMENT '',
`query_datasource_id` bigint(20) DEFAULT NULL COMMENT 'ID',
`storage_datasource_id` bigint(20) DEFAULT NULL COMMENT 'ID',
`query_sql` varchar(2048) DEFAULT NULL COMMENT 'sql',
`storage_sql` varchar(2048) DEFAULT NULL COMMENT 'sql',
`need_count` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 0= 1=',
`last_execute_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 0= 1= 2= 3= 4=',
`last_execute_time` datetime DEFAULT NULL COMMENT '',
`last_execute_info` text DEFAULT NULL COMMENT '',
`create_user_id` bigint(20) DEFAULT NULL COMMENT 'ID',
`create_user_name` varchar(20) DEFAULT NULL COMMENT '',
`create_time` datetime DEFAULT NULL COMMENT '',
`del_flag` tinyint(4) NOT NULL DEFAULT '0' COMMENT ' 0= 1=',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,3 +0,0 @@
{
"presets": ["vue-app"]
}

View File

@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = tab
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false

View File

@@ -0,0 +1,11 @@
# 开发环境
ENV = 'development'
# base api
VUE_APP_BASE_API = 'http://local.zyplayer.com:8083/zyplayer-doc-manage'
# VUE_APP_BASE_API = 'http://doc.zyplayer.com/zyplayer-doc-manage'
VUE_CLI_BABEL_TRANSPILE_MODULES = true

View File

@@ -0,0 +1,6 @@
# 线上环境
ENV = 'production'
# base api
VUE_APP_BASE_API = './'

View File

@@ -1,5 +1,21 @@
.DS_Store .DS_Store
node_modules/ node_modules
dist/ /dist
npm-debug.log
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea .idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -1,9 +0,0 @@
.PHONY: dist build
install:
@npm install
dev: install
@npm run dev
build:
@npm run build

View File

@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,43 +1,40 @@
{ {
"name": "console-ui", "name": "zyplayer-db-ui",
"description": "console-ui", "version": "0.1.0",
"author": "", "private": true,
"private": true, "scripts": {
"scripts": { "dev": "vue-cli-service serve --mode development",
"dev": "webpack-dev-server --inline --hot --env.dev", "build": "vue-cli-service build --mode production"
"build": "rimraf dist && webpack -p --progress --hide-modules" },
}, "dependencies": {
"dependencies": { "axios": "^0.19.0",
"axios": "^0.18.0", "core-js": "^3.3.2",
"element-ui": "^2.10.0", "echarts": "^4.5.0",
"sql-formatter": "^2.3.3", "js-cookie": "^2.2.1",
"vue": "^2.5.16", "pouchdb": "^7.1.1",
"vue-axios": "^2.1.4", "vue": "^2.6.10",
"vue-hljs": "^1.1.2", "vue-axios": "^2.1.5",
"vue-router": "^3.0.6", "vue-hljs": "^1.1.2",
"vuex": "^3.3.0", "vue-router": "^3.1.3",
"wangeditor": "^3.1.1" "vuex": "^3.1.2",
}, "element-ui": "^2.10.0",
"engines": { "sql-formatter": "^2.3.3",
"node": ">=6" "wangeditor": "^3.1.1"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^6.6.0", "@vue/cli-plugin-babel": "^4.0.0",
"babel-core": "^6.24.1", "@vue/cli-service": "^4.0.0",
"babel-loader": "^6.4.0", "less": "^3.10.3",
"babel-preset-vue-app": "^1.2.0", "less-loader": "^5.0.0",
"css-loader": "^0.27.0", "vue-template-compiler": "^2.6.10"
"file-loader": "^0.10.1", },
"html-webpack-plugin": "^2.24.1", "postcss": {
"postcss-loader": "^1.3.3", "plugins": {
"rimraf": "^2.6.3", "autoprefixer": {}
"style-loader": "^0.13.2", }
"url-loader": "^0.5.8", },
"vue-loader": "^13.3.0", "browserslist": [
"vue-template-compiler": "^2.5.16", "> 1%",
"webpack": "^2.4.1", "last 2 versions"
"webpack-dev-server": "^2.4.2", ]
"axios": "^0.18.0",
"vue-axios": "^2.1.4"
}
} }

View File

@@ -1,5 +0,0 @@
module.exports = {
plugins: [
require('autoprefixer')()
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -0,0 +1,17 @@
<!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.0">
<link rel="icon" href="<%= BASE_URL %>favicon-db.png">
<title>数据库文档管理</title>
</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>
<!-- built files will be auto injected -->
</body>
</html>

View File

@@ -1,13 +1,17 @@
<template> <template>
<div id="app"> <div id="app">
<template v-if="global.fullscreen"> <template v-if="fullscreen">
<router-view></router-view> <router-view></router-view>
</template> </template>
<el-container v-else> <el-container v-else>
<el-aside style="background: #fafafa;"> <el-aside style="background: #fafafa;">
<div style="padding: 10px;height: 100%;box-sizing: border-box;"> <div style="padding: 10px;height: 100%;box-sizing: border-box;">
<div style="margin-bottom: 10px;"> <div style="margin-bottom: 10px;">
<el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" filterable placeholder="请先选择数据源" style="width: 100%;"> <el-select v-model="choiceDatasourceGroup" @change="sourceGroupChangeEvents" 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" 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-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
</div> </div>
@@ -56,9 +60,11 @@
</el-dropdown> </el-dropdown>
</el-header> </el-header>
<el-main style="padding: 0;"> <el-main style="padding: 0;">
<router-view></router-view> <router-view @initLoadDataList="initLoadDataList"
</el-main> @loadDatasourceList="loadDatasourceList">
</el-container> </router-view>
</el-main>
</el-container>
</el-container> </el-container>
<!--关于弹窗--> <!--关于弹窗-->
<el-dialog title="关于zyplayer-doc" :visible.sync="aboutDialogVisible" width="600px"> <el-dialog title="关于zyplayer-doc" :visible.sync="aboutDialogVisible" width="600px">
@@ -86,10 +92,9 @@
</template> </template>
<script> <script>
import global from './common/config/global' import userApi from './common/api/user'
import toast from './common/lib/common/toast' import datasourceApi from './common/api/datasource'
var app;
export default { export default {
data() { data() {
return { return {
@@ -99,7 +104,9 @@
// 数据源相关 // 数据源相关
datasourceOptions: [], datasourceOptions: [],
datasourceList: [], datasourceList: [],
datasourceGroupList: [],
choiceDatasourceId: "", choiceDatasourceId: "",
choiceDatasourceGroup: "",
defaultProps: {children: 'children', label: 'name'}, defaultProps: {children: 'children', label: 'name'},
// 页面展示相关 // 页面展示相关
nowDatasourceShow: {}, nowDatasourceShow: {},
@@ -109,9 +116,12 @@
upgradeInfo: {}, upgradeInfo: {},
} }
}, },
computed: {
fullscreen () {
return this.$store.state.global.fullscreen;
}
},
mounted: function () { mounted: function () {
app = this;
global.vue.$app = this;
this.getSelfUserInfo(); this.getSelfUserInfo();
this.checkSystemUpgrade(); this.checkSystemUpgrade();
this.loadDatasourceList(); this.loadDatasourceList();
@@ -122,35 +132,45 @@
if (command == 'userSignOut') { if (command == 'userSignOut') {
this.userSignOut(); this.userSignOut();
} else if (command == 'aboutDoc') { } else if (command == 'aboutDoc') {
app.aboutDialogVisible = true; this.aboutDialogVisible = true;
} else if (command == 'myInfo') { } else if (command == 'myInfo') {
this.$router.push({path: '/user/myInfo'}); this.$router.push({path: '/user/myInfo'});
} else if (command == 'console') { } else if (command == 'console') {
window.location = this.apilist1.HOST; window.location = process.env.VUE_APP_BASE_API;
} else { } else {
toast.notOpen(); this.$message.warn("功能暂未开放");
} }
}, },
userSignOut() { userSignOut() {
this.common.post(this.apilist1.userLogout, {}, function (json) { userApi.userLogout().then(() => {
location.reload(); location.reload();
}); });
}, },
getSelfUserInfo() { getSelfUserInfo() {
this.common.post(this.apilist1.getSelfUserInfo, {}, function (json) { userApi.getSelfUserInfo().then(json=>{
app.userSelfInfo = json.data; this.userSelfInfo = json.data;
}); });
},
sourceGroupChangeEvents() {
let datasourceOptions = [];
for (let i = 0; i < this.datasourceList.length; i++) {
let item = this.datasourceList[i];
if (!this.choiceDatasourceGroup || this.choiceDatasourceGroup == item.groupName) {
datasourceOptions.push({label: item.name, value: item.id});
}
}
this.datasourceOptions = datasourceOptions;
}, },
datasourceChangeEvents() { datasourceChangeEvents() {
app.nowDatasourceShow = this.choiceDatasourceId; this.nowDatasourceShow = this.choiceDatasourceId;
var host = ""; var host = "";
for (var i = 0; i < this.datasourceList.length; i++) { for (var i = 0; i < this.datasourceList.length; i++) {
if (this.datasourceList[i].id == this.choiceDatasourceId) { if (this.datasourceList[i].id == this.choiceDatasourceId) {
host = this.datasourceList[i].cnName; host = this.datasourceList[i].name;
break; break;
} }
} }
app.loadDatabaseList(this.choiceDatasourceId, host); this.loadDatabaseList(this.choiceDatasourceId, host);
}, },
handleNodeClick(node) { handleNodeClick(node) {
console.log("点击节点:", node); console.log("点击节点:", node);
@@ -170,16 +190,16 @@
if (node.children.length > 0 && node.children[0].needLoad) { if (node.children.length > 0 && node.children[0].needLoad) {
console.log("加载节点:", node); console.log("加载节点:", node);
if (node.type == 1) { if (node.type == 1) {
app.loadGetTableList(node); this.loadGetTableList(node);
} }
} }
}, },
loadGetTableList(node, callback) { loadGetTableList(node, callback) {
this.common.post(this.apilist1.tableList, {sourceId: this.choiceDatasourceId, dbName: node.dbName}, function (json) { datasourceApi.tableList({sourceId: this.choiceDatasourceId, dbName: node.dbName}).then(json => {
var pathIndex = []; let pathIndex = [];
var result = json.data || []; let result = json.data || [];
for (var i = 0; i < result.length; i++) { for (let i = 0; i < result.length; i++) {
var item = { let item = {
id: node.host + "_" + node.dbName + "_" + result[i].tableName, host: node.host, id: node.host + "_" + node.dbName + "_" + result[i].tableName, host: node.host,
dbName: node.dbName, tableName: result[i].tableName, name: result[i].tableName, type: 2, dbName: node.dbName, tableName: result[i].tableName, name: result[i].tableName, type: 2,
comment: result[i].tableComment comment: result[i].tableComment
@@ -194,51 +214,53 @@
}); });
}, },
loadDatasourceList() { loadDatasourceList() {
this.common.post(this.apilist1.datasourceList, {}, function (json) { datasourceApi.datasourceList({}).then(json => {
app.datasourceList = json.data || []; this.datasourceList = json.data || [];
var datasourceOptions = []; let datasourceOptions = [];
for (var i = 0; i < app.datasourceList.length; i++) { for (let i = 0; i < this.datasourceList.length; i++) {
datasourceOptions.push({ let item = this.datasourceList[i];
label: app.datasourceList[i].cnName, value: app.datasourceList[i].id datasourceOptions.push({label: item.name, value: item.id});
}); }
} this.datasourceOptions = datasourceOptions;
app.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, callback) { loadDatabaseList(sourceId, host) {
app.databaseList = []; return new Promise((resolve, reject) => {
this.common.post(this.apilist1.databaseList, {sourceId: sourceId}, function (json) { this.databaseList = [];
var result = json.data || []; datasourceApi.databaseList({sourceId: sourceId}).then(json => {
var pathIndex = []; let result = json.data || [];
var children = []; let pathIndex = [];
for (var i = 0; i < result.length; i++) { let children = [];
var item = { for (let i = 0; i < result.length; i++) {
id: host + "_" + result[i].dbName, host: host, dbName: result[i].dbName, let item = {
name: result[i].dbName, type: 1 id: host + "_" + result[i].dbName, host: host, dbName: result[i].dbName,
}; name: result[i].dbName, type: 1
item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载 };
children.push(item); item.children = [{label: '', needLoad: true}];// 初始化一个对象,点击展开时重新查询加载
} children.push(item);
pathIndex.push({id: host, host: host, name: host, children: children}); }
app.databaseList = pathIndex; pathIndex.push({id: host, host: host, name: host, children: children});
if (typeof callback == 'function') { this.databaseList = pathIndex;
callback(); resolve();
} });
}); });
}, },
initLoadDataList(sourceId, host, dbName) { initLoadDataList(param) {
if (app.databaseList.length > 0) { if (this.databaseList.length > 0) {
return; return;
} }
this.choiceDatasourceId = parseInt(sourceId); this.choiceDatasourceId = parseInt(param.sourceId);
this.loadDatabaseList(sourceId, host, function () { this.loadDatabaseList(param.sourceId, param.host).then(() => {
app.databaseExpandedKeys = [host]; this.databaseExpandedKeys = [param.host];
}); });
}, },
checkSystemUpgrade() { checkSystemUpgrade() {
this.common.post(this.apilist1.systemUpgradeInfo, {}, function (json) { datasourceApi.systemUpgradeInfo({}).then(json => {
if (!!json.data) { if (!!json.data) {
app.upgradeInfo = json.data; this.upgradeInfo = json.data;
console.log("zyplayer-doc发现新版本" console.log("zyplayer-doc发现新版本"
+ "\n升级地址" + json.data.upgradeUrl + "\n升级地址" + json.data.upgradeUrl
+ "\n当前版本" + json.data.nowVersion + "\n当前版本" + json.data.nowVersion

View File

@@ -1,15 +1,86 @@
import Qs from 'qs' import Qs from 'qs'
import request from '../lib/common/request' import request from './request'
export function queryExecuteSql(data) {
return request({url: '/zyplayer-doc-db/executor/execute', method: 'post', data: Qs.stringify(data)});
}
export function queryTestDatasource(data) {
return request({url: '/zyplayer-doc-db/datasource/test', method: 'post', data: Qs.stringify(data)});
}
export function queryTableDdl(data) {
return request({url: '/zyplayer-doc-db/doc-db/getTableDdl', method: 'post', data: Qs.stringify(data)});
}
export default {
queryTestDatasource: data => {
return request({url: '/zyplayer-doc-db/datasource/test', method: 'post', data: Qs.stringify(data)});
},
queryTableDdl: data => {
return request({url: '/zyplayer-doc-db/doc-db/getTableDdl', method: 'post', data: Qs.stringify(data)});
},
getEditorData: data => {
return request({url: '/zyplayer-doc-db/doc-db/getEditorData', method: 'post', data: Qs.stringify(data)});
},
datasourceList: data => {
return request({url: '/zyplayer-doc-db/doc-db/getDataSourceList', method: 'post', data: Qs.stringify(data)});
},
databaseList: data => {
return request({url: '/zyplayer-doc-db/doc-db/getDatabaseList', method: 'post', data: Qs.stringify(data)});
},
tableList: data => {
return request({url: '/zyplayer-doc-db/doc-db/getTableList', method: 'post', data: Qs.stringify(data)});
},
tableColumnList: data => {
return request({url: '/zyplayer-doc-db/doc-db/getTableColumnList', method: 'post', data: Qs.stringify(data)});
},
tableStatus: data => {
return request({url: '/zyplayer-doc-db/doc-db/getTableStatus', method: 'post', data: Qs.stringify(data)});
},
tableAndColumnBySearch: data => {
return request({url: '/zyplayer-doc-db/doc-db/getTableAndColumnBySearch', method: 'post', data: Qs.stringify(data)});
},
updateTableDesc: data => {
return request({url: '/zyplayer-doc-db/doc-db/updateTableDesc', method: 'post', data: Qs.stringify(data)});
},
updateTableColumnDesc: data => {
return request({url: '/zyplayer-doc-db/doc-db/updateTableColumnDesc', method: 'post', data: Qs.stringify(data)});
},
manageDatasourceList: data => {
return request({url: '/zyplayer-doc-db/datasource/list', method: 'post', data: Qs.stringify(data)});
},
manageUpdateDatasource: data => {
return request({url: '/zyplayer-doc-db/datasource/update', method: 'post', data: Qs.stringify(data)});
},
queryExecuteSql: data => {
return request({url: '/zyplayer-doc-db/executor/execute', method: 'post', data: Qs.stringify(data)});
},
executeSqlCancel: data => {
return request({url: '/zyplayer-doc-db/executor/cancel', method: 'post', data: Qs.stringify(data)});
},
updateFavorite: data => {
return request({url: '/zyplayer-doc-db/executor/favorite/add', method: 'post', data: Qs.stringify(data)});
},
favoriteList: data => {
return request({url: '/zyplayer-doc-db/executor/favorite/list', method: 'post', data: Qs.stringify(data)});
},
historyList: data => {
return request({url: '/zyplayer-doc-db/executor/history/list', method: 'post', data: Qs.stringify(data)});
},
transferStart: data => {
return request({url: '/zyplayer-doc-db/transfer/start', method: 'post', data: Qs.stringify(data)});
},
transferCancel: data => {
return request({url: '/zyplayer-doc-db/transfer/cancel', method: 'post', data: Qs.stringify(data)});
},
transferList: data => {
return request({url: '/zyplayer-doc-db/transfer/list', method: 'post', data: Qs.stringify(data)});
},
transferDetail: data => {
return request({url: '/zyplayer-doc-db/transfer/detail', method: 'post', data: Qs.stringify(data)});
},
transferUpdate: data => {
return request({url: '/zyplayer-doc-db/transfer/update', method: 'post', data: Qs.stringify(data)});
},
transferSqlColumns: data => {
return request({url: '/zyplayer-doc-db/transfer/sqlColumns', method: 'post', data: Qs.stringify(data)});
},
assignDbUserAuth: data => {
return request({url: '/zyplayer-doc-db/auth/assign', method: 'post', data: Qs.stringify(data)});
},
dbUserAuthList: data => {
return request({url: '/zyplayer-doc-db/auth/list', method: 'post', data: Qs.stringify(data)});
},
systemUpgradeInfo: data => {
return request({url: '/system/info/upgrade', method: 'post', data: Qs.stringify(data)});
},
};

View File

@@ -1,9 +1,8 @@
import axios from 'axios' import axios from 'axios'
import global from '../../config/global' import vue from '../../main'
import apimix from '../../config/apimix'
const service = axios.create({ const service = axios.create({
baseURL: apimix.host, // url = base url + request url process.env.APP_BASE_API baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url process.env.APP_BASE_API
timeout: 10000, timeout: 10000,
headers: {'Content-type': 'application/x-www-form-urlencoded'}, headers: {'Content-type': 'application/x-www-form-urlencoded'},
withCredentials: true withCredentials: true
@@ -32,25 +31,25 @@ service.interceptors.request.use(
service.interceptors.response.use( service.interceptors.response.use(
response => { response => {
if (!!response.message) { if (!!response.message) {
global.vue.$message('请求错误:' + response.message); vue.$message.error('请求错误:' + response.message);
}else { }else {
if (!response.config.needValidateResult || response.data.errCode == 200) { if (!response.config.needValidateResult || response.data.errCode == 200) {
return response.data; return response.data;
} else if (response.data.errCode == 400) { } else if (response.data.errCode == 400) {
global.vue.$message('请先登录'); vue.$message.error('请先登录');
var href = encodeURIComponent(window.location.href); var href = encodeURIComponent(window.location.href);
window.location = apimix.apilist1.HOST + "#/user/login?redirect=" + href; window.location = process.env.VUE_APP_BASE_API + "#/user/login?redirect=" + href;
} else if (response.data.errCode == 402) { } else if (response.data.errCode == 402) {
global.vue.$router.push("/common/noAuth"); vue.$router.push("/common/noAuth");
} else if (response.data.errCode !== 200) { } else if (response.data.errCode !== 200) {
global.vue.$message(response.data.errMsg || "未知错误"); vue.$message.error(response.data.errMsg || "未知错误");
} }
} }
return Promise.reject('请求错误'); return Promise.reject('请求错误');
}, },
error => { error => {
console.log('err' + error); console.log('err' + error);
global.vue.$message.info('请求错误:' + error.message); vue.$message.info('请求错误:' + error.message);
return Promise.reject(error) return Promise.reject(error)
} }
); );

View File

@@ -0,0 +1,22 @@
import Qs from 'qs'
import request from './request'
export default {
userLogin: data => {
return request({url: '/login', method: 'post', data: Qs.stringify(data)});
},
userLogout: () => {
return request({url: '/logout', method: 'post', data: Qs.stringify({})});
},
getSelfUserInfo: () => {
return request({url: '/user/info/selfInfo', method: 'post', data: Qs.stringify({})});
},
getUserBaseInfo: data => {
return request({url: '/zyplayer-doc-wiki/common/user/base', method: 'post', data: Qs.stringify(data)});
},
};
// userLogin: '/login',
// userLogout: '/logout',
// getSelfUserInfo: '/user/info/selfInfo',
// getUserBaseInfo: '/zyplayer-doc-wiki/common/user/base',

View File

@@ -1,47 +0,0 @@
var URL = {
userLogin: '/login',
userLogout: '/logout',
getSelfUserInfo: '/user/info/selfInfo',
getUserBaseInfo: '/zyplayer-doc-wiki/common/user/base',
getEditorData: '/zyplayer-doc-db/doc-db/getEditorData',
datasourceList: '/zyplayer-doc-db/doc-db/getDataSourceList',
databaseList: '/zyplayer-doc-db/doc-db/getDatabaseList',
tableList: '/zyplayer-doc-db/doc-db/getTableList',
tableColumnList: '/zyplayer-doc-db/doc-db/getTableColumnList',
tableStatus: '/zyplayer-doc-db/doc-db/getTableStatus',
tableAndColumnBySearch: '/zyplayer-doc-db/doc-db/getTableAndColumnBySearch',
updateTableDesc: '/zyplayer-doc-db/doc-db/updateTableDesc',
updateTableColumnDesc: '/zyplayer-doc-db/doc-db/updateTableColumnDesc',
manageDatasourceList: '/zyplayer-doc-db/datasource/list',
manageUpdateDatasource: '/zyplayer-doc-db/datasource/update',
executeSql: '/zyplayer-doc-db/executor/execute',
executeSqlCancel: '/zyplayer-doc-db/executor/cancel',
updateFavorite: '/zyplayer-doc-db/executor/favorite/add',
favoriteList: '/zyplayer-doc-db/executor/favorite/list',
historyList: '/zyplayer-doc-db/executor/history/list',
transferStart: '/zyplayer-doc-db/transfer/start',
transferCancel: '/zyplayer-doc-db/transfer/cancel',
transferList: '/zyplayer-doc-db/transfer/list',
transferDetail: '/zyplayer-doc-db/transfer/detail',
transferUpdate: '/zyplayer-doc-db/transfer/update',
transferSqlColumns: '/zyplayer-doc-db/transfer/sqlColumns',
assignDbUserAuth: '/zyplayer-doc-db/auth/assign',
dbUserAuthList: '/zyplayer-doc-db/auth/list',
systemUpgradeInfo: '/system/info/upgrade',
};
var URL1 = {};
export default {
URL, URL1
};

View File

@@ -1,52 +0,0 @@
import apilist from './apilist'
var href = window.location.href;
var _fn = {
href: href,
// 本地启动时使用本地接口调试
// HOST: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
// HOST1: 'http://local.zyplayer.com:8083/zyplayer-doc-manage',
// 也可以直接使用线上的服务调试
// HOST: 'http://doc.zyplayer.com/zyplayer-doc-manage',
// HOST1: 'http://doc.zyplayer.com/zyplayer-doc-manage',
// 打包时使用下面这两行,文件就放在根目录下,所以当前路劲就好
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, host: _fn.HOST
};

View File

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

View File

@@ -1,113 +0,0 @@
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

@@ -1,40 +0,0 @@
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

@@ -4,7 +4,7 @@
<el-tab-pane :label="pageTabNameMap[item.fullPath]||item.name" :name="item.fullPath" v-for="item in pageList"/> <el-tab-pane :label="pageTabNameMap[item.fullPath]||item.name" :name="item.fullPath" v-for="item in pageList"/>
</el-tabs> </el-tabs>
<keep-alive> <keep-alive>
<router-view :key="$route.fullPath"/> <router-view :key="$route.fullPath" @initLoadDataList="initLoadDataList" @loadDatasourceList="loadDatasourceList"/>
</keep-alive> </keep-alive>
</div> </div>
</template> </template>
@@ -44,6 +44,12 @@
}, },
}, },
methods: { methods: {
initLoadDataList(param) {
this.$emit('initLoadDataList', param);
},
loadDatasourceList() {
this.$emit('loadDatasourceList');
},
changePage(key) { changePage(key) {
this.activePage = key.name; this.activePage = key.name;
}, },

View File

@@ -1,14 +0,0 @@
<!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>
</html>

View File

@@ -1,15 +0,0 @@
<!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>
</html>

View File

@@ -3,11 +3,6 @@ import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue' 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 VueRouter from 'vue-router'
import routes from './routes' import routes from './routes'
import store from './store/index' import store from './store/index'
@@ -22,44 +17,27 @@ Vue.use(VueRouter);
Vue.use(VueAxios, axios); Vue.use(VueAxios, axios);
Vue.use(vueHljs); Vue.use(vueHljs);
// 全局参数
Vue.prototype.global = global;
// 接口列表
Vue.prototype.apilist1 = apimix.apilist1;
Vue.prototype.apilist2 = apimix.apilist1;
// 公用方法 // 公用方法
Vue.prototype.common = common;
Vue.prototype.toast = toast;
Vue.prototype.$store = store; Vue.prototype.$store = store;
const router = new VueRouter({routes}); const router = new VueRouter({routes});
// 路由跳转时判断处理 // 路由跳转时判断处理
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.meta.title) { if (to.meta.title) {
document.title = to.meta.title document.title = to.meta.title;
} }
global.fullscreen = !!to.meta.fullscreen; store.commit('global/setFullscreen', !!to.meta.fullscreen);
/* 判断该路由是否需要登录权限 */ next();
if (to.matched.some(record => record.meta.requireAuth)) {
if (global.user.isLogin) {
next();
} else {
next({path: '/login'});
}
} else {
next();
}
}); });
new Vue({ let vue = new Vue({
el: '#app', el: '#app',
router, router,
render(h) { render(h) {
var app = h(App); return h(App);
global.vue = app.context;
return app;
} }
}); });
export default vue;

View File

@@ -2,17 +2,21 @@ export default {
namespaced: true, namespaced: true,
state: { state: {
pageTabNameMap: {}, pageTabNameMap: {},
fullscreen: false,
}, },
getters: { getters: {
getPageTabNameMap(state) { getPageTabNameMap(state) {
return state.pageTabNameMap; return state.pageTabNameMap;
} },
}, },
mutations: { mutations: {
addTableName(state, item) { addTableName(state, item) {
let sameObj = Object.assign({}, state.pageTabNameMap); let sameObj = Object.assign({}, state.pageTabNameMap);
sameObj[item.key] = item.val; sameObj[item.key] = item.val;
state.pageTabNameMap = sameObj; state.pageTabNameMap = sameObj;
}, },
setFullscreen(state, val) {
state.fullscreen = val;
},
} }
} }

View File

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

View File

@@ -78,8 +78,7 @@
import '../../common/lib/ace/mode-sql' import '../../common/lib/ace/mode-sql'
import '../../common/lib/ace/ext-language_tools' import '../../common/lib/ace/ext-language_tools'
import '../../common/lib/ace/snippets/sql' import '../../common/lib/ace/snippets/sql'
import global from '../../common/config/global' import datasourceApi from '../../common/api/datasource'
import {queryExecuteSql} from '../../common/api/datasource'
import sqlFormatter from "sql-formatter"; import sqlFormatter from "sql-formatter";
export default { export default {
@@ -112,11 +111,15 @@
that.doExecutorClick(); that.doExecutorClick();
} }
}); });
// 延迟设置展开的目录edit比app先初始化 // 延迟设置展开的目录edit比app先初始化
setTimeout(()=> { setTimeout(() => {
this.doExecutorSql(); this.doExecutorSql();
global.vue.$app.initLoadDataList(this.vueQueryParam.sourceId, this.vueQueryParam.host, this.vueQueryParam.dbName); this.$emit('initLoadDataList', {
}, 500); sourceId: this.vueQueryParam.sourceId,
host: this.vueQueryParam.host,
dbName: this.vueQueryParam.dbName
});
}, 500);
}, },
activated: function () { activated: function () {
this.initQueryParam(this.$route); this.initQueryParam(this.$route);
@@ -160,9 +163,8 @@
} }
}, },
cancelExecutorSql() { cancelExecutorSql() {
let that = this; datasourceApi.executeSqlCancel({executeId: this.nowExecutorId}).then(() => {
this.common.post(this.apilist1.executeSqlCancel, {executeId: this.nowExecutorId}, function (json) { this.$message.success("取消成功");
that.$message.success("取消成功");
}); });
}, },
doExecutorClick() { doExecutorClick() {
@@ -185,7 +187,6 @@
this.doExecutorSqlCommon(dataSql, countSql); this.doExecutorSqlCommon(dataSql, countSql);
}, },
doExecutorSqlCommon(dataSql, countSql) { doExecutorSqlCommon(dataSql, countSql) {
let that = this;
if (!this.vueQueryParam.sourceId) { if (!this.vueQueryParam.sourceId) {
this.$message.error("请先选择数据源"); this.$message.error("请先选择数据源");
return; return;
@@ -205,7 +206,7 @@
}; };
// 第一页才查询总条数 // 第一页才查询总条数
if (!!countSql && this.currentPage == 1) { if (!!countSql && this.currentPage == 1) {
queryExecuteSql(param).then(res => { datasourceApi.queryExecuteSql(param).then(res => {
if (res.errCode != 200 || !res.data || res.data.length <= 0) return; if (res.errCode != 200 || !res.data || res.data.length <= 0) return;
let objItem = JSON.parse(res.data[0]); let objItem = JSON.parse(res.data[0]);
if(!objItem.result || objItem.result.length <= 0) return; if(!objItem.result || objItem.result.length <= 0) return;
@@ -213,29 +214,29 @@
}); });
} }
param.sql = dataSql; param.sql = dataSql;
this.common.postNonCheck(this.apilist1.executeSql, param, function (json) { datasourceApi.queryExecuteSql(param).then(json => {
if (json.errCode != 200) { if (json.errCode != 200) {
that.executeError = json.errMsg; this.executeError = json.errMsg;
that.sqlExecuting = false; this.sqlExecuting = false;
return; return;
} }
var resultList = json.data || []; let resultList = json.data || [];
var executeResultList = []; let executeResultList = [];
var executeResultInfo = "", itemIndex = 1; let executeResultInfo = "", itemIndex = 1;
for (var i = 0; i < resultList.length; i++) { for (let i = 0; i < resultList.length; i++) {
var objItem = JSON.parse(resultList[i]); let objItem = JSON.parse(resultList[i]);
executeResultInfo += that.getExecuteInfoStr(objItem); executeResultInfo += this.getExecuteInfoStr(objItem);
var resultItem = that.dealExecuteResult(objItem); let resultItem = this.dealExecuteResult(objItem);
if (resultItem.updateCount < 0) { if (resultItem.updateCount < 0) {
resultItem.index = itemIndex; resultItem.index = itemIndex;
itemIndex++; itemIndex++;
} }
executeResultList.push(resultItem); executeResultList.push(resultItem);
} }
that.executeShowTable = (itemIndex === 1) ? "table0" : "table1"; this.executeShowTable = (itemIndex === 1) ? "table0" : "table1";
that.executeResultInfo = executeResultInfo; this.executeResultInfo = executeResultInfo;
that.executeResultList = executeResultList; this.executeResultList = executeResultList;
that.sqlExecuting = false; this.sqlExecuting = false;
}); });
}, },
getExecuteSql() { getExecuteSql() {

View File

@@ -8,6 +8,7 @@
</div> </div>
<el-table :data="datasourceList" stripe border style="width: 100%; margin-bottom: 5px;"> <el-table :data="datasourceList" stripe border style="width: 100%; margin-bottom: 5px;">
<el-table-column prop="name" label="名字" width="100"></el-table-column> <el-table-column prop="name" label="名字" width="100"></el-table-column>
<el-table-column prop="groupName" label="分组" width="100"></el-table-column>
<el-table-column prop="driverClassName" label="驱动类" width="200"></el-table-column> <el-table-column prop="driverClassName" label="驱动类" width="200"></el-table-column>
<el-table-column prop="sourceUrl" label="数据源URL"></el-table-column> <el-table-column prop="sourceUrl" label="数据源URL"></el-table-column>
<el-table-column prop="sourceName" label="账号"></el-table-column> <el-table-column prop="sourceName" label="账号"></el-table-column>
@@ -23,15 +24,15 @@
</el-card> </el-card>
<!--增加数据源弹窗--> <!--增加数据源弹窗-->
<el-dialog :inline="true" :title="newDatasource.id>0?'编辑数据源':'新增数据源'" :visible.sync="datasourceDialogVisible" width="760px"> <el-dialog :inline="true" :title="newDatasource.id>0?'编辑数据源':'新增数据源'" :visible.sync="datasourceDialogVisible" width="760px">
<!-- <el-alert-->
<!-- title="重要提醒"-->
<!-- description="请录入正确可用的数据库连接、账号、密码信息,否则初始化数据源失败将影响整个系统,有可能需要重启服务才能解决"-->
<!-- type="warning" :closable="false"-->
<!-- show-icon style="margin-bottom: 10px;">-->
<!-- </el-alert>-->
<el-form label-width="120px"> <el-form label-width="120px">
<el-form-item label="名字"> <el-form-item label="分组">
<el-input v-model="newDatasource.name" placeholder="中文名字"></el-input> <el-select v-model="newDatasource.groupName" placeholder="分组名字" style="width: 100%" filterable allow-create>
<el-option value="">未分组</el-option>
<el-option :value="item" v-for="item in datasourceGroupList"></el-option>
</el-select>
</el-form-item>
<el-form-item label="数据源名称:">
<el-input v-model="newDatasource.name" placeholder="给数据源起个中文名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="驱动类:"> <el-form-item label="驱动类:">
<el-select v-model="newDatasource.driverClassName" @change="driverClassNameChange" placeholder="驱动类" style="width: 100%"> <el-select v-model="newDatasource.driverClassName" @change="driverClassNameChange" placeholder="驱动类" style="width: 100%">
@@ -49,7 +50,7 @@
<el-form-item label="密码:"> <el-form-item label="密码:">
<el-input v-model="newDatasource.sourcePassword" placeholder="密码"></el-input> <el-input v-model="newDatasource.sourcePassword" placeholder="密码"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="测试:"> <el-form-item label="测试连接">
<el-button v-on:click="testDatasource" type="primary" v-loading="testDatasourceErrLoading">测试数据源</el-button> <el-button v-on:click="testDatasource" type="primary" v-loading="testDatasourceErrLoading">测试数据源</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -103,12 +104,8 @@
</template> </template>
<script> <script>
import toast from '../../common/lib/common/toast' import datasourceApi from '../../common/api/datasource'
import global from '../../common/config/global' import userApi from '../../common/api/user'
import {queryTestDatasource} from '../../common/api/datasource'
var app;
export default { export default {
data() { data() {
return { return {
@@ -127,30 +124,31 @@
testDatasourceErrInfo: "", testDatasourceErrInfo: "",
testDatasourceErrVisible: false, testDatasourceErrVisible: false,
testDatasourceErrLoading: false, testDatasourceErrLoading: false,
// 数据源分组
datasourceGroupList: [],
}; };
}, },
mounted: function () { mounted: function () {
app = this;
this.getDatasourceList(); this.getDatasourceList();
}, },
methods: { methods: {
editDbAuth(row) { editDbAuth(row) {
this.newDatasource = JSON.parse(JSON.stringify(row)); this.newDatasource = JSON.parse(JSON.stringify(row));
app.dbSourceAuthDialogVisible = true; this.dbSourceAuthDialogVisible = true;
this.loadDbAuthUserList(); this.loadDbAuthUserList();
}, },
loadDbAuthUserList() { loadDbAuthUserList() {
app.dbSourceAuthNewUser = []; this.dbSourceAuthNewUser = [];
app.dbSourceAuthUserList = []; this.dbSourceAuthUserList = [];
var param = {sourceId: app.newDatasource.id}; let param = {sourceId: this.newDatasource.id};
this.common.post(this.apilist1.dbUserAuthList, param, function (json) { datasourceApi.dbUserAuthList(param).then(json => {
app.dbSourceAuthUserList = json.data || []; this.dbSourceAuthUserList = json.data || [];
}); });
}, },
saveUserDbSourceAuth() { saveUserDbSourceAuth() {
var param = {sourceId: app.newDatasource.id, authList: JSON.stringify(app.dbSourceAuthUserList)}; let param = {sourceId: this.newDatasource.id, authList: JSON.stringify(this.dbSourceAuthUserList)};
this.common.post(this.apilist1.assignDbUserAuth, param, function (json) { datasourceApi.assignDbUserAuth(param).then(() => {
toast.success("保存成功"); this.$message.success("保存成功");
}); });
}, },
deleteUserDbSourceAuth(row) { deleteUserDbSourceAuth(row) {
@@ -165,7 +163,7 @@
}, },
addDbSourceAuthUser() { addDbSourceAuthUser() {
if (this.dbSourceAuthNewUser.length <= 0) { if (this.dbSourceAuthNewUser.length <= 0) {
toast.warn("请先选择用户"); this.$message.warn("请先选择用户");
return; return;
} }
var userName = ""; var userName = "";
@@ -184,19 +182,16 @@
this.dbSourceAuthNewUser = ""; this.dbSourceAuthNewUser = "";
}, },
getSearchUserList(query) { getSearchUserList(query) {
if (query == '') { if (!query) return;
return;
}
this.dbSourceAuthUserLoading = true; this.dbSourceAuthUserLoading = true;
var param = {search: query}; userApi.getUserBaseInfo({search: query}).then(json => {
this.common.post(this.apilist1.getUserBaseInfo, param, function (json) { this.searchUserList = json.data || [];
app.searchUserList = json.data || []; this.dbSourceAuthUserLoading = false;
app.dbSourceAuthUserLoading = false;
}); });
}, },
addDatasource() { addDatasource() {
this.datasourceDialogVisible = true; this.datasourceDialogVisible = true;
this.newDatasource = {name: "", driverClassName: "", sourceUrl: "", sourceName: "", sourcePassword: ""}; this.newDatasource = {name: "", driverClassName: "", sourceUrl: "", sourceName: "", sourcePassword: "", groupName: ""};
}, },
editDatasource(row) { editDatasource(row) {
this.newDatasource = JSON.parse(JSON.stringify(row)); this.newDatasource = JSON.parse(JSON.stringify(row));
@@ -209,25 +204,27 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
row.yn = 0; row.yn = 0;
this.common.post(this.apilist1.manageUpdateDatasource, row, function (json) { datasourceApi.manageUpdateDatasource(row).then(() => {
app.$message.success("删除成功!"); this.$message.success("删除成功!");
app.getDatasourceList(); this.$emit('loadDatasourceList');
this.getDatasourceList();
}); });
}).catch(()=>{}); }).catch(()=>{});
}, },
saveDatasource() { saveDatasource() {
app.datasourceDialogVisible = false; this.datasourceDialogVisible = false;
this.common.post(this.apilist1.manageUpdateDatasource, this.newDatasource, function (json) { datasourceApi.manageUpdateDatasource(this.newDatasource).then(() => {
app.$message.success("保存成功!"); this.$message.success("保存成功!");
app.getDatasourceList(); this.$emit('loadDatasourceList');
this.getDatasourceList();
}); });
}, },
testDatasource() { testDatasource() {
this.testDatasourceErrLoading = true; this.testDatasourceErrLoading = true;
queryTestDatasource(this.newDatasource).then(res => { datasourceApi.queryTestDatasource(this.newDatasource).then(res => {
this.testDatasourceErrLoading = false; this.testDatasourceErrLoading = false;
if (res.errCode == 200) { if (res.errCode == 200) {
this.$message.success("测试成功!"); this.$message.success("连接成功!");
} else { } else {
this.testDatasourceErrVisible = true; this.testDatasourceErrVisible = true;
this.testDatasourceErrInfo = res.errMsg || ''; this.testDatasourceErrInfo = res.errMsg || '';
@@ -245,9 +242,14 @@
}, },
getDatasourceList() { getDatasourceList() {
this.loadDataListLoading = true; this.loadDataListLoading = true;
this.common.post(this.apilist1.manageDatasourceList, {}, function (json) { datasourceApi.manageDatasourceList({}).then(json => {
app.datasourceList = json.data || []; this.datasourceList = json.data || [];
setTimeout(()=>{app.loadDataListLoading = false;}, 800); let datasourceGroupList = [];
this.datasourceList.filter(item => !!item.groupName).forEach(item => datasourceGroupList.push(item.groupName));
this.datasourceGroupList = Array.from(new Set(datasourceGroupList));
setTimeout(() => {
this.loadDataListLoading = false;
}, 800);
}); });
}, },
} }

View File

@@ -14,7 +14,7 @@
<div style="float: right;margin-top: -5px;"> <div style="float: right;margin-top: -5px;">
数据源 数据源
<el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" filterable placeholder="请选择数据源" style="width: 400px;"> <el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" filterable placeholder="请选择数据源" style="width: 400px;">
<el-option v-for="item in datasourceList" :key="item.id" :label="item.cnName" :value="item.id"></el-option> <el-option v-for="item in datasourceList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</div> </div>
</div> </div>
@@ -54,21 +54,25 @@
<pre style="margin: 0;">{{scope.row.content}}</pre> <pre style="margin: 0;">{{scope.row.content}}</pre>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="150px"> <el-table-column label="操作" width="160px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" v-on:click="inputFavoriteSql(scope.row.content)">输入</el-button> <el-button size="mini" type="primary" v-on:click="inputFavoriteSql(scope.row.content)">输入</el-button>
<el-button size="mini" type="danger" v-on:click="delFavorite(scope.row)">删除</el-button> <el-button size="mini" type="danger" v-on:click="delFavorite(scope.row)" style="margin-left: 10px;">删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="历史记录" name="history"> <el-tab-pane label="历史记录" name="history">
<el-table :data="myHistoryListList" stripe border style="width: 100%; margin-bottom: 5px;"> <el-table :data="myHistoryListList" stripe border style="width: 100%; margin-bottom: 5px;">
<el-table-column prop="content" label="SQL"></el-table-column> <el-table-column prop="content" label="SQL">
<el-table-column label="操作" width="150px"> <template slot-scope="scope">
<pre style="margin: 0;">{{scope.row.content}}</pre>
</template>
</el-table-column>
<el-table-column label="操作" width="160px">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" v-on:click="inputFavoriteSql(scope.row.content)">输入</el-button> <el-button size="mini" type="primary" v-on:click="inputFavoriteSql(scope.row.content)">输入</el-button>
<el-button size="mini" type="success" v-on:click="addFavorite(scope.row.content)">收藏</el-button> <el-button size="mini" type="success" v-on:click="addFavorite(scope.row.content)" style="margin-left: 10px;">收藏</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -87,6 +91,8 @@
import '../../common/lib/ace/ext-language_tools' import '../../common/lib/ace/ext-language_tools'
import '../../common/lib/ace/snippets/sql' import '../../common/lib/ace/snippets/sql'
import sqlFormatter from "sql-formatter" import sqlFormatter from "sql-formatter"
import datasourceApi from '../../common/api/datasource'
export default { export default {
data() { data() {
return { return {
@@ -141,9 +147,8 @@
}); });
}, },
cancelExecutorSql() { cancelExecutorSql() {
let that = this; datasourceApi.executeSqlCancel({executeId: this.nowExecutorId}).then(() => {
this.common.post(this.apilist1.executeSqlCancel, {executeId: this.nowExecutorId}, function (json) { this.$message.success("取消成功");
that.$message.success("取消成功");
}); });
}, },
loadHistoryAndFavoriteList() { loadHistoryAndFavoriteList() {
@@ -152,15 +157,13 @@
this.loadFavoriteList(); this.loadFavoriteList();
}, },
loadFavoriteList() { loadFavoriteList() {
let that = this; datasourceApi.favoriteList({sourceId: this.choiceDatasourceId}).then(json => {
this.common.post(this.apilist1.favoriteList, {sourceId: this.choiceDatasourceId}, function (json) { this.myFavoriteList = json.data || [];
that.myFavoriteList = json.data || [];
}); });
}, },
loadHistoryList() { loadHistoryList() {
let that = this; datasourceApi.historyList({sourceId: this.choiceDatasourceId}).then(json => {
this.common.post(this.apilist1.historyList, {sourceId: this.choiceDatasourceId}, function (json) { this.myHistoryListList = json.data || [];
that.myHistoryListList = json.data || [];
}); });
}, },
addFavorite(sqlValue) { addFavorite(sqlValue) {
@@ -170,19 +173,16 @@
sqlValue = this.sqlExecutorEditor.getValue(); sqlValue = this.sqlExecutorEditor.getValue();
} }
} }
let that = this; let param = {name: '我的收藏', content: sqlValue, datasourceId: this.choiceDatasourceId};
var param = {name: '我的收藏', content: sqlValue, datasourceId: this.choiceDatasourceId}; datasourceApi.updateFavorite(param).then(() => {
this.common.post(this.apilist1.updateFavorite, param, function (json) { this.$message.success("收藏成功");
that.$message.success("收藏成功"); this.loadFavoriteList();
that.loadFavoriteList();
}); });
}, },
delFavorite(row) { delFavorite(row) {
let that = this; datasourceApi.updateFavorite({id: row.id, yn: 0}).then(() => {
var param = {id: row.id, yn: 0}; this.$message.success("删除成功");
this.common.post(this.apilist1.updateFavorite, param, function (json) { this.loadFavoriteList();
that.$message.success("删除成功");
that.loadFavoriteList();
}); });
}, },
inputFavoriteSql(content) { inputFavoriteSql(content) {
@@ -218,16 +218,15 @@
sqlValue = this.sqlExecutorEditor.getValue(); sqlValue = this.sqlExecutorEditor.getValue();
} }
this.sqlExecuting = true; this.sqlExecuting = true;
let that = this; datasourceApi.queryExecuteSql({
this.common.postNonCheck(this.apilist1.executeSql, {
sourceId: this.choiceDatasourceId, sourceId: this.choiceDatasourceId,
executeId: this.nowExecutorId, executeId: this.nowExecutorId,
sql: sqlValue, sql: sqlValue,
params: '', params: '',
}, function (json) { }).then(json => {
that.sqlExecuting = false; this.sqlExecuting = false;
if (json.errCode != 200) { if (json.errCode != 200) {
that.executeError = json.errMsg; this.executeError = json.errMsg;
return; return;
} }
var resultList = json.data || []; var resultList = json.data || [];
@@ -235,43 +234,38 @@
var executeResultInfo = "", itemIndex = 1; var executeResultInfo = "", itemIndex = 1;
for (var i = 0; i < resultList.length; i++) { for (var i = 0; i < resultList.length; i++) {
var objItem = JSON.parse(resultList[i]); var objItem = JSON.parse(resultList[i]);
executeResultInfo += that.getExecuteInfoStr(objItem); executeResultInfo += this.getExecuteInfoStr(objItem);
var resultItem = that.dealExecuteResult(objItem); var resultItem = this.dealExecuteResult(objItem);
if (resultItem.updateCount < 0) { if (resultItem.updateCount < 0) {
resultItem.index = itemIndex; resultItem.index = itemIndex;
itemIndex++; itemIndex++;
} }
executeResultList.push(resultItem); executeResultList.push(resultItem);
} }
that.executeShowTable = (itemIndex === 1) ? "table0" : "table1"; this.executeShowTable = (itemIndex === 1) ? "table0" : "table1";
that.executeResultInfo = executeResultInfo; this.executeResultInfo = executeResultInfo;
that.executeResultList = executeResultList; this.executeResultList = executeResultList;
}); });
}, },
loadDatasourceList() { loadDatasourceList() {
let that = this; datasourceApi.datasourceList({}).then(json => {
this.common.post(this.apilist1.datasourceList, {}, function (json) { this.datasourceList = json.data || [];
that.datasourceList = json.data || []; if (this.datasourceList.length > 0) {
if (that.datasourceList.length > 0) { this.choiceDatasourceId = this.datasourceList[0].id;
that.choiceDatasourceId = that.datasourceList[0].id; this.loadEditorData();
that.loadEditorData();
} }
}); });
}, },
loadEditorData() { loadEditorData() {
let that = this; datasourceApi.getEditorData({sourceId: this.choiceDatasourceId}).then(json => {
this.common.post(this.apilist1.getEditorData, {sourceId: this.choiceDatasourceId}, function (json) { let data = json.data || {};
var data = json.data || {}; this.editorDbInfo = data.db || [];
that.editorDbInfo = data.db || []; this.editorDbTableInfo = data.table || {};
that.editorDbTableInfo = data.table || {}; this.editorColumnInfo = data.column || {};
that.editorColumnInfo = data.column || {};
}); });
}, },
datasourceChangeEvents() { datasourceChangeEvents() {
this.loadEditorData(); this.loadEditorData();
// this.common.post(this.apilist1.databaseList, {sourceId: this.choiceDatasourceId}, function (json) {
// app.databaseList = json.data || [];
// });
}, },
databaseChangeEvents() { databaseChangeEvents() {

View File

@@ -8,14 +8,14 @@
<el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" filterable placeholder="请选择数据源"> <el-select v-model="choiceDatasourceId" @change="datasourceChangeEvents" filterable placeholder="请选择数据源">
<el-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option> <el-option v-for="item in datasourceOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
</el-select> </el-select>
<el-select v-model="choiceDatabase" @change="databaseChangeEvents" filterable placeholder="请选择数据库"> <el-select v-model="choiceDatabase" @change="databaseChangeEvents" filterable placeholder="请选择数据库" style="margin: 0 10px;">
<el-option v-for="item in databaseList" :key="item.dbName" :label="item.dbName" :value="item.dbName"></el-option> <el-option v-for="item in databaseList" :key="item.dbName" :label="item.dbName" :value="item.dbName"></el-option>
</el-select> </el-select>
<el-radio-group v-model="exportType"> <el-radio-group v-model="exportType">
<el-radio :label="1">HTML格式</el-radio> <el-radio :label="1">HTML格式</el-radio>
<el-radio :label="2">Excel格式</el-radio> <el-radio :label="2">Excel格式</el-radio>
</el-radio-group> </el-radio-group>
<el-button v-on:click="exportChoiceTable" type="primary" style="margin-left: 20px;">导出选中的表</el-button> <el-button v-on:click="exportChoiceTable" type="primary" style="margin: 0 10px 0 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> <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> </div>
<el-table :data="tableList" stripe border @selection-change="handleSelectionChange" style="width: 100%; margin-bottom: 5px;"> <el-table :data="tableList" stripe border @selection-change="handleSelectionChange" style="width: 100%; margin-bottom: 5px;">
@@ -28,6 +28,7 @@
</template> </template>
<script> <script>
import datasourceApi from '../../common/api/datasource'
var app; var app;
export default { export default {
@@ -77,25 +78,25 @@
+ "&tableNames=" + tableNames); + "&tableNames=" + tableNames);
}, },
loadGetTableList() { loadGetTableList() {
this.common.post(this.apilist1.tableList, {sourceId: this.choiceDatasourceId, dbName: this.choiceDatabase}, function (json) { datasourceApi.tableList({sourceId: this.choiceDatasourceId, dbName: this.choiceDatabase}).then(json => {
app.tableList = json.data || []; this.tableList = json.data || [];
}); });
}, },
loadDatasourceList() { loadDatasourceList() {
this.common.post(this.apilist1.datasourceList, {}, function (json) { datasourceApi.datasourceList({}).then(json => {
app.datasourceList = json.data || []; this.datasourceList = json.data || [];
var datasourceOptions = []; let datasourceOptions = [];
for (var i = 0; i < app.datasourceList.length; i++) { for (let i = 0; i < this.datasourceList.length; i++) {
datasourceOptions.push({ datasourceOptions.push({
label: app.datasourceList[i].cnName, value: app.datasourceList[i].id label: this.datasourceList[i].name, value: this.datasourceList[i].id
}); });
} }
app.datasourceOptions = datasourceOptions; this.datasourceOptions = datasourceOptions;
}); });
}, },
loadDatabaseList() { loadDatabaseList() {
this.common.post(this.apilist1.databaseList, {sourceId: this.choiceDatasourceId}, function (json) { datasourceApi.databaseList({sourceId: this.choiceDatasourceId}).then(json => {
app.databaseList = json.data || []; this.databaseList = json.data || [];
}); });
}, },
handleSelectionChange(val) { handleSelectionChange(val) {

View File

@@ -111,6 +111,7 @@
import '../../common/lib/ace/mode-sql' import '../../common/lib/ace/mode-sql'
import '../../common/lib/ace/ext-language_tools' import '../../common/lib/ace/ext-language_tools'
import '../../common/lib/ace/snippets/sql' import '../../common/lib/ace/snippets/sql'
import datasourceApi from '../../common/api/datasource'
var app; var app;
export default { export default {
@@ -162,9 +163,9 @@
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.common.post(this.apilist1.transferUpdate, {id: id, delFlag: 1}, function (json) { datasourceApi.transferUpdate({id: id, delFlag: 1}).then(() => {
app.$message.success("删除成功"); this.$message.success("删除成功");
app.loadGetTaskList(); this.loadGetTaskList();
}); });
}).catch(()=>{}); }).catch(()=>{});
}, },
@@ -174,26 +175,28 @@
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.common.post(this.apilist1.transferStart, {id: id}, function (json) { datasourceApi.transferStart({id: id}).then(() => {
app.$message.success("任务提交成功"); this.$message.success("任务提交成功");
}); });
}).catch(()=>{}); }).catch(()=>{});
}, },
saveEditTask() { saveEditTask() {
this.taskEditInfo.querySql = app.querySqlEditor.getValue(); this.taskEditInfo.querySql = this.querySqlEditor.getValue();
this.taskEditInfo.storageSql = app.storageSqlEditor.getValue(); this.taskEditInfo.storageSql = this.storageSqlEditor.getValue();
this.common.post(this.apilist1.transferUpdate, this.taskEditInfo, function (json) { datasourceApi.transferUpdate(this.taskEditInfo).then(() => {
app.$message.success("保存成功"); this.$message.success("保存成功");
app.taskEditDialogVisible = false; this.taskEditDialogVisible = false;
app.loadGetTaskList(); this.loadGetTaskList();
}); });
}, },
viewTask(id) { viewTask(id) {
this.viewTaskLoading = true; this.viewTaskLoading = true;
this.taskViewDialogVisible = true; this.taskViewDialogVisible = true;
this.common.post(this.apilist1.transferDetail, {id: id}, function (json) { datasourceApi.transferDetail({id: id}).then(json => {
app.taskEditInfo = json.data || {}; this.taskEditInfo = json.data || {};
setTimeout(()=>{app.viewTaskLoading = false;}, 300); setTimeout(() => {
app.viewTaskLoading = false;
}, 300);
}); });
}, },
cancelTask() { cancelTask() {
@@ -202,51 +205,54 @@
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.common.post(this.apilist1.transferCancel, {id: this.taskEditInfo.id}, function (json) { datasourceApi.transferCancel({id: this.taskEditInfo.id}).then(() => {
app.$message.success("取消成功"); this.$message.success("取消成功");
app.viewTask(app.taskEditInfo.id); this.viewTask(this.taskEditInfo.id);
}); });
}).catch(()=>{}); }).catch(()=>{});
}, },
loadGetTaskList() { loadGetTaskList() {
this.loadDataListLoading = true; this.loadDataListLoading = true;
this.common.post(this.apilist1.transferList, {}, function (json) { datasourceApi.transferList({}).then(json => {
app.taskList = json.data || []; this.taskList = json.data || [];
setTimeout(()=>{app.loadDataListLoading = false;}, 800); setTimeout(()=>{this.loadDataListLoading = false;}, 800);
}); });
}, },
autoFillStorageSql() { autoFillStorageSql() {
var sqlStr = app.querySqlEditor.getValue(); let sqlStr = this.querySqlEditor.getValue();
this.common.post(this.apilist1.transferSqlColumns, {sql: sqlStr}, function (json) { datasourceApi.transferSqlColumns({sql: sqlStr}).then(json => {
var resultData = json.data || []; let resultData = json.data || [];
if (resultData.length <= 0) { if (resultData.length <= 0) {
app.$message.error("查询的字段不明确,不能自动填充"); this.$message.error("查询的字段不明确,不能自动填充");
return; return;
} }
var storageSql = "\n"; let storageSql = "\n";
storageSql += "insert into TableName (\n"; storageSql += "insert into TableName (\n";
for (var i = 0; i < resultData.length; i++) { for (let i = 0; i < resultData.length; i++) {
storageSql += "\t" + ((i === 0) ? "" : ",") + resultData[i] + "\n"; storageSql += "\t" + ((i === 0) ? "" : ",") + resultData[i] + "\n";
} }
storageSql += ") values (\n"; storageSql += ") values (\n";
for (var i = 0; i < resultData.length; i++) { for (let i = 0; i < resultData.length; i++) {
storageSql += "\t" + ((i === 0) ? "" : ",") + "#{" + resultData[i] + "}\n"; storageSql += "\t" + ((i === 0) ? "" : ",") + "#{" + resultData[i] + "}\n";
} }
storageSql += ")\n\n"; storageSql += ")\n\n";
app.storageSqlEditor.setValue(storageSql, 1); this.storageSqlEditor.setValue(storageSql, 1);
}); });
}, },
loadDatasourceList() { loadDatasourceList() {
this.common.post(this.apilist1.datasourceList, {}, function (json) { datasourceApi.datasourceList({}).then(json => {
app.datasourceList = json.data || []; this.datasourceList = json.data || [];
var datasourceOptions = [], datasourceMap = {}; let datasourceOptions = [], datasourceMap = {};
for (var i = 0; i < app.datasourceList.length; i++) { for (let i = 0; i < this.datasourceList.length; i++) {
datasourceMap[app.datasourceList[i].id] = app.datasourceList[i].cnName; datasourceMap[this.datasourceList[i].id] = this.datasourceList[i].name;
datasourceOptions.push({label: app.datasourceList[i].cnName, value: app.datasourceList[i].id}); datasourceOptions.push({
label: this.datasourceList[i].name,
value: this.datasourceList[i].id
});
} }
app.datasourceMap = datasourceMap; this.datasourceMap = datasourceMap;
app.datasourceOptions = datasourceOptions; this.datasourceOptions = datasourceOptions;
app.loadGetTaskList(); this.loadGetTaskList();
}); });
}, },
initAceEditor(editor, minLines) { initAceEditor(editor, minLines) {

View File

@@ -7,9 +7,6 @@
</template> </template>
<script> <script>
import toast from '../../common/lib/common/toast'
import global from '../../common/config/global'
var app; var app;
export default { export default {

View File

@@ -26,7 +26,7 @@
</template> </template>
<script> <script>
import global from '../../common/config/global' import datasourceApi from '../../common/api/datasource'
export default { export default {
data() { data() {
@@ -38,12 +38,18 @@
keyword: '', keyword: '',
}; };
}, },
mounted: function () {
// 延迟设置展开的目录edit比app先初始化
setTimeout(() => {
this.$emit('initLoadDataList', {
sourceId: this.vueQueryParam.sourceId,
host: this.vueQueryParam.host,
dbName: this.vueQueryParam.dbName
});
}, 500);
},
activated: function () { activated: function () {
this.initQueryParam(this.$route); this.initQueryParam(this.$route);
// 延迟设置展开的目录edit比app先初始化
setTimeout(() => {
global.vue.$app.initLoadDataList(this.vueQueryParam.sourceId, this.vueQueryParam.host, this.vueQueryParam.dbName);
}, 500);
}, },
methods: { methods: {
initQueryParam(to) { initQueryParam(to) {
@@ -52,12 +58,11 @@
this.$store.commit('global/addTableName', newName); this.$store.commit('global/addTableName', newName);
}, },
searchSubmit() { searchSubmit() {
let that = this;
this.columnListLoading = true; this.columnListLoading = true;
this.vueQueryParam.searchText = this.keyword; this.vueQueryParam.searchText = this.keyword;
this.common.post(this.apilist1.tableAndColumnBySearch, this.vueQueryParam, function (json) { datasourceApi.tableAndColumnBySearch(this.vueQueryParam).then(json => {
that.columnList = json.data || []; this.columnList = json.data || [];
that.columnListLoading = false; this.columnListLoading = false;
}); });
}, },
} }

View File

@@ -88,8 +88,7 @@
</template> </template>
<script> <script>
import global from '../../common/config/global' import datasourceApi from '../../common/api/datasource'
import {queryTableDdl} from '../../common/api/datasource'
export default { export default {
data() { data() {
@@ -104,38 +103,43 @@
tableDDLInfoDialogVisible: false, tableDDLInfoDialogVisible: false,
}; };
}, },
activated: function () { mounted: function () {
this.initQueryParam(this.$route); // 延迟设置展开的目录edit比app先初始化
// 延迟设置展开的目录edit比app先初始化 setTimeout(() => {
setTimeout(()=> { this.$emit('initLoadDataList', {
global.vue.$app.initLoadDataList(this.vueQueryParam.sourceId, this.vueQueryParam.host, this.vueQueryParam.dbName); sourceId: this.vueQueryParam.sourceId,
}, 500); host: this.vueQueryParam.host,
}, dbName: this.vueQueryParam.dbName
});
}, 500);
},
activated: function () {
this.initQueryParam(this.$route);
},
methods: { methods: {
initQueryParam(to) { initQueryParam(to) {
if (this.columnListLoading) { if (this.columnListLoading) {
return; return;
} }
let that = this;
this.columnListLoading = true; this.columnListLoading = true;
this.vueQueryParam = to.query; this.vueQueryParam = to.query;
this.common.post(this.apilist1.tableColumnList, this.vueQueryParam, function (json) { datasourceApi.tableColumnList(this.vueQueryParam).then(json => {
var columnList = json.data.columnList || []; let columnList = json.data.columnList || [];
for (var i = 0; i < columnList.length; i++) { for (let i = 0; i < columnList.length; i++) {
columnList[i].inEdit = 0; columnList[i].inEdit = 0;
columnList[i].newDesc = columnList[i].description; columnList[i].newDesc = columnList[i].description;
} }
that.columnList = columnList; this.columnList = columnList;
var tableInfo = json.data.tableInfo || {}; let tableInfo = json.data.tableInfo || {};
tableInfo.inEdit = 0; tableInfo.inEdit = 0;
tableInfo.newDesc = tableInfo.description; tableInfo.newDesc = tableInfo.description;
that.tableInfo = tableInfo; this.tableInfo = tableInfo;
var newName = {key: that.$route.fullPath, val: '表-' + tableInfo.tableName}; let newName = {key: this.$route.fullPath, val: '表-' + tableInfo.tableName};
that.$store.commit('global/addTableName', newName); this.$store.commit('global/addTableName', newName);
that.columnListLoading = false; this.columnListLoading = false;
}); });
this.common.post(this.apilist1.tableStatus, this.vueQueryParam, function (json) { datasourceApi.tableStatus(this.vueQueryParam).then(json => {
that.tableStatusInfo = json.data || {}; this.tableStatusInfo = json.data || {};
}); });
}, },
showCreateTableDdl() { showCreateTableDdl() {
@@ -146,7 +150,7 @@
dbName: this.vueQueryParam.dbName, dbName: this.vueQueryParam.dbName,
tableName: this.vueQueryParam.tableName, tableName: this.vueQueryParam.tableName,
}; };
queryTableDdl(param).then(res => { datasourceApi.queryTableDdl(param).then(res => {
this.tableDDLInfo = res.data || '获取失败'; this.tableDDLInfo = res.data || '获取失败';
}); });
}, },
@@ -181,10 +185,9 @@
row.inEdit = 0; row.inEdit = 0;
this.vueQueryParam.columnName = row.name; this.vueQueryParam.columnName = row.name;
this.vueQueryParam.newDesc = row.newDesc; this.vueQueryParam.newDesc = row.newDesc;
let that = this; datasourceApi.updateTableColumnDesc(this.vueQueryParam).then(() => {
this.common.post(this.apilist1.updateTableColumnDesc, this.vueQueryParam, function (json) {
row.description = row.newDesc; row.description = row.newDesc;
that.$message.success("修改成功"); this.$message.success("修改成功");
}); });
}, },
saveTableDescription() { saveTableDescription() {
@@ -194,10 +197,9 @@
} }
this.tableInfo.inEdit = 0; this.tableInfo.inEdit = 0;
this.vueQueryParam.newDesc = this.tableInfo.newDesc; this.vueQueryParam.newDesc = this.tableInfo.newDesc;
let that = this; datasourceApi.updateTableDesc(this.vueQueryParam).then(() => {
this.common.post(this.apilist1.updateTableDesc, this.vueQueryParam, function (json) { this.tableInfo.description = this.tableInfo.newDesc;
that.tableInfo.description = that.tableInfo.newDesc; this.$message.success("修改成功");
that.$message.success("修改成功");
}); });
}, },
} }

View File

@@ -18,6 +18,7 @@
</template> </template>
<script> <script>
import userApi from '../../common/api/user'
export default { export default {
data() { data() {
return { return {
@@ -43,14 +44,13 @@
}, },
methods: { methods: {
loginSubmit() { loginSubmit() {
var that = this;
this.$refs.loginParam.validate((valid) => { this.$refs.loginParam.validate((valid) => {
if (!valid) return; if (!valid) return;
that.common.post(that.apilist1.userLogin, that.loginParam, function (json) { userApi.userLogin(this.loginParam).then(() => {
if(!!that.redirect) { if (!!this.redirect) {
location.href = decodeURIComponent(that.redirect); location.href = decodeURIComponent(this.redirect);
} else { } else {
that.$router.back(); this.$router.back();
} }
}); });
}); });

View File

@@ -21,7 +21,7 @@
</template> </template>
<script> <script>
var app; import userApi from '../../common/api/user'
export default { export default {
data() { data() {
return { return {
@@ -29,13 +29,12 @@
}; };
}, },
mounted: function () { mounted: function () {
app = this;
this.getUserInfo(); this.getUserInfo();
}, },
methods: { methods: {
getUserInfo() { getUserInfo() {
this.common.post(this.apilist1.getSelfUserInfo, this.searchParam, function (json) { userApi.getSelfUserInfo().then(json => {
app.userInfo = json.data; this.userInfo = json.data;
}); });
}, },
} }

View File

@@ -0,0 +1,12 @@
// 官方配置文档https://webpack.js.org/configuration/dev-server/
module.exports = {
devServer: {
hot: true,
disableHostCheck: true,
port: 80,
host: 'local.zyplayer.com'
},
publicPath: './',
productionSourceMap: false
};

View File

@@ -1,76 +0,0 @@
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' : '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/doc-db.html',
filename: options.dev ? 'index.html':'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'
});

File diff suppressed because it is too large Load Diff