Commit bff940d4 by fengshuonan

转移模块

parent 1616884c
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.stylefeng</groupId>
<artifactId>guns-parent</artifactId>
<version>1.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>guns-admin</artifactId>
<name>guns-admin</name>
<description>guns 的spring boot版本</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-core</artifactId>
<version>1.0.0</version>
</dependency>
<!--spring boot依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!--shiro依赖-->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<!--需要分布式session的话需要放开注释-->
<!--<dependency>-->
<!--<groupId>org.springframework.session</groupId>-->
<!--<artifactId>spring-session-data-redis</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork><!-- 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/webapp</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
</build>
</project>
/* iCheck plugin Square skin, green
----------------------------------- */
.icheckbox_square-green,
.iradio_square-green {
display: inline-block;
*display: inline;
vertical-align: middle;
margin: 0;
padding: 0;
width: 22px;
height: 22px;
background: url(green.png) no-repeat;
border: none;
cursor: pointer;
}
.icheckbox_square-green {
background-position: 0 0;
}
.icheckbox_square-green.hover {
background-position: -24px 0;
}
.icheckbox_square-green.checked {
background-position: -48px 0;
}
.icheckbox_square-green.disabled {
background-position: -72px 0;
cursor: default;
}
.icheckbox_square-green.checked.disabled {
background-position: -96px 0;
}
.iradio_square-green {
background-position: -120px 0;
}
.iradio_square-green.hover {
background-position: -144px 0;
}
.iradio_square-green.checked {
background-position: -168px 0;
}
.iradio_square-green.disabled {
background-position: -192px 0;
cursor: default;
}
.iradio_square-green.checked.disabled {
background-position: -216px 0;
}
/* HiDPI support */
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
.icheckbox_square-green,
.iradio_square-green {
background-image: url(green@2x.png);
-webkit-background-size: 240px 24px;
background-size: 240px 24px;
}
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;}
body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;}
h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;}
h1 {font-size: 24px;line-height: 34px;text-align: center;}
h2 {font-size: 14px;line-height: 24px;padding-top: 5px;}
h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;}
a {color:#3C6E31;text-decoration: underline;}
a:hover {background-color:#3C6E31;color:white;}
input.radio {margin: 0 2px 0 8px;}
input.radio.first {margin-left:0;}
input.empty {color: lightgray;}
code {color: #2f332a;}
.highlight_red {color:#A60000;}
.highlight_green {color:#A7F43D;}
li {list-style: circle;font-size: 12px;}
li.title {list-style: none;}
ul.list {margin-left: 17px;}
div.content_wrap {width: 600px;height:380px;}
div.content_wrap div.left{float: left;width: 250px;}
div.content_wrap div.right{float: right;width: 340px;}
div.zTreeDemoBackground {width:250px;height:362px;text-align:left;}
ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;}
ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;}
ul.log.small {height:45px;}
ul.log li {color: #666666;list-style: none;padding-left: 10px;}
ul.log li.dark {background-color: #E3E3E3;}
/* ruler */
div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer}
div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer}
\ No newline at end of file
var DateUtils = {
/**
* 扩展Date 对象格式化方法
*/
expandDate : function() {
Date.prototype.format = function(fmt)
{ //author: meizz
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时
"H+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt))
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)
if(new RegExp("("+ k +")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
return fmt;
}
},
/**
* 获取具体年龄
* @param {} beginStr
* @param {} endStr
* @return {}
*/
getAgeInfo: function (beginStr, endStr) {
var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})(\s)(\d{1,2})(:)(\d{1,2})(:{0,1})(\d{0,2})$/);
var beginArr = beginStr.match(reg);
var endArr = endStr.match(reg);
var days = 0;
var month = 0;
var year = 0;
days = endArr[5] - beginArr[5];
if (days < 0) {
month = -1;
days = 30 + days;
}
month = month + (endArr[3] - beginArr[3]);
if (month < 0) {
year = -1;
month = 12 + month;
}
year = year + (endArr[1] - beginArr[1]);
var yearString = year > 0 ? year + "岁" : "";
var mnthString = month > 0 ? month + "月" : "";
var dayString = days > 0 ? days + "天" : "";
/*
* 1 如果岁 大于等于1 那么年龄取 几岁 2 如果 岁等于0 但是月大于1 那么如果天等于0天小于3天 取小时 例如出生2天 就取 48小时
*/
var result = "";
if (year >= 1) {
result = yearString + mnthString;
} else {
if (month >= 1) {
result = days > 0 ? mnthString + dayString : mnthString;
} else {
var begDate = new Date(beginArr[1], beginArr[3] - 1, beginArr[5],
beginArr[7], beginArr[9], beginArr[11]);
var endDate = new Date(endArr[1], endArr[3] - 1, endArr[5],
endArr[7], endArr[9], endArr[11]);
var between = (endDate.getTime() - begDate.getTime()) / 1000;
days = Math.floor(between / (24 * 3600));
var hours = Math.floor(between / 3600 - (days * 24));
var dayString = days > 0 ? days + "天" : "";
result = days >= 3 ? dayString : days * 24 + hours + "小时";
}
}
return result;
},
/**
* 获取年龄,不满一天算天
* @param {} birthday
* @param {} today
* @return {}
*/
getAge :function(birthday,today) {
var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/);
var beginArr = birthday.match(reg);
var endArr = today.match(reg);
var days = 0;
var month = 0;
var year = 0;
days = endArr[5] - beginArr[5];
if (days < 0) {
month = -1;
days = 30 + days;
}
month = month + (endArr[3] - beginArr[3]);
if (month < 0) {
year = -1;
month = 12 + month;
}
year = year + (endArr[1] - beginArr[1]);
var yearString = year > 0 ? year + "岁" : "";
var mnthString = month > 0 ? month + "月" : "";
var dayString = days > 0 ? days + "天" : "1天";
/*
* 1 如果岁 大于等于1 那么年龄取 几岁 2 如果 岁等于0 但是月大于1 name取几月 3 如果不足月, 则取天数 4 不满一天算一天
*/
var result = "";
if (year >= 1) {
result = yearString + mnthString + dayString;
} else {
if (month >= 1) {
result = days > 0 ? mnthString + dayString : mnthString;
} else {
result = dayString;
}
}
return result;
},
/**
* 获取月龄
* @param {} birthday
* @param {} today
* @return {}
*/
getMonthage :function(birthday,today) {
var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/);
var beginArr = birthday.match(reg);
var endArr = today.match(reg);
var days = 0;
var month = 0;
var year = 0;
days = endArr[5] - beginArr[5];
if (days < 0) {
month = -1;
days = 30 + days;
}
month = month + (endArr[3] - beginArr[3]);
if (month < 0) {
year = -1;
month = 12 + month;
}
year = year + (endArr[1] - beginArr[1]);
var result = "";
if (year >= 1) {
result = (year * 12 + month + 1) + "个月";
} else {
if (month >= 1) {
result = (month + 1) + "个月";
} else {
result = "1个月";
}
}
return result;
}
}
\ No newline at end of file
(function () {
var $ax = function (url, success, error) {
this.url = url;
this.type = "post";
this.data = {};
this.dataType = "json";
this.async = false;
this.success = success;
this.error = error;
};
$ax.prototype = {
start : function () {
var me = this;
if (this.url.indexOf("?") == -1) {
this.url = this.url + "?jstime=" + new Date().getTime();
} else {
this.url = this.url + "&jstime=" + new Date().getTime();
}
$.ajax({
type: this.type,
url: this.url,
dataType: this.dataType,
async: this.async,
data: this.data,
beforeSend: function(data) {
},
success: function(data) {
me.success(data);
},
error: function(data) {
me.error(data);
}
});
},
set : function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
setData : function(data){
this.data = data;
return this;
},
clear : function () {
this.data = {};
return this;
}
};
window.$ax = $ax;
} ());
\ No newline at end of file
/**
* 初始化 BootStrap Table 的封装
*
* 约定:toolbar的id为 (bstableId + "Toolbar")
*
* @author fengshuonan
*/
(function () {
var BSTable = function (bstableId, url, columns) {
this.btInstance = null; //jquery和BootStrapTable绑定的对象
this.bstableId = bstableId;
this.url = Feng.ctxPath + url;
this.method = "post";
this.paginationType = "server"; //默认分页方式是服务器分页,可选项"client"
this.toolbarId = bstableId + "Toolbar";
this.columns = columns;
this.height = 665; //默认表格高度665
this.data = {};
this.queryParams = {}; // 向后台传递的自定义参数
};
BSTable.prototype = {
/**
* 初始化bootstrap table
*/
init: function () {
var tableId = this.bstableId;
var me = this;
this.btInstance =
$('#' + tableId).bootstrapTable({
contentType: "application/x-www-form-urlencoded",
url: this.url, //请求地址
method: this.method, //ajax方式,post还是get
ajaxOptions: { //ajax请求的附带参数
data: this.data
},
toolbar: "#" + this.toolbarId,//顶部工具条
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true
pagination: true, //是否显示分页(*)
sortable: true, //是否启用排序
sortOrder: "desc", //排序方式
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 14, //每页的记录行数(*)
pageList: [14, 50, 100], //可供选择的每页的行数(*)
queryParamsType: 'limit', //默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
queryParams: function (param) {
return $.extend(me.queryParams, param);
}, // 向后台传递的自定义参数
sidePagination: this.paginationType, //分页方式:client客户端分页,server服务端分页(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端
strictSearch: true, //设置为 true启用 全匹配搜索,否则为模糊搜索
showColumns: true, //是否显示所有的列
showRefresh: true, //是否显示刷新按钮
minimumCountColumns: 2, //最少允许的列数
clickToSelect: true, //是否启用点击选中行
searchOnEnterKey: true, //设置为 true时,按回车触发搜索方法,否则自动触发搜索方法
columns: this.columns, //列数组
pagination: true, //是否显示分页条
height: this.height,
icons: {
refresh: 'glyphicon-repeat',
toggle: 'glyphicon-list-alt',
columns: 'glyphicon-list'
},
iconSize: 'outline'
});
return this;
},
/**
* 向后台传递的自定义参数
* @param param
*/
setQueryParams: function (param) {
this.queryParams = param;
},
/**
* 设置分页方式:server 或者 client
*/
setPaginationType: function (type) {
this.paginationType = type;
},
/**
* 设置ajax post请求时候附带的参数
*/
set: function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
/**
* 设置ajax post请求时候附带的参数
*/
setData: function (data) {
this.data = data;
return this;
},
/**
* 清空ajax post请求参数
*/
clear: function () {
this.data = {};
return this;
},
/**
* 刷新 bootstrap 表格
* Refresh the remote server data,
* you can set {silent: true} to refresh the data silently,
* and set {url: newUrl} to change the url.
* To supply query params specific to this request, set {query: {foo: 'bar'}}
*/
refresh: function (parms) {
if (typeof parms != "undefined") {
this.btInstance.bootstrapTable('refresh', parms);
} else {
this.btInstance.bootstrapTable('refresh');
}
}
};
window.BSTable = BSTable;
}());
\ No newline at end of file
var SelectList = {};
SelectList.singelSelect = function (eleName, attr, data) {
var result = false;
$("#" + eleName).find("a").each(function (i, d) {
if ($(this).attr(attr) == data) {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
result = true;
}
} else {
$(this).removeClass('active');
}
});
return result;
};
SelectList.mutiSelect = function (eleName, attr, data) {
var result = false;
$("#" + eleName).find("a").each(function (i, d) {
if ($(this).attr(attr) == data) {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
result = true;
}
}
});
return result;
};
SelectList.clearSelect = function (eleName) {
$("#" + eleName).find("a").each(function (i, d) {
$(this).removeClass('active');
});
};
\ No newline at end of file
/**
* 初始化 Tree Table 的封装
*
* @author cyf
*/
(function () {
var BSTreeTable = function (bstableId, url, columns) {
this.btInstance = null; //jquery和bootstrapTreeTable绑定的对象
this.bstableId = bstableId;
this.url = Feng.ctxPath + url;
this.method = "post";
this.columns = columns;
this.data = {};// ajax的参数
this.expandColumn = null;// 展开显示的列
this.id = 'id';// 选取记录返回的值
this.code = 'code';// 用于设置父子关系
this.parentCode = 'pcode';// 用于设置父子关系
this.expandAll = false;// 是否默认全部展开
this.toolbarId = bstableId + "Toolbar";
this.height = 665; //默认表格高度665
};
BSTreeTable.prototype = {
/**
* 初始化bootstrap table
*/
init: function () {
var tableId = this.bstableId;
this.btInstance =
$('#'+tableId).bootstrapTreeTable({
id: this.id,// 选取记录返回的值
code: this.code,// 用于设置父子关系
parentCode: this.parentCode,// 用于设置父子关系
rootCodeValue: this.rootCodeValue,//设置根节点code值----可指定根节点,默认为null,"",0,"0"
type: this.method, //请求数据的ajax类型
url: this.url, //请求数据的ajax的url
ajaxParams: this.data, //请求数据的ajax的data属性
expandColumn: this.expandColumn,//在哪一列上面显示展开按钮,从0开始
striped: true, //是否各行渐变色
expandAll: this.expandAll, //是否全部展开
columns: this.columns, //列数组
toolbar: "#" + this.toolbarId,//顶部工具条
height: this.height,
});
return this;
},
/**
* 设置在哪一列上面显示展开按钮,从0开始
*/
setExpandColumn: function (expandColumn) {
this.expandColumn = expandColumn;
},
/**
* 设置记录返回的id值
*/
setIdField: function (id) {
this.id = id;
},
/**
* 设置记录分级的字段
*/
setCodeField: function (code) {
this.code = code;
},
/**
* 设置记录分级的父级字段
*/
setParentCodeField: function (parentCode) {
this.parentCode = parentCode;
},
/**
* 设置根节点code值----可指定根节点,默认为null,"",0,"0"
*/
setRootCodeValue: function (rootCodeValue) {
this.rootCodeValue = rootCodeValue;
},
/**
* 设置是否默认全部展开
*/
setExpandAll: function (expandAll) {
this.expandAll = expandAll;
},
/**
* 设置表格高度
*/
setHeight: function (height) {
this.height = height;
},
/**
* 设置ajax post请求时候附带的参数
*/
set: function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
/**
* 设置ajax post请求时候附带的参数
*/
setData: function (data) {
this.data = data;
return this;
},
/**
* 清空ajax post请求参数
*/
clear: function () {
this.data = {};
return this;
},
/**
* 刷新表格
*/
refresh: function (parms) {
if (typeof parms != "undefined") {
this.btInstance.bootstrapTreeTable('refresh', parms.query);// 为了兼容bootstrap-table的写法
} else {
this.btInstance.bootstrapTreeTable('refresh');
}
}
};
window.BSTreeTable = BSTreeTable;
}());
\ No newline at end of file
/**
* web-upload 工具类
*
* 约定:
* 上传按钮的id = 图片隐藏域id + 'BtnId'
* 图片预览框的id = 图片隐藏域id + 'PreId'
*
* @author fengshuonan
*/
(function() {
var $WebUpload = function(pictureId) {
this.pictureId = pictureId;
this.uploadBtnId = pictureId + "BtnId";
this.uploadPreId = pictureId + "PreId";
this.uploadUrl = Feng.ctxPath + '/mgr/upload';
this.fileSizeLimit = 100 * 1024 * 1024;
this.picWidth = 800;
this.picHeight = 800;
this.uploadBarId = null;
};
$WebUpload.prototype = {
/**
* 初始化webUploader
*/
init : function() {
var uploader = this.create();
this.bindEvent(uploader);
return uploader;
},
/**
* 创建webuploader对象
*/
create : function() {
var webUploader = WebUploader.create({
auto : true,
pick : {
id : '#' + this.uploadBtnId,
multiple : false,// 只上传一个
},
accept : {
title : 'Images',
extensions : 'gif,jpg,jpeg,bmp,png',
mimeTypes : 'image/gif,image/jpg,image/jpeg,image/bmp,image/png'
},
swf : Feng.ctxPath
+ '/static/js/plugins/webuploader/Uploader.swf',
disableGlobalDnd : true,
duplicate : true,
server : this.uploadUrl,
fileSingleSizeLimit : this.fileSizeLimit
});
return webUploader;
},
/**
* 绑定事件
*/
bindEvent : function(bindedObj) {
var me = this;
bindedObj.on('fileQueued', function(file) {
var $li = $('<div><img width="100px" height="100px"></div>');
var $img = $li.find('img');
$("#" + me.uploadPreId).html($li);
// 生成缩略图
bindedObj.makeThumb(file, function(error, src) {
if (error) {
$img.replaceWith('<span>不能预览</span>');
return;
}
$img.attr('src', src);
}, me.picWidth, me.picHeight);
});
// 文件上传过程中创建进度条实时显示。
bindedObj.on('uploadProgress', function(file, percentage) {
$("#"+me.uploadBarId).css("width",percentage * 100 + "%");
});
// 文件上传成功,给item添加成功class, 用样式标记上传成功。
bindedObj.on('uploadSuccess', function(file,response) {
Feng.success("上传成功");
$("#" + me.pictureId).val(response);
});
// 文件上传失败,显示上传出错。
bindedObj.on('uploadError', function(file) {
Feng.error("上传失败");
});
// 其他错误
bindedObj.on('error', function(type) {
if ("Q_EXCEED_SIZE_LIMIT" == type) {
Feng.error("文件大小超出了限制");
} else if ("Q_TYPE_DENIED" == type) {
Feng.error("文件类型不满足");
} else if ("Q_EXCEED_NUM_LIMIT" == type) {
Feng.error("上传数量超过限制");
} else if ("F_DUPLICATE" == type) {
Feng.error("图片选择重复");
} else {
Feng.error("上传过程中出错");
}
});
// 完成上传完了,成功或者失败
bindedObj.on('uploadComplete', function(file) {
});
},
/**
* 设置图片上传的进度条的id
*/
setUploadBarId: function (id) {
this.uploadBarId = id;
}
};
window.$WebUpload = $WebUpload;
}());
\ No newline at end of file
/**
* ztree插件的封装
*/
(function() {
var $ZTree = function(id, url) {
this.id = id;
this.url = url;
this.onClick = null;
this.settings = null;
this.ondblclick=null;
};
$ZTree.prototype = {
/**
* 初始化ztree的设置
*/
initSetting : function() {
var settings = {
view : {
dblClickExpand : true,
selectedMulti : false
},
data : {simpleData : {enable : true}},
callback : {
onClick : this.onClick,
onDblClick:this.ondblclick
}
};
return settings;
},
/**
* 手动设置ztree的设置
*/
setSettings : function(val) {
this.settings = val;
},
/**
* 初始化ztree
*/
init : function() {
var zNodeSeting = null;
if(this.settings != null){
zNodeSeting = this.settings;
}else{
zNodeSeting = this.initSetting();
}
var zNodes = this.loadNodes();
$.fn.zTree.init($("#" + this.id), zNodeSeting, zNodes);
},
/**
* 绑定onclick事件
*/
bindOnClick : function(func) {
this.onClick = func;
},
/**
* 绑定双击事件
*/
bindOnDblClick : function(func) {
this.ondblclick=func;
},
/**
* 加载节点
*/
loadNodes : function() {
var zNodes = null;
var ajax = new $ax(Feng.ctxPath + this.url, function(data) {
zNodes = data;
}, function(data) {
Feng.error("加载ztree信息失败!");
});
ajax.start();
return zNodes;
},
/**
* 获取选中的值
*/
getSelectedVal : function(){
var zTree = $.fn.zTree.getZTreeObj(this.id);
var nodes = zTree.getSelectedNodes();
return nodes[0].name;
}
};
window.$ZTree = $ZTree;
}());
\ No newline at end of file
var $parentNode = window.parent.document;
function $childNode(name) {
return window.frames[name]
}
// tooltips
$('.tooltip-demo').tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
});
// 使用animation.css修改Bootstrap Modal
$('.modal').appendTo("body");
$("[data-toggle=popover]").popover();
//折叠ibox
$('.collapse-link').click(function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.find('div.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
//关闭ibox
$('.close-link').click(function () {
var content = $(this).closest('div.ibox');
content.remove();
});
//判断当前页面是否在iframe中
if (top == this) {
var gohome = '<div class="gohome"><a class="animated bounceInUp" href="' + Feng.ctxPath + '/" title="返回首页"><i class="fa fa-home"></i></a></div>';
$('body').append(gohome);
}
//animation.css
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//动画完成之前移除class
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
//拖动面板
function WinMove() {
var element = "[class*=col]";
var handle = ".ibox-title";
var connect = "[class*=col]";
$(element).sortable({
handle: handle,
connectWith: connect,
tolerance: 'pointer',
forcePlaceholderSize: true,
opacity: 0.8,
})
.disableSelection();
};
$(function () {
//初始化下拉框
var config = {
'.chosen-select': {},
'.chosen-select-deselect': {
allow_single_deselect: true
},
'.chosen-select-no-single': {
disable_search_threshold: 10
},
'.chosen-select-no-results': {
no_results_text: '没有要显示的数据!'
},
'.chosen-select-width': {
width: "95%"
}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
});
\ No newline at end of file
/*
* bootstrap-table - v1.11.1 - 2017-02-22
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2017 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b=function(b,c){b.options.columnsHidden.length>0&&a.each(b.columns,function(d,e){-1!==b.options.columnsHidden.indexOf(e.field)&&e.visible!==c&&b.toggleColumn(a.fn.bootstrapTable.utils.getFieldIndex(b.columns,e.field),c,!0)})},c=function(a){(a.options.height||a.options.showFooter)&&setTimeout(function(){a.resetView.call(a)},1)},d=function(a,b,d){a.options.minHeight?b<=a.options.minWidth&&d<=a.options.minHeight?e(a):b>a.options.minWidth&&d>a.options.minHeight&&f(a):b<=a.options.minWidth?e(a):b>a.options.minWidth&&f(a),c(a)},e=function(a){g(a,!1),b(a,!1)},f=function(a){g(a,!0),b(a,!0)},g=function(a,b){a.options.cardView=b,a.toggleView()},h=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}};a.extend(a.fn.bootstrapTable.defaults,{mobileResponsive:!1,minWidth:562,minHeight:void 0,heightThreshold:100,checkOnInit:!0,columnsHidden:[]});var i=a.fn.bootstrapTable.Constructor,j=i.prototype.init;i.prototype.init=function(){if(j.apply(this,Array.prototype.slice.apply(arguments)),this.options.mobileResponsive&&this.options.minWidth){this.options.minWidth<100&&this.options.resizable&&(console.log("The minWidth when the resizable extension is active should be greater or equal than 100"),this.options.minWidth=100);var b=this,c={width:a(window).width(),height:a(window).height()};if(a(window).on("resize orientationchange",h(function(){var e=a(this).height(),f=a(this).width();(Math.abs(c.height-e)>b.options.heightThreshold||c.width!=f)&&(d(b,f,e),c={width:f,height:e})},200)),this.options.checkOnInit){var e=a(window).height(),f=a(window).width();d(this,f,e),c={width:f,height:e}}}}}(jQuery);
\ No newline at end of file
/**
* Bootstrap Table Chinese translation
* Author: Zhixin Wen<wenzhixin2010@gmail.com>
*/
(function ($) {
'use strict';
$.fn.bootstrapTable.locales['zh-CN'] = {
formatLoadingMessage: function () {
return '正在努力地加载数据中,请稍候……';
},
formatRecordsPerPage: function (pageNumber) {
return '每页显示 ' + pageNumber + ' 条记录';
},
formatShowingRows: function (pageFrom, pageTo, totalRows) {
return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
},
formatSearch: function () {
return '搜索';
},
formatNoMatches: function () {
return '没有找到匹配的记录';
},
formatPaginationSwitch: function () {
return '隐藏/显示分页';
},
formatRefresh: function () {
return '刷新';
},
formatToggle: function () {
return '切换';
},
formatColumns: function () {
return '列';
},
formatExport: function () {
return '导出数据';
},
formatClearFilters: function () {
return '清空过滤';
}
};
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
})(jQuery);
/*
* bootstrap-table - v1.11.1 - 2017-02-22
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2017 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery);
\ No newline at end of file
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="laydate-icon" horiz-adv-x="1024" >
<font-face
font-family="laydate-icon"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
<glyph glyph-name="youyou" unicode="&#58882;" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="zuozuo" unicode="&#58883;" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye" unicode="&#58970;" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye1" unicode="&#58971;" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" />
</font>
</defs></svg>
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);
\ No newline at end of file
.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px}
\ No newline at end of file
/*
* metismenu - v1.1.3
* Easy menu jQuery plugin for Twitter Bootstrap 3
* https://github.com/onokumus/metisMenu
*
* Made by Osman Nuri Okumus
* Under MIT License
*/
;(function($, window, document, undefined) {
var pluginName = "metisMenu",
defaults = {
toggle: true,
doubleTapToGo: false
};
function Plugin(element, options) {
this.element = $(element);
this.settings = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function() {
var $this = this.element,
$toggle = this.settings.toggle,
obj = this;
if (this.isIE() <= 9) {
$this.find("li.active").has("ul").children("ul").collapse("show");
$this.find("li").not(".active").has("ul").children("ul").collapse("hide");
} else {
$this.find("li.active").has("ul").children("ul").addClass("collapse in");
$this.find("li").not(".active").has("ul").children("ul").addClass("collapse");
}
//add the "doubleTapToGo" class to active items if needed
if (obj.settings.doubleTapToGo) {
$this.find("li.active").has("ul").children("a").addClass("doubleTapToGo");
}
$this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) {
e.preventDefault();
//Do we need to enable the double tap
if (obj.settings.doubleTapToGo) {
//if we hit a second time on the link and the href is valid, navigate to that url
if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") {
e.stopPropagation();
document.location = $(this).attr("href");
return;
}
}
$(this).parent("li").toggleClass("active").children("ul").collapse("toggle");
if ($toggle) {
$(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide");
}
});
},
isIE: function() { //https://gist.github.com/padolsey/527683
var undef,
v = 3,
div = document.createElement("div"),
all = div.getElementsByTagName("i");
while (
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
all[0]
) {
return v > 4 ? v : undef;
}
},
//Enable the link on the second click.
doubleTapToGo: function(elem) {
var $this = this.element;
//if the class "doubleTapToGo" exists, remove it and return
if (elem.hasClass("doubleTapToGo")) {
elem.removeClass("doubleTapToGo");
return true;
}
//does not exists, add a new class and return false
if (elem.parent().children("ul").length) {
//first remove all other class
$this.find(".doubleTapToGo").removeClass("doubleTapToGo");
//add the class on the current element
elem.addClass("doubleTapToGo");
return false;
}
},
remove: function() {
this.element.off("." + pluginName);
this.element.removeData(pluginName);
}
};
$.fn[pluginName] = function(options) {
this.each(function () {
var el = $(this);
if (el.data(pluginName)) {
el.data(pluginName).remove();
}
el.data(pluginName, new Plugin(this, options));
});
return this;
};
})(jQuery, window, document);
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.0
*
*/
(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"4px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d||
window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());
e=l*(b[0].scrollHeight-b.outerHeight());h&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),g),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);v();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",r,!1),this.addEventListener("mousewheel",r,!1),this.addEventListener("MozMousePixelScroll",r,!1)):document.attachEvent("onmousewheel",r)}function w(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:u+"px"});
var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function v(){w();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;u>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),
c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative",width:a.width,height:a.height});b.css({width:a.width,height:a.height});var g=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?
"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});
b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&
(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery);
.webuploader-container {
position: relative;
}
.webuploader-element-invisible {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px,1px,1px,1px);
}
.webuploader-pick {
position: relative;
display: inline-block;
cursor: pointer;
background: #00b7ee;
padding: 10px 15px;
color: #fff;
text-align: center;
border-radius: 3px;
overflow: hidden;
}
.webuploader-pick-hover {
background: #00a2d4;
}
.webuploader-pick-disable {
opacity: 0.6;
pointer-events:none;
}
/**
* 初始化
*/
var Code = {
ztreeInstance: null,
tableName: "",
submitData: {},
switchs: {}
};
/**
* 选择table的事件
*/
Code.selectTable = function (tableName) {
SelectList.clearSelect("templateList");
Code.switchs = {};
if (SelectList.singelSelect("tableList", "tableName", tableName) == true) {
Code.tableName = tableName;
Code.setTableName(tableName);
} else {
Code.tableName = "";
}
};
/**
* 选择模板的事件
*/
Code.selectTemplate = function (templateKey) {
if (Code.tableName != "") {
if (SelectList.mutiSelect("templateList", "key", templateKey) == true) {
Code.switchs[templateKey] = true;
} else {
Code.switchs[templateKey] = false;
}
} else {
Feng.info("请先选择表");
}
};
/**
* 点击生成
*/
Code.generate = function () {
Code.submitData = {};
Code.submitData.tableName = Code.tableName;
this.set('projectPath').set('author').set('projectPackage').set('corePackage').set('ignoreTabelPrefix').set('bizName').set('moduleName').set('parentMenuName');
var baseAjax = Feng.baseAjax("/code/generate", "生成代码");
for (var item in Code.switchs) {
Code.submitData[item] = Code.switchs[item];
}
baseAjax.setData(Code.submitData);
baseAjax.start();
};
/**
* 设置表名称
*/
Code.setTableName = function (tableName) {
var preSize = $("#ignoreTabelPrefix").val().length;
$("#tableName").val(tableName);
$("#className").val(Feng.underLineToCamel(tableName.substring(preSize)));
};
/**
* 点击父级编号input框时
*/
Code.onClickDept = function (e, treeId, treeNode) {
$("#parentMenuName").attr("value", Code.ztreeInstance.getSelectedVal());
};
/**
* 显示父级菜单选择的树
*/
Code.showMenuSelectTree = function () {
Feng.showInputTree("parentMenuName", "pcodeTreeDiv", 15, 34);
};
$(function () {
var ztree = new $ZTree("pcodeTree", "/menu/selectMenuTreeList");
ztree.bindOnClick(Code.onClickDept);
ztree.init();
Code.ztreeInstance = ztree;
$("#pcodeTree").css('width',$("#parentMenuName").css('width'));
});
Code.set = function (key, value) {
Code.submitData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
};
\ No newline at end of file
/**
* 报销管理管理初始化
*/
var Expense = {
id: "ExpenseTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Expense.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: '报销id', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '报销金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
{title: '描述', field: 'desc', visible: true, align: 'center', valign: 'middle'},
{title: '状态', field: 'stateName', visible: true, align: 'center', valign: 'middle'},
{title: '创建时间', field: 'createtime', visible: true, align: 'center', valign: 'middle'},
{
title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) {
if (row.state == 3) {
return '<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;删除</button>';
} else {
return '<button type="button" class="btn btn-primary button-margin" onclick="Expense.findRecord(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;查看</button>' +
'<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;删除</button>';
}
}
}
];
};
/**
* 流程详情
*/
Expense.findRecord = function (id) {
var index = layer.open({
type: 2,
title: '流程详情',
area: ['1000px', '500px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/expense/expense_update/' + id
});
this.layerIndex = index;
};
/**
* 删除审核记录
*/
Expense.deleteRecord = function (id) {
var ajax = new $ax(Feng.ctxPath + "/expense/delete", function (data) {
Feng.success("删除成功!");
Expense.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("expenseId", id);
ajax.start();
};
/**
* 点击添加报销管理
*/
Expense.openAddExpense = function () {
var index = layer.open({
type: 2,
title: '添加报销管理',
area: ['600px', '350px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/expense/expense_add'
});
this.layerIndex = index;
};
/**
* 查询报销管理列表
*/
Expense.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Expense.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Expense.initColumn();
var table = new BSTable(Expense.id, "/expense/list", defaultColunms);
table.setPaginationType("client");
Expense.table = table.init();
});
/**
* 初始化报销管理详情对话框
*/
var ExpenseInfoDlg = {
expenseInfoData : {}
};
/**
* 清除数据
*/
ExpenseInfoDlg.clearData = function() {
this.expenseInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.set = function(key, val) {
this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
ExpenseInfoDlg.close = function() {
parent.layer.close(window.parent.Expense.layerIndex);
}
/**
* 收集数据
*/
ExpenseInfoDlg.collectData = function() {
this
.set('id')
.set('money')
.set('desc')
;
}
/**
* 提交添加
*/
ExpenseInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){
Feng.success("添加成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
/**
* 提交修改
*/
ExpenseInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){
Feng.success("修改成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
$(function() {
});
/**
* 报销管理管理初始化
*/
var Process = {
id: "ProcessTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Process.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: '任务id', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
{title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
{title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
{title: '申请人', field: 'assignee', visible: true, align: 'center', valign: 'middle'},
{
title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) {
if (row.selfFlag == true) {
return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;通过</button>' +
'<button type="button" class="btn btn-danger button-margin" onclick="Process.unPass(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;不通过</button>';
} else {
return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;通过</button>';
}
}
}
];
};
/**
* 通过审核
*/
Process.pass = function (id) {
var ajax = new $ax(Feng.ctxPath + "/process/pass", function (data) {
Feng.success("审核成功!");
Process.table.refresh();
}, function (data) {
Feng.error("审核失败!" + data.responseJSON.message + "!");
});
ajax.set("taskId", id);
ajax.start();
};
/**
* 未通过审核
*/
Process.unPass = function (id) {
var ajax = new $ax(Feng.ctxPath + "/process/unPass", function (data) {
Feng.success("审核成功!");
Process.table.refresh();
}, function (data) {
Feng.error("审核失败!" + data.responseJSON.message + "!");
});
ajax.set("taskId", id);
ajax.start();
};
/**
* 查询报销管理列表
*/
Process.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Process.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Process.initColumn();
var table = new BSTable(Process.id, "/process/list", defaultColunms);
table.setPaginationType("client");
Process.table = table.init();
});
/**
* 初始化报销管理详情对话框
*/
var ExpenseInfoDlg = {
expenseInfoData : {}
};
/**
* 清除数据
*/
ExpenseInfoDlg.clearData = function() {
this.expenseInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.set = function(key, val) {
this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
ExpenseInfoDlg.close = function() {
parent.layer.close(window.parent.Expense.layerIndex);
}
/**
* 收集数据
*/
ExpenseInfoDlg.collectData = function() {
this
.set('id')
.set('money')
.set('desc')
;
}
/**
* 提交添加
*/
ExpenseInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){
Feng.success("添加成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
/**
* 提交修改
*/
ExpenseInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){
Feng.success("修改成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
$(function() {
});
/**
* 部门管理初始化
*/
var Dept = {
id: "DeptTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Dept.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', align: 'center', valign: 'middle',width:'50px'},
{title: '部门简称', field: 'simplename', align: 'center', valign: 'middle', sortable: true},
{title: '部门全称', field: 'fullname', align: 'center', valign: 'middle', sortable: true},
{title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true},
{title: '备注', field: 'tips', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
Dept.check = function () {
var selected = $('#' + this.id).bootstrapTreeTable('getSelections');
if(selected.length == 0){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
Dept.seItem = selected[0];
return true;
}
};
/**
* 点击添加部门
*/
Dept.openAddDept = function () {
var index = layer.open({
type: 2,
title: '添加部门',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dept/dept_add'
});
this.layerIndex = index;
};
/**
* 打开查看部门详情
*/
Dept.openDeptDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '部门详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dept/dept_update/' + Dept.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除部门
*/
Dept.delete = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/dept/delete", function () {
Feng.success("删除成功!");
Dept.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("deptId",Dept.seItem.id);
ajax.start();
};
Feng.confirm("是否刪除该部门?", operation);
}
};
/**
* 查询部门列表
*/
Dept.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Dept.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Dept.initColumn();
var table = new BSTreeTable(Dept.id, "/dept/list", defaultColunms);
table.setExpandColumn(2);
table.setIdField("id");
table.setCodeField("id");
table.setParentCodeField("pid");
table.setExpandAll(true);
table.init();
Dept.table = table;
});
/**
* 初始化部门详情对话框
*/
var DeptInfoDlg = {
deptInfoData : {},
zTreeInstance : null,
validateFields: {
simplename: {
validators: {
notEmpty: {
message: '部门名称不能为空'
}
}
},
fullname: {
validators: {
notEmpty: {
message: '部门全称不能为空'
}
}
},
pName: {
validators: {
notEmpty: {
message: '上级名称不能为空'
}
}
}
}
};
/**
* 清除数据
*/
DeptInfoDlg.clearData = function() {
this.deptInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
DeptInfoDlg.set = function(key, val) {
this.deptInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
DeptInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
DeptInfoDlg.close = function() {
parent.layer.close(window.parent.Dept.layerIndex);
}
/**
* 点击部门ztree列表的选项时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
DeptInfoDlg.onClickDept = function(e, treeId, treeNode) {
$("#pName").attr("value", DeptInfoDlg.zTreeInstance.getSelectedVal());
$("#pid").attr("value", treeNode.id);
}
/**
* 显示部门选择的树
*
* @returns
*/
DeptInfoDlg.showDeptSelectTree = function() {
var pName = $("#pName");
var pNameOffset = $("#pName").offset();
$("#parentDeptMenu").css({
left : pNameOffset.left + "px",
top : pNameOffset.top + pName.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
}
/**
* 隐藏部门选择的树
*/
DeptInfoDlg.hideDeptSelectTree = function() {
$("#parentDeptMenu").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
}
/**
* 收集数据
*/
DeptInfoDlg.collectData = function() {
this.set('id').set('simplename').set('fullname').set('tips').set('num').set('pid');
}
/**
* 验证数据是否为空
*/
DeptInfoDlg.validate = function () {
$('#deptInfoForm').data("bootstrapValidator").resetForm();
$('#deptInfoForm').bootstrapValidator('validate');
return $("#deptInfoForm").data('bootstrapValidator').isValid();
}
/**
* 提交添加部门
*/
DeptInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/dept/add", function(data){
Feng.success("添加成功!");
window.parent.Dept.table.refresh();
DeptInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.deptInfoData);
ajax.start();
}
/**
* 提交修改
*/
DeptInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/dept/update", function(data){
Feng.success("修改成功!");
window.parent.Dept.table.refresh();
DeptInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.deptInfoData);
ajax.start();
}
function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "parentDeptMenu" || $(
event.target).parents("#parentDeptMenu").length > 0)) {
DeptInfoDlg.hideDeptSelectTree();
}
}
$(function() {
Feng.initValidator("deptInfoForm", DeptInfoDlg.validateFields);
var ztree = new $ZTree("parentDeptMenuTree", "/dept/tree");
ztree.bindOnClick(DeptInfoDlg.onClickDept);
ztree.init();
DeptInfoDlg.zTreeInstance = ztree;
});
/**
* 字典管理初始化
*/
var Dict = {
id: "DictTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Dict.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '详情', field: 'detail', align: 'center', valign: 'middle', sortable: true},
{title: '备注', field: 'tips', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
Dict.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Dict.seItem = selected[0];
return true;
}
};
/**
* 点击添加字典
*/
Dict.openAddDict = function () {
var index = layer.open({
type: 2,
title: '添加字典',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dict/dict_add'
});
this.layerIndex = index;
};
/**
* 打开查看字典详情
*/
Dict.openDictDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '字典详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dict/dict_edit/' + Dict.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除字典
*/
Dict.delete = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/dict/delete", function (data) {
Feng.success("删除成功!");
Dict.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("dictId", Dict.seItem.id);
ajax.start();
};
Feng.confirm("是否刪除字典 " + Dict.seItem.name + "?", operation);
}
};
/**
* 查询字典列表
*/
Dict.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Dict.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Dict.initColumn();
var table = new BSTable(Dict.id, "/dict/list", defaultColunms);
table.setPaginationType("client");
Dict.table = table.init();
});
/**
* 初始化字典详情对话框
*/
var DictInfoDlg = {
count: $("#itemSize").val(),
dictName: '', //字典的名称
dictCode: '',//字典类型编码
dictTips: '',//字典备注
mutiString: '', //拼接字符串内容(拼接字典条目)
itemTemplate: $("#itemTemplate").html()
};
/**
* item获取新的id
*/
DictInfoDlg.newId = function () {
if(this.count == undefined){
this.count = 0;
}
this.count = this.count + 1;
return "dictItem" + this.count;
};
/**
* 关闭此对话框
*/
DictInfoDlg.close = function () {
parent.layer.close(window.parent.Dict.layerIndex);
};
/**
* 添加条目
*/
DictInfoDlg.addItem = function () {
$("#itemsArea").append(this.itemTemplate);
$("#dictItem").attr("id", this.newId());
};
/**
* 删除item
*/
DictInfoDlg.deleteItem = function (event) {
var obj = Feng.eventParseObject(event);
obj = obj.is('button') ? obj : obj.parent();
obj.parent().parent().remove();
};
/**
* 清除为空的item Dom
*/
DictInfoDlg.clearNullDom = function(){
$("[name='dictItem']").each(function(){
var num = $(this).find("[name='itemNum']").val();
var name = $(this).find("[name='itemName']").val();
if(num == '' || name == ''){
$(this).remove();
}
});
};
/**
* 收集添加字典的数据
*/
DictInfoDlg.collectData = function () {
this.clearNullDom();
var mutiString = "";
$("[name='dictItem']").each(function(){
var code = $(this).find("[name='itemCode']").val();
var name = $(this).find("[name='itemName']").val();
var num = $(this).find("[name='itemNum']").val();
mutiString = mutiString + (code + ":" + name + ":"+ num+";");
});
this.dictName = $("#dictName").val();
this.dictCode = $("#dictCode").val();
this.dictTips = $("#dictTips").val();
this.mutiString = mutiString;
};
/**
* 提交添加字典
*/
DictInfoDlg.addSubmit = function () {
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/dict/add", function (data) {
Feng.success("添加成功!");
window.parent.Dict.table.refresh();
DictInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set('dictName',this.dictName);
ajax.set('dictCode',this.dictCode);
ajax.set('dictTips',this.dictTips);
ajax.set('dictValues',this.mutiString);
ajax.start();
};
/**
* 提交修改
*/
DictInfoDlg.editSubmit = function () {
this.collectData();
var ajax = new $ax(Feng.ctxPath + "/dict/update", function (data) {
Feng.success("修改成功!");
window.parent.Dict.table.refresh();
DictInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set('dictId',$("#dictId").val());
ajax.set('dictName',this.dictName);
ajax.set('dictCode',this.dictCode);
ajax.set('dictTips',this.dictTips);
ajax.set('dictValues',this.mutiString);
ajax.start();
};
/**
* 日志管理初始化
*/
var OptLog = {
id: "OptLogTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
OptLog.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '日志类型', field: 'logtype', align: 'center', valign: 'middle', sortable: true},
{title: '日志名称', field: 'logname', align: 'center', valign: 'middle', sortable: true},
// {title: '用户名称', field: 'userName', align: 'center', valign: 'middle', sortable: true, sortName: 'userid'},
{title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
{title: '类名', field: 'classname', align: 'center', valign: 'middle', sortable: true},
{title: '方法名', field: 'method', align: 'center', valign: 'middle', sortable: true},
{title: '时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
OptLog.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if(selected.length == 0){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
OptLog.seItem = selected[0];
return true;
}
};
/**
* 查看日志详情
*/
OptLog.detail = function () {
if (this.check()) {
var ajax = new $ax(Feng.ctxPath + "/log/detail/" + this.seItem.id, function (data) {
Feng.infoDetail("日志详情", data.regularMessage);
}, function (data) {
Feng.error("获取详情失败!");
});
ajax.start();
}
};
/**
* 清空日志
*/
OptLog.delLog = function () {
Feng.confirm("是否清空所有日志?",function(){
var ajax = Feng.baseAjax("/log/delLog","清空日志");
ajax.start();
OptLog.table.refresh();
});
}
/**
* 查询表单提交参数对象
* @returns {{}}
*/
OptLog.formParams = function() {
var queryData = {};
queryData['logName'] = $("#logName").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
queryData['logType'] = $("#logType").val();
return queryData;
}
/**
* 查询日志列表
*/
OptLog.search = function () {
OptLog.table.refresh({query: OptLog.formParams()});
};
$(function () {
var defaultColunms = OptLog.initColumn();
var table = new BSTable(OptLog.id, "/log/list", defaultColunms);
table.setPaginationType("server");
table.setQueryParams(OptLog.formParams());
OptLog.table = table.init();
});
/**
* 日志管理初始化
*/
var LoginLog = {
id: "LoginLogTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
LoginLog.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '日志名称', field: 'logname', align: 'center', valign: 'middle', sortable: true},
{title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
{title: '时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true},
{title: 'ip', field: 'ip', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
LoginLog.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
LoginLog.seItem = selected[0];
return true;
}
};
/**
* 清空日志
*/
LoginLog.delLog = function () {
Feng.confirm("是否清空所有日志?", function () {
var ajax = Feng.baseAjax("/loginLog/delLoginLog", "清空日志");
ajax.start();
LoginLog.table.refresh();
});
}
/**
* 查询日志列表
*/
LoginLog.search = function () {
var queryData = {};
queryData['logName'] = $("#logName").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
LoginLog.table.refresh({query: queryData});
};
$(function () {
init();
var defaultColunms = LoginLog.initColumn();
var table = new BSTable(LoginLog.id, "/loginLog/list", defaultColunms);
table.setPaginationType("server");
LoginLog.table = table.init();
});
function init() {
var BootstrapTable = $.fn.bootstrapTable.Constructor;
BootstrapTable.prototype.onSort = function (event) {
var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(),
$this_ = this.$header.find('th').eq($this.index()),
sortName = this.header.sortNames[$this.index()];
this.$header.add(this.$header_).find('span.order').remove();
if (this.options.sortName === $this.data('field')) {
this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
} else {
this.options.sortName = sortName || $this.data('field');
this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
}
this.trigger('sort', this.options.sortName, this.options.sortOrder);
$this.add($this_).data('order', this.options.sortOrder);
// Assign the correct sortable arrow
this.getCaret();
if (this.options.sidePagination === 'server') {
this.initServer(this.options.silentSort);
return;
}
this.initSort();
this.initBody();
};
BootstrapTable.prototype.getCaret = function () {
var that = this;
$.each(this.$header.find('th'), function (i, th) {
var sortName = that.header.sortNames[i];
$(th).find('.sortable').removeClass('desc asc').addClass((sortName || $(th).data('field')) === that.options.sortName ? that.options.sortOrder : 'both');
});
};
}
/**
* 角色管理的单例
*/
var Menu = {
id: "menuTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Menu.initColumn = function () {
var columns = [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '菜单名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '菜单编号', field: 'code', align: 'center', valign: 'middle', sortable: true},
{title: '菜单父编号', field: 'pcode', align: 'center', valign: 'middle', sortable: true},
{title: '请求地址', field: 'url', align: 'center', valign: 'middle', sortable: true},
{title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true},
{title: '层级', field: 'levels', align: 'center', valign: 'middle', sortable: true},
{title: '是否是菜单', field: 'isMenuName', align: 'center', valign: 'middle', sortable: true},
{title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}]
return columns;
};
/**
* 检查是否选中
*/
Menu.check = function () {
var selected = $('#' + this.id).bootstrapTreeTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Menu.seItem = selected[0];
return true;
}
};
/**
* 点击添加菜单
*/
Menu.openAddMenu = function () {
var index = layer.open({
type: 2,
title: '添加菜单',
area: ['830px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/menu/menu_add'
});
this.layerIndex = index;
};
/**
* 点击修改
*/
Menu.openChangeMenu = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '修改菜单',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/menu/menu_edit/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除
*/
Menu.delMenu = function () {
if (this.check()) {
var operation = function () {
var ajax = new $ax(Feng.ctxPath + "/menu/remove", function (data) {
Feng.success("删除成功!");
Menu.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("menuId", Menu.seItem.id);
ajax.start();
};
Feng.confirm("是否刪除该菜单?", operation);
}
};
/**
* 搜索
*/
Menu.search = function () {
var queryData = {};
queryData['menuName'] = $("#menuName").val();
queryData['level'] = $("#level").val();
Menu.table.refresh({query: queryData});
}
$(function () {
var defaultColunms = Menu.initColumn();
var table = new BSTreeTable(Menu.id, "/menu/list", defaultColunms);
table.setExpandColumn(2);
table.setIdField("id");
table.setCodeField("code");
table.setParentCodeField("pcode");
table.setExpandAll(true);
table.init();
Menu.table = table;
});
/**
* 菜单详情对话框
*/
var MenuInfoDlg = {
menuInfoData: {},
ztreeInstance: null,
validateFields: {
name: {
validators: {
notEmpty: {
message: '菜单名称不能为空'
}
}
},
code: {
validators: {
notEmpty: {
message: '菜单编号不能为空'
}
}
},
pcodeName: {
validators: {
notEmpty: {
message: '父菜单不能为空'
}
}
},
url: {
validators: {
notEmpty: {
message: '请求地址不能为空'
}
}
},
num: {
validators: {
notEmpty: {
message: '序号不能为空'
}
}
}
}
};
/**
* 清除数据
*/
MenuInfoDlg.clearData = function () {
this.menuInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
MenuInfoDlg.set = function (key, value) {
this.menuInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
MenuInfoDlg.get = function (key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
MenuInfoDlg.close = function () {
parent.layer.close(window.parent.Menu.layerIndex);
}
/**
* 收集数据
*/
MenuInfoDlg.collectData = function () {
this.set('id').set('name').set('code').set('pcode').set('url').set('num').set('levels').set('icon').set("ismenu");
}
/**
* 验证数据是否为空
*/
MenuInfoDlg.validate = function () {
$('#menuInfoForm').data("bootstrapValidator").resetForm();
$('#menuInfoForm').bootstrapValidator('validate');
return $("#menuInfoForm").data('bootstrapValidator').isValid();
}
/**
* 提交添加用户
*/
MenuInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/menu/add", function (data) {
Feng.success("添加成功!");
window.parent.Menu.table.refresh();
MenuInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.menuInfoData);
ajax.start();
}
/**
* 提交修改
*/
MenuInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/menu/edit", function (data) {
Feng.success("修改成功!");
window.parent.Menu.table.refresh();
MenuInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.menuInfoData);
ajax.start();
}
/**
* 点击父级编号input框时
*/
MenuInfoDlg.onClickDept = function (e, treeId, treeNode) {
$("#pcodeName").attr("value", MenuInfoDlg.ztreeInstance.getSelectedVal());
$("#pcode").attr("value", treeNode.id);
};
/**
* 显示父级菜单选择的树
*/
MenuInfoDlg.showMenuSelectTree = function () {
Feng.showInputTree("pcodeName", "pcodeTreeDiv", 15, 34);
};
$(function () {
Feng.initValidator("menuInfoForm", MenuInfoDlg.validateFields);
var ztree = new $ZTree("pcodeTree", "/menu/selectMenuTreeList");
ztree.bindOnClick(MenuInfoDlg.onClickDept);
ztree.init();
MenuInfoDlg.ztreeInstance = ztree;
//初始化是否是菜单
if($("#ismenuValue").val() == undefined){
$("#ismenu").val(0);
}else{
$("#ismenu").val($("#ismenuValue").val());
}
});
/**
* 通知管理初始化
*/
var Notice = {
id: "NoticeTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Notice.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '标题', field: 'title', align: 'center', valign: 'middle', sortable: true},
{title: '内容', field: 'content', align: 'center', valign: 'middle', sortable: true},
{title: '发布者', field: 'createrName', align: 'center', valign: 'middle', sortable: true},
{title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true}
];
};
/**
* 检查是否选中
*/
Notice.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Notice.seItem = selected[0];
return true;
}
};
/**
* 点击添加通知
*/
Notice.openAddNotice = function () {
var index = layer.open({
type: 2,
title: '添加通知',
area: ['800px', '500px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/notice/notice_add'
});
this.layerIndex = index;
};
/**
* 打开查看通知详情
*/
Notice.openNoticeDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '通知详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/notice/notice_update/' + Notice.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除通知
*/
Notice.delete = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/notice/delete", function (data) {
Feng.success("删除成功!");
Notice.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("noticeId", Notice.seItem.id);
ajax.start();
};
Feng.confirm("是否删除通知 " + Notice.seItem.title + "?", operation);
}
};
/**
* 查询通知列表
*/
Notice.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Notice.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Notice.initColumn();
var table = new BSTable(Notice.id, "/notice/list", defaultColunms);
table.setPaginationType("client");
Notice.table = table.init();
});
/**
* 初始化通知详情对话框
*/
var NoticeInfoDlg = {
noticeInfoData: {},
editor: null,
validateFields: {
title: {
validators: {
notEmpty: {
message: '标题不能为空'
}
}
}
}
};
/**
* 清除数据
*/
NoticeInfoDlg.clearData = function () {
this.noticeInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
NoticeInfoDlg.set = function (key, value) {
this.noticeInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
NoticeInfoDlg.get = function (key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
NoticeInfoDlg.close = function () {
parent.layer.close(window.parent.Notice.layerIndex);
}
/**
* 收集数据
*/
NoticeInfoDlg.collectData = function () {
this.noticeInfoData['content'] = NoticeInfoDlg.editor.txt.html();
this.set('id').set('title');
}
/**
* 验证数据是否为空
*/
NoticeInfoDlg.validate = function () {
$('#noticeInfoForm').data("bootstrapValidator").resetForm();
$('#noticeInfoForm').bootstrapValidator('validate');
return $("#noticeInfoForm").data('bootstrapValidator').isValid();
};
/**
* 提交添加
*/
NoticeInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/notice/add", function (data) {
Feng.success("添加成功!");
window.parent.Notice.table.refresh();
NoticeInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.noticeInfoData);
ajax.start();
}
/**
* 提交修改
*/
NoticeInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/notice/update", function (data) {
Feng.success("修改成功!");
window.parent.Notice.table.refresh();
NoticeInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.noticeInfoData);
ajax.start();
}
$(function () {
Feng.initValidator("noticeInfoForm", NoticeInfoDlg.validateFields);
//初始化编辑器
var E = window.wangEditor;
var editor = new E('#editor');
editor.create();
editor.txt.html($("#contentVal").val());
NoticeInfoDlg.editor = editor;
});
/**
* 角色管理的单例
*/
var Role = {
id: "roleTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Role.initColumn = function () {
var columns = [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '上级角色', field: 'pName', align: 'center', valign: 'middle', sortable: true},
{title: '所在部门', field: 'deptName', align: 'center', valign: 'middle', sortable: true},
{title: '别名', field: 'tips', align: 'center', valign: 'middle', sortable: true}]
return columns;
};
/**
* 检查是否选中
*/
Role.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Role.seItem = selected[0];
return true;
}
};
/**
* 点击添加管理员
*/
Role.openAddRole = function () {
var index = layer.open({
type: 2,
title: '添加角色',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/role/role_add'
});
this.layerIndex = index;
};
/**
* 点击修改按钮时
*/
Role.openChangeRole = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '修改角色',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/role/role_edit/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除角色
*/
Role.delRole = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/role/remove", function () {
Feng.success("删除成功!");
Role.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("roleId", Role.seItem.id);
ajax.start();
};
Feng.confirm("是否删除角色 " + Role.seItem.name + "?",operation);
}
};
/**
* 权限配置
*/
Role.assign = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '权限配置',
area: ['300px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/role/role_assign/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 搜索角色
*/
Role.search = function () {
var queryData = {};
queryData['roleName'] = $("#roleName").val();
Role.table.refresh({query: queryData});
}
$(function () {
var defaultColunms = Role.initColumn();
var table = new BSTable(Role.id, "/role/list", defaultColunms);
table.setPaginationType("client");
table.init();
Role.table = table;
});
/**
* 角色详情对话框(可用于添加和修改对话框)
*/
var RolInfoDlg = {
roleInfoData: {},
deptZtree: null,
pNameZtree: null,
validateFields: {
name: {
validators: {
notEmpty: {
message: '用户名不能为空'
}
}
},
tips: {
validators: {
notEmpty: {
message: '别名不能为空'
}
}
},
pName: {
validators: {
notEmpty: {
message: '父级名称不能为空'
}
}
}
}
};
/**
* 清除数据
*/
RolInfoDlg.clearData = function () {
this.roleInfoData = {};
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
RolInfoDlg.set = function (key, value) {
this.roleInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
RolInfoDlg.get = function (key) {
return $("#" + key).val();
};
/**
* 关闭此对话框
*/
RolInfoDlg.close = function () {
parent.layer.close(window.parent.Role.layerIndex);
};
/**
* 点击部门input框时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
RolInfoDlg.onClickDept = function (e, treeId, treeNode) {
$("#deptName").attr("value", RolInfoDlg.deptZtree.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
};
RolInfoDlg.onDblClickDept = function (e, treeId, treeNode) {
$("#deptName").attr("value", RolInfoDlg.deptZtree.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
$("#deptContent").fadeOut("fast");
};
/**
* 点击父级菜单input框时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
RolInfoDlg.onClickPName = function (e, treeId, treeNode) {
$("#pName").attr("value", RolInfoDlg.pNameZtree.getSelectedVal());
$("#pid").attr("value", treeNode.id);
};
/**
* 显示部门选择的树
*
* @returns
*/
RolInfoDlg.showDeptSelectTree = function () {
Feng.showInputTree("deptName", "deptContent");
};
/**
* 显示父级菜单的树
*
* @returns
*/
RolInfoDlg.showPNameSelectTree = function () {
Feng.showInputTree("pName", "pNameContent");
};
/**
* 收集数据
*/
RolInfoDlg.collectData = function () {
this.set('id').set('name').set('pid').set('deptid').set('tips').set('num');
};
/**
* 验证数据是否为空
*/
RolInfoDlg.validate = function () {
$('#roleInfoForm').data("bootstrapValidator").resetForm();
$('#roleInfoForm').bootstrapValidator('validate');
return $("#roleInfoForm").data('bootstrapValidator').isValid();
};
/**
* 提交添加用户
*/
RolInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/role/add", function (data) {
Feng.success("添加成功!");
window.parent.Role.table.refresh();
RolInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.roleInfoData);
ajax.start();
};
/**
* 提交修改
*/
RolInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/role/edit", function (data) {
Feng.success("修改成功!");
window.parent.Role.table.refresh();
RolInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.roleInfoData);
ajax.start();
};
$(function () {
Feng.initValidator("roleInfoForm", RolInfoDlg.validateFields);
var deptTree = new $ZTree("deptTree", "/dept/tree");
deptTree.bindOnClick(RolInfoDlg.onClickDept);
deptTree.bindOnDblClick(RolInfoDlg.onDblClickDept)
deptTree.init();
RolInfoDlg.deptZtree = deptTree;
var pNameTree = new $ZTree("pNameTree", "/role/roleTreeList");
pNameTree.bindOnClick(RolInfoDlg.onClickPName);
pNameTree.init();
RolInfoDlg.pNameZtree = pNameTree;
});
/**
* 系统管理--用户管理的单例对象
*/
var MgrUser = {
id: "managerTable",//表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1,
deptid:0
};
/**
* 初始化表格的列
*/
MgrUser.initColumn = function () {
var columns = [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '账号', field: 'account', align: 'center', valign: 'middle', sortable: true},
{title: '姓名', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '性别', field: 'sexName', align: 'center', valign: 'middle', sortable: true},
{title: '角色', field: 'roleName', align: 'center', valign: 'middle', sortable: true},
{title: '部门', field: 'deptName', align: 'center', valign: 'middle', sortable: true},
{title: '邮箱', field: 'email', align: 'center', valign: 'middle', sortable: true},
{title: '电话', field: 'phone', align: 'center', valign: 'middle', sortable: true},
{title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}];
return columns;
};
/**
* 检查是否选中
*/
MgrUser.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
MgrUser.seItem = selected[0];
return true;
}
};
/**
* 点击添加管理员
*/
MgrUser.openAddMgr = function () {
var index = layer.open({
type: 2,
title: '添加管理员',
area: ['800px', '560px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/mgr/user_add'
});
this.layerIndex = index;
};
/**
* 点击修改按钮时
* @param userId 管理员id
*/
MgrUser.openChangeUser = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '编辑管理员',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/mgr/user_edit/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 点击角色分配
* @param
*/
MgrUser.roleAssign = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '角色分配',
area: ['300px', '400px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/mgr/role_assign/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除用户
*/
MgrUser.delMgrUser = function () {
if (this.check()) {
var operation = function(){
var userId = MgrUser.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/delete", function () {
Feng.success("删除成功!");
MgrUser.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("userId", userId);
ajax.start();
};
Feng.confirm("是否删除用户" + MgrUser.seItem.account + "?",operation);
}
};
/**
* 冻结用户账户
* @param userId
*/
MgrUser.freezeAccount = function () {
if (this.check()) {
var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/freeze", function (data) {
Feng.success("冻结成功!");
MgrUser.table.refresh();
}, function (data) {
Feng.error("冻结失败!" + data.responseJSON.message + "!");
});
ajax.set("userId", userId);
ajax.start();
}
};
/**
* 解除冻结用户账户
* @param userId
*/
MgrUser.unfreeze = function () {
if (this.check()) {
var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/unfreeze", function (data) {
Feng.success("解除冻结成功!");
MgrUser.table.refresh();
}, function (data) {
Feng.error("解除冻结失败!");
});
ajax.set("userId", userId);
ajax.start();
}
}
/**
* 重置密码
*/
MgrUser.resetPwd = function () {
if (this.check()) {
var userId = this.seItem.id;
parent.layer.confirm('是否重置密码为111111?', {
btn: ['确定', '取消'],
shade: false //不显示遮罩
}, function () {
var ajax = new $ax(Feng.ctxPath + "/mgr/reset", function (data) {
Feng.success("重置密码成功!");
}, function (data) {
Feng.error("重置密码失败!");
});
ajax.set("userId", userId);
ajax.start();
});
}
};
MgrUser.resetSearch = function () {
$("#name").val("");
$("#beginTime").val("");
$("#endTime").val("");
MgrUser.search();
}
MgrUser.search = function () {
var queryData = {};
queryData['deptid'] = MgrUser.deptid;
queryData['name'] = $("#name").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
MgrUser.table.refresh({query: queryData});
}
MgrUser.onClickDept = function (e, treeId, treeNode) {
MgrUser.deptid = treeNode.id;
MgrUser.search();
};
$(function () {
var defaultColunms = MgrUser.initColumn();
var table = new BSTable("managerTable", "/mgr/list", defaultColunms);
table.setPaginationType("client");
MgrUser.table = table.init();
var ztree = new $ZTree("deptTree", "/dept/tree");
ztree.bindOnClick(MgrUser.onClickDept);
ztree.init();
});
/**
* 用户详情对话框(可用于添加和修改对话框)
*/
var UserInfoDlg = {
userInfoData: {},
validateFields: {
account: {
validators: {
notEmpty: {
message: '账户不能为空'
}
}
},
name: {
validators: {
notEmpty: {
message: '姓名不能为空'
}
}
},
citySel: {
validators: {
notEmpty: {
message: '部门不能为空'
}
}
},
password: {
validators: {
notEmpty: {
message: '密码不能为空'
},
identical: {
field: 'rePassword',
message: '两次密码不一致'
},
}
},
rePassword: {
validators: {
notEmpty: {
message: '密码不能为空'
},
identical: {
field: 'password',
message: '两次密码不一致'
},
}
}
}
};
/**
* 清除数据
*/
UserInfoDlg.clearData = function () {
this.userInfoData = {};
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
UserInfoDlg.set = function (key, value) {
if(typeof value == "undefined"){
if(typeof $("#" + key).val() =="undefined"){
var str="";
var ids="";
$("input[name='"+key+"']:checkbox").each(function(){
if(true == $(this).is(':checked')){
str+=$(this).val()+",";
}
});
if(str){
if(str.substr(str.length-1)== ','){
ids = str.substr(0,str.length-1);
}
}else{
$("input[name='"+key+"']:radio").each(function(){
if(true == $(this).is(':checked')){
ids=$(this).val()
}
});
}
this.userInfoData[key] = ids;
}else{
this.userInfoData[key]= $("#" + key).val();
}
}
return this;
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
UserInfoDlg.get = function (key) {
return $("#" + key).val();
};
/**
* 关闭此对话框
*/
UserInfoDlg.close = function () {
parent.layer.close(window.parent.MgrUser.layerIndex);
};
/**
* 点击部门input框时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
UserInfoDlg.onClickDept = function (e, treeId, treeNode) {
$("#citySel").attr("value", instance.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
};
/**
* 显示部门选择的树
*
* @returns
*/
UserInfoDlg.showDeptSelectTree = function () {
var cityObj = $("#citySel");
var cityOffset = $("#citySel").offset();
$("#menuContent").css({
left: cityOffset.left + "px",
top: cityOffset.top + cityObj.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
};
/**
* 显示用户详情部门选择的树
*
* @returns
*/
UserInfoDlg.showInfoDeptSelectTree = function () {
var cityObj = $("#citySel");
var cityPosition = $("#citySel").position();
$("#menuContent").css({
left: cityPosition.left + "px",
top: cityPosition.top + cityObj.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
};
/**
* 隐藏部门选择的树
*/
UserInfoDlg.hideDeptSelectTree = function () {
$("#menuContent").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
};
/**
* 收集数据
*/
UserInfoDlg.collectData = function () {
this.set('id').set('account').set('sex').set('password').set('avatar')
.set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone');
};
/**
* 验证两个密码是否一致
*/
UserInfoDlg.validatePwd = function () {
var password = this.get("password");
var rePassword = this.get("rePassword");
if (password == rePassword) {
return true;
} else {
return false;
}
};
/**
* 验证数据是否为空
*/
UserInfoDlg.validate = function () {
$('#userInfoForm').data("bootstrapValidator").resetForm();
$('#userInfoForm').bootstrapValidator('validate');
return $("#userInfoForm").data('bootstrapValidator').isValid();
};
/**
* 提交添加用户
*/
UserInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
if (!this.validatePwd()) {
Feng.error("两次密码输入不一致");
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/mgr/add", function (data) {
Feng.success("添加成功!");
window.parent.MgrUser.table.refresh();
UserInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.userInfoData);
ajax.start();
};
/**
* 提交修改
*/
UserInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/mgr/edit", function (data) {
Feng.success("修改成功!");
if (window.parent.MgrUser != undefined) {
window.parent.MgrUser.table.refresh();
UserInfoDlg.close();
}
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.userInfoData);
ajax.start();
};
/**
* 修改密码
*/
UserInfoDlg.chPwd = function () {
var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) {
Feng.success("修改成功!");
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set("oldPwd");
ajax.set("newPwd");
ajax.set("rePwd");
ajax.start();
};
function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(
event.target).parents("#menuContent").length > 0)) {
UserInfoDlg.hideDeptSelectTree();
}
}
$(function () {
Feng.initValidator("userInfoForm", UserInfoDlg.validateFields);
//初始化性别选项
$("#sex").val($("#sexValue").val());
var ztree = new $ZTree("treeDemo", "/dept/tree");
ztree.bindOnClick(UserInfoDlg.onClickDept);
ztree.init();
instance = ztree;
// 初始化头像上传
var avatarUp = new $WebUpload("avatar");
avatarUp.setUploadBarId("progressBar");
avatarUp.init();
});
package com.stylefeng.guns.base;
import com.stylefeng.guns.GunsApplication;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
/**
* 基础测试类
*
* @author stylefeng
* @Date 2017/5/21 16:10
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = GunsApplication.class)
@WebAppConfiguration
//@Transactional //打开的话测试之后数据可自动回滚
public class BaseJunit {
@Autowired
WebApplicationContext webApplicationContext;
protected MockMvc mockMvc;
@Before
public void setupMockMvc(){
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
@Before
public void initDatabase(){
}
}
package com.stylefeng.guns.multi.entity;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author fengshuonan
* @since 2018-07-10
*/
public class Test implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "aaa", type = IdType.AUTO)
private Integer aaa;
private String bbb;
public Integer getAaa() {
return aaa;
}
public void setAaa(Integer aaa) {
this.aaa = aaa;
}
public String getBbb() {
return bbb;
}
public void setBbb(String bbb) {
this.bbb = bbb;
}
@Override
public String toString() {
return "Test{" +
"aaa=" + aaa +
", bbb=" + bbb +
"}";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.example.modular.mapper.TestMapper">
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.stylefeng.guns.multi.entity.Test">
<id column="aaa" property="aaa" />
<result column="bbb" property="bbb" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
aaa, bbb
</sql>
</mapper>
package com.stylefeng.guns.multi.service;
/**
* <p>
* 服务类
* </p>
*
* @author fengshuonan
* @since 2018-07-10
*/
public interface TestService {
/**
* 测试多数据源的业务
*
* @author stylefeng
* @Date 2017/6/23 23:02
*/
void testBiz();
/**
* 测试多数据源的业务
*
* @author stylefeng
* @Date 2017/6/23 23:02
*/
void testGuns();
/**
* 测试多数据源的业务
*
* @author stylefeng
* @Date 2017/6/23 23:02
*/
void testAll();
}
package com.stylefeng.guns.multi.service.impl;
import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
import com.stylefeng.guns.core.common.constant.DatasourceEnum;
import com.stylefeng.guns.multi.entity.Test;
import com.stylefeng.guns.multi.mapper.TestMapper;
import com.stylefeng.guns.multi.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 服务实现类
* </p>
*
* @author fengshuonan
* @since 2018-07-10
*/
@Service
public class TestServiceImpl implements TestService {
@Autowired
private TestMapper testMapper;
@Override
@DataSource(name = DatasourceEnum.DATA_SOURCE_BIZ)
@Transactional
public void testBiz() {
Test test = new Test();
test.setBbb("bizTest");
testMapper.insert(test);
}
@Override
@DataSource(name = DatasourceEnum.DATA_SOURCE_GUNS)
@Transactional
public void testGuns() {
Test test = new Test();
test.setBbb("gunsTest");
testMapper.insert(test);
}
@Override
@Transactional
public void testAll() {
testBiz();
testGuns();
//int i = 1 / 0;
}
}
package com.stylefeng.guns.multi.test;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.multi.service.TestService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 业务测试
*
* @author fengshuonan
* @date 2017-06-23 23:12
*/
public class BizTest extends BaseJunit {
@Autowired
TestService testService;
@Test
public void test() {
testService.testGuns();
testService.testBiz();
//testService.testAll();
}
}
package com.stylefeng.guns.shiro;
import org.springframework.util.Base64Utils;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
public class Base64Test {
/**
* Shiro 记住密码采用的是AES加密,AES key length 需要是16位,该方法生成16位的key
*/
public static void main(String[] args) {
String keyStr = "guns";
byte[] keys;
try {
keys = keyStr.getBytes("UTF-8");
System.out.println(Base64Utils.encodeToString(Arrays.copyOf(keys, 16)));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.NoticeMapper;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertTrue;
/**
* 首页通知展示测试
*
* @author fengshuonan
* @date 2017-05-21 15:02
*/
public class BlackBoardTest extends BaseJunit {
@Autowired
NoticeMapper noticeMapper;
@Test
public void blackBoardTest() {
List<Map<String, Object>> notices = noticeMapper.list(null);
assertTrue(notices.size() > 0);
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.DeptMapper;
import com.stylefeng.guns.modular.system.model.Dept;
import org.junit.Test;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* 字典服务测试
*
* @author fengshuonan
* @date 2017-04-27 17:05
*/
public class DeptTest extends BaseJunit {
@Resource
DeptMapper deptMapper;
@Test
public void addDeptTest() {
Dept dept = new Dept();
dept.setFullname("测试fullname");
dept.setNum(5);
dept.setPid(1);
dept.setSimplename("测试");
dept.setTips("测试tips");
dept.setVersion(1);
Integer insert = deptMapper.insert(dept);
assertEquals(insert, new Integer(1));
}
@Test
public void updateTest() {
Dept dept = this.deptMapper.selectById(24);
dept.setTips("哈哈");
boolean flag = dept.updateById();
assertTrue(flag);
}
@Test
public void deleteTest() {
Dept dept = this.deptMapper.selectById(24);
Integer integer = deptMapper.deleteById(dept);
assertTrue(integer > 0);
}
@Test
public void listTest() {
List<Map<String, Object>> list = this.deptMapper.list("总公司");
assertTrue(list.size() > 0);
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.DictMapper;
import com.stylefeng.guns.modular.system.service.IDictService;
import org.junit.Assert;
import org.junit.Test;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 字典服务测试
*
* @author fengshuonan
* @date 2017-04-27 17:05
*/
public class DictTest extends BaseJunit {
@Resource
IDictService dictService;
@Resource
DictMapper dictMapper;
@Test
public void addTest() {
String dictCode = "test";
String dictName = "字典测试";
String dictTips = "这是一个字典测试";
String dictValues = "1:测试1:1;2:测试2:2";
dictService.addDict(dictCode,dictName,dictTips, dictValues);
}
@Test
public void editTest() {
dictService.editDict(16, "tes","测试","备注", "1:测试1;2:测试2");
}
@Test
public void deleteTest() {
this.dictService.delteDict(16);
}
@Test
public void listTest() {
List<Map<String, Object>> list = this.dictMapper.list("性别");
Assert.assertTrue(list.size() > 0);
}
}
package com.stylefeng.guns.system;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.MenuMapper;
import com.stylefeng.guns.modular.system.model.Menu;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Stack;
/**
* 菜单测试
*
* @author fengshuonan
* @date 2017-06-13 21:23
*/
public class MenuTest extends BaseJunit {
@Autowired
MenuMapper menuMapper;
/**
* 初始化pcodes
*
* @author stylefeng
* @Date 2017/6/13 21:24
*/
@Test
public void generatePcodes() {
List<Menu> menus = menuMapper.selectList(null);
for (Menu menu : menus) {
if ("0".equals(menu.getPcode()) || null == menu.getPcode()) {
menu.setPcodes("[0],");
} else {
StringBuffer sb = new StringBuffer();
Menu parentMenu = getParentMenu(menu.getCode());
sb.append("[0],");
Stack<String> pcodes = new Stack<>();
while (null != parentMenu.getPcode()) {
pcodes.push(parentMenu.getCode());
parentMenu = getParentMenu(parentMenu.getPcode());
}
int pcodeSize = pcodes.size();
for (int i = 0; i < pcodeSize; i++) {
String code = pcodes.pop();
if (code.equals(menu.getCode())) {
continue;
}
sb.append("[" + code + "],");
}
menu.setPcodes(sb.toString());
}
menu.updateById();
}
}
private Menu getParentMenu(String code) {
Wrapper<Menu> wrapper = new EntityWrapper<Menu>();
wrapper = wrapper.eq("code", code);
List<Menu> menus = menuMapper.selectList(wrapper);
if (menus == null || menus.size() == 0) {
return new Menu();
} else {
return menus.get(0);
}
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.UserMapper;
import org.junit.Test;
import javax.annotation.Resource;
/**
* 用户测试
*
* @author fengshuonan
* @date 2017-04-27 17:05
*/
public class UserTest extends BaseJunit {
@Resource
UserMapper userMapper;
@Test
public void userTest() throws Exception {
}
}
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50719
Source Host : localhost:3306
Source Schema : guns
Target Server Type : MySQL
Target Server Version : 50719
File Encoding : 65001
Date: 10/07/2018 14:09:19
*/
DROP DATABASE IF EXISTS guns_test;
CREATE DATABASE IF NOT EXISTS guns_test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
use guns_test;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for test
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`aaa` int(11) NOT NULL AUTO_INCREMENT,
`bbb` varchar(255) DEFAULT NULL,
PRIMARY KEY (`aaa`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stylefeng</groupId>
<artifactId>guns-parent</artifactId>
<version>1.0.0</version>
<name>guns-parent</name>
<packaging>pom</packaging>
<groupId>com.stylefeng.guns</groupId>
<artifactId>guns-admin</artifactId>
<version>1.0.0</version>
<modules>
<module>guns-admin</module>
</modules>
<name>guns-admin</name>
<description>guns 的spring boot版本</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<guns.version>1.0.0</guns.version>
<mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version>
<shiro.version>1.4.0</shiro.version>
<mybatis-plus.version>2.3</mybatis-plus.version>
......@@ -49,123 +42,137 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<version>${mybatisplus-spring-boot-starter.version}</version>
</dependency>
<!--shiro依赖-->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generate</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>${beetl.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.core.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-core</artifactId>
<version>1.0.0</version>
</dependency>
<!--spring boot依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!--shiro依赖-->
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>${shiro.version}</version>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>${ehcache.version}</version>
</dependency>
<!--需要分布式session的话需要放开注释-->
<!--<dependency>-->
<!--<groupId>org.springframework.session</groupId>-->
<!--<artifactId>spring-session-data-redis</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.boot</groupId>-->
<!--<artifactId>spring-boot-starter-data-redis</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>com.github.penggle</groupId>
<artifactId>kaptcha</artifactId>
<version>${kaptcha.version}</version>
</dependency>
<dependency>
<groupId>com.ibeetl</groupId>
<artifactId>beetl</artifactId>
<version>${beetl.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jwt.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork><!-- 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<delimiters>
......@@ -177,6 +184,9 @@
</plugins>
<resources>
<resource>
<directory>src/main/webapp</directory>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
......
......@@ -5,7 +5,6 @@ import com.stylefeng.guns.core.beetl.BeetlConfiguration;
import org.beetl.core.resource.ClasspathResourceLoader;
import org.beetl.ext.spring.BeetlSpringViewResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
......@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
/**
......
/* iCheck plugin Square skin, green
----------------------------------- */
.icheckbox_square-green,
.iradio_square-green {
display: inline-block;
*display: inline;
vertical-align: middle;
margin: 0;
padding: 0;
width: 22px;
height: 22px;
background: url(green.png) no-repeat;
border: none;
cursor: pointer;
}
.icheckbox_square-green {
background-position: 0 0;
}
.icheckbox_square-green.hover {
background-position: -24px 0;
}
.icheckbox_square-green.checked {
background-position: -48px 0;
}
.icheckbox_square-green.disabled {
background-position: -72px 0;
cursor: default;
}
.icheckbox_square-green.checked.disabled {
background-position: -96px 0;
}
.iradio_square-green {
background-position: -120px 0;
}
.iradio_square-green.hover {
background-position: -144px 0;
}
.iradio_square-green.checked {
background-position: -168px 0;
}
.iradio_square-green.disabled {
background-position: -192px 0;
cursor: default;
}
.iradio_square-green.checked.disabled {
background-position: -216px 0;
}
/* HiDPI support */
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) {
.icheckbox_square-green,
.iradio_square-green {
background-image: url(green@2x.png);
-webkit-background-size: 240px 24px;
background-size: 240px 24px;
}
}
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;}
body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;}
h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;}
h1 {font-size: 24px;line-height: 34px;text-align: center;}
h2 {font-size: 14px;line-height: 24px;padding-top: 5px;}
h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;}
a {color:#3C6E31;text-decoration: underline;}
a:hover {background-color:#3C6E31;color:white;}
input.radio {margin: 0 2px 0 8px;}
input.radio.first {margin-left:0;}
input.empty {color: lightgray;}
code {color: #2f332a;}
.highlight_red {color:#A60000;}
.highlight_green {color:#A7F43D;}
li {list-style: circle;font-size: 12px;}
li.title {list-style: none;}
ul.list {margin-left: 17px;}
div.content_wrap {width: 600px;height:380px;}
div.content_wrap div.left{float: left;width: 250px;}
div.content_wrap div.right{float: right;width: 340px;}
div.zTreeDemoBackground {width:250px;height:362px;text-align:left;}
ul.ztree {margin-top: 10px;border: 1px solid #617775;background: #f0f6e4;width:220px;height:360px;overflow-y:scroll;overflow-x:auto;}
ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;}
ul.log.small {height:45px;}
ul.log li {color: #666666;list-style: none;padding-left: 10px;}
ul.log li.dark {background-color: #E3E3E3;}
/* ruler */
div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer}
div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer}
\ No newline at end of file
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<metadata></metadata>
<defs>
<font id="fontawesomeregular" horiz-adv-x="1536" >
......
var DateUtils = {
/**
* 扩展Date 对象格式化方法
*/
expandDate : function() {
Date.prototype.format = function(fmt)
{ //author: meizz
var o = {
"M+" : this.getMonth()+1, //月份
"d+" : this.getDate(), //日
"h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时
"H+" : this.getHours(), //小时
"m+" : this.getMinutes(), //分
"s+" : this.getSeconds(), //秒
"q+" : Math.floor((this.getMonth()+3)/3), //季度
"S" : this.getMilliseconds() //毫秒
};
if(/(y+)/.test(fmt))
fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
for(var k in o)
if(new RegExp("("+ k +")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
return fmt;
}
},
/**
* 获取具体年龄
* @param {} beginStr
* @param {} endStr
* @return {}
*/
getAgeInfo: function (beginStr, endStr) {
var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})(\s)(\d{1,2})(:)(\d{1,2})(:{0,1})(\d{0,2})$/);
var beginArr = beginStr.match(reg);
var endArr = endStr.match(reg);
var days = 0;
var month = 0;
var year = 0;
days = endArr[5] - beginArr[5];
if (days < 0) {
month = -1;
days = 30 + days;
}
month = month + (endArr[3] - beginArr[3]);
if (month < 0) {
year = -1;
month = 12 + month;
}
year = year + (endArr[1] - beginArr[1]);
var yearString = year > 0 ? year + "岁" : "";
var mnthString = month > 0 ? month + "月" : "";
var dayString = days > 0 ? days + "天" : "";
/*
* 1 如果岁 大于等于1 那么年龄取 几岁 2 如果 岁等于0 但是月大于1 那么如果天等于0天小于3天 取小时 例如出生2天 就取 48小时
*/
var result = "";
if (year >= 1) {
result = yearString + mnthString;
} else {
if (month >= 1) {
result = days > 0 ? mnthString + dayString : mnthString;
} else {
var begDate = new Date(beginArr[1], beginArr[3] - 1, beginArr[5],
beginArr[7], beginArr[9], beginArr[11]);
var endDate = new Date(endArr[1], endArr[3] - 1, endArr[5],
endArr[7], endArr[9], endArr[11]);
var between = (endDate.getTime() - begDate.getTime()) / 1000;
days = Math.floor(between / (24 * 3600));
var hours = Math.floor(between / 3600 - (days * 24));
var dayString = days > 0 ? days + "天" : "";
result = days >= 3 ? dayString : days * 24 + hours + "小时";
}
}
return result;
},
/**
* 获取年龄,不满一天算天
* @param {} birthday
* @param {} today
* @return {}
*/
getAge :function(birthday,today) {
var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/);
var beginArr = birthday.match(reg);
var endArr = today.match(reg);
var days = 0;
var month = 0;
var year = 0;
days = endArr[5] - beginArr[5];
if (days < 0) {
month = -1;
days = 30 + days;
}
month = month + (endArr[3] - beginArr[3]);
if (month < 0) {
year = -1;
month = 12 + month;
}
year = year + (endArr[1] - beginArr[1]);
var yearString = year > 0 ? year + "岁" : "";
var mnthString = month > 0 ? month + "月" : "";
var dayString = days > 0 ? days + "天" : "1天";
/*
* 1 如果岁 大于等于1 那么年龄取 几岁 2 如果 岁等于0 但是月大于1 name取几月 3 如果不足月, 则取天数 4 不满一天算一天
*/
var result = "";
if (year >= 1) {
result = yearString + mnthString + dayString;
} else {
if (month >= 1) {
result = days > 0 ? mnthString + dayString : mnthString;
} else {
result = dayString;
}
}
return result;
},
/**
* 获取月龄
* @param {} birthday
* @param {} today
* @return {}
*/
getMonthage :function(birthday,today) {
var reg = new RegExp(/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/);
var beginArr = birthday.match(reg);
var endArr = today.match(reg);
var days = 0;
var month = 0;
var year = 0;
days = endArr[5] - beginArr[5];
if (days < 0) {
month = -1;
days = 30 + days;
}
month = month + (endArr[3] - beginArr[3]);
if (month < 0) {
year = -1;
month = 12 + month;
}
year = year + (endArr[1] - beginArr[1]);
var result = "";
if (year >= 1) {
result = (year * 12 + month + 1) + "个月";
} else {
if (month >= 1) {
result = (month + 1) + "个月";
} else {
result = "1个月";
}
}
return result;
}
}
\ No newline at end of file
(function () {
var $ax = function (url, success, error) {
this.url = url;
this.type = "post";
this.data = {};
this.dataType = "json";
this.async = false;
this.success = success;
this.error = error;
};
$ax.prototype = {
start : function () {
var me = this;
if (this.url.indexOf("?") == -1) {
this.url = this.url + "?jstime=" + new Date().getTime();
} else {
this.url = this.url + "&jstime=" + new Date().getTime();
}
$.ajax({
type: this.type,
url: this.url,
dataType: this.dataType,
async: this.async,
data: this.data,
beforeSend: function(data) {
},
success: function(data) {
me.success(data);
},
error: function(data) {
me.error(data);
}
});
},
set : function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
setData : function(data){
this.data = data;
return this;
},
clear : function () {
this.data = {};
return this;
}
};
window.$ax = $ax;
} ());
\ No newline at end of file
/**
* 初始化 BootStrap Table 的封装
*
* 约定:toolbar的id为 (bstableId + "Toolbar")
*
* @author fengshuonan
*/
(function () {
var BSTable = function (bstableId, url, columns) {
this.btInstance = null; //jquery和BootStrapTable绑定的对象
this.bstableId = bstableId;
this.url = Feng.ctxPath + url;
this.method = "post";
this.paginationType = "server"; //默认分页方式是服务器分页,可选项"client"
this.toolbarId = bstableId + "Toolbar";
this.columns = columns;
this.height = 665; //默认表格高度665
this.data = {};
this.queryParams = {}; // 向后台传递的自定义参数
};
BSTable.prototype = {
/**
* 初始化bootstrap table
*/
init: function () {
var tableId = this.bstableId;
var me = this;
this.btInstance =
$('#' + tableId).bootstrapTable({
contentType: "application/x-www-form-urlencoded",
url: this.url, //请求地址
method: this.method, //ajax方式,post还是get
ajaxOptions: { //ajax请求的附带参数
data: this.data
},
toolbar: "#" + this.toolbarId,//顶部工具条
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true
pagination: true, //是否显示分页(*)
sortable: true, //是否启用排序
sortOrder: "desc", //排序方式
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 14, //每页的记录行数(*)
pageList: [14, 50, 100], //可供选择的每页的行数(*)
queryParamsType: 'limit', //默认值为 'limit' ,在默认情况下 传给服务端的参数为:offset,limit,sort
queryParams: function (param) {
return $.extend(me.queryParams, param);
}, // 向后台传递的自定义参数
sidePagination: this.paginationType, //分页方式:client客户端分页,server服务端分页(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端
strictSearch: true, //设置为 true启用 全匹配搜索,否则为模糊搜索
showColumns: true, //是否显示所有的列
showRefresh: true, //是否显示刷新按钮
minimumCountColumns: 2, //最少允许的列数
clickToSelect: true, //是否启用点击选中行
searchOnEnterKey: true, //设置为 true时,按回车触发搜索方法,否则自动触发搜索方法
columns: this.columns, //列数组
pagination: true, //是否显示分页条
height: this.height,
icons: {
refresh: 'glyphicon-repeat',
toggle: 'glyphicon-list-alt',
columns: 'glyphicon-list'
},
iconSize: 'outline'
});
return this;
},
/**
* 向后台传递的自定义参数
* @param param
*/
setQueryParams: function (param) {
this.queryParams = param;
},
/**
* 设置分页方式:server 或者 client
*/
setPaginationType: function (type) {
this.paginationType = type;
},
/**
* 设置ajax post请求时候附带的参数
*/
set: function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
/**
* 设置ajax post请求时候附带的参数
*/
setData: function (data) {
this.data = data;
return this;
},
/**
* 清空ajax post请求参数
*/
clear: function () {
this.data = {};
return this;
},
/**
* 刷新 bootstrap 表格
* Refresh the remote server data,
* you can set {silent: true} to refresh the data silently,
* and set {url: newUrl} to change the url.
* To supply query params specific to this request, set {query: {foo: 'bar'}}
*/
refresh: function (parms) {
if (typeof parms != "undefined") {
this.btInstance.bootstrapTable('refresh', parms);
} else {
this.btInstance.bootstrapTable('refresh');
}
}
};
window.BSTable = BSTable;
}());
\ No newline at end of file
var SelectList = {};
SelectList.singelSelect = function (eleName, attr, data) {
var result = false;
$("#" + eleName).find("a").each(function (i, d) {
if ($(this).attr(attr) == data) {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
result = true;
}
} else {
$(this).removeClass('active');
}
});
return result;
};
SelectList.mutiSelect = function (eleName, attr, data) {
var result = false;
$("#" + eleName).find("a").each(function (i, d) {
if ($(this).attr(attr) == data) {
if ($(this).hasClass('active')) {
$(this).removeClass('active');
} else {
$(this).addClass('active');
result = true;
}
}
});
return result;
};
SelectList.clearSelect = function (eleName) {
$("#" + eleName).find("a").each(function (i, d) {
$(this).removeClass('active');
});
};
\ No newline at end of file
/**
* 初始化 Tree Table 的封装
*
* @author cyf
*/
(function () {
var BSTreeTable = function (bstableId, url, columns) {
this.btInstance = null; //jquery和bootstrapTreeTable绑定的对象
this.bstableId = bstableId;
this.url = Feng.ctxPath + url;
this.method = "post";
this.columns = columns;
this.data = {};// ajax的参数
this.expandColumn = null;// 展开显示的列
this.id = 'id';// 选取记录返回的值
this.code = 'code';// 用于设置父子关系
this.parentCode = 'pcode';// 用于设置父子关系
this.expandAll = false;// 是否默认全部展开
this.toolbarId = bstableId + "Toolbar";
this.height = 665; //默认表格高度665
};
BSTreeTable.prototype = {
/**
* 初始化bootstrap table
*/
init: function () {
var tableId = this.bstableId;
this.btInstance =
$('#'+tableId).bootstrapTreeTable({
id: this.id,// 选取记录返回的值
code: this.code,// 用于设置父子关系
parentCode: this.parentCode,// 用于设置父子关系
rootCodeValue: this.rootCodeValue,//设置根节点code值----可指定根节点,默认为null,"",0,"0"
type: this.method, //请求数据的ajax类型
url: this.url, //请求数据的ajax的url
ajaxParams: this.data, //请求数据的ajax的data属性
expandColumn: this.expandColumn,//在哪一列上面显示展开按钮,从0开始
striped: true, //是否各行渐变色
expandAll: this.expandAll, //是否全部展开
columns: this.columns, //列数组
toolbar: "#" + this.toolbarId,//顶部工具条
height: this.height,
});
return this;
},
/**
* 设置在哪一列上面显示展开按钮,从0开始
*/
setExpandColumn: function (expandColumn) {
this.expandColumn = expandColumn;
},
/**
* 设置记录返回的id值
*/
setIdField: function (id) {
this.id = id;
},
/**
* 设置记录分级的字段
*/
setCodeField: function (code) {
this.code = code;
},
/**
* 设置记录分级的父级字段
*/
setParentCodeField: function (parentCode) {
this.parentCode = parentCode;
},
/**
* 设置根节点code值----可指定根节点,默认为null,"",0,"0"
*/
setRootCodeValue: function (rootCodeValue) {
this.rootCodeValue = rootCodeValue;
},
/**
* 设置是否默认全部展开
*/
setExpandAll: function (expandAll) {
this.expandAll = expandAll;
},
/**
* 设置表格高度
*/
setHeight: function (height) {
this.height = height;
},
/**
* 设置ajax post请求时候附带的参数
*/
set: function (key, value) {
if (typeof key == "object") {
for (var i in key) {
if (typeof i == "function")
continue;
this.data[i] = key[i];
}
} else {
this.data[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
}
return this;
},
/**
* 设置ajax post请求时候附带的参数
*/
setData: function (data) {
this.data = data;
return this;
},
/**
* 清空ajax post请求参数
*/
clear: function () {
this.data = {};
return this;
},
/**
* 刷新表格
*/
refresh: function (parms) {
if (typeof parms != "undefined") {
this.btInstance.bootstrapTreeTable('refresh', parms.query);// 为了兼容bootstrap-table的写法
} else {
this.btInstance.bootstrapTreeTable('refresh');
}
}
};
window.BSTreeTable = BSTreeTable;
}());
\ No newline at end of file
/**
* web-upload 工具类
*
* 约定:
* 上传按钮的id = 图片隐藏域id + 'BtnId'
* 图片预览框的id = 图片隐藏域id + 'PreId'
*
* @author fengshuonan
*/
(function() {
var $WebUpload = function(pictureId) {
this.pictureId = pictureId;
this.uploadBtnId = pictureId + "BtnId";
this.uploadPreId = pictureId + "PreId";
this.uploadUrl = Feng.ctxPath + '/mgr/upload';
this.fileSizeLimit = 100 * 1024 * 1024;
this.picWidth = 800;
this.picHeight = 800;
this.uploadBarId = null;
};
$WebUpload.prototype = {
/**
* 初始化webUploader
*/
init : function() {
var uploader = this.create();
this.bindEvent(uploader);
return uploader;
},
/**
* 创建webuploader对象
*/
create : function() {
var webUploader = WebUploader.create({
auto : true,
pick : {
id : '#' + this.uploadBtnId,
multiple : false,// 只上传一个
},
accept : {
title : 'Images',
extensions : 'gif,jpg,jpeg,bmp,png',
mimeTypes : 'image/gif,image/jpg,image/jpeg,image/bmp,image/png'
},
swf : Feng.ctxPath
+ '/static/js/plugins/webuploader/Uploader.swf',
disableGlobalDnd : true,
duplicate : true,
server : this.uploadUrl,
fileSingleSizeLimit : this.fileSizeLimit
});
return webUploader;
},
/**
* 绑定事件
*/
bindEvent : function(bindedObj) {
var me = this;
bindedObj.on('fileQueued', function(file) {
var $li = $('<div><img width="100px" height="100px"></div>');
var $img = $li.find('img');
$("#" + me.uploadPreId).html($li);
// 生成缩略图
bindedObj.makeThumb(file, function(error, src) {
if (error) {
$img.replaceWith('<span>不能预览</span>');
return;
}
$img.attr('src', src);
}, me.picWidth, me.picHeight);
});
// 文件上传过程中创建进度条实时显示。
bindedObj.on('uploadProgress', function(file, percentage) {
$("#"+me.uploadBarId).css("width",percentage * 100 + "%");
});
// 文件上传成功,给item添加成功class, 用样式标记上传成功。
bindedObj.on('uploadSuccess', function(file,response) {
Feng.success("上传成功");
$("#" + me.pictureId).val(response);
});
// 文件上传失败,显示上传出错。
bindedObj.on('uploadError', function(file) {
Feng.error("上传失败");
});
// 其他错误
bindedObj.on('error', function(type) {
if ("Q_EXCEED_SIZE_LIMIT" == type) {
Feng.error("文件大小超出了限制");
} else if ("Q_TYPE_DENIED" == type) {
Feng.error("文件类型不满足");
} else if ("Q_EXCEED_NUM_LIMIT" == type) {
Feng.error("上传数量超过限制");
} else if ("F_DUPLICATE" == type) {
Feng.error("图片选择重复");
} else {
Feng.error("上传过程中出错");
}
});
// 完成上传完了,成功或者失败
bindedObj.on('uploadComplete', function(file) {
});
},
/**
* 设置图片上传的进度条的id
*/
setUploadBarId: function (id) {
this.uploadBarId = id;
}
};
window.$WebUpload = $WebUpload;
}());
\ No newline at end of file
/**
* ztree插件的封装
*/
(function() {
var $ZTree = function(id, url) {
this.id = id;
this.url = url;
this.onClick = null;
this.settings = null;
this.ondblclick=null;
};
$ZTree.prototype = {
/**
* 初始化ztree的设置
*/
initSetting : function() {
var settings = {
view : {
dblClickExpand : true,
selectedMulti : false
},
data : {simpleData : {enable : true}},
callback : {
onClick : this.onClick,
onDblClick:this.ondblclick
}
};
return settings;
},
/**
* 手动设置ztree的设置
*/
setSettings : function(val) {
this.settings = val;
},
/**
* 初始化ztree
*/
init : function() {
var zNodeSeting = null;
if(this.settings != null){
zNodeSeting = this.settings;
}else{
zNodeSeting = this.initSetting();
}
var zNodes = this.loadNodes();
$.fn.zTree.init($("#" + this.id), zNodeSeting, zNodes);
},
/**
* 绑定onclick事件
*/
bindOnClick : function(func) {
this.onClick = func;
},
/**
* 绑定双击事件
*/
bindOnDblClick : function(func) {
this.ondblclick=func;
},
/**
* 加载节点
*/
loadNodes : function() {
var zNodes = null;
var ajax = new $ax(Feng.ctxPath + this.url, function(data) {
zNodes = data;
}, function(data) {
Feng.error("加载ztree信息失败!");
});
ajax.start();
return zNodes;
},
/**
* 获取选中的值
*/
getSelectedVal : function(){
var zTree = $.fn.zTree.getZTreeObj(this.id);
var nodes = zTree.getSelectedNodes();
return nodes[0].name;
}
};
window.$ZTree = $ZTree;
}());
\ No newline at end of file
var $parentNode = window.parent.document;
function $childNode(name) {
return window.frames[name]
}
// tooltips
$('.tooltip-demo').tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
});
// 使用animation.css修改Bootstrap Modal
$('.modal').appendTo("body");
$("[data-toggle=popover]").popover();
//折叠ibox
$('.collapse-link').click(function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.find('div.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
//关闭ibox
$('.close-link').click(function () {
var content = $(this).closest('div.ibox');
content.remove();
});
//判断当前页面是否在iframe中
if (top == this) {
var gohome = '<div class="gohome"><a class="animated bounceInUp" href="' + Feng.ctxPath + '/" title="返回首页"><i class="fa fa-home"></i></a></div>';
$('body').append(gohome);
}
//animation.css
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//动画完成之前移除class
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
//拖动面板
function WinMove() {
var element = "[class*=col]";
var handle = ".ibox-title";
var connect = "[class*=col]";
$(element).sortable({
handle: handle,
connectWith: connect,
tolerance: 'pointer',
forcePlaceholderSize: true,
opacity: 0.8,
})
.disableSelection();
};
$(function () {
//初始化下拉框
var config = {
'.chosen-select': {},
'.chosen-select-deselect': {
allow_single_deselect: true
},
'.chosen-select-no-single': {
disable_search_threshold: 10
},
'.chosen-select-no-results': {
no_results_text: '没有要显示的数据!'
},
'.chosen-select-width': {
width: "95%"
}
}
for (var selector in config) {
$(selector).chosen(config[selector]);
}
$('.i-checks').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
});
});
\ No newline at end of file
/*
* bootstrap-table - v1.11.1 - 2017-02-22
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2017 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";var b=function(b,c){b.options.columnsHidden.length>0&&a.each(b.columns,function(d,e){-1!==b.options.columnsHidden.indexOf(e.field)&&e.visible!==c&&b.toggleColumn(a.fn.bootstrapTable.utils.getFieldIndex(b.columns,e.field),c,!0)})},c=function(a){(a.options.height||a.options.showFooter)&&setTimeout(function(){a.resetView.call(a)},1)},d=function(a,b,d){a.options.minHeight?b<=a.options.minWidth&&d<=a.options.minHeight?e(a):b>a.options.minWidth&&d>a.options.minHeight&&f(a):b<=a.options.minWidth?e(a):b>a.options.minWidth&&f(a),c(a)},e=function(a){g(a,!1),b(a,!1)},f=function(a){g(a,!0),b(a,!0)},g=function(a,b){a.options.cardView=b,a.toggleView()},h=function(a,b){var c;return function(){var d=this,e=arguments,f=function(){c=null,a.apply(d,e)};clearTimeout(c),c=setTimeout(f,b)}};a.extend(a.fn.bootstrapTable.defaults,{mobileResponsive:!1,minWidth:562,minHeight:void 0,heightThreshold:100,checkOnInit:!0,columnsHidden:[]});var i=a.fn.bootstrapTable.Constructor,j=i.prototype.init;i.prototype.init=function(){if(j.apply(this,Array.prototype.slice.apply(arguments)),this.options.mobileResponsive&&this.options.minWidth){this.options.minWidth<100&&this.options.resizable&&(console.log("The minWidth when the resizable extension is active should be greater or equal than 100"),this.options.minWidth=100);var b=this,c={width:a(window).width(),height:a(window).height()};if(a(window).on("resize orientationchange",h(function(){var e=a(this).height(),f=a(this).width();(Math.abs(c.height-e)>b.options.heightThreshold||c.width!=f)&&(d(b,f,e),c={width:f,height:e})},200)),this.options.checkOnInit){var e=a(window).height(),f=a(window).width();d(this,f,e),c={width:f,height:e}}}}}(jQuery);
\ No newline at end of file
/**
* Bootstrap Table Chinese translation
* Author: Zhixin Wen<wenzhixin2010@gmail.com>
*/
(function ($) {
'use strict';
$.fn.bootstrapTable.locales['zh-CN'] = {
formatLoadingMessage: function () {
return '正在努力地加载数据中,请稍候……';
},
formatRecordsPerPage: function (pageNumber) {
return '每页显示 ' + pageNumber + ' 条记录';
},
formatShowingRows: function (pageFrom, pageTo, totalRows) {
return '显示第 ' + pageFrom + ' 到第 ' + pageTo + ' 条记录,总共 ' + totalRows + ' 条记录';
},
formatSearch: function () {
return '搜索';
},
formatNoMatches: function () {
return '没有找到匹配的记录';
},
formatPaginationSwitch: function () {
return '隐藏/显示分页';
},
formatRefresh: function () {
return '刷新';
},
formatToggle: function () {
return '切换';
},
formatColumns: function () {
return '列';
},
formatExport: function () {
return '导出数据';
},
formatClearFilters: function () {
return '清空过滤';
}
};
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['zh-CN']);
})(jQuery);
/*
* bootstrap-table - v1.11.1 - 2017-02-22
* https://github.com/wenzhixin/bootstrap-table
* Copyright (c) 2017 zhixin wen
* Licensed MIT License
*/
!function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery);
\ No newline at end of file
/*! iCheck v1.0.2 by Damir Sultanov, http://git.io/arlzeA, MIT Licensed */
(function(f){function A(a,b,d){var c=a[0],g=/er/.test(d)?_indeterminate:/bl/.test(d)?n:k,e=d==_update?{checked:c[k],disabled:c[n],indeterminate:"true"==a.attr(_indeterminate)||"false"==a.attr(_determinate)}:c[g];if(/^(ch|di|in)/.test(d)&&!e)x(a,g);else if(/^(un|en|de)/.test(d)&&e)q(a,g);else if(d==_update)for(var f in e)e[f]?x(a,f,!0):q(a,f,!0);else if(!b||"toggle"==d){if(!b)a[_callback]("ifClicked");e?c[_type]!==r&&q(a,g):x(a,g)}}function x(a,b,d){var c=a[0],g=a.parent(),e=b==k,u=b==_indeterminate,
v=b==n,s=u?_determinate:e?y:"enabled",F=l(a,s+t(c[_type])),B=l(a,b+t(c[_type]));if(!0!==c[b]){if(!d&&b==k&&c[_type]==r&&c.name){var w=a.closest("form"),p='input[name="'+c.name+'"]',p=w.length?w.find(p):f(p);p.each(function(){this!==c&&f(this).data(m)&&q(f(this),b)})}u?(c[b]=!0,c[k]&&q(a,k,"force")):(d||(c[b]=!0),e&&c[_indeterminate]&&q(a,_indeterminate,!1));D(a,e,b,d)}c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"default");g[_add](B||l(a,b)||"");g.attr("role")&&!u&&g.attr("aria-"+(v?n:k),"true");
g[_remove](F||l(a,s)||"")}function q(a,b,d){var c=a[0],g=a.parent(),e=b==k,f=b==_indeterminate,m=b==n,s=f?_determinate:e?y:"enabled",q=l(a,s+t(c[_type])),r=l(a,b+t(c[_type]));if(!1!==c[b]){if(f||!d||"force"==d)c[b]=!1;D(a,e,s,d)}!c[n]&&l(a,_cursor,!0)&&g.find("."+C).css(_cursor,"pointer");g[_remove](r||l(a,b)||"");g.attr("role")&&!f&&g.attr("aria-"+(m?n:k),"false");g[_add](q||l(a,s)||"")}function E(a,b){if(a.data(m)){a.parent().html(a.attr("style",a.data(m).s||""));if(b)a[_callback](b);a.off(".i").unwrap();
f(_label+'[for="'+a[0].id+'"]').add(a.closest(_label)).off(".i")}}function l(a,b,f){if(a.data(m))return a.data(m).o[b+(f?"":"Class")]}function t(a){return a.charAt(0).toUpperCase()+a.slice(1)}function D(a,b,f,c){if(!c){if(b)a[_callback]("ifToggled");a[_callback]("ifChanged")[_callback]("if"+t(f))}}var m="iCheck",C=m+"-helper",r="radio",k="checked",y="un"+k,n="disabled";_determinate="determinate";_indeterminate="in"+_determinate;_update="update";_type="type";_click="click";_touch="touchbegin.i touchend.i";
_add="addClass";_remove="removeClass";_callback="trigger";_label="label";_cursor="cursor";_mobile=/ipad|iphone|ipod|android|blackberry|windows phone|opera mini|silk/i.test(navigator.userAgent);f.fn[m]=function(a,b){var d='input[type="checkbox"], input[type="'+r+'"]',c=f(),g=function(a){a.each(function(){var a=f(this);c=a.is(d)?c.add(a):c.add(a.find(d))})};if(/^(check|uncheck|toggle|indeterminate|determinate|disable|enable|update|destroy)$/i.test(a))return a=a.toLowerCase(),g(this),c.each(function(){var c=
f(this);"destroy"==a?E(c,"ifDestroyed"):A(c,!0,a);f.isFunction(b)&&b()});if("object"!=typeof a&&a)return this;var e=f.extend({checkedClass:k,disabledClass:n,indeterminateClass:_indeterminate,labelHover:!0},a),l=e.handle,v=e.hoverClass||"hover",s=e.focusClass||"focus",t=e.activeClass||"active",B=!!e.labelHover,w=e.labelHoverClass||"hover",p=(""+e.increaseArea).replace("%","")|0;if("checkbox"==l||l==r)d='input[type="'+l+'"]';-50>p&&(p=-50);g(this);return c.each(function(){var a=f(this);E(a);var c=this,
b=c.id,g=-p+"%",d=100+2*p+"%",d={position:"absolute",top:g,left:g,display:"block",width:d,height:d,margin:0,padding:0,background:"#fff",border:0,opacity:0},g=_mobile?{position:"absolute",visibility:"hidden"}:p?d:{position:"absolute",opacity:0},l="checkbox"==c[_type]?e.checkboxClass||"icheckbox":e.radioClass||"i"+r,z=f(_label+'[for="'+b+'"]').add(a.closest(_label)),u=!!e.aria,y=m+"-"+Math.random().toString(36).substr(2,6),h='<div class="'+l+'" '+(u?'role="'+c[_type]+'" ':"");u&&z.each(function(){h+=
'aria-labelledby="';this.id?h+=this.id:(this.id=y,h+=y);h+='"'});h=a.wrap(h+"/>")[_callback]("ifCreated").parent().append(e.insert);d=f('<ins class="'+C+'"/>').css(d).appendTo(h);a.data(m,{o:e,s:a.attr("style")}).css(g);e.inheritClass&&h[_add](c.className||"");e.inheritID&&b&&h.attr("id",m+"-"+b);"static"==h.css("position")&&h.css("position","relative");A(a,!0,_update);if(z.length)z.on(_click+".i mouseover.i mouseout.i "+_touch,function(b){var d=b[_type],e=f(this);if(!c[n]){if(d==_click){if(f(b.target).is("a"))return;
A(a,!1,!0)}else B&&(/ut|nd/.test(d)?(h[_remove](v),e[_remove](w)):(h[_add](v),e[_add](w)));if(_mobile)b.stopPropagation();else return!1}});a.on(_click+".i focus.i blur.i keyup.i keydown.i keypress.i",function(b){var d=b[_type];b=b.keyCode;if(d==_click)return!1;if("keydown"==d&&32==b)return c[_type]==r&&c[k]||(c[k]?q(a,k):x(a,k)),!1;if("keyup"==d&&c[_type]==r)!c[k]&&x(a,k);else if(/us|ur/.test(d))h["blur"==d?_remove:_add](s)});d.on(_click+" mousedown mouseup mouseover mouseout "+_touch,function(b){var d=
b[_type],e=/wn|up/.test(d)?t:v;if(!c[n]){if(d==_click)A(a,!1,!0);else{if(/wn|er|in/.test(d))h[_add](e);else h[_remove](e+" "+t);if(z.length&&B&&e==v)z[/ut|nd/.test(d)?_remove:_add](w)}if(_mobile)b.stopPropagation();else return!1}})})}})(window.jQuery||window.Zepto);
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!--
2013-9-30: Created.
-->
<svg>
<metadata>
Created by iconfont
</metadata>
<defs>
<font id="laydate-icon" horiz-adv-x="1024" >
<font-face
font-family="laydate-icon"
font-weight="500"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="x" unicode="x" horiz-adv-x="1001"
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
<glyph glyph-name="youyou" unicode="&#58882;" d="M283.648 721.918976 340.873216 780.926976 740.352 383.997952 340.876288-12.925952 283.648 46.077952 619.52 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="zuozuo" unicode="&#58883;" d="M740.352 721.918976 683.126784 780.926976 283.648 383.997952 683.123712-12.925952 740.352 46.077952 404.48 383.997952Z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye" unicode="&#58970;" d="M62.573 384.103l423.401 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.751-18.976-68.727 0l-39.753 39.753 0.269 0.246-385.655 385.661zM451.365 384.103l423.407 423.662c18.985 18.985 49.757 18.985 68.727 0 18.982-18.972 18.985-49.746 0-68.729l-355.058-355.067 356.796-356.796c18.977-18.971 18.976-49.746 0-68.727-18.982-18.976-49.757-18.977-68.727 0l-39.762 39.754 0.273 0.249-385.662 385.661zM451.365 384.103z" horiz-adv-x="1024" />
<glyph glyph-name="xiayiye1" unicode="&#58971;" d="M948.066926 382.958838l-411.990051-412.24426c-18.47333-18.47333-48.417689-18.47333-66.875207 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L814.691135 383.088983 467.512212 730.269123c-18.466032 18.458735-18.466032 48.405526 0 66.873991 18.468465 18.464816 48.410391 18.464816 66.872774 0l38.682336-38.682336-0.261507-0.239614 375.259894-375.265975v0.003649m-378.312834 0L157.756743-29.285422c-18.47333-18.47333-48.415256-18.47333-66.872775 0-18.47333 18.461167-18.47333 48.405526 0 66.875207L436.369787 383.088983 89.19208 730.269123c-18.4636 18.458735-18.4636 48.405526 0 66.873991 18.470898 18.464816 48.415256 18.464816 66.872774 0l38.692067-38.682336-0.266372-0.239614 375.267191-375.265975-0.004865 0.003649m0 0z" horiz-adv-x="1024" />
</font>
</defs></svg>
/*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */
;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'<h3 style="'+(e?n.title[1]:"")+'">'+(e?n.title[0]:n.title)+"</h3>":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e='<span yes type="1">'+n.btn[0]+"</span>",2===t&&(e='<span no type="0">'+n.btn[1]+"</span>"+e),'<div class="layui-m-layerbtn">'+e+"</div>"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='<i></i><i class="layui-m-layerload"></i><i></i><p>'+(n.content||"")+"</p>"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"<div "+("string"==typeof n.shade?'style="'+n.shade+'"':"")+' class="layui-m-layershade"></div>':"")+'<div class="layui-m-layermain" '+(n.fixed?"":'style="position:static;"')+'><div class="layui-m-layersection"><div class="layui-m-layerchild '+(n.skin?"layui-m-layer-"+n.skin+" ":"")+(n.className?n.className:"")+" "+(n.anim?"layui-m-anim-"+n.anim:"")+'" '+(n.style?'style="'+n.style+'"':"")+">"+l+'<div class="layui-m-layercont">'+n.content+"</div>"+c+"</div></div></div>",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;o<r;o++)l.touch(s[o],a);if(e.shade&&e.shadeClose){var c=t[i]("layui-m-layershade")[0];l.touch(c,function(){layer.close(n.index,e.end)})}e.end&&(l.end[n.index]=e.end)},e.layer={v:"2.0",index:r,open:function(e){var t=new c(e||{});return t.index},close:function(e){var n=a("#"+o[0]+e)[0];n&&(n.innerHTML="",t.body.removeChild(n),clearTimeout(l.timer[e]),delete l.timer[e],"function"==typeof l.end[e]&&l.end[e](),delete l.end[e])},closeAll:function(){for(var e=t[i](o[0]),n=0,a=e.length;n<a;n++)layer.close(0|e[0].getAttribute("index"))}},"function"==typeof define?define(function(){return layer}):function(){var e=document.scripts,n=e[e.length-1],i=n.src,a=i.substring(0,i.lastIndexOf("/")+1);n.getAttribute("merge")||document.head.appendChild(function(){var e=t.createElement("link");return e.href=a+"need/layer.css?2.0",e.type="text/css",e.rel="styleSheet",e.id="layermcss",e}())}()}(window);
\ No newline at end of file
.layui-m-layer{position:relative;z-index:19891014}.layui-m-layer *{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}.layui-m-layermain,.layui-m-layershade{position:fixed;left:0;top:0;width:100%;height:100%}.layui-m-layershade{background-color:rgba(0,0,0,.7);pointer-events:auto}.layui-m-layermain{display:table;font-family:Helvetica,arial,sans-serif;pointer-events:none}.layui-m-layermain .layui-m-layersection{display:table-cell;vertical-align:middle;text-align:center}.layui-m-layerchild{position:relative;display:inline-block;text-align:left;background-color:#fff;font-size:14px;border-radius:5px;box-shadow:0 0 8px rgba(0,0,0,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@-webkit-keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}@keyframes layui-m-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.layui-m-anim-scale{animation-name:layui-m-anim-scale;-webkit-animation-name:layui-m-anim-scale}@-webkit-keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layui-m-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.layui-m-anim-up{-webkit-animation-name:layui-m-anim-up;animation-name:layui-m-anim-up}.layui-m-layer0 .layui-m-layerchild{width:90%;max-width:640px}.layui-m-layer1 .layui-m-layerchild{border:none;border-radius:0}.layui-m-layer2 .layui-m-layerchild{width:auto;max-width:260px;min-width:40px;border:none;background:0 0;box-shadow:none;color:#fff}.layui-m-layerchild h3{padding:0 10px;height:60px;line-height:60px;font-size:16px;font-weight:400;border-radius:5px 5px 0 0;text-align:center}.layui-m-layerbtn span,.layui-m-layerchild h3{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.layui-m-layercont{padding:50px 30px;line-height:22px;text-align:center}.layui-m-layer1 .layui-m-layercont{padding:0;text-align:left}.layui-m-layer2 .layui-m-layercont{text-align:center;padding:0;line-height:0}.layui-m-layer2 .layui-m-layercont i{width:25px;height:25px;margin-left:8px;display:inline-block;background-color:#fff;border-radius:100%;-webkit-animation:layui-m-anim-loading 1.4s infinite ease-in-out;animation:layui-m-anim-loading 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.layui-m-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0;-webkit-animation-delay:-.32s;animation-delay:-.32s}.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay:-.16s;animation-delay:-.16s}.layui-m-layer2 .layui-m-layercont>div{line-height:22px;padding-top:7px;margin-bottom:20px;font-size:14px}.layui-m-layerbtn{display:box;display:-moz-box;display:-webkit-box;width:100%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;cursor:pointer}.layui-m-layerbtn span[yes]{color:#40AFFE}.layui-m-layerbtn span[no]{border-right:1px solid #D0D0D0;border-radius:0 0 0 5px}.layui-m-layerbtn span:active{background-color:#F6F6F6}.layui-m-layerend{position:absolute;right:7px;top:10px;width:30px;height:30px;border:0;font-weight:400;background:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{position:absolute;left:5px;top:15px;content:'';width:18px;height:1px;background-color:#999;transform:rotate(45deg);-webkit-transform:rotate(45deg);border-radius:3px}.layui-m-layerend::after{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}body .layui-m-layer .layui-m-layer-footer{position:fixed;width:95%;max-width:100%;margin:0 auto;left:0;right:0;bottom:10px;background:0 0}.layui-m-layer-footer .layui-m-layercont{padding:20px;border-radius:5px 5px 0 0;background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn{display:block;height:auto;background:0 0;border-top:none}.layui-m-layer-footer .layui-m-layerbtn span{background-color:rgba(255,255,255,.8)}.layui-m-layer-footer .layui-m-layerbtn span[no]{color:#FD482C;border-top:1px solid #c2c2c2;border-radius:0 0 5px 5px}.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top:10px;border-radius:5px}body .layui-m-layer .layui-m-layer-msg{width:auto;max-width:90%;margin:0 auto;bottom:-150px;background-color:rgba(0,0,0,.7);color:#fff}.layui-m-layer-msg .layui-m-layercont{padding:10px 20px}
\ No newline at end of file
/*
* metismenu - v1.1.3
* Easy menu jQuery plugin for Twitter Bootstrap 3
* https://github.com/onokumus/metisMenu
*
* Made by Osman Nuri Okumus
* Under MIT License
*/
;(function($, window, document, undefined) {
var pluginName = "metisMenu",
defaults = {
toggle: true,
doubleTapToGo: false
};
function Plugin(element, options) {
this.element = $(element);
this.settings = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Plugin.prototype = {
init: function() {
var $this = this.element,
$toggle = this.settings.toggle,
obj = this;
if (this.isIE() <= 9) {
$this.find("li.active").has("ul").children("ul").collapse("show");
$this.find("li").not(".active").has("ul").children("ul").collapse("hide");
} else {
$this.find("li.active").has("ul").children("ul").addClass("collapse in");
$this.find("li").not(".active").has("ul").children("ul").addClass("collapse");
}
//add the "doubleTapToGo" class to active items if needed
if (obj.settings.doubleTapToGo) {
$this.find("li.active").has("ul").children("a").addClass("doubleTapToGo");
}
$this.find("li").has("ul").children("a").on("click" + "." + pluginName, function(e) {
e.preventDefault();
//Do we need to enable the double tap
if (obj.settings.doubleTapToGo) {
//if we hit a second time on the link and the href is valid, navigate to that url
if (obj.doubleTapToGo($(this)) && $(this).attr("href") !== "#" && $(this).attr("href") !== "") {
e.stopPropagation();
document.location = $(this).attr("href");
return;
}
}
$(this).parent("li").toggleClass("active").children("ul").collapse("toggle");
if ($toggle) {
$(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide");
}
});
},
isIE: function() { //https://gist.github.com/padolsey/527683
var undef,
v = 3,
div = document.createElement("div"),
all = div.getElementsByTagName("i");
while (
div.innerHTML = "<!--[if gt IE " + (++v) + "]><i></i><![endif]-->",
all[0]
) {
return v > 4 ? v : undef;
}
},
//Enable the link on the second click.
doubleTapToGo: function(elem) {
var $this = this.element;
//if the class "doubleTapToGo" exists, remove it and return
if (elem.hasClass("doubleTapToGo")) {
elem.removeClass("doubleTapToGo");
return true;
}
//does not exists, add a new class and return false
if (elem.parent().children("ul").length) {
//first remove all other class
$this.find(".doubleTapToGo").removeClass("doubleTapToGo");
//add the class on the current element
elem.addClass("doubleTapToGo");
return false;
}
},
remove: function() {
this.element.off("." + pluginName);
this.element.removeData(pluginName);
}
};
$.fn[pluginName] = function(options) {
this.each(function () {
var el = $(this);
if (el.data(pluginName)) {
el.data(pluginName).remove();
}
el.data(pluginName, new Plugin(this, options));
});
return this;
};
})(jQuery, window, document);
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.0
*
*/
(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"4px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d||
window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());
e=l*(b[0].scrollHeight-b.outerHeight());h&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),g),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);v();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",r,!1),this.addEventListener("mousewheel",r,!1),this.addEventListener("MozMousePixelScroll",r,!1)):document.attachEvent("onmousewheel",r)}function w(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:u+"px"});
var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function v(){w();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;u>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),
c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative",width:a.width,height:a.height});b.css({width:a.width,height:a.height});var g=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?
"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});
b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&
(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery);
.webuploader-container {
position: relative;
}
.webuploader-element-invisible {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px,1px,1px,1px);
}
.webuploader-pick {
position: relative;
display: inline-block;
cursor: pointer;
background: #00b7ee;
padding: 10px 15px;
color: #fff;
text-align: center;
border-radius: 3px;
overflow: hidden;
}
.webuploader-pick-hover {
background: #00a2d4;
}
.webuploader-pick-disable {
opacity: 0.6;
pointer-events:none;
}
/**
* 初始化
*/
var Code = {
ztreeInstance: null,
tableName: "",
submitData: {},
switchs: {}
};
/**
* 选择table的事件
*/
Code.selectTable = function (tableName) {
SelectList.clearSelect("templateList");
Code.switchs = {};
if (SelectList.singelSelect("tableList", "tableName", tableName) == true) {
Code.tableName = tableName;
Code.setTableName(tableName);
} else {
Code.tableName = "";
}
};
/**
* 选择模板的事件
*/
Code.selectTemplate = function (templateKey) {
if (Code.tableName != "") {
if (SelectList.mutiSelect("templateList", "key", templateKey) == true) {
Code.switchs[templateKey] = true;
} else {
Code.switchs[templateKey] = false;
}
} else {
Feng.info("请先选择表");
}
};
/**
* 点击生成
*/
Code.generate = function () {
Code.submitData = {};
Code.submitData.tableName = Code.tableName;
this.set('projectPath').set('author').set('projectPackage').set('corePackage').set('ignoreTabelPrefix').set('bizName').set('moduleName').set('parentMenuName');
var baseAjax = Feng.baseAjax("/code/generate", "生成代码");
for (var item in Code.switchs) {
Code.submitData[item] = Code.switchs[item];
}
baseAjax.setData(Code.submitData);
baseAjax.start();
};
/**
* 设置表名称
*/
Code.setTableName = function (tableName) {
var preSize = $("#ignoreTabelPrefix").val().length;
$("#tableName").val(tableName);
$("#className").val(Feng.underLineToCamel(tableName.substring(preSize)));
};
/**
* 点击父级编号input框时
*/
Code.onClickDept = function (e, treeId, treeNode) {
$("#parentMenuName").attr("value", Code.ztreeInstance.getSelectedVal());
};
/**
* 显示父级菜单选择的树
*/
Code.showMenuSelectTree = function () {
Feng.showInputTree("parentMenuName", "pcodeTreeDiv", 15, 34);
};
$(function () {
var ztree = new $ZTree("pcodeTree", "/menu/selectMenuTreeList");
ztree.bindOnClick(Code.onClickDept);
ztree.init();
Code.ztreeInstance = ztree;
$("#pcodeTree").css('width',$("#parentMenuName").css('width'));
});
Code.set = function (key, value) {
Code.submitData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
};
\ No newline at end of file
/**
* 报销管理管理初始化
*/
var Expense = {
id: "ExpenseTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Expense.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: '报销id', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '报销金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
{title: '描述', field: 'desc', visible: true, align: 'center', valign: 'middle'},
{title: '状态', field: 'stateName', visible: true, align: 'center', valign: 'middle'},
{title: '创建时间', field: 'createtime', visible: true, align: 'center', valign: 'middle'},
{
title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) {
if (row.state == 3) {
return '<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;删除</button>';
} else {
return '<button type="button" class="btn btn-primary button-margin" onclick="Expense.findRecord(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;查看</button>' +
'<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;删除</button>';
}
}
}
];
};
/**
* 流程详情
*/
Expense.findRecord = function (id) {
var index = layer.open({
type: 2,
title: '流程详情',
area: ['1000px', '500px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/expense/expense_update/' + id
});
this.layerIndex = index;
};
/**
* 删除审核记录
*/
Expense.deleteRecord = function (id) {
var ajax = new $ax(Feng.ctxPath + "/expense/delete", function (data) {
Feng.success("删除成功!");
Expense.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("expenseId", id);
ajax.start();
};
/**
* 点击添加报销管理
*/
Expense.openAddExpense = function () {
var index = layer.open({
type: 2,
title: '添加报销管理',
area: ['600px', '350px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/expense/expense_add'
});
this.layerIndex = index;
};
/**
* 查询报销管理列表
*/
Expense.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Expense.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Expense.initColumn();
var table = new BSTable(Expense.id, "/expense/list", defaultColunms);
table.setPaginationType("client");
Expense.table = table.init();
});
/**
* 初始化报销管理详情对话框
*/
var ExpenseInfoDlg = {
expenseInfoData : {}
};
/**
* 清除数据
*/
ExpenseInfoDlg.clearData = function() {
this.expenseInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.set = function(key, val) {
this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
ExpenseInfoDlg.close = function() {
parent.layer.close(window.parent.Expense.layerIndex);
}
/**
* 收集数据
*/
ExpenseInfoDlg.collectData = function() {
this
.set('id')
.set('money')
.set('desc')
;
}
/**
* 提交添加
*/
ExpenseInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){
Feng.success("添加成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
/**
* 提交修改
*/
ExpenseInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){
Feng.success("修改成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
$(function() {
});
/**
* 报销管理管理初始化
*/
var Process = {
id: "ProcessTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Process.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: '任务id', field: 'id', visible: true, align: 'center', valign: 'middle'},
{title: '名称', field: 'name', visible: true, align: 'center', valign: 'middle'},
{title: '金额', field: 'money', visible: true, align: 'center', valign: 'middle'},
{title: '创建时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
{title: '申请人', field: 'assignee', visible: true, align: 'center', valign: 'middle'},
{
title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) {
if (row.selfFlag == true) {
return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;通过</button>' +
'<button type="button" class="btn btn-danger button-margin" onclick="Process.unPass(' + row.id + ')" id=""><i class="fa fa-arrows-alt"></i>&nbsp;不通过</button>';
} else {
return '<button type="button" class="btn btn-primary button-margin" onclick="Process.pass(' + row.id + ')" id=""><i class="fa fa-edit"></i>&nbsp;通过</button>';
}
}
}
];
};
/**
* 通过审核
*/
Process.pass = function (id) {
var ajax = new $ax(Feng.ctxPath + "/process/pass", function (data) {
Feng.success("审核成功!");
Process.table.refresh();
}, function (data) {
Feng.error("审核失败!" + data.responseJSON.message + "!");
});
ajax.set("taskId", id);
ajax.start();
};
/**
* 未通过审核
*/
Process.unPass = function (id) {
var ajax = new $ax(Feng.ctxPath + "/process/unPass", function (data) {
Feng.success("审核成功!");
Process.table.refresh();
}, function (data) {
Feng.error("审核失败!" + data.responseJSON.message + "!");
});
ajax.set("taskId", id);
ajax.start();
};
/**
* 查询报销管理列表
*/
Process.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Process.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Process.initColumn();
var table = new BSTable(Process.id, "/process/list", defaultColunms);
table.setPaginationType("client");
Process.table = table.init();
});
/**
* 初始化报销管理详情对话框
*/
var ExpenseInfoDlg = {
expenseInfoData : {}
};
/**
* 清除数据
*/
ExpenseInfoDlg.clearData = function() {
this.expenseInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.set = function(key, val) {
this.expenseInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
ExpenseInfoDlg.close = function() {
parent.layer.close(window.parent.Expense.layerIndex);
}
/**
* 收集数据
*/
ExpenseInfoDlg.collectData = function() {
this
.set('id')
.set('money')
.set('desc')
;
}
/**
* 提交添加
*/
ExpenseInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/add", function(data){
Feng.success("添加成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
/**
* 提交修改
*/
ExpenseInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/expense/update", function(data){
Feng.success("修改成功!");
window.parent.Expense.table.refresh();
ExpenseInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.expenseInfoData);
ajax.start();
}
$(function() {
});
/**
* 部门管理初始化
*/
var Dept = {
id: "DeptTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Dept.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', align: 'center', valign: 'middle',width:'50px'},
{title: '部门简称', field: 'simplename', align: 'center', valign: 'middle', sortable: true},
{title: '部门全称', field: 'fullname', align: 'center', valign: 'middle', sortable: true},
{title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true},
{title: '备注', field: 'tips', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
Dept.check = function () {
var selected = $('#' + this.id).bootstrapTreeTable('getSelections');
if(selected.length == 0){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
Dept.seItem = selected[0];
return true;
}
};
/**
* 点击添加部门
*/
Dept.openAddDept = function () {
var index = layer.open({
type: 2,
title: '添加部门',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dept/dept_add'
});
this.layerIndex = index;
};
/**
* 打开查看部门详情
*/
Dept.openDeptDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '部门详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dept/dept_update/' + Dept.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除部门
*/
Dept.delete = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/dept/delete", function () {
Feng.success("删除成功!");
Dept.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("deptId",Dept.seItem.id);
ajax.start();
};
Feng.confirm("是否刪除该部门?", operation);
}
};
/**
* 查询部门列表
*/
Dept.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Dept.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Dept.initColumn();
var table = new BSTreeTable(Dept.id, "/dept/list", defaultColunms);
table.setExpandColumn(2);
table.setIdField("id");
table.setCodeField("id");
table.setParentCodeField("pid");
table.setExpandAll(true);
table.init();
Dept.table = table;
});
/**
* 初始化部门详情对话框
*/
var DeptInfoDlg = {
deptInfoData : {},
zTreeInstance : null,
validateFields: {
simplename: {
validators: {
notEmpty: {
message: '部门名称不能为空'
}
}
},
fullname: {
validators: {
notEmpty: {
message: '部门全称不能为空'
}
}
},
pName: {
validators: {
notEmpty: {
message: '上级名称不能为空'
}
}
}
}
};
/**
* 清除数据
*/
DeptInfoDlg.clearData = function() {
this.deptInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
DeptInfoDlg.set = function(key, val) {
this.deptInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
DeptInfoDlg.get = function(key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
DeptInfoDlg.close = function() {
parent.layer.close(window.parent.Dept.layerIndex);
}
/**
* 点击部门ztree列表的选项时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
DeptInfoDlg.onClickDept = function(e, treeId, treeNode) {
$("#pName").attr("value", DeptInfoDlg.zTreeInstance.getSelectedVal());
$("#pid").attr("value", treeNode.id);
}
/**
* 显示部门选择的树
*
* @returns
*/
DeptInfoDlg.showDeptSelectTree = function() {
var pName = $("#pName");
var pNameOffset = $("#pName").offset();
$("#parentDeptMenu").css({
left : pNameOffset.left + "px",
top : pNameOffset.top + pName.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
}
/**
* 隐藏部门选择的树
*/
DeptInfoDlg.hideDeptSelectTree = function() {
$("#parentDeptMenu").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
}
/**
* 收集数据
*/
DeptInfoDlg.collectData = function() {
this.set('id').set('simplename').set('fullname').set('tips').set('num').set('pid');
}
/**
* 验证数据是否为空
*/
DeptInfoDlg.validate = function () {
$('#deptInfoForm').data("bootstrapValidator").resetForm();
$('#deptInfoForm').bootstrapValidator('validate');
return $("#deptInfoForm").data('bootstrapValidator').isValid();
}
/**
* 提交添加部门
*/
DeptInfoDlg.addSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/dept/add", function(data){
Feng.success("添加成功!");
window.parent.Dept.table.refresh();
DeptInfoDlg.close();
},function(data){
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.deptInfoData);
ajax.start();
}
/**
* 提交修改
*/
DeptInfoDlg.editSubmit = function() {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/dept/update", function(data){
Feng.success("修改成功!");
window.parent.Dept.table.refresh();
DeptInfoDlg.close();
},function(data){
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.deptInfoData);
ajax.start();
}
function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "parentDeptMenu" || $(
event.target).parents("#parentDeptMenu").length > 0)) {
DeptInfoDlg.hideDeptSelectTree();
}
}
$(function() {
Feng.initValidator("deptInfoForm", DeptInfoDlg.validateFields);
var ztree = new $ZTree("parentDeptMenuTree", "/dept/tree");
ztree.bindOnClick(DeptInfoDlg.onClickDept);
ztree.init();
DeptInfoDlg.zTreeInstance = ztree;
});
/**
* 字典管理初始化
*/
var Dict = {
id: "DictTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Dict.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '详情', field: 'detail', align: 'center', valign: 'middle', sortable: true},
{title: '备注', field: 'tips', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
Dict.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Dict.seItem = selected[0];
return true;
}
};
/**
* 点击添加字典
*/
Dict.openAddDict = function () {
var index = layer.open({
type: 2,
title: '添加字典',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dict/dict_add'
});
this.layerIndex = index;
};
/**
* 打开查看字典详情
*/
Dict.openDictDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '字典详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/dict/dict_edit/' + Dict.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除字典
*/
Dict.delete = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/dict/delete", function (data) {
Feng.success("删除成功!");
Dict.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("dictId", Dict.seItem.id);
ajax.start();
};
Feng.confirm("是否刪除字典 " + Dict.seItem.name + "?", operation);
}
};
/**
* 查询字典列表
*/
Dict.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Dict.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Dict.initColumn();
var table = new BSTable(Dict.id, "/dict/list", defaultColunms);
table.setPaginationType("client");
Dict.table = table.init();
});
/**
* 初始化字典详情对话框
*/
var DictInfoDlg = {
count: $("#itemSize").val(),
dictName: '', //字典的名称
dictCode: '',//字典类型编码
dictTips: '',//字典备注
mutiString: '', //拼接字符串内容(拼接字典条目)
itemTemplate: $("#itemTemplate").html()
};
/**
* item获取新的id
*/
DictInfoDlg.newId = function () {
if(this.count == undefined){
this.count = 0;
}
this.count = this.count + 1;
return "dictItem" + this.count;
};
/**
* 关闭此对话框
*/
DictInfoDlg.close = function () {
parent.layer.close(window.parent.Dict.layerIndex);
};
/**
* 添加条目
*/
DictInfoDlg.addItem = function () {
$("#itemsArea").append(this.itemTemplate);
$("#dictItem").attr("id", this.newId());
};
/**
* 删除item
*/
DictInfoDlg.deleteItem = function (event) {
var obj = Feng.eventParseObject(event);
obj = obj.is('button') ? obj : obj.parent();
obj.parent().parent().remove();
};
/**
* 清除为空的item Dom
*/
DictInfoDlg.clearNullDom = function(){
$("[name='dictItem']").each(function(){
var num = $(this).find("[name='itemNum']").val();
var name = $(this).find("[name='itemName']").val();
if(num == '' || name == ''){
$(this).remove();
}
});
};
/**
* 收集添加字典的数据
*/
DictInfoDlg.collectData = function () {
this.clearNullDom();
var mutiString = "";
$("[name='dictItem']").each(function(){
var code = $(this).find("[name='itemCode']").val();
var name = $(this).find("[name='itemName']").val();
var num = $(this).find("[name='itemNum']").val();
mutiString = mutiString + (code + ":" + name + ":"+ num+";");
});
this.dictName = $("#dictName").val();
this.dictCode = $("#dictCode").val();
this.dictTips = $("#dictTips").val();
this.mutiString = mutiString;
};
/**
* 提交添加字典
*/
DictInfoDlg.addSubmit = function () {
this.collectData();
//提交信息
var ajax = new $ax(Feng.ctxPath + "/dict/add", function (data) {
Feng.success("添加成功!");
window.parent.Dict.table.refresh();
DictInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set('dictName',this.dictName);
ajax.set('dictCode',this.dictCode);
ajax.set('dictTips',this.dictTips);
ajax.set('dictValues',this.mutiString);
ajax.start();
};
/**
* 提交修改
*/
DictInfoDlg.editSubmit = function () {
this.collectData();
var ajax = new $ax(Feng.ctxPath + "/dict/update", function (data) {
Feng.success("修改成功!");
window.parent.Dict.table.refresh();
DictInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set('dictId',$("#dictId").val());
ajax.set('dictName',this.dictName);
ajax.set('dictCode',this.dictCode);
ajax.set('dictTips',this.dictTips);
ajax.set('dictValues',this.mutiString);
ajax.start();
};
/**
* 日志管理初始化
*/
var OptLog = {
id: "OptLogTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
OptLog.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '日志类型', field: 'logtype', align: 'center', valign: 'middle', sortable: true},
{title: '日志名称', field: 'logname', align: 'center', valign: 'middle', sortable: true},
// {title: '用户名称', field: 'userName', align: 'center', valign: 'middle', sortable: true, sortName: 'userid'},
{title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
{title: '类名', field: 'classname', align: 'center', valign: 'middle', sortable: true},
{title: '方法名', field: 'method', align: 'center', valign: 'middle', sortable: true},
{title: '时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
OptLog.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if(selected.length == 0){
Feng.info("请先选中表格中的某一记录!");
return false;
}else{
OptLog.seItem = selected[0];
return true;
}
};
/**
* 查看日志详情
*/
OptLog.detail = function () {
if (this.check()) {
var ajax = new $ax(Feng.ctxPath + "/log/detail/" + this.seItem.id, function (data) {
Feng.infoDetail("日志详情", data.regularMessage);
}, function (data) {
Feng.error("获取详情失败!");
});
ajax.start();
}
};
/**
* 清空日志
*/
OptLog.delLog = function () {
Feng.confirm("是否清空所有日志?",function(){
var ajax = Feng.baseAjax("/log/delLog","清空日志");
ajax.start();
OptLog.table.refresh();
});
}
/**
* 查询表单提交参数对象
* @returns {{}}
*/
OptLog.formParams = function() {
var queryData = {};
queryData['logName'] = $("#logName").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
queryData['logType'] = $("#logType").val();
return queryData;
}
/**
* 查询日志列表
*/
OptLog.search = function () {
OptLog.table.refresh({query: OptLog.formParams()});
};
$(function () {
var defaultColunms = OptLog.initColumn();
var table = new BSTable(OptLog.id, "/log/list", defaultColunms);
table.setPaginationType("server");
table.setQueryParams(OptLog.formParams());
OptLog.table = table.init();
});
/**
* 日志管理初始化
*/
var LoginLog = {
id: "LoginLogTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
LoginLog.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '日志名称', field: 'logname', align: 'center', valign: 'middle', sortable: true},
{title: '用户名称', field: 'userName', align: 'center', valign: 'middle'},
{title: '时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '具体消息', field: 'message', align: 'center', valign: 'middle', sortable: true},
{title: 'ip', field: 'ip', align: 'center', valign: 'middle', sortable: true}];
};
/**
* 检查是否选中
*/
LoginLog.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
LoginLog.seItem = selected[0];
return true;
}
};
/**
* 清空日志
*/
LoginLog.delLog = function () {
Feng.confirm("是否清空所有日志?", function () {
var ajax = Feng.baseAjax("/loginLog/delLoginLog", "清空日志");
ajax.start();
LoginLog.table.refresh();
});
}
/**
* 查询日志列表
*/
LoginLog.search = function () {
var queryData = {};
queryData['logName'] = $("#logName").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
LoginLog.table.refresh({query: queryData});
};
$(function () {
init();
var defaultColunms = LoginLog.initColumn();
var table = new BSTable(LoginLog.id, "/loginLog/list", defaultColunms);
table.setPaginationType("server");
LoginLog.table = table.init();
});
function init() {
var BootstrapTable = $.fn.bootstrapTable.Constructor;
BootstrapTable.prototype.onSort = function (event) {
var $this = event.type === "keypress" ? $(event.currentTarget) : $(event.currentTarget).parent(),
$this_ = this.$header.find('th').eq($this.index()),
sortName = this.header.sortNames[$this.index()];
this.$header.add(this.$header_).find('span.order').remove();
if (this.options.sortName === $this.data('field')) {
this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
} else {
this.options.sortName = sortName || $this.data('field');
this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
}
this.trigger('sort', this.options.sortName, this.options.sortOrder);
$this.add($this_).data('order', this.options.sortOrder);
// Assign the correct sortable arrow
this.getCaret();
if (this.options.sidePagination === 'server') {
this.initServer(this.options.silentSort);
return;
}
this.initSort();
this.initBody();
};
BootstrapTable.prototype.getCaret = function () {
var that = this;
$.each(this.$header.find('th'), function (i, th) {
var sortName = that.header.sortNames[i];
$(th).find('.sortable').removeClass('desc asc').addClass((sortName || $(th).data('field')) === that.options.sortName ? that.options.sortOrder : 'both');
});
};
}
/**
* 角色管理的单例
*/
var Menu = {
id: "menuTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Menu.initColumn = function () {
var columns = [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '菜单名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '菜单编号', field: 'code', align: 'center', valign: 'middle', sortable: true},
{title: '菜单父编号', field: 'pcode', align: 'center', valign: 'middle', sortable: true},
{title: '请求地址', field: 'url', align: 'center', valign: 'middle', sortable: true},
{title: '排序', field: 'num', align: 'center', valign: 'middle', sortable: true},
{title: '层级', field: 'levels', align: 'center', valign: 'middle', sortable: true},
{title: '是否是菜单', field: 'isMenuName', align: 'center', valign: 'middle', sortable: true},
{title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}]
return columns;
};
/**
* 检查是否选中
*/
Menu.check = function () {
var selected = $('#' + this.id).bootstrapTreeTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Menu.seItem = selected[0];
return true;
}
};
/**
* 点击添加菜单
*/
Menu.openAddMenu = function () {
var index = layer.open({
type: 2,
title: '添加菜单',
area: ['830px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/menu/menu_add'
});
this.layerIndex = index;
};
/**
* 点击修改
*/
Menu.openChangeMenu = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '修改菜单',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/menu/menu_edit/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除
*/
Menu.delMenu = function () {
if (this.check()) {
var operation = function () {
var ajax = new $ax(Feng.ctxPath + "/menu/remove", function (data) {
Feng.success("删除成功!");
Menu.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("menuId", Menu.seItem.id);
ajax.start();
};
Feng.confirm("是否刪除该菜单?", operation);
}
};
/**
* 搜索
*/
Menu.search = function () {
var queryData = {};
queryData['menuName'] = $("#menuName").val();
queryData['level'] = $("#level").val();
Menu.table.refresh({query: queryData});
}
$(function () {
var defaultColunms = Menu.initColumn();
var table = new BSTreeTable(Menu.id, "/menu/list", defaultColunms);
table.setExpandColumn(2);
table.setIdField("id");
table.setCodeField("code");
table.setParentCodeField("pcode");
table.setExpandAll(true);
table.init();
Menu.table = table;
});
/**
* 菜单详情对话框
*/
var MenuInfoDlg = {
menuInfoData: {},
ztreeInstance: null,
validateFields: {
name: {
validators: {
notEmpty: {
message: '菜单名称不能为空'
}
}
},
code: {
validators: {
notEmpty: {
message: '菜单编号不能为空'
}
}
},
pcodeName: {
validators: {
notEmpty: {
message: '父菜单不能为空'
}
}
},
url: {
validators: {
notEmpty: {
message: '请求地址不能为空'
}
}
},
num: {
validators: {
notEmpty: {
message: '序号不能为空'
}
}
}
}
};
/**
* 清除数据
*/
MenuInfoDlg.clearData = function () {
this.menuInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
MenuInfoDlg.set = function (key, value) {
this.menuInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
MenuInfoDlg.get = function (key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
MenuInfoDlg.close = function () {
parent.layer.close(window.parent.Menu.layerIndex);
}
/**
* 收集数据
*/
MenuInfoDlg.collectData = function () {
this.set('id').set('name').set('code').set('pcode').set('url').set('num').set('levels').set('icon').set("ismenu");
}
/**
* 验证数据是否为空
*/
MenuInfoDlg.validate = function () {
$('#menuInfoForm').data("bootstrapValidator").resetForm();
$('#menuInfoForm').bootstrapValidator('validate');
return $("#menuInfoForm").data('bootstrapValidator').isValid();
}
/**
* 提交添加用户
*/
MenuInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/menu/add", function (data) {
Feng.success("添加成功!");
window.parent.Menu.table.refresh();
MenuInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.menuInfoData);
ajax.start();
}
/**
* 提交修改
*/
MenuInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/menu/edit", function (data) {
Feng.success("修改成功!");
window.parent.Menu.table.refresh();
MenuInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.menuInfoData);
ajax.start();
}
/**
* 点击父级编号input框时
*/
MenuInfoDlg.onClickDept = function (e, treeId, treeNode) {
$("#pcodeName").attr("value", MenuInfoDlg.ztreeInstance.getSelectedVal());
$("#pcode").attr("value", treeNode.id);
};
/**
* 显示父级菜单选择的树
*/
MenuInfoDlg.showMenuSelectTree = function () {
Feng.showInputTree("pcodeName", "pcodeTreeDiv", 15, 34);
};
$(function () {
Feng.initValidator("menuInfoForm", MenuInfoDlg.validateFields);
var ztree = new $ZTree("pcodeTree", "/menu/selectMenuTreeList");
ztree.bindOnClick(MenuInfoDlg.onClickDept);
ztree.init();
MenuInfoDlg.ztreeInstance = ztree;
//初始化是否是菜单
if($("#ismenuValue").val() == undefined){
$("#ismenu").val(0);
}else{
$("#ismenu").val($("#ismenuValue").val());
}
});
/**
* 通知管理初始化
*/
var Notice = {
id: "NoticeTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Notice.initColumn = function () {
return [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '标题', field: 'title', align: 'center', valign: 'middle', sortable: true},
{title: '内容', field: 'content', align: 'center', valign: 'middle', sortable: true},
{title: '发布者', field: 'createrName', align: 'center', valign: 'middle', sortable: true},
{title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true}
];
};
/**
* 检查是否选中
*/
Notice.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Notice.seItem = selected[0];
return true;
}
};
/**
* 点击添加通知
*/
Notice.openAddNotice = function () {
var index = layer.open({
type: 2,
title: '添加通知',
area: ['800px', '500px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/notice/notice_add'
});
this.layerIndex = index;
};
/**
* 打开查看通知详情
*/
Notice.openNoticeDetail = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '通知详情',
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/notice/notice_update/' + Notice.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除通知
*/
Notice.delete = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/notice/delete", function (data) {
Feng.success("删除成功!");
Notice.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("noticeId", Notice.seItem.id);
ajax.start();
};
Feng.confirm("是否删除通知 " + Notice.seItem.title + "?", operation);
}
};
/**
* 查询通知列表
*/
Notice.search = function () {
var queryData = {};
queryData['condition'] = $("#condition").val();
Notice.table.refresh({query: queryData});
};
$(function () {
var defaultColunms = Notice.initColumn();
var table = new BSTable(Notice.id, "/notice/list", defaultColunms);
table.setPaginationType("client");
Notice.table = table.init();
});
/**
* 初始化通知详情对话框
*/
var NoticeInfoDlg = {
noticeInfoData: {},
editor: null,
validateFields: {
title: {
validators: {
notEmpty: {
message: '标题不能为空'
}
}
}
}
};
/**
* 清除数据
*/
NoticeInfoDlg.clearData = function () {
this.noticeInfoData = {};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
NoticeInfoDlg.set = function (key, value) {
this.noticeInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
NoticeInfoDlg.get = function (key) {
return $("#" + key).val();
}
/**
* 关闭此对话框
*/
NoticeInfoDlg.close = function () {
parent.layer.close(window.parent.Notice.layerIndex);
}
/**
* 收集数据
*/
NoticeInfoDlg.collectData = function () {
this.noticeInfoData['content'] = NoticeInfoDlg.editor.txt.html();
this.set('id').set('title');
}
/**
* 验证数据是否为空
*/
NoticeInfoDlg.validate = function () {
$('#noticeInfoForm').data("bootstrapValidator").resetForm();
$('#noticeInfoForm').bootstrapValidator('validate');
return $("#noticeInfoForm").data('bootstrapValidator').isValid();
};
/**
* 提交添加
*/
NoticeInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/notice/add", function (data) {
Feng.success("添加成功!");
window.parent.Notice.table.refresh();
NoticeInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.noticeInfoData);
ajax.start();
}
/**
* 提交修改
*/
NoticeInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/notice/update", function (data) {
Feng.success("修改成功!");
window.parent.Notice.table.refresh();
NoticeInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.noticeInfoData);
ajax.start();
}
$(function () {
Feng.initValidator("noticeInfoForm", NoticeInfoDlg.validateFields);
//初始化编辑器
var E = window.wangEditor;
var editor = new E('#editor');
editor.create();
editor.txt.html($("#contentVal").val());
NoticeInfoDlg.editor = editor;
});
/**
* 角色管理的单例
*/
var Role = {
id: "roleTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
/**
* 初始化表格的列
*/
Role.initColumn = function () {
var columns = [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '名称', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '上级角色', field: 'pName', align: 'center', valign: 'middle', sortable: true},
{title: '所在部门', field: 'deptName', align: 'center', valign: 'middle', sortable: true},
{title: '别名', field: 'tips', align: 'center', valign: 'middle', sortable: true}]
return columns;
};
/**
* 检查是否选中
*/
Role.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
Role.seItem = selected[0];
return true;
}
};
/**
* 点击添加管理员
*/
Role.openAddRole = function () {
var index = layer.open({
type: 2,
title: '添加角色',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/role/role_add'
});
this.layerIndex = index;
};
/**
* 点击修改按钮时
*/
Role.openChangeRole = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '修改角色',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/role/role_edit/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除角色
*/
Role.delRole = function () {
if (this.check()) {
var operation = function(){
var ajax = new $ax(Feng.ctxPath + "/role/remove", function () {
Feng.success("删除成功!");
Role.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("roleId", Role.seItem.id);
ajax.start();
};
Feng.confirm("是否删除角色 " + Role.seItem.name + "?",operation);
}
};
/**
* 权限配置
*/
Role.assign = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '权限配置',
area: ['300px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/role/role_assign/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 搜索角色
*/
Role.search = function () {
var queryData = {};
queryData['roleName'] = $("#roleName").val();
Role.table.refresh({query: queryData});
}
$(function () {
var defaultColunms = Role.initColumn();
var table = new BSTable(Role.id, "/role/list", defaultColunms);
table.setPaginationType("client");
table.init();
Role.table = table;
});
/**
* 角色详情对话框(可用于添加和修改对话框)
*/
var RolInfoDlg = {
roleInfoData: {},
deptZtree: null,
pNameZtree: null,
validateFields: {
name: {
validators: {
notEmpty: {
message: '用户名不能为空'
}
}
},
tips: {
validators: {
notEmpty: {
message: '别名不能为空'
}
}
},
pName: {
validators: {
notEmpty: {
message: '父级名称不能为空'
}
}
}
}
};
/**
* 清除数据
*/
RolInfoDlg.clearData = function () {
this.roleInfoData = {};
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
RolInfoDlg.set = function (key, value) {
this.roleInfoData[key] = (typeof value == "undefined") ? $("#" + key).val() : value;
return this;
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
RolInfoDlg.get = function (key) {
return $("#" + key).val();
};
/**
* 关闭此对话框
*/
RolInfoDlg.close = function () {
parent.layer.close(window.parent.Role.layerIndex);
};
/**
* 点击部门input框时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
RolInfoDlg.onClickDept = function (e, treeId, treeNode) {
$("#deptName").attr("value", RolInfoDlg.deptZtree.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
};
RolInfoDlg.onDblClickDept = function (e, treeId, treeNode) {
$("#deptName").attr("value", RolInfoDlg.deptZtree.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
$("#deptContent").fadeOut("fast");
};
/**
* 点击父级菜单input框时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
RolInfoDlg.onClickPName = function (e, treeId, treeNode) {
$("#pName").attr("value", RolInfoDlg.pNameZtree.getSelectedVal());
$("#pid").attr("value", treeNode.id);
};
/**
* 显示部门选择的树
*
* @returns
*/
RolInfoDlg.showDeptSelectTree = function () {
Feng.showInputTree("deptName", "deptContent");
};
/**
* 显示父级菜单的树
*
* @returns
*/
RolInfoDlg.showPNameSelectTree = function () {
Feng.showInputTree("pName", "pNameContent");
};
/**
* 收集数据
*/
RolInfoDlg.collectData = function () {
this.set('id').set('name').set('pid').set('deptid').set('tips').set('num');
};
/**
* 验证数据是否为空
*/
RolInfoDlg.validate = function () {
$('#roleInfoForm').data("bootstrapValidator").resetForm();
$('#roleInfoForm').bootstrapValidator('validate');
return $("#roleInfoForm").data('bootstrapValidator').isValid();
};
/**
* 提交添加用户
*/
RolInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/role/add", function (data) {
Feng.success("添加成功!");
window.parent.Role.table.refresh();
RolInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.roleInfoData);
ajax.start();
};
/**
* 提交修改
*/
RolInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/role/edit", function (data) {
Feng.success("修改成功!");
window.parent.Role.table.refresh();
RolInfoDlg.close();
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.roleInfoData);
ajax.start();
};
$(function () {
Feng.initValidator("roleInfoForm", RolInfoDlg.validateFields);
var deptTree = new $ZTree("deptTree", "/dept/tree");
deptTree.bindOnClick(RolInfoDlg.onClickDept);
deptTree.bindOnDblClick(RolInfoDlg.onDblClickDept)
deptTree.init();
RolInfoDlg.deptZtree = deptTree;
var pNameTree = new $ZTree("pNameTree", "/role/roleTreeList");
pNameTree.bindOnClick(RolInfoDlg.onClickPName);
pNameTree.init();
RolInfoDlg.pNameZtree = pNameTree;
});
/**
* 系统管理--用户管理的单例对象
*/
var MgrUser = {
id: "managerTable",//表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1,
deptid:0
};
/**
* 初始化表格的列
*/
MgrUser.initColumn = function () {
var columns = [
{field: 'selectItem', radio: true},
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
{title: '账号', field: 'account', align: 'center', valign: 'middle', sortable: true},
{title: '姓名', field: 'name', align: 'center', valign: 'middle', sortable: true},
{title: '性别', field: 'sexName', align: 'center', valign: 'middle', sortable: true},
{title: '角色', field: 'roleName', align: 'center', valign: 'middle', sortable: true},
{title: '部门', field: 'deptName', align: 'center', valign: 'middle', sortable: true},
{title: '邮箱', field: 'email', align: 'center', valign: 'middle', sortable: true},
{title: '电话', field: 'phone', align: 'center', valign: 'middle', sortable: true},
{title: '创建时间', field: 'createtime', align: 'center', valign: 'middle', sortable: true},
{title: '状态', field: 'statusName', align: 'center', valign: 'middle', sortable: true}];
return columns;
};
/**
* 检查是否选中
*/
MgrUser.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length == 0) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
MgrUser.seItem = selected[0];
return true;
}
};
/**
* 点击添加管理员
*/
MgrUser.openAddMgr = function () {
var index = layer.open({
type: 2,
title: '添加管理员',
area: ['800px', '560px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/mgr/user_add'
});
this.layerIndex = index;
};
/**
* 点击修改按钮时
* @param userId 管理员id
*/
MgrUser.openChangeUser = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '编辑管理员',
area: ['800px', '450px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/mgr/user_edit/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 点击角色分配
* @param
*/
MgrUser.roleAssign = function () {
if (this.check()) {
var index = layer.open({
type: 2,
title: '角色分配',
area: ['300px', '400px'], //宽高
fix: false, //不固定
maxmin: true,
content: Feng.ctxPath + '/mgr/role_assign/' + this.seItem.id
});
this.layerIndex = index;
}
};
/**
* 删除用户
*/
MgrUser.delMgrUser = function () {
if (this.check()) {
var operation = function(){
var userId = MgrUser.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/delete", function () {
Feng.success("删除成功!");
MgrUser.table.refresh();
}, function (data) {
Feng.error("删除失败!" + data.responseJSON.message + "!");
});
ajax.set("userId", userId);
ajax.start();
};
Feng.confirm("是否删除用户" + MgrUser.seItem.account + "?",operation);
}
};
/**
* 冻结用户账户
* @param userId
*/
MgrUser.freezeAccount = function () {
if (this.check()) {
var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/freeze", function (data) {
Feng.success("冻结成功!");
MgrUser.table.refresh();
}, function (data) {
Feng.error("冻结失败!" + data.responseJSON.message + "!");
});
ajax.set("userId", userId);
ajax.start();
}
};
/**
* 解除冻结用户账户
* @param userId
*/
MgrUser.unfreeze = function () {
if (this.check()) {
var userId = this.seItem.id;
var ajax = new $ax(Feng.ctxPath + "/mgr/unfreeze", function (data) {
Feng.success("解除冻结成功!");
MgrUser.table.refresh();
}, function (data) {
Feng.error("解除冻结失败!");
});
ajax.set("userId", userId);
ajax.start();
}
}
/**
* 重置密码
*/
MgrUser.resetPwd = function () {
if (this.check()) {
var userId = this.seItem.id;
parent.layer.confirm('是否重置密码为111111?', {
btn: ['确定', '取消'],
shade: false //不显示遮罩
}, function () {
var ajax = new $ax(Feng.ctxPath + "/mgr/reset", function (data) {
Feng.success("重置密码成功!");
}, function (data) {
Feng.error("重置密码失败!");
});
ajax.set("userId", userId);
ajax.start();
});
}
};
MgrUser.resetSearch = function () {
$("#name").val("");
$("#beginTime").val("");
$("#endTime").val("");
MgrUser.search();
}
MgrUser.search = function () {
var queryData = {};
queryData['deptid'] = MgrUser.deptid;
queryData['name'] = $("#name").val();
queryData['beginTime'] = $("#beginTime").val();
queryData['endTime'] = $("#endTime").val();
MgrUser.table.refresh({query: queryData});
}
MgrUser.onClickDept = function (e, treeId, treeNode) {
MgrUser.deptid = treeNode.id;
MgrUser.search();
};
$(function () {
var defaultColunms = MgrUser.initColumn();
var table = new BSTable("managerTable", "/mgr/list", defaultColunms);
table.setPaginationType("client");
MgrUser.table = table.init();
var ztree = new $ZTree("deptTree", "/dept/tree");
ztree.bindOnClick(MgrUser.onClickDept);
ztree.init();
});
/**
* 用户详情对话框(可用于添加和修改对话框)
*/
var UserInfoDlg = {
userInfoData: {},
validateFields: {
account: {
validators: {
notEmpty: {
message: '账户不能为空'
}
}
},
name: {
validators: {
notEmpty: {
message: '姓名不能为空'
}
}
},
citySel: {
validators: {
notEmpty: {
message: '部门不能为空'
}
}
},
password: {
validators: {
notEmpty: {
message: '密码不能为空'
},
identical: {
field: 'rePassword',
message: '两次密码不一致'
},
}
},
rePassword: {
validators: {
notEmpty: {
message: '密码不能为空'
},
identical: {
field: 'password',
message: '两次密码不一致'
},
}
}
}
};
/**
* 清除数据
*/
UserInfoDlg.clearData = function () {
this.userInfoData = {};
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
UserInfoDlg.set = function (key, value) {
if(typeof value == "undefined"){
if(typeof $("#" + key).val() =="undefined"){
var str="";
var ids="";
$("input[name='"+key+"']:checkbox").each(function(){
if(true == $(this).is(':checked')){
str+=$(this).val()+",";
}
});
if(str){
if(str.substr(str.length-1)== ','){
ids = str.substr(0,str.length-1);
}
}else{
$("input[name='"+key+"']:radio").each(function(){
if(true == $(this).is(':checked')){
ids=$(this).val()
}
});
}
this.userInfoData[key] = ids;
}else{
this.userInfoData[key]= $("#" + key).val();
}
}
return this;
};
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
UserInfoDlg.get = function (key) {
return $("#" + key).val();
};
/**
* 关闭此对话框
*/
UserInfoDlg.close = function () {
parent.layer.close(window.parent.MgrUser.layerIndex);
};
/**
* 点击部门input框时
*
* @param e
* @param treeId
* @param treeNode
* @returns
*/
UserInfoDlg.onClickDept = function (e, treeId, treeNode) {
$("#citySel").attr("value", instance.getSelectedVal());
$("#deptid").attr("value", treeNode.id);
};
/**
* 显示部门选择的树
*
* @returns
*/
UserInfoDlg.showDeptSelectTree = function () {
var cityObj = $("#citySel");
var cityOffset = $("#citySel").offset();
$("#menuContent").css({
left: cityOffset.left + "px",
top: cityOffset.top + cityObj.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
};
/**
* 显示用户详情部门选择的树
*
* @returns
*/
UserInfoDlg.showInfoDeptSelectTree = function () {
var cityObj = $("#citySel");
var cityPosition = $("#citySel").position();
$("#menuContent").css({
left: cityPosition.left + "px",
top: cityPosition.top + cityObj.outerHeight() + "px"
}).slideDown("fast");
$("body").bind("mousedown", onBodyDown);
};
/**
* 隐藏部门选择的树
*/
UserInfoDlg.hideDeptSelectTree = function () {
$("#menuContent").fadeOut("fast");
$("body").unbind("mousedown", onBodyDown);// mousedown当鼠标按下就可以触发,不用弹起
};
/**
* 收集数据
*/
UserInfoDlg.collectData = function () {
this.set('id').set('account').set('sex').set('password').set('avatar')
.set('email').set('name').set('birthday').set('rePassword').set('deptid').set('phone');
};
/**
* 验证两个密码是否一致
*/
UserInfoDlg.validatePwd = function () {
var password = this.get("password");
var rePassword = this.get("rePassword");
if (password == rePassword) {
return true;
} else {
return false;
}
};
/**
* 验证数据是否为空
*/
UserInfoDlg.validate = function () {
$('#userInfoForm').data("bootstrapValidator").resetForm();
$('#userInfoForm').bootstrapValidator('validate');
return $("#userInfoForm").data('bootstrapValidator').isValid();
};
/**
* 提交添加用户
*/
UserInfoDlg.addSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
if (!this.validatePwd()) {
Feng.error("两次密码输入不一致");
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/mgr/add", function (data) {
Feng.success("添加成功!");
window.parent.MgrUser.table.refresh();
UserInfoDlg.close();
}, function (data) {
Feng.error("添加失败!" + data.responseJSON.message + "!");
});
ajax.set(this.userInfoData);
ajax.start();
};
/**
* 提交修改
*/
UserInfoDlg.editSubmit = function () {
this.clearData();
this.collectData();
if (!this.validate()) {
return;
}
//提交信息
var ajax = new $ax(Feng.ctxPath + "/mgr/edit", function (data) {
Feng.success("修改成功!");
if (window.parent.MgrUser != undefined) {
window.parent.MgrUser.table.refresh();
UserInfoDlg.close();
}
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set(this.userInfoData);
ajax.start();
};
/**
* 修改密码
*/
UserInfoDlg.chPwd = function () {
var ajax = new $ax(Feng.ctxPath + "/mgr/changePwd", function (data) {
Feng.success("修改成功!");
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.set("oldPwd");
ajax.set("newPwd");
ajax.set("rePwd");
ajax.start();
};
function onBodyDown(event) {
if (!(event.target.id == "menuBtn" || event.target.id == "menuContent" || $(
event.target).parents("#menuContent").length > 0)) {
UserInfoDlg.hideDeptSelectTree();
}
}
$(function () {
Feng.initValidator("userInfoForm", UserInfoDlg.validateFields);
//初始化性别选项
$("#sex").val($("#sexValue").val());
var ztree = new $ZTree("treeDemo", "/dept/tree");
ztree.bindOnClick(UserInfoDlg.onClickDept);
ztree.init();
instance = ztree;
// 初始化头像上传
var avatarUp = new $WebUpload("avatar");
avatarUp.setUploadBarId("progressBar");
avatarUp.init();
});
package com.stylefeng.guns.base;
import com.stylefeng.guns.GunsApplication;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
/**
* 基础测试类
*
* @author stylefeng
* @Date 2017/5/21 16:10
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = GunsApplication.class)
@WebAppConfiguration
//@Transactional //打开的话测试之后数据可自动回滚
public class BaseJunit {
@Autowired
WebApplicationContext webApplicationContext;
protected MockMvc mockMvc;
@Before
public void setupMockMvc(){
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
@Before
public void initDatabase(){
}
}
package com.stylefeng.guns.multi.entity;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author fengshuonan
* @since 2018-07-10
*/
public class Test implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "aaa", type = IdType.AUTO)
private Integer aaa;
private String bbb;
public Integer getAaa() {
return aaa;
}
public void setAaa(Integer aaa) {
this.aaa = aaa;
}
public String getBbb() {
return bbb;
}
public void setBbb(String bbb) {
this.bbb = bbb;
}
@Override
public String toString() {
return "Test{" +
"aaa=" + aaa +
", bbb=" + bbb +
"}";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="share.example.modular.mapper.TestMapper">
<!-- 开启二级缓存 -->
<cache type="org.mybatis.caches.ehcache.LoggingEhcache"/>
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.stylefeng.guns.multi.entity.Test">
<id column="aaa" property="aaa" />
<result column="bbb" property="bbb" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
aaa, bbb
</sql>
</mapper>
package com.stylefeng.guns.multi.service;
/**
* <p>
* 服务类
* </p>
*
* @author fengshuonan
* @since 2018-07-10
*/
public interface TestService {
/**
* 测试多数据源的业务
*
* @author stylefeng
* @Date 2017/6/23 23:02
*/
void testBiz();
/**
* 测试多数据源的业务
*
* @author stylefeng
* @Date 2017/6/23 23:02
*/
void testGuns();
/**
* 测试多数据源的业务
*
* @author stylefeng
* @Date 2017/6/23 23:02
*/
void testAll();
}
package com.stylefeng.guns.multi.service.impl;
import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
import com.stylefeng.guns.core.common.constant.DatasourceEnum;
import com.stylefeng.guns.multi.entity.Test;
import com.stylefeng.guns.multi.mapper.TestMapper;
import com.stylefeng.guns.multi.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* <p>
* 服务实现类
* </p>
*
* @author fengshuonan
* @since 2018-07-10
*/
@Service
public class TestServiceImpl implements TestService {
@Autowired
private TestMapper testMapper;
@Override
@DataSource(name = DatasourceEnum.DATA_SOURCE_BIZ)
@Transactional
public void testBiz() {
Test test = new Test();
test.setBbb("bizTest");
testMapper.insert(test);
}
@Override
@DataSource(name = DatasourceEnum.DATA_SOURCE_GUNS)
@Transactional
public void testGuns() {
Test test = new Test();
test.setBbb("gunsTest");
testMapper.insert(test);
}
@Override
@Transactional
public void testAll() {
testBiz();
testGuns();
//int i = 1 / 0;
}
}
package com.stylefeng.guns.multi.test;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.multi.service.TestService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 业务测试
*
* @author fengshuonan
* @date 2017-06-23 23:12
*/
public class BizTest extends BaseJunit {
@Autowired
TestService testService;
@Test
public void test() {
testService.testGuns();
testService.testBiz();
//testService.testAll();
}
}
package com.stylefeng.guns.shiro;
import org.springframework.util.Base64Utils;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
public class Base64Test {
/**
* Shiro 记住密码采用的是AES加密,AES key length 需要是16位,该方法生成16位的key
*/
public static void main(String[] args) {
String keyStr = "guns";
byte[] keys;
try {
keys = keyStr.getBytes("UTF-8");
System.out.println(Base64Utils.encodeToString(Arrays.copyOf(keys, 16)));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.NoticeMapper;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertTrue;
/**
* 首页通知展示测试
*
* @author fengshuonan
* @date 2017-05-21 15:02
*/
public class BlackBoardTest extends BaseJunit {
@Autowired
NoticeMapper noticeMapper;
@Test
public void blackBoardTest() {
List<Map<String, Object>> notices = noticeMapper.list(null);
assertTrue(notices.size() > 0);
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.DeptMapper;
import com.stylefeng.guns.modular.system.model.Dept;
import org.junit.Test;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* 字典服务测试
*
* @author fengshuonan
* @date 2017-04-27 17:05
*/
public class DeptTest extends BaseJunit {
@Resource
DeptMapper deptMapper;
@Test
public void addDeptTest() {
Dept dept = new Dept();
dept.setFullname("测试fullname");
dept.setNum(5);
dept.setPid(1);
dept.setSimplename("测试");
dept.setTips("测试tips");
dept.setVersion(1);
Integer insert = deptMapper.insert(dept);
assertEquals(insert, new Integer(1));
}
@Test
public void updateTest() {
Dept dept = this.deptMapper.selectById(24);
dept.setTips("哈哈");
boolean flag = dept.updateById();
assertTrue(flag);
}
@Test
public void deleteTest() {
Dept dept = this.deptMapper.selectById(24);
Integer integer = deptMapper.deleteById(dept);
assertTrue(integer > 0);
}
@Test
public void listTest() {
List<Map<String, Object>> list = this.deptMapper.list("总公司");
assertTrue(list.size() > 0);
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.DictMapper;
import com.stylefeng.guns.modular.system.service.IDictService;
import org.junit.Assert;
import org.junit.Test;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 字典服务测试
*
* @author fengshuonan
* @date 2017-04-27 17:05
*/
public class DictTest extends BaseJunit {
@Resource
IDictService dictService;
@Resource
DictMapper dictMapper;
@Test
public void addTest() {
String dictCode = "test";
String dictName = "字典测试";
String dictTips = "这是一个字典测试";
String dictValues = "1:测试1:1;2:测试2:2";
dictService.addDict(dictCode,dictName,dictTips, dictValues);
}
@Test
public void editTest() {
dictService.editDict(16, "tes","测试","备注", "1:测试1;2:测试2");
}
@Test
public void deleteTest() {
this.dictService.delteDict(16);
}
@Test
public void listTest() {
List<Map<String, Object>> list = this.dictMapper.list("性别");
Assert.assertTrue(list.size() > 0);
}
}
package com.stylefeng.guns.system;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.MenuMapper;
import com.stylefeng.guns.modular.system.model.Menu;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Stack;
/**
* 菜单测试
*
* @author fengshuonan
* @date 2017-06-13 21:23
*/
public class MenuTest extends BaseJunit {
@Autowired
MenuMapper menuMapper;
/**
* 初始化pcodes
*
* @author stylefeng
* @Date 2017/6/13 21:24
*/
@Test
public void generatePcodes() {
List<Menu> menus = menuMapper.selectList(null);
for (Menu menu : menus) {
if ("0".equals(menu.getPcode()) || null == menu.getPcode()) {
menu.setPcodes("[0],");
} else {
StringBuffer sb = new StringBuffer();
Menu parentMenu = getParentMenu(menu.getCode());
sb.append("[0],");
Stack<String> pcodes = new Stack<>();
while (null != parentMenu.getPcode()) {
pcodes.push(parentMenu.getCode());
parentMenu = getParentMenu(parentMenu.getPcode());
}
int pcodeSize = pcodes.size();
for (int i = 0; i < pcodeSize; i++) {
String code = pcodes.pop();
if (code.equals(menu.getCode())) {
continue;
}
sb.append("[" + code + "],");
}
menu.setPcodes(sb.toString());
}
menu.updateById();
}
}
private Menu getParentMenu(String code) {
Wrapper<Menu> wrapper = new EntityWrapper<Menu>();
wrapper = wrapper.eq("code", code);
List<Menu> menus = menuMapper.selectList(wrapper);
if (menus == null || menus.size() == 0) {
return new Menu();
} else {
return menus.get(0);
}
}
}
package com.stylefeng.guns.system;
import com.stylefeng.guns.base.BaseJunit;
import com.stylefeng.guns.modular.system.dao.UserMapper;
import org.junit.Test;
import javax.annotation.Resource;
/**
* 用户测试
*
* @author fengshuonan
* @date 2017-04-27 17:05
*/
public class UserTest extends BaseJunit {
@Resource
UserMapper userMapper;
@Test
public void userTest() throws Exception {
}
}
/*
Navicat Premium Data Transfer
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 50719
Source Host : localhost:3306
Source Schema : guns
Target Server Type : MySQL
Target Server Version : 50719
File Encoding : 65001
Date: 10/07/2018 14:09:19
*/
DROP DATABASE IF EXISTS guns_test;
CREATE DATABASE IF NOT EXISTS guns_test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
use guns_test;
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for test
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`aaa` int(11) NOT NULL AUTO_INCREMENT,
`bbb` varchar(255) DEFAULT NULL,
PRIMARY KEY (`aaa`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment