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

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,33 @@
html,body{width: 100%;height: 100%;}
.container{padding-top: 20px;}
.table-info,.table-columns{margin-top: 10px;}
.table-info .desc{margin-top: 10px;}
#tableDescInput{display: none;}
#tableDescShow .icon-edit{cursor: pointer;margin-left: 20px;display: none;}
#fuzzySearchModal .table-box{margin-top: 20px; max-height: 600px;overflow-y: auto;}
#fuzzySearchModal .table-box td:nth-child(3){word-break:break-all;max-width: 400px;}
/* S-覆盖原生样式 */
.chosen-container-single .chosen-single div b {margin-top: 8px;}
/* E-覆盖原生样式 */
/* S-JSON展示的样式 */
pre.json{margin-top:0px;margin-bottom:0px;}
pre.json .canvas{font:10pt georgia;background-color:#ececec;color:#000000;border:1px solid #cecece;}
pre.json .objectBrace{color:#00aa00;font-weight:bold;}
pre.json .arrayBrace{color:#0033ff;font-weight:bold;}
pre.json .propertyName{color:#cc0000;font-weight:bold;}
pre.json .string{color:#007777;}
pre.json .number{color:#aa00aa;}
pre.json .boolean{color:#0000ff;}
pre.json .function{color:#aa6633;text-decoration:italic;}
pre.json .null{color:#0000ff;}
pre.json .comma{color:#000000;font-weight:bold;}
pre img{cursor: pointer;}
/* E-JSON展示的样式 */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,45 @@
<!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">
<title>zyplayer-doc-db</title>
<link rel="stylesheet" href="css/zui.min.css" />
<link rel="stylesheet" href="css/zui-theme.min.css">
<link rel="stylesheet" href="css/chosen.min.css" />
<link rel="stylesheet" href="css/doc-db.css" />
</head>
<body>
<div class="container">
<div class="row choise-db">
<div class="col-md-12">
<select id="choiseTable" data-placeholder="选择一张表" class="chosen-select form-control" tabindex="2">
<option value=""></option>
</select>
</div>
</div>
<div class="table-info">
<div>表注释:<span class="table-desc"></span></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>
</body>
<script type="text/javascript" src="js/database.js"></script>
<script type="text/javascript" src="js/jquery-3.1.0.min.js"></script>
<script type="text/javascript" src="js/zui.min.js"></script>
<script type="text/javascript" src="js/chosen.min.js"></script>
<script type="text/javascript" src="js/formatjson.js"></script>
<script type="text/javascript" src="js/toast.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/doc-db.js"></script>
</html>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 290 KiB

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,54 @@
$(document).ready(function(){
$('select.chosen-select').chosen({
no_results_text: '没有找到', // 当检索时没有找到匹配项时显示的提示文本
disable_search_threshold: 0, // 10 个以下的选择项则不显示检索框
search_contains: true, // 从任意位置开始检索
width: '100%'
});
$('#choiseTable').on('change', function(e){
var tableName = $("#choiseTable").val();
var columnList = database.columnList[tableName];
$("#tableCloumnsTable tbody").empty();
for (var i = 0; i < columnList.length; i++) {
var item = columnList[i];
$("#tableCloumnsTable tbody").append(
'<tr>'
+'<td>' + item.name + '</td>'
+'<td>' + (1 == item.isidentity ? '是' : '否') + '</td>'
+'<td>' + getNotEmptyStr(item.type) + '</td>'
+'<td>' + getNotEmptyStr(item.length) + '</td>'
+'<td>' + (1 == item.nullable ? '允许' : '不允许') + '</td>'
+'<td>' + ("true" == item.ispramary ? '是' : '否') + '</td>'
+'<td class="column-desc"><span>' + getNotEmptyStr(item.description) + '</span>'
+'<input type="text" class="desc-input form-control" style="display:none;width: 100%;" column="' + item.name + '" value="' + (isEmpty(item.description)?'':item.description) + '">'
+'</tr>'
);
}
var tableList = database.tableList;
for (var i = 0; i < tableList.length; i++) {
if(tableList[i].tableName == tableName) {
$(".table-desc").text(getNotEmptyStr(tableList[i].description));
break;
}
}
});
initData();
});
function initData(){
$('#choiseTable').empty();
$("#choiseTable").append('<option value=""></option>');
var tableList = database.tableList;
for (var i = 0; i < tableList.length; i++) {
var tableName = tableList[i].tableName;
var description = tableList[i].description;
var infoShow = tableName;
if(isNotEmpty(description)) {
infoShow += "(" + description + ")";
}
$("#choiseTable").append('<option value="'+tableName+'">' + infoShow + '</option>');
}
$('#choiseTable').trigger('chosen:updated');
}

View File

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

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,106 @@
/**
* 两个元素上下、左右拖动动态改变大小
* @author 暮光:城中城
* @since 2017年5月7日
*/
(function($){
$.fn.mgResizableHeight = function(options) {
var defaults = {prev:this,next:this, prevHtMin:0, prevHtMax:999, nextHtMin:0, nextHtMax:999};
var opts = $.extend(defaults, options);
var disY = 0, prevH = 0, nextH = 0, isStart = false;
var prev, next, thisObj = this;
$(document).mousemove(function(ev){
if(!isStart){return;}
var ev = ev || window.event;
var H = ev.clientY - disY;
var prevHNow = prevH+H, nextHNow = nextH-H;
if(opts.prevHtMin >= prevHNow) {
prevHNow = opts.prevHtMin;
nextHNow = next.outerHeight();
}
if(opts.nextHtMin >= nextHNow) {
nextHNow = opts.nextHtMin;
prevHNow = prev.outerHeight();
}
if(opts.prevHtMax <= prevHNow) {
prevHNow = opts.prevHtMax;
nextHNow = next.outerHeight();
}
if(opts.nextHtMax <= nextHNow) {
nextHNow = opts.nextHtMax;
prevHNow = prev.outerHeight();
}
//prev.css("height", prevHNow + 'px');
//next.css("height", nextHNow + 'px');
if(typeof opts.onresize == 'function') {
opts.onresize(prevHNow, nextHNow);
}
}).mouseup(function(ev){
isStart = false;
});
$(this).mousedown(function(ev){
var ev = ev || window.event;
disY = ev.clientY;
prev = (opts.prev == thisObj)?$(opts.prev).prev():$(opts.prev);
next = (opts.next == thisObj)?$(opts.next).next():$(opts.next);
prevH = prev.outerHeight();
nextH = next.outerHeight();
isStart = true;
});
}
/**
* 改变宽度的功能,只是实现各种消息的通知,实际改变大小需要在回调里面自己操作
*/
$.fn.mgResizableWidth = function(options) {
var defaults = {prev:this,next:this, prevWtMin:0, prevWtMax:999, nextWtMin:0, nextWtMax:999};
var opts = $.extend(defaults, options);
var disX = 0, prevW = 0, nextW = 0, isStart = false;
var prev, next, thisObj = this;
$(document).mousemove(function(ev){
if(!isStart){return;}
var ev = ev || window.event;
var W = ev.clientX - disX;
var prevWNow = prevW+W, nextWNow = nextW-W;
if(opts.prevWtMin >= prevWNow) {
prevWNow = opts.prevWtMin;
nextWNow = next.outerWidth();
}
if(opts.nextWtMin >= nextWNow) {
nextWNow = opts.nextWtMin;
prevWNow = prev.outerWidth();
}
if(opts.prevWtMax <= prevWNow) {
prevWNow = opts.prevWtMax;
nextWNow = next.outerWidth();
}
if(opts.nextWtMax <= nextWNow) {
nextWNow = opts.nextWtMax;
prevWNow = prev.outerWidth();
}
//prev.css("width", prevWNow + 'px');
//next.css("width", nextWNow + 'px');
if(typeof opts.onresize == 'function') {
opts.onresize(prevWNow, nextWNow);
}
}).mouseup(function(ev){
if(!isStart){return;}
isStart = false;
if(typeof opts.onfinish == 'function') {
opts.onfinish();
}
});
$(this).mousedown(function(ev){
var ev = ev || window.event;
disX = ev.clientX;
prev = (opts.prev == thisObj)?$(opts.prev).prev():$(opts.prev);
next = (opts.next == thisObj)?$(opts.next).next():$(opts.next);
prevW = prev.outerWidth();
nextW = next.outerWidth();
isStart = true;
if(typeof opts.onstart == 'function') {
opts.onstart();
}
});
}
})(jQuery);

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long