add resource
This commit is contained in:
parent
3de86dde66
commit
e4358c9acc
@ -2,17 +2,13 @@ package ink.wgink.gateway.handler.route;
|
|||||||
|
|
||||||
import ink.wgink.gateway.dao.route.IRouteDao;
|
import ink.wgink.gateway.dao.route.IRouteDao;
|
||||||
import ink.wgink.gateway.handler.BaseHandler;
|
import ink.wgink.gateway.handler.BaseHandler;
|
||||||
import ink.wgink.gateway.pojo.ListSearch;
|
|
||||||
import ink.wgink.gateway.pojo.result.SuccessResultList;
|
|
||||||
import ink.wgink.gateway.pojo.route.Route;
|
import ink.wgink.gateway.pojo.route.Route;
|
||||||
import org.springframework.data.domain.Example;
|
import org.springframework.data.domain.Example;
|
||||||
import org.springframework.data.domain.ExampleMatcher;
|
import org.springframework.data.domain.ExampleMatcher;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.reactive.function.server.RouterFunction;
|
|
||||||
import org.springframework.web.reactive.function.server.ServerRequest;
|
import org.springframework.web.reactive.function.server.ServerRequest;
|
||||||
import org.springframework.web.reactive.function.server.ServerResponse;
|
import org.springframework.web.reactive.function.server.ServerResponse;
|
||||||
import reactor.core.publisher.Flux;
|
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -94,27 +90,6 @@ public class RouteHandler extends BaseHandler {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Mono<ServerResponse> list(ServerRequest serverRequest) {
|
public Mono<ServerResponse> list(ServerRequest serverRequest) {
|
||||||
return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(routeDao.findAll(), Route.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 列表分页
|
|
||||||
*
|
|
||||||
* @param serverRequest
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Mono<ServerResponse> listPage(ServerRequest serverRequest) {
|
|
||||||
Optional<String> page = serverRequest.queryParam("page");
|
|
||||||
int currentPage = 1;
|
|
||||||
if (page.isPresent()) {
|
|
||||||
currentPage = Integer.parseInt(page.get());
|
|
||||||
}
|
|
||||||
int totalSize = 5;
|
|
||||||
Optional<String> size = serverRequest.queryParam("size");
|
|
||||||
if (size.isPresent()) {
|
|
||||||
totalSize = Integer.parseInt(size.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
Optional<String> keyword = serverRequest.queryParam("keyword");
|
Optional<String> keyword = serverRequest.queryParam("keyword");
|
||||||
Route route = new Route();
|
Route route = new Route();
|
||||||
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny()
|
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAny()
|
||||||
@ -126,14 +101,7 @@ public class RouteHandler extends BaseHandler {
|
|||||||
route.setSystem(keyword.get());
|
route.setSystem(keyword.get());
|
||||||
route.setSummary(keyword.get());
|
route.setSummary(keyword.get());
|
||||||
}
|
}
|
||||||
return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(listPage(example, currentPage - 1, totalSize), Route.class);
|
return ServerResponse.ok().contentType(MediaType.APPLICATION_JSON).body(routeDao.findAll(example), Route.class);
|
||||||
//return routeDao.findAll(example).skip((currentPage - 1) * totalSize).take(totalSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mono<SuccessResultList> listPage(Example example, int skip, long totalSize) {
|
|
||||||
Flux<Route> routeFlux = routeDao.findAll(example).skip(skip * totalSize).take(totalSize);
|
|
||||||
Mono<Long> mono = routeDao.count(example);
|
|
||||||
return Mono.just(new SuccessResultList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +35,6 @@ public class RouteRouter {
|
|||||||
.andRoute(RequestPredicates.DELETE("/delete/{ids}"), routeHandler::delete)
|
.andRoute(RequestPredicates.DELETE("/delete/{ids}"), routeHandler::delete)
|
||||||
.andRoute(RequestPredicates.PUT("/update/{id}"), routeHandler::update)
|
.andRoute(RequestPredicates.PUT("/update/{id}"), routeHandler::update)
|
||||||
.andRoute(RequestPredicates.GET("/list"), routeHandler::list)
|
.andRoute(RequestPredicates.GET("/list"), routeHandler::list)
|
||||||
.andRoute(RequestPredicates.GET("/listpage"), routeHandler::listPage)
|
|
||||||
.andRoute(RequestPredicates.GET("get/{id}"), routeHandler::get)
|
.andRoute(RequestPredicates.GET("get/{id}"), routeHandler::get)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Title</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Hello Gateway</h1>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
170
src/main/resources/static/wg/assets/js/common.js
Normal file
170
src/main/resources/static/wg/assets/js/common.js
Normal file
@ -0,0 +1,170 @@
|
|||||||
|
var TextMessage = {
|
||||||
|
loading: '加载中...',
|
||||||
|
commit: '确定提交?',
|
||||||
|
committing: '正在提交,请稍后...',
|
||||||
|
commitSuccess: '提交成功,继续操作?',
|
||||||
|
update: '确定更新?',
|
||||||
|
updating: '正在更新,请稍后...',
|
||||||
|
updated: '更新成功',
|
||||||
|
updateSuccess: '更新成功,继续操作?',
|
||||||
|
delete: '确定删除?',
|
||||||
|
deleting: '删除中...',
|
||||||
|
deleted: '删除成功',
|
||||||
|
deleteSuccess: '删除成功',
|
||||||
|
deleteUserConfirm: '请选择要删除的用户',
|
||||||
|
deleteGroupConfirm: '请选择要删除的组',
|
||||||
|
uploading: '正在上传...',
|
||||||
|
bind: '确认绑定?',
|
||||||
|
binding: '正在绑定...',
|
||||||
|
bindSuccess: '绑定成功',
|
||||||
|
button: {
|
||||||
|
yes: '确定',
|
||||||
|
no: '取消',
|
||||||
|
},
|
||||||
|
dialog: {
|
||||||
|
save: '新增',
|
||||||
|
update: '修改'
|
||||||
|
},
|
||||||
|
tree: {
|
||||||
|
rootName: '基础节点'
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
loading: '拼命加载中...',
|
||||||
|
selectDelete: '请选择要删除的数据',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getBaseUrl() {
|
||||||
|
return document.getElementsByTagName('base')[0].href;
|
||||||
|
}
|
||||||
|
|
||||||
|
function goPage(url) {
|
||||||
|
window.location.href = getBaseUrl() + url;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCookie(key) {
|
||||||
|
if (document.cookie.length > 0) {
|
||||||
|
var cookieStart = document.cookie.indexOf(key + "=")
|
||||||
|
if (cookieStart != -1) {
|
||||||
|
cookieStart = cookieStart + key.length + 1
|
||||||
|
var cookieEnd = document.cookie.indexOf(";", cookieStart)
|
||||||
|
if (cookieEnd == -1) cookieEnd = document.cookie.length
|
||||||
|
return unescape(document.cookie.substring(cookieStart, cookieEnd))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setCookie(key, value, expiredays) {
|
||||||
|
var exdate = new Date()
|
||||||
|
exdate.setDate(exdate.getDate() + expiredays)
|
||||||
|
document.cookie = (key + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
function getContentHeight() {
|
||||||
|
var windowHeight = $(window).height();
|
||||||
|
var contentFrameHeight = windowHeight - 50;
|
||||||
|
return contentFrameHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopPaoPao() {
|
||||||
|
window.event ? window.event.cancelBubble = true : e.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新树节点
|
||||||
|
* @param treeId
|
||||||
|
*/
|
||||||
|
function refreshTree(treeId) {
|
||||||
|
if (typeof (treeId) == 'undefined' || null == treeId || '' == treeId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var treeObj = $.fn.zTree.getZTreeObj(treeId);
|
||||||
|
var nodes = treeObj.getSelectedNodes();
|
||||||
|
var node;
|
||||||
|
if (nodes && nodes.length > 0) {
|
||||||
|
node = nodes[0];
|
||||||
|
} else {
|
||||||
|
node = treeObj.getNodeByParam("pId", -1, null);
|
||||||
|
}
|
||||||
|
if (node) {
|
||||||
|
node.isParent = true;
|
||||||
|
treeObj.reAsyncChildNodes(node, "refresh");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新table
|
||||||
|
* @param tableId
|
||||||
|
*/
|
||||||
|
function refreshTable(tableId) {
|
||||||
|
if (typeof (tableId) == 'undefined' || null == tableId || '' == tableId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$('#' + tableId).datagrid('reload');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新树和表格
|
||||||
|
* @param treeId
|
||||||
|
* @param tableId
|
||||||
|
*/
|
||||||
|
function refreshTreeTable(treeId, tableId) {
|
||||||
|
refreshTree(treeId);
|
||||||
|
refreshTable(tableId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算剩余的ID列表
|
||||||
|
* @param deleteIds
|
||||||
|
* @param currentIds
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function resultIdsOfDeleteIds(deleteIds, currentIds) {
|
||||||
|
var tempSelectGroupIds = [];
|
||||||
|
for (var i = 0, currentId; currentId = currentIds[i++];) {
|
||||||
|
var isDelete = false;
|
||||||
|
for (var j = 0, deleteId; deleteId = deleteIds[j++];) {
|
||||||
|
if (currentId == deleteId) {
|
||||||
|
isDelete = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isDelete) {
|
||||||
|
tempSelectGroupIds.push(currentId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var tempIds = '';
|
||||||
|
for (var i = 0, currentId; currentId = tempSelectGroupIds[i++];) {
|
||||||
|
if (tempIds.length > 0) {
|
||||||
|
tempIds += '_';
|
||||||
|
}
|
||||||
|
tempIds += currentId;
|
||||||
|
}
|
||||||
|
return tempIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 驼峰命名转小写
|
||||||
|
* @param humpName
|
||||||
|
* @param split 分隔符
|
||||||
|
* @returns {string|string|*}
|
||||||
|
*/
|
||||||
|
function humpNameToLower(humpName, split) {
|
||||||
|
if (typeof (humpName) != 'string') {
|
||||||
|
return humpName;
|
||||||
|
}
|
||||||
|
var splitStr = '';
|
||||||
|
if (typeof (split) != 'undefined') {
|
||||||
|
splitStr = split;
|
||||||
|
}
|
||||||
|
var tableFieldName = '';
|
||||||
|
for (var i = 0, letter = humpName[i]; letter = humpName[i++];) {
|
||||||
|
if (/[A-Z]/.test(letter)) {
|
||||||
|
tableFieldName += splitStr;
|
||||||
|
letter = letter.toLowerCase();
|
||||||
|
}
|
||||||
|
tableFieldName += letter;
|
||||||
|
}
|
||||||
|
return tableFieldName;
|
||||||
|
}
|
325
src/main/resources/static/wg/assets/js/dialog.js
Normal file
325
src/main/resources/static/wg/assets/js/dialog.js
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
(function () {
|
||||||
|
top.layer.config({
|
||||||
|
skin: 'dialog-box'
|
||||||
|
});
|
||||||
|
var DialogBox = {
|
||||||
|
dialogArray: [],
|
||||||
|
dialogData: {},
|
||||||
|
dialogTreeData: {
|
||||||
|
apiUri: null,
|
||||||
|
method: null,
|
||||||
|
primaryKey: null,
|
||||||
|
autoParams: null,
|
||||||
|
otherParams: null,
|
||||||
|
defaultParams: null,
|
||||||
|
resultType: null,
|
||||||
|
dataFilter: null,
|
||||||
|
rootNode: null,
|
||||||
|
data: null,
|
||||||
|
check: null,
|
||||||
|
selectedNodes: []
|
||||||
|
},
|
||||||
|
maxFileCount: null,
|
||||||
|
close: function (index) {
|
||||||
|
layer.close(index);
|
||||||
|
},
|
||||||
|
msg: function (msg, args, callback) {
|
||||||
|
return layer.msg(msg, args, callback);
|
||||||
|
},
|
||||||
|
confirm: function (msg, callback) {
|
||||||
|
var self = this;
|
||||||
|
return top.layer.msg(msg, {
|
||||||
|
time: 0,
|
||||||
|
btn: ['确定', '取消'],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function (index) {
|
||||||
|
callback(index);
|
||||||
|
},
|
||||||
|
btn1: function () {
|
||||||
|
self.closeBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
choiceConfirm: function (msg, yesCallback, noCallback) {
|
||||||
|
var self = this;
|
||||||
|
return top.layer.msg(msg, {
|
||||||
|
time: 0,
|
||||||
|
btn: ['是', '否', '取消'],
|
||||||
|
shade: 0.3,
|
||||||
|
btn1: function (index) {
|
||||||
|
yesCallback(index);
|
||||||
|
},
|
||||||
|
btn2: function (index) {
|
||||||
|
noCallback(index);
|
||||||
|
},
|
||||||
|
btn3: function () {
|
||||||
|
self.closeBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
open: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
resize: false,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: opt.url,
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
user: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var single = true;
|
||||||
|
if (typeof (opt.single) == 'undefined' || opt.single == null || (opt.single != true && opt.single != false)) {
|
||||||
|
single = false;
|
||||||
|
} else {
|
||||||
|
single = opt.single;
|
||||||
|
}
|
||||||
|
var selectedUserIds = '';
|
||||||
|
if (typeof (opt.selectedUserIds) != 'undefined' && opt.selectedUserIds != null) {
|
||||||
|
selectedUserIds = opt.selectedUserIds;
|
||||||
|
}
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
closeBtn: 0,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: 'route/user/departmentuser?single=' + single + '&selectedUserIds=' + selectedUserIds,
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
tree: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
self.dialogTreeData.apiUri = opt.apiUri;
|
||||||
|
if (typeof (opt.method) != 'undefined' && opt.method != null) {
|
||||||
|
self.dialogTreeData.method = opt.method;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.method = 'get';
|
||||||
|
}
|
||||||
|
if (typeof (opt.primaryKey) != 'undefined' && opt.primaryKey != null) {
|
||||||
|
self.dialogTreeData.primaryKey = opt.primaryKey;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.primaryKey = 'id';
|
||||||
|
}
|
||||||
|
if (typeof (opt.autoParams) != 'undefined' && opt.autoParams != null) {
|
||||||
|
self.dialogTreeData.autoParams = opt.autoParams;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.autoParams = ['id'];
|
||||||
|
}
|
||||||
|
if (typeof (opt.otherParams) != 'undefined' && opt.otherParams != null) {
|
||||||
|
self.dialogTreeData.otherParams = opt.otherParams;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.otherParams = {};
|
||||||
|
}
|
||||||
|
if (typeof (opt.resultType) != 'undefined' && opt.resultType != null) {
|
||||||
|
self.dialogTreeData.resultType = opt.resultType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.resultType = 'justList';
|
||||||
|
}
|
||||||
|
if (typeof (opt.dataFilter) != 'undefined' && opt.dataFilter != null) {
|
||||||
|
self.dialogTreeData.dataFilter = opt.dataFilter;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.dataFilter = function (treeId, parentNode, childNodes) {
|
||||||
|
return childNodes;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (typeof (opt.rootNode) != 'undefined' && opt.rootNode != null) {
|
||||||
|
self.dialogTreeData.rootNode = opt.rootNode;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.rootNode = null;
|
||||||
|
}
|
||||||
|
if (typeof (opt.data) != 'undefined' && opt.data != null) {
|
||||||
|
self.dialogTreeData.data = {};
|
||||||
|
if (typeof (opt.data.checked) != 'undefined' && opt.data.checked != null) {
|
||||||
|
self.dialogTreeData.data.checked = opt.data.checked;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.checked = 'checked';
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.children) != 'undefined' && opt.data.children != null) {
|
||||||
|
self.dialogTreeData.data.children = opt.data.children;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.children = 'children'
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.isParent) != 'undefined' && opt.data.isParent != null) {
|
||||||
|
self.dialogTreeData.data.isParent = opt.data.isParent;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.isParent = 'isParent';
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.name) != 'undefined' && opt.data.name != null) {
|
||||||
|
self.dialogTreeData.data.name = opt.data.name;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.name = 'name';
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.title) != 'undefined' && opt.data.title != null) {
|
||||||
|
self.dialogTreeData.data.title = opt.data.title;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.title = 'title';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data = {
|
||||||
|
checked: 'checked',
|
||||||
|
children: 'children',
|
||||||
|
isParent: 'isParent',
|
||||||
|
name: 'name',
|
||||||
|
title: 'title'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof (opt.defaultParams) != 'undefined' && opt.defaultParams != null) {
|
||||||
|
self.dialogTreeData.defaultParams = opt.defaultParams;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.defaultParams = null;
|
||||||
|
}
|
||||||
|
if (typeof (opt.check) != 'undefined' && opt.check != null) {
|
||||||
|
self.dialogTreeData.check = {};
|
||||||
|
if (typeof (opt.check.enable) != 'undefined' && opt.check.enable != null) {
|
||||||
|
self.dialogTreeData.check.enable = opt.check.enable;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.enable = false;
|
||||||
|
}
|
||||||
|
if (typeof (opt.check.selectType) != 'undefined' && opt.check.selectType != null) {
|
||||||
|
self.dialogTreeData.check.chkStyle = opt.check.selectType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.chkStyle = 'checkbox';
|
||||||
|
}
|
||||||
|
if (typeof (opt.check.checkboxType) != 'undefined' && opt.check.checkboxType != null) {
|
||||||
|
self.dialogTreeData.check.chkboxType = opt.check.checkboxType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.chkboxType = {Y: 'ps', N: 'ps'};
|
||||||
|
}
|
||||||
|
if (typeof (opt.check.radioType) != 'undefined' && opt.check.radioType != null) {
|
||||||
|
self.dialogTreeData.check.radioType = opt.check.radioType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.radioType = 'level';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check = {
|
||||||
|
enable: false,
|
||||||
|
chkStyle: 'checkbox',
|
||||||
|
chkboxType: {Y: 'ps', N: 'ps'},
|
||||||
|
radioType: 'level',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof (opt.selectedNodes) != 'undefined' && opt.selectedNodes != null) {
|
||||||
|
self.dialogTreeData.selectedNodes = opt.selectedNodes;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.selectedNodes = [];
|
||||||
|
}
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: top.restAjax.path('route/tree/tree', []),
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
// 文件上传
|
||||||
|
file: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var fileType = opt.type;
|
||||||
|
var url = 'route/file/uploadfile/';
|
||||||
|
if (fileType == 'image') {
|
||||||
|
url += '2';
|
||||||
|
} else if (fileType == 'video') {
|
||||||
|
url += '3';
|
||||||
|
} else if (fileType == 'audio') {
|
||||||
|
url += '4';
|
||||||
|
} else {
|
||||||
|
url += '1';
|
||||||
|
}
|
||||||
|
if (typeof (opt.maxFileCount) != 'undefined' && opt.maxFileCount != '') {
|
||||||
|
self.maxFileCount = opt.maxFileCount;
|
||||||
|
} else {
|
||||||
|
self.maxFileCount = null;
|
||||||
|
}
|
||||||
|
self.dialogData.uploadFileArray = [];
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: top.restAjax.path(url, []),
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
// 显示文件,图片和视频(MP4)
|
||||||
|
showFile: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var showType = opt.type;
|
||||||
|
var url = 'route/file/showfile/';
|
||||||
|
if (showType == 'image') {
|
||||||
|
url += 'image';
|
||||||
|
} else if (showType == 'video') {
|
||||||
|
url += 'video';
|
||||||
|
}
|
||||||
|
url += '/' + opt.fileId;
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: true,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: top.restAjax.path(url, []),
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
closeBox: function () {
|
||||||
|
top.layer.close(this.dialogArray[this.dialogArray.length - 1]);
|
||||||
|
this.dialogArray.pop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var Mask = {
|
||||||
|
showMask: function () {
|
||||||
|
$(".mask").fadeIn(300);
|
||||||
|
$("#loader").fadeIn(500);
|
||||||
|
},
|
||||||
|
hideMask: function () {
|
||||||
|
$("#loader").fadeOut(300);
|
||||||
|
$(".mask").fadeOut(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
window.DialogBox = DialogBox;
|
||||||
|
window.Mask = Mask;
|
||||||
|
})();
|
2
src/main/resources/static/wg/assets/js/jquery-3.5.1.min.js
vendored
Normal file
2
src/main/resources/static/wg/assets/js/jquery-3.5.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
288
src/main/resources/static/wg/assets/js/restajax.js
Normal file
288
src/main/resources/static/wg/assets/js/restajax.js
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
(function () {
|
||||||
|
var methods = {
|
||||||
|
POST_METHOD: 'POST',
|
||||||
|
DELETE_METHOD: 'DELETE',
|
||||||
|
PUT_METHOD: 'PUT',
|
||||||
|
GET_METHOD: 'GET'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象转form表单
|
||||||
|
* @param obj
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function objToForm(obj) {
|
||||||
|
var formStr = '';
|
||||||
|
for (var name in obj) {
|
||||||
|
if (formStr == undefined || formStr == null || formStr == '') {
|
||||||
|
formStr += name + '=' + obj[name];
|
||||||
|
} else {
|
||||||
|
formStr += '&' + name + '=' + obj[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return formStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function postJson(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.POST_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function deleteForm(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.DELETE_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function putJson(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.PUT_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function getForm(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.GET_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行上传
|
||||||
|
* @param url
|
||||||
|
* @param method
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function doAjax(url, method, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
var ajaxData = (dataObj == undefined || dataObj == null) ? {} : dataObj;
|
||||||
|
if (methods.POST_METHOD == method || methods.PUT_METHOD == method) {
|
||||||
|
ajaxData = JSON.stringify(ajaxData);
|
||||||
|
} else {
|
||||||
|
ajaxData = objToForm(ajaxData);
|
||||||
|
dataObj.tm = new Date().getTime();
|
||||||
|
}
|
||||||
|
var headers = {};
|
||||||
|
if(args != null && typeof(args.headers) != 'undefined' && args.headers != null) {
|
||||||
|
headers = args.headers;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: method,
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
headers: headers,
|
||||||
|
data: ajaxData,
|
||||||
|
success: function (data, status, XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
successCallback(responseCode, data, args);
|
||||||
|
},
|
||||||
|
error: function (XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
var responseData = JSON.parse(XMLHttpRequest.responseText);
|
||||||
|
if (errorCallback != undefined && errorCallback != null && typeof(errorCallback) == 'function') {
|
||||||
|
errorCallback(responseCode, responseData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend: function (XMLHttpRequest) {
|
||||||
|
if (beforeCallback != undefined && beforeCallback != null && typeof(beforeCallback) == 'function') {
|
||||||
|
beforeCallback(XMLHttpRequest);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function (XMLHttpRequest, status) {
|
||||||
|
if (completeCallback != undefined && completeCallback != null && typeof(completeCallback) == 'function') {
|
||||||
|
completeCallback(XMLHttpRequest, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测是路径参数有重复值
|
||||||
|
* @param pathArgArray
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function pathArgsHasSameValue(pathArgArray) {
|
||||||
|
var tempArgIndex = 0;
|
||||||
|
var tempArgs = pathArgArray[tempArgIndex];
|
||||||
|
for (var i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) {
|
||||||
|
if (tempArgs == item) {
|
||||||
|
throw new Error('参数' + item + '有重复值!!!');
|
||||||
|
}
|
||||||
|
if (i == pathArgArray.length - 1) {
|
||||||
|
tempArgs = pathArgArray[++tempArgIndex];
|
||||||
|
i = tempArgIndex;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取页面间传递的参数
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
|
function getParamsArg(url) {
|
||||||
|
var params = url.split('?')[1];
|
||||||
|
var paramsObj = {};
|
||||||
|
if (typeof(params) == 'undefined' || params == null) {
|
||||||
|
return paramsObj;
|
||||||
|
}
|
||||||
|
var paramsKVs = params.split('&');
|
||||||
|
for (var i = 0, item = null; item = paramsKVs[i++];) {
|
||||||
|
var kvs = item.split('=');
|
||||||
|
if (kvs.length == 1) {
|
||||||
|
paramsObj[kvs[0]] = null;
|
||||||
|
}
|
||||||
|
if (kvs.length == 2) {
|
||||||
|
paramsObj[kvs[0]] = decodeURI(kvs[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paramsObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建路径
|
||||||
|
* @param basePath 请求路径,{参数},
|
||||||
|
* @param pathArgs 替换的路径参数,不能重复
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function buildPath(basePath, pathArgs) {
|
||||||
|
var path = basePath;
|
||||||
|
if (!basePath || !(typeof(basePath) == 'string')) {
|
||||||
|
throw new Error('basePath必须为字符串!!!');
|
||||||
|
}
|
||||||
|
if (!pathArgs || !Array.isArray(pathArgs)) {
|
||||||
|
throw new Error('pathArgs必须为数组!!!');
|
||||||
|
}
|
||||||
|
var pathArgArray = basePath.match(/\{\w+\}/g);
|
||||||
|
if (!pathArgArray) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
pathArgsHasSameValue(pathArgArray);
|
||||||
|
for (var i = 0, item; item = pathArgArray[i]; i++) {
|
||||||
|
path = path.replace(item, pathArgs[i]);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过form对象上传文件
|
||||||
|
* @param url
|
||||||
|
* @param formData
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function postFile(url, formData, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
var headers = {};
|
||||||
|
if(args != null && typeof(args.headers) != 'undefined' && args.headers != null) {
|
||||||
|
headers = args.headers;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
headers: headers,
|
||||||
|
cache: false,
|
||||||
|
success: function (data, status, XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
successCallback(responseCode, data, args);
|
||||||
|
},
|
||||||
|
error: function (XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
var responseData = JSON.parse(XMLHttpRequest.responseText);
|
||||||
|
if (errorCallback != undefined && errorCallback != null && typeof(errorCallback) == 'function') {
|
||||||
|
errorCallback(responseCode, responseData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend: function (XMLHttpRequest) {
|
||||||
|
if (beforeCallback != undefined && beforeCallback != null && typeof(beforeCallback) == 'function') {
|
||||||
|
beforeCallback(XMLHttpRequest);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function (XMLHttpRequest, status) {
|
||||||
|
if (completeCallback != undefined && completeCallback != null && typeof(completeCallback) == 'function') {
|
||||||
|
completeCallback(XMLHttpRequest, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xss 转义
|
||||||
|
* @param html
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function escape(html) {
|
||||||
|
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||||
|
.replace(/</g, '<').replace(/>/g, '>')
|
||||||
|
.replace(/'/g, ''').replace(/"/g, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkBoxToString(formObj, checkBoxKey) {
|
||||||
|
var value = '';
|
||||||
|
for(var key in formObj) {
|
||||||
|
if(key.indexOf(checkBoxKey) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(value !== '') {
|
||||||
|
value += ',';
|
||||||
|
}
|
||||||
|
value += key.substring(checkBoxKey.length + 1, key.length - 1);
|
||||||
|
delete formObj[key];
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
window.restAjax = {
|
||||||
|
post: postJson,
|
||||||
|
postFile: postFile,
|
||||||
|
delete: deleteForm,
|
||||||
|
put: putJson,
|
||||||
|
get: getForm,
|
||||||
|
params: getParamsArg,
|
||||||
|
path: buildPath,
|
||||||
|
escape: escape,
|
||||||
|
checkBoxToString: checkBoxToString
|
||||||
|
}
|
||||||
|
|
||||||
|
})();
|
10947
src/main/resources/static/wg/assets/js/vue.min.js
vendored
Normal file
10947
src/main/resources/static/wg/assets/js/vue.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#FAFAFA;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}
|
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
After Width: | Height: | Size: 701 B |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 299 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,50 @@
|
|||||||
|
layui.define(function(exports) {
|
||||||
|
|
||||||
|
var message = {
|
||||||
|
loading: '加载中...',
|
||||||
|
commit: '确定提交?',
|
||||||
|
committing: '正在提交,请稍后...',
|
||||||
|
commitSuccess: '提交成功,继续操作?',
|
||||||
|
update: '确定更新?',
|
||||||
|
updating: '正在更新,请稍后...',
|
||||||
|
updated: '更新成功',
|
||||||
|
updateSuccess: '更新成功,继续操作?',
|
||||||
|
delete: '确定删除?',
|
||||||
|
deleting: '删除中...',
|
||||||
|
deleted: '删除成功',
|
||||||
|
deleteSuccess: '删除成功',
|
||||||
|
deleteUserConfirm: '请选择要删除的用户',
|
||||||
|
deleteGroupConfirm: '请选择要删除的组',
|
||||||
|
uploading: '正在上传...',
|
||||||
|
bind: '确认绑定?',
|
||||||
|
binding: '正在绑定...',
|
||||||
|
bindSuccess: '绑定成功',
|
||||||
|
unBindSuccess: '解绑成功',
|
||||||
|
button: {
|
||||||
|
yes: '确定',
|
||||||
|
no: '取消',
|
||||||
|
},
|
||||||
|
dialog: {
|
||||||
|
save: '新增',
|
||||||
|
update: '修改'
|
||||||
|
},
|
||||||
|
tree: {
|
||||||
|
rootName: '根节点'
|
||||||
|
},
|
||||||
|
table: {
|
||||||
|
loading: '拼命加载中...',
|
||||||
|
selectDelete: '请选择要删除的数据',
|
||||||
|
selectEdit: '请选择要编辑的数据',
|
||||||
|
selectOneEdit: '只能同时编辑一条数据',
|
||||||
|
selectUnbind: '请选择要解除绑定的数据',
|
||||||
|
selectBind: '请选择要执行绑定的数据',
|
||||||
|
selectOn: '请选择要启用数据',
|
||||||
|
selectOff: '请选择要停用数据',
|
||||||
|
selectConfig: '请选择要配置数据',
|
||||||
|
selectOneConfig: '请选择要配置一条数据',
|
||||||
|
selectExamine: '请选择要审核数据',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports('datamessage', message);
|
||||||
|
});
|
@ -0,0 +1,314 @@
|
|||||||
|
layui.define(function(exports) {
|
||||||
|
var dialog = {
|
||||||
|
dialogArray: [],
|
||||||
|
dialogData: {},
|
||||||
|
dialogTreeData: {
|
||||||
|
apiUri: null,
|
||||||
|
method: null,
|
||||||
|
primaryKey: null,
|
||||||
|
autoParams: null,
|
||||||
|
otherParams: null,
|
||||||
|
defaultParams: null,
|
||||||
|
resultType: null,
|
||||||
|
dataFilter: null,
|
||||||
|
rootNode: null,
|
||||||
|
data: null,
|
||||||
|
check: null,
|
||||||
|
selectedNodes: []
|
||||||
|
},
|
||||||
|
maxFileCount: null,
|
||||||
|
close: function (index) {
|
||||||
|
layer.close(index);
|
||||||
|
},
|
||||||
|
msg: function (msg, args, callback) {
|
||||||
|
return layer.msg(msg, args, callback);
|
||||||
|
},
|
||||||
|
confirm: function (msg, callback) {
|
||||||
|
var self = this;
|
||||||
|
return top.layer.msg(msg, {
|
||||||
|
time: 0,
|
||||||
|
btn: ['确定', '取消'],
|
||||||
|
shade: 0.3,
|
||||||
|
yes: function (index) {
|
||||||
|
callback(index);
|
||||||
|
},
|
||||||
|
btn1: function () {
|
||||||
|
self.closeBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
choiceConfirm: function (msg, yesCallback, noCallback) {
|
||||||
|
var self = this;
|
||||||
|
return top.layer.msg(msg, {
|
||||||
|
time: 0,
|
||||||
|
btn: ['是', '否', '取消'],
|
||||||
|
shade: 0.3,
|
||||||
|
btn1: function (index) {
|
||||||
|
yesCallback(index);
|
||||||
|
},
|
||||||
|
btn2: function (index) {
|
||||||
|
noCallback(index);
|
||||||
|
},
|
||||||
|
btn3: function () {
|
||||||
|
self.closeBox();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
open: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
resize: false,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: opt.url,
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
user: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var single = true;
|
||||||
|
if (typeof (opt.single) == 'undefined' || opt.single == null || (opt.single != true && opt.single != false)) {
|
||||||
|
single = false;
|
||||||
|
} else {
|
||||||
|
single = opt.single;
|
||||||
|
}
|
||||||
|
var selectedUserIds = '';
|
||||||
|
if (typeof (opt.selectedUserIds) != 'undefined' && opt.selectedUserIds != null) {
|
||||||
|
selectedUserIds = opt.selectedUserIds;
|
||||||
|
}
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
closeBtn: 0,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: 'route/user/departmentuser?single=' + single + '&selectedUserIds=' + selectedUserIds,
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
tree: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
self.dialogTreeData.apiUri = opt.apiUri;
|
||||||
|
if (typeof (opt.method) != 'undefined' && opt.method != null) {
|
||||||
|
self.dialogTreeData.method = opt.method;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.method = 'get';
|
||||||
|
}
|
||||||
|
if (typeof (opt.primaryKey) != 'undefined' && opt.primaryKey != null) {
|
||||||
|
self.dialogTreeData.primaryKey = opt.primaryKey;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.primaryKey = 'id';
|
||||||
|
}
|
||||||
|
if (typeof (opt.autoParams) != 'undefined' && opt.autoParams != null) {
|
||||||
|
self.dialogTreeData.autoParams = opt.autoParams;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.autoParams = ['id'];
|
||||||
|
}
|
||||||
|
if (typeof (opt.otherParams) != 'undefined' && opt.otherParams != null) {
|
||||||
|
self.dialogTreeData.otherParams = opt.otherParams;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.otherParams = {};
|
||||||
|
}
|
||||||
|
if (typeof (opt.resultType) != 'undefined' && opt.resultType != null) {
|
||||||
|
self.dialogTreeData.resultType = opt.resultType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.resultType = 'justList';
|
||||||
|
}
|
||||||
|
if (typeof (opt.dataFilter) != 'undefined' && opt.dataFilter != null) {
|
||||||
|
self.dialogTreeData.dataFilter = opt.dataFilter;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.dataFilter = function (treeId, parentNode, childNodes) {
|
||||||
|
return childNodes;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (typeof (opt.rootNode) != 'undefined' && opt.rootNode != null) {
|
||||||
|
self.dialogTreeData.rootNode = opt.rootNode;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.rootNode = null;
|
||||||
|
}
|
||||||
|
if (typeof (opt.data) != 'undefined' && opt.data != null) {
|
||||||
|
self.dialogTreeData.data = {};
|
||||||
|
if (typeof (opt.data.checked) != 'undefined' && opt.data.checked != null) {
|
||||||
|
self.dialogTreeData.data.checked = opt.data.checked;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.checked = 'checked';
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.children) != 'undefined' && opt.data.children != null) {
|
||||||
|
self.dialogTreeData.data.children = opt.data.children;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.children = 'children'
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.isParent) != 'undefined' && opt.data.isParent != null) {
|
||||||
|
self.dialogTreeData.data.isParent = opt.data.isParent;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.isParent = 'isParent';
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.name) != 'undefined' && opt.data.name != null) {
|
||||||
|
self.dialogTreeData.data.name = opt.data.name;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.name = 'name';
|
||||||
|
}
|
||||||
|
if (typeof (opt.data.title) != 'undefined' && opt.data.title != null) {
|
||||||
|
self.dialogTreeData.data.title = opt.data.title;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data.title = 'title';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.data = {
|
||||||
|
checked: 'checked',
|
||||||
|
children: 'children',
|
||||||
|
isParent: 'isParent',
|
||||||
|
name: 'name',
|
||||||
|
title: 'title'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof (opt.defaultParams) != 'undefined' && opt.defaultParams != null) {
|
||||||
|
self.dialogTreeData.defaultParams = opt.defaultParams;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.defaultParams = null;
|
||||||
|
}
|
||||||
|
if (typeof (opt.check) != 'undefined' && opt.check != null) {
|
||||||
|
self.dialogTreeData.check = {};
|
||||||
|
if (typeof (opt.check.enable) != 'undefined' && opt.check.enable != null) {
|
||||||
|
self.dialogTreeData.check.enable = opt.check.enable;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.enable = false;
|
||||||
|
}
|
||||||
|
if (typeof (opt.check.selectType) != 'undefined' && opt.check.selectType != null) {
|
||||||
|
self.dialogTreeData.check.chkStyle = opt.check.selectType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.chkStyle = 'checkbox';
|
||||||
|
}
|
||||||
|
if (typeof (opt.check.checkboxType) != 'undefined' && opt.check.checkboxType != null) {
|
||||||
|
self.dialogTreeData.check.chkboxType = opt.check.checkboxType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.chkboxType = {Y: 'ps', N: 'ps'};
|
||||||
|
}
|
||||||
|
if (typeof (opt.check.radioType) != 'undefined' && opt.check.radioType != null) {
|
||||||
|
self.dialogTreeData.check.radioType = opt.check.radioType;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check.radioType = 'level';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.check = {
|
||||||
|
enable: false,
|
||||||
|
chkStyle: 'checkbox',
|
||||||
|
chkboxType: {Y: 'ps', N: 'ps'},
|
||||||
|
radioType: 'level',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof (opt.selectedNodes) != 'undefined' && opt.selectedNodes != null) {
|
||||||
|
self.dialogTreeData.selectedNodes = opt.selectedNodes;
|
||||||
|
} else {
|
||||||
|
self.dialogTreeData.selectedNodes = [];
|
||||||
|
}
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: top.restAjax.path('route/tree/tree/v2', []),
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
// 文件上传
|
||||||
|
file: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var fileType = opt.type;
|
||||||
|
var customType = opt.customType;
|
||||||
|
var url = 'route/file/uploadfile/';
|
||||||
|
if (fileType == 'image') {
|
||||||
|
url += '2';
|
||||||
|
} else if (fileType == 'video') {
|
||||||
|
url += '3';
|
||||||
|
} else if (fileType == 'audio') {
|
||||||
|
url += '4';
|
||||||
|
} else {
|
||||||
|
url += '1';
|
||||||
|
}
|
||||||
|
if(customType) {
|
||||||
|
url += '?customType='+ customType;
|
||||||
|
}
|
||||||
|
if (typeof (opt.maxFileCount) != 'undefined' && opt.maxFileCount != '') {
|
||||||
|
self.maxFileCount = opt.maxFileCount;
|
||||||
|
} else {
|
||||||
|
self.maxFileCount = null;
|
||||||
|
}
|
||||||
|
self.dialogData.uploadFileArray = [];
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: false,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: top.restAjax.path(url, []),
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
end: opt.onClose
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
// 显示文件,图片和视频(MP4)
|
||||||
|
showFile: function (opt) {
|
||||||
|
var self = this;
|
||||||
|
var showType = opt.type;
|
||||||
|
var url = 'route/file/showfile/';
|
||||||
|
if (showType == 'image') {
|
||||||
|
url += 'image';
|
||||||
|
} else if (showType == 'video') {
|
||||||
|
url += 'video';
|
||||||
|
}
|
||||||
|
url += '/' + opt.fileId;
|
||||||
|
var index = top.layer.open({
|
||||||
|
type: 2,
|
||||||
|
icon: 1,
|
||||||
|
title: opt.title,
|
||||||
|
shadeClose: false,
|
||||||
|
maxmin: true,
|
||||||
|
shade: 0.3,
|
||||||
|
area: [opt.width, opt.height],
|
||||||
|
content: top.restAjax.path(url, []),
|
||||||
|
cancel: function (index) {
|
||||||
|
self.closeBox();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
this.dialogArray.push(index);
|
||||||
|
return index;
|
||||||
|
},
|
||||||
|
closeBox: function () {
|
||||||
|
top.layer.close(this.dialogArray[this.dialogArray.length - 1]);
|
||||||
|
this.dialogArray.pop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
exports('dialog', dialog);
|
||||||
|
});
|
@ -0,0 +1,283 @@
|
|||||||
|
layui.define(function(exports) {
|
||||||
|
var $ = layui.$;
|
||||||
|
var methods = {
|
||||||
|
POST_METHOD: 'POST',
|
||||||
|
DELETE_METHOD: 'DELETE',
|
||||||
|
PUT_METHOD: 'PUT',
|
||||||
|
GET_METHOD: 'GET'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象转form表单
|
||||||
|
* @param obj
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function objToForm(obj) {
|
||||||
|
var formStr = '';
|
||||||
|
for (var name in obj) {
|
||||||
|
if (formStr == undefined || formStr == null || formStr == '') {
|
||||||
|
formStr += name + '=' + obj[name];
|
||||||
|
} else {
|
||||||
|
formStr += '&' + name + '=' + obj[name];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return formStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function postJson(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.POST_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function deleteForm(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.DELETE_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function putJson(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.PUT_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
* @param url
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function getForm(url, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
doAjax(url, methods.GET_METHOD, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行上传
|
||||||
|
* @param url
|
||||||
|
* @param method
|
||||||
|
* @param dataObj
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function doAjax(url, method, dataObj, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
var ajaxData = (dataObj == undefined || dataObj == null) ? {} : dataObj;
|
||||||
|
if (methods.POST_METHOD == method || methods.PUT_METHOD == method) {
|
||||||
|
ajaxData = JSON.stringify(ajaxData);
|
||||||
|
} else {
|
||||||
|
ajaxData = objToForm(ajaxData);
|
||||||
|
dataObj.tm = new Date().getTime();
|
||||||
|
}
|
||||||
|
var headers = {};
|
||||||
|
if(args != null && typeof(args.headers) != 'undefined' && args.headers != null) {
|
||||||
|
headers = args.headers;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: method,
|
||||||
|
contentType: "application/json;charset=utf-8",
|
||||||
|
headers: headers,
|
||||||
|
data: ajaxData,
|
||||||
|
success: function (data, status, XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
successCallback(responseCode, data, args);
|
||||||
|
},
|
||||||
|
error: function (XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
var responseData = JSON.parse(XMLHttpRequest.responseText);
|
||||||
|
if (errorCallback != undefined && errorCallback != null && typeof(errorCallback) == 'function') {
|
||||||
|
errorCallback(responseCode, responseData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend: function (XMLHttpRequest) {
|
||||||
|
if (beforeCallback != undefined && beforeCallback != null && typeof(beforeCallback) == 'function') {
|
||||||
|
beforeCallback(XMLHttpRequest);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function (XMLHttpRequest, status) {
|
||||||
|
if (completeCallback != undefined && completeCallback != null && typeof(completeCallback) == 'function') {
|
||||||
|
completeCallback(XMLHttpRequest, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测是路径参数有重复值
|
||||||
|
* @param pathArgArray
|
||||||
|
* @returns {boolean}
|
||||||
|
*/
|
||||||
|
function pathArgsHasSameValue(pathArgArray) {
|
||||||
|
var tempArgIndex = 0;
|
||||||
|
var tempArgs = pathArgArray[tempArgIndex];
|
||||||
|
for (var i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) {
|
||||||
|
if (tempArgs == item) {
|
||||||
|
throw new Error('参数' + item + '有重复值!!!');
|
||||||
|
}
|
||||||
|
if (i == pathArgArray.length - 1) {
|
||||||
|
tempArgs = pathArgArray[++tempArgIndex];
|
||||||
|
i = tempArgIndex;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取页面间传递的参数
|
||||||
|
* @param url
|
||||||
|
*/
|
||||||
|
function getParamsArg(url) {
|
||||||
|
var params = url.split('?')[1];
|
||||||
|
var paramsObj = {};
|
||||||
|
if (typeof(params) == 'undefined' || params == null) {
|
||||||
|
return paramsObj;
|
||||||
|
}
|
||||||
|
var paramsKVs = params.split('&');
|
||||||
|
for (var i = 0, item = null; item = paramsKVs[i++];) {
|
||||||
|
var kvs = item.split('=');
|
||||||
|
if (kvs.length == 1) {
|
||||||
|
paramsObj[kvs[0]] = null;
|
||||||
|
}
|
||||||
|
if (kvs.length == 2) {
|
||||||
|
paramsObj[kvs[0]] = decodeURI(kvs[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return paramsObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建路径
|
||||||
|
* @param basePath 请求路径,{参数},
|
||||||
|
* @param pathArgs 替换的路径参数,不能重复
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
function buildPath(basePath, pathArgs) {
|
||||||
|
var path = basePath;
|
||||||
|
if (!basePath || !(typeof(basePath) == 'string')) {
|
||||||
|
throw new Error('basePath必须为字符串!!!');
|
||||||
|
}
|
||||||
|
if (!pathArgs || !Array.isArray(pathArgs)) {
|
||||||
|
throw new Error('pathArgs必须为数组!!!');
|
||||||
|
}
|
||||||
|
var pathArgArray = basePath.match(/\{\w+\}/g);
|
||||||
|
if (!pathArgArray) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
pathArgsHasSameValue(pathArgArray);
|
||||||
|
for (var i = 0, item; item = pathArgArray[i]; i++) {
|
||||||
|
path = path.replace(item, pathArgs[i]);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过form对象上传文件
|
||||||
|
* @param url
|
||||||
|
* @param formData
|
||||||
|
* @param args
|
||||||
|
* @param successCallback
|
||||||
|
* @param errorCallback
|
||||||
|
* @param beforeCallback
|
||||||
|
* @param completeCallback
|
||||||
|
*/
|
||||||
|
function postFile(url, formData, args, successCallback, errorCallback, beforeCallback, completeCallback) {
|
||||||
|
$.ajax({
|
||||||
|
url: url,
|
||||||
|
type: 'POST',
|
||||||
|
data: formData,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
cache: false,
|
||||||
|
success: function (data, status, XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
successCallback(responseCode, data, args);
|
||||||
|
},
|
||||||
|
error: function (XMLHttpRequest) {
|
||||||
|
var responseCode = XMLHttpRequest.status;
|
||||||
|
var responseData = JSON.parse(XMLHttpRequest.responseText);
|
||||||
|
if (errorCallback != undefined && errorCallback != null && typeof(errorCallback) == 'function') {
|
||||||
|
errorCallback(responseCode, responseData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSend: function (XMLHttpRequest) {
|
||||||
|
if (beforeCallback != undefined && beforeCallback != null && typeof(beforeCallback) == 'function') {
|
||||||
|
beforeCallback(XMLHttpRequest);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete: function (XMLHttpRequest, status) {
|
||||||
|
if (completeCallback != undefined && completeCallback != null && typeof(completeCallback) == 'function') {
|
||||||
|
completeCallback(XMLHttpRequest, status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* xss 转义
|
||||||
|
* @param html
|
||||||
|
* @returns {string}
|
||||||
|
*/
|
||||||
|
function escape(html) {
|
||||||
|
return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
|
||||||
|
.replace(/</g, '<').replace(/>/g, '>')
|
||||||
|
.replace(/'/g, ''').replace(/"/g, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkBoxToString(formObj, checkBoxKey) {
|
||||||
|
var value = '';
|
||||||
|
for(var key in formObj) {
|
||||||
|
if(key.indexOf(checkBoxKey) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(value !== '') {
|
||||||
|
value += ',';
|
||||||
|
}
|
||||||
|
value += key.substring(checkBoxKey.length + 1, key.length - 1);
|
||||||
|
delete formObj[key];
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
exports('restajax', {
|
||||||
|
post: postJson,
|
||||||
|
postFile: postFile,
|
||||||
|
delete: deleteForm,
|
||||||
|
put: putJson,
|
||||||
|
get: getForm,
|
||||||
|
params: getParamsArg,
|
||||||
|
path: buildPath,
|
||||||
|
escape: escape,
|
||||||
|
checkBoxToString: checkBoxToString
|
||||||
|
});
|
||||||
|
});
|
99
src/main/resources/static/wg/assets/layui-v2.6.4/test.html
Normal file
99
src/main/resources/static/wg/assets/layui-v2.6.4/test.html
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>测试 - layui</title>
|
||||||
|
<link rel="stylesheet" href="layui/css/layui.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="layui-container">
|
||||||
|
<div class="layui-progress" style="margin: 15px 0 30px;">
|
||||||
|
<div class="layui-progress-bar" lay-percent="100%"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="layui-btn-container">
|
||||||
|
<button class="layui-btn" test-active="test-form">一个按钮</button>
|
||||||
|
<button class="layui-btn layui-btn-normal" id="test2">当前日期</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<blockquote class="layui-elem-quote" style="margin-top: 30px;">
|
||||||
|
<div class="layui-text">
|
||||||
|
<ul>
|
||||||
|
<li>你当前预览的是:<span>layui-v<span id="version"></span></span></li>
|
||||||
|
<li>这是一个极其简洁的演示页面</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 引入 layui.js 的 <script> 标签最好放置在 html 末尾 -->
|
||||||
|
<script src="layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
layui.use(function(){
|
||||||
|
var layer = layui.layer
|
||||||
|
,form = layui.form
|
||||||
|
,laypage = layui.laypage
|
||||||
|
,element = layui.element
|
||||||
|
,laydate = layui.laydate
|
||||||
|
,util = layui.util;
|
||||||
|
|
||||||
|
//欢迎信息
|
||||||
|
layer.msg('Hello World');
|
||||||
|
|
||||||
|
//输出版本号
|
||||||
|
lay('#version').html(layui.v);
|
||||||
|
|
||||||
|
//日期
|
||||||
|
laydate.render({
|
||||||
|
elem: '#test2'
|
||||||
|
,value: new Date()
|
||||||
|
,isInitValue: true
|
||||||
|
});
|
||||||
|
|
||||||
|
//触发事件
|
||||||
|
util.event('test-active', {
|
||||||
|
'test-form': function(){
|
||||||
|
layer.open({
|
||||||
|
type: 1
|
||||||
|
,resize: false
|
||||||
|
,shadeClose: true
|
||||||
|
,content: ['<ul class="layui-form" style="margin: 10px;">'
|
||||||
|
,'<li class="layui-form-item">'
|
||||||
|
,'<label class="layui-form-label">输入框</label>'
|
||||||
|
,'<div class="layui-input-block">'
|
||||||
|
,'<input class="layui-input" name="field1">'
|
||||||
|
,'</div>'
|
||||||
|
,'</li>'
|
||||||
|
,'<li class="layui-form-item">'
|
||||||
|
,'<label class="layui-form-label">选择框</label>'
|
||||||
|
,'<div class="layui-input-block">'
|
||||||
|
,'<select name="field2">'
|
||||||
|
,'<option value="A">A</option>'
|
||||||
|
,'<option value="B">B</option>'
|
||||||
|
,'<select>'
|
||||||
|
,'</div>'
|
||||||
|
,'</li>'
|
||||||
|
,'<li class="layui-form-item" style="text-align:center;">'
|
||||||
|
,'<button type="submit" lay-submit lay-filter="*" class="layui-btn">提交</button>'
|
||||||
|
,'</li>'
|
||||||
|
,'</ul>'].join('')
|
||||||
|
,success: function(layero){
|
||||||
|
layero.find('.layui-layer-content').css('overflow', 'visible');
|
||||||
|
|
||||||
|
form.render().on('submit(*)', function(data){
|
||||||
|
layer.msg(JSON.stringify(data.field));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,6 @@
|
|||||||
|
[{000214A0-0000-0000-C000-000000000046}]
|
||||||
|
Prop3=19,11
|
||||||
|
[InternetShortcut]
|
||||||
|
URL=https://www.layui.com/about/disclaimer.html
|
||||||
|
IDList=
|
||||||
|
HotKey=0
|
55
src/main/resources/static/wg/route/index.html
Normal file
55
src/main/resources/static/wg/route/index.html
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<base href="/wg/">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>网关管理</title>
|
||||||
|
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/layui.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<div class="layui-header">
|
||||||
|
<ul class="layui-nav layui-bg-blue" lay-filter="">
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a href="javascript:void(0);">网关管理</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a href="javascript:void(0);">网关管理</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item" style="float: right;">
|
||||||
|
<a href=""><img src="//t.cn/RCzsdCq" class="layui-nav-img">我</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a href="javascript:;">修改信息</a></dd>
|
||||||
|
<dd><a href="javascript:;">安全管理</a></dd>
|
||||||
|
<dd><a href="javascript:;">退了</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="layui-body" id="LAY_app_body">
|
||||||
|
<div class="layadmin-tabsbody-item layui-show">
|
||||||
|
<iframe id="defaultIFrame" frameborder="0" class="layadmin-iframe"></iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layui-v2.6.4/layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
layui.config({
|
||||||
|
base: 'assets/layui-v2.6.4/layui/modules/'
|
||||||
|
}).extend({}).use(['restajax', 'datamessage', 'dialog'], function() {
|
||||||
|
var $ = layui.$;
|
||||||
|
var layer = layui.layer;
|
||||||
|
window.dialog = layui.dialog;
|
||||||
|
window.restAjax = layui.restajax;
|
||||||
|
window.dataMessage = layui.datamessage;
|
||||||
|
|
||||||
|
$('#defaultIFrame').attr('src', 'route/route/list.html');
|
||||||
|
$('#LAY-logout').on('click', function() {
|
||||||
|
top.dialog.confirm('确认退出?', function() {
|
||||||
|
window.location.href = 'logout';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
136
src/main/resources/static/wg/route/route/list.html
Normal file
136
src/main/resources/static/wg/route/route/list.html
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<base href="/wg/">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<link rel="stylesheet" href="assets/layui-v2.6.4/layui/css/layui.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="layui-anim layui-anim-fadein">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-body">
|
||||||
|
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="keywords" class="layui-input search-item" placeholder="输入关键字">
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="startTime" class="layui-input search-item" placeholder="开始时间"
|
||||||
|
readonly>
|
||||||
|
</div>
|
||||||
|
<div class="layui-inline">
|
||||||
|
<input type="text" id="endTime" class="layui-input search-item" placeholder="结束时间" readonly>
|
||||||
|
</div>
|
||||||
|
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||||
|
<i class="fa fa-lg fa-search"></i> 搜索
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
|
||||||
|
<!-- 表头按钮组 -->
|
||||||
|
<script type="text/html" id="headerToolBar">
|
||||||
|
<div class="layui-btn-group">
|
||||||
|
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
|
||||||
|
<i class="fa fa-lg fa-plus"></i> 新增
|
||||||
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm"
|
||||||
|
lay-event="updateEvent">
|
||||||
|
<i class="fa fa-lg fa-edit"></i> 编辑
|
||||||
|
</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm"
|
||||||
|
lay-event="removeEvent">
|
||||||
|
<i class="fa fa-lg fa-trash"></i> 删除
|
||||||
|
</button>
|
||||||
|
<button id="levelUpBtn" type="button" class="layui-btn layui-btn-warm layui-btn-sm"
|
||||||
|
lay-event="levelUpEvent" style="display: none;">
|
||||||
|
返回上级 <i class="fa fa-lg fa-level-up"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="assets/layui-v2.6.4/layui/layui.js"></script>
|
||||||
|
<script>
|
||||||
|
layui.use(['layer', 'table'], function () {
|
||||||
|
var $ = layui.$;
|
||||||
|
var $win = $(window);
|
||||||
|
var layer = layui.layer;
|
||||||
|
var table = layui.table;
|
||||||
|
var resizeTimeout = null;
|
||||||
|
|
||||||
|
var tableUrl = 'api/chapter/listpage/{courseId}/{parentId}';
|
||||||
|
|
||||||
|
function initTable() {
|
||||||
|
table.render({
|
||||||
|
elem: '#dataTable',
|
||||||
|
id: 'dataTable',
|
||||||
|
url: top.restAjax.path(tableUrl, []),
|
||||||
|
width: '100%',
|
||||||
|
height: $win.height() - 60,
|
||||||
|
limit: 20,
|
||||||
|
limits: [20, 40, 60, 80, 100, 200],
|
||||||
|
toolbar: '#headerToolBar',
|
||||||
|
request: {
|
||||||
|
pageName: 'page',
|
||||||
|
limitName: 'rows'
|
||||||
|
},
|
||||||
|
cols: [[
|
||||||
|
{type: 'checkbox', fixed: 'left'},
|
||||||
|
{
|
||||||
|
field: 'rowNum',
|
||||||
|
width: 80,
|
||||||
|
title: '序号',
|
||||||
|
fixed: 'left',
|
||||||
|
align: 'center',
|
||||||
|
templet: '<span>{{d.LAY_INDEX}}</span>'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'courseName', width: 200, title: '课程名称', align: 'center',
|
||||||
|
templet: function (row) {
|
||||||
|
var rowData = row[this.field];
|
||||||
|
if (typeof (rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
return rowData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]],
|
||||||
|
page: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重载表格
|
||||||
|
function reloadTable(currentPage) {
|
||||||
|
table.reload('dataTable', {
|
||||||
|
url: top.restAjax.path(tableUrl, []),
|
||||||
|
where: {
|
||||||
|
keywords: $('#keywords').val(),
|
||||||
|
startTime: $('#startTime').val(),
|
||||||
|
endTime: $('#endTime').val()
|
||||||
|
},
|
||||||
|
page: {
|
||||||
|
curr: currentPage
|
||||||
|
},
|
||||||
|
height: $win.height() - 60,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
initTable();
|
||||||
|
// 事件 - 页面变化
|
||||||
|
$win.on('resize', function() {
|
||||||
|
clearTimeout(resizeTimeout);
|
||||||
|
resizeTimeout = setTimeout(function() {
|
||||||
|
reloadTable();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
// 事件 - 搜索
|
||||||
|
$(document).on('click', '#search', function() {
|
||||||
|
reloadTable(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user