style(jinja2):修改模板的复用方式
This commit is contained in:
@@ -1,48 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
{#页面标题#}
|
|
||||||
{% block title %}
|
|
||||||
<title>Pear Admin Flask</title>
|
|
||||||
{% endblock %}
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="renderer" content="webkit">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
||||||
{# 头部导入的 Script,主要为样式 #}
|
|
||||||
{% block header_script %}
|
|
||||||
<link rel="stylesheet" href="/static/admin/component/pear/css/pear.css"/>
|
|
||||||
{% endblock %}
|
|
||||||
</head>
|
|
||||||
{#pear 后台边框#}
|
|
||||||
<body class="pear-container">
|
|
||||||
|
|
||||||
{#页面的主题内容,用于页面进行改写#}
|
|
||||||
{% block body %}
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{# 当前页面需要依赖的 JavaScript #}
|
|
||||||
{% block footer_script %}
|
|
||||||
<script src="/static/admin/component/layui/layui.js"></script>
|
|
||||||
<script src="/static/admin/component/pear/pear.js"></script>
|
|
||||||
<script>
|
|
||||||
/******************数据解析********************************/
|
|
||||||
function parserTableData (data) {
|
|
||||||
/* 将服务器返回的 json 数据解析为 layui 表格需要的格式 */
|
|
||||||
return {
|
|
||||||
'code': data.code, //解析接口状态
|
|
||||||
'msg': data.message, //解析提示文本
|
|
||||||
'count': data.result.total, //解析数据长度
|
|
||||||
'data': data.result.items, //解析数据列表
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
{# 当前页面自己编写的 JavaScript #}
|
|
||||||
{% block models_script %}
|
|
||||||
{% endblock %}
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,2 +1,14 @@
|
|||||||
<script src="/static/admin/component/layui/layui.js"></script>
|
<script src="/static/admin/component/layui/layui.js"></script>
|
||||||
<script src="/static/admin/component/pear/pear.js"></script>
|
<script src="/static/admin/component/pear/pear.js"></script>
|
||||||
|
<script>
|
||||||
|
/******************数据解析********************************/
|
||||||
|
function parserTableData(data) {
|
||||||
|
/* 将服务器返回的 json 数据解析为 layui 表格需要的格式 */
|
||||||
|
return {
|
||||||
|
'code': data.code, /*解析接口状态*/
|
||||||
|
'msg': data.message, /*解析提示文本*/
|
||||||
|
'count': data.result.total, /*解析数据长度*/
|
||||||
|
'data': data.result.items, /*解析数据列表*/
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!DOCTYPE html>
|
||||||
{% block title %}
|
<html lang="en">
|
||||||
|
<head>
|
||||||
<title>部门新增</title>
|
<title>部门新增</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
<body class="pear-container">
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
{#搜索框布局#}
|
{#搜索框布局#}
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
@@ -35,10 +34,9 @@
|
|||||||
<table id="tables" lay-filter="tables"></table>
|
<table id="tables" lay-filter="tables"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
{#表格工具栏,需要在表格中绑定,且需要自定义事件#}
|
{#表格工具栏,需要在表格中绑定,且需要自定义事件#}
|
||||||
<script type="text/html" id="toolbar">
|
<script type="text/html" id="toolbar">
|
||||||
{% if authorize("admin:dept:edit") %}
|
{% if authorize("admin:dept:edit") %}
|
||||||
@@ -76,13 +74,13 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'treetable', 'popup'], function() {
|
layui.use(['table', 'form', 'jquery', 'treetable', 'popup'], function() {
|
||||||
let table = layui.table
|
let table = layui.table;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let treetable = layui.treetable
|
let treetable = layui.treetable;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
|
|
||||||
let MODULE_PATH = '/dept/'
|
let MODULE_PATH = '/dept/';
|
||||||
const get_columns = () => [
|
const get_columns = () => [
|
||||||
[
|
[
|
||||||
{type: 'checkbox'},
|
{type: 'checkbox'},
|
||||||
@@ -95,7 +93,7 @@
|
|||||||
{field: 'sort', title: '排序', width: 100},
|
{field: 'sort', title: '排序', width: 100},
|
||||||
{title: '操作', templet: '#tool', width: 120, align: 'center'},
|
{title: '操作', templet: '#tool', width: 120, align: 'center'},
|
||||||
],
|
],
|
||||||
]
|
];
|
||||||
|
|
||||||
{#定义表格渲染函数#}
|
{#定义表格渲染函数#}
|
||||||
window.render = function() {
|
window.render = function() {
|
||||||
@@ -113,77 +111,77 @@
|
|||||||
url: '/api/v1/dept/department', /*数据来源接口*/
|
url: '/api/v1/dept/department', /*数据来源接口*/
|
||||||
page: false,
|
page: false,
|
||||||
cols: get_columns(),/*表格渲染的数据*/
|
cols: get_columns(),/*表格渲染的数据*/
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/*查询表单按钮被点击的事件*/
|
/*查询表单按钮被点击的事件*/
|
||||||
form.on('submit(form_search)', function(data) {
|
form.on('submit(form_search)', function(data) {
|
||||||
let keyword = $.trim(data.field.deptName)
|
let keyword = $.trim(data.field.deptName);
|
||||||
/*获取所有的公司节点*/
|
/*获取所有的公司节点*/
|
||||||
let $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td')
|
let $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td');
|
||||||
if (!keyword) {
|
if (!keyword) {
|
||||||
$tds.css('background-color', 'transparent')
|
$tds.css('background-color', 'transparent');
|
||||||
layer.msg('请输入关键字', { icon: 5 })
|
layer.msg('请输入关键字', {icon: 5});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
/*本地查询并且标注高亮*/
|
/*本地查询并且标注高亮*/
|
||||||
let searchCount = 0
|
let searchCount = 0;
|
||||||
$tds.each(function() {
|
$tds.each(function() {
|
||||||
$(this).css('background-color', 'transparent')
|
$(this).css('background-color', 'transparent');
|
||||||
if ($(this).text().indexOf(keyword) >= 0) {
|
if ($(this).text().indexOf(keyword) >= 0) {
|
||||||
$(this).css('background-color', 'rgba(250,230,160,0.5)')
|
$(this).css('background-color', 'rgba(250,230,160,0.5)');
|
||||||
if (searchCount === 0) {
|
if (searchCount === 0) {
|
||||||
$('body,html').stop(true)
|
$('body,html').stop(true);
|
||||||
$('body,html').animate({ scrollTop: $(this).offset().top - 150 }, 500)
|
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
|
||||||
}
|
}
|
||||||
searchCount++
|
searchCount++;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (searchCount === 0) {
|
if (searchCount === 0) {
|
||||||
layer.msg('没有匹配结果', { icon: 5 })
|
layer.msg('没有匹配结果', {icon: 5});
|
||||||
} else {
|
} else {
|
||||||
treetable.expandAll('#tables')
|
treetable.expandAll('#tables');
|
||||||
}
|
}
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
render()
|
render();
|
||||||
|
|
||||||
/*表格的操作栏*/
|
/*表格的操作栏*/
|
||||||
table.on('tool(tables)', function(obj) {
|
table.on('tool(tables)', function(obj) {
|
||||||
if (obj.event === 'tool_remove') {
|
if (obj.event === 'tool_remove') {
|
||||||
/*移出事件*/
|
/*移出事件*/
|
||||||
window.tool_remove(obj)
|
window.tool_remove(obj);
|
||||||
} else if (obj.event === 'tool_edit') {
|
} else if (obj.event === 'tool_edit') {
|
||||||
/*编辑事件*/
|
/*编辑事件*/
|
||||||
window.tool_edit(obj)
|
window.tool_edit(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
/*表格的工具栏*/
|
/*表格的工具栏*/
|
||||||
table.on('toolbar(tables)', function(obj) {
|
table.on('toolbar(tables)', function(obj) {
|
||||||
{#console.log(obj)#}
|
{#console.log(obj)#}
|
||||||
if (obj.event === 'toolbar-add') {
|
if (obj.event === 'toolbar-add') {
|
||||||
window.toolbar_add()
|
window.toolbar_add();
|
||||||
} else if (obj.event === 'refresh') {
|
} else if (obj.event === 'refresh') {
|
||||||
window.refresh()
|
window.refresh();
|
||||||
} else if (obj.event === 'toolbar-remove') {
|
} else if (obj.event === 'toolbar-remove') {
|
||||||
{#window.toolbar_remove(obj)#}
|
{#window.toolbar_remove(obj)#}
|
||||||
layer.msg('禁止批量删除')
|
layer.msg('禁止批量删除');
|
||||||
return false
|
return false;
|
||||||
{#console.log(table.checkStatus(obj.config.id).data)#}
|
{#console.log(table.checkStatus(obj.config.id).data)#}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
/*切换选择状态*/
|
/*切换选择状态*/
|
||||||
form.on('switch(dept_enable)', function(obj) {
|
form.on('switch(dept_enable)', function(obj) {
|
||||||
let operate
|
let operate;
|
||||||
if (obj.elem.checked) {
|
if (obj.elem.checked) {
|
||||||
operate = 1
|
operate = 1;
|
||||||
} else {
|
} else {
|
||||||
operate = 0
|
operate = 0;
|
||||||
}
|
}
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/dept/department/' + this.value + '/status',
|
url: '/api/v1/dept/department/' + this.value + '/status',
|
||||||
data: JSON.stringify({deptId: this.value, operate: operate}),
|
data: JSON.stringify({deptId: this.value, operate: operate}),
|
||||||
@@ -191,15 +189,15 @@
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'put',
|
type: 'put',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message)
|
popup.success(result.message);
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
window.toolbar_add = function() {
|
window.toolbar_add = function() {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -208,8 +206,8 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['450px', '500px'], /*新增窗口的大小*/
|
area: ['450px', '500px'], /*新增窗口的大小*/
|
||||||
content: '/dept/add', /*新增窗口从那里来*/
|
content: '/dept/add', /*新增窗口从那里来*/
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_edit = function(obj) {
|
window.tool_edit = function(obj) {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -218,32 +216,39 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['450px', '500px'],
|
area: ['450px', '500px'],
|
||||||
content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId'], /*编辑修改窗口从那里来*/
|
content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId'], /*编辑修改窗口从那里来*/
|
||||||
})
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_remove = function(obj) {
|
window.tool_remove = function(obj) {
|
||||||
layer.confirm('确定要删除该部门', {icon: 3, title: '提示'}, function(index) {
|
layer.confirm('确定要删除该部门', {icon: 3, title: '提示'}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/dept/department/' + obj.data['deptId'],
|
url: '/api/v1/dept/department/' + obj.data['deptId'],
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
obj.del()
|
obj.del();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>部门管理</title>
|
<title>部门管理</title>
|
||||||
{% endblock %}
|
<title>部门新增</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
{% block body %}
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
{% include 'admin/common/header.html' %}
|
||||||
|
<body class="pear-container">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -80,31 +83,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery', 'dtree'], function() {
|
layui.use(['form', 'jquery', 'dtree'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
|
|
||||||
/*添加数据 渲染下拉选择组件*/
|
/*添加数据 渲染下拉选择组件*/
|
||||||
dtree.renderSelect({
|
dtree.renderSelect({
|
||||||
elem: '#selectParent',
|
elem: '#selectParent',
|
||||||
url: '/api/v1/dept/departments',
|
url: '/api/v1/dept/department/',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
selectInputName: {nodeId: 'parentId', context: 'parentName'},
|
selectInputName: {nodeId: 'parentId', context: 'parentName'},
|
||||||
skin: 'layui',
|
skin: 'layui',
|
||||||
dataFormat: 'list',
|
dataFormat: 'list',
|
||||||
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
||||||
selectInitVal: '1',
|
selectInitVal: '1',
|
||||||
})
|
});
|
||||||
|
|
||||||
/*添加数据 表单组件,提交按钮之后触发的事件*/
|
/*添加数据 表单组件,提交按钮之后触发的事件*/
|
||||||
form.on('submit(dept-save)', function(data) {
|
form.on('submit(dept-save)', function(data) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/dept/departments',
|
url: '/api/v1/dept/department/',
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
@@ -112,16 +114,17 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
parent.render()
|
parent.render();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>部门修改</title>
|
<title>部门修改</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
{% block body %}
|
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -91,14 +90,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
{% block models_script %}
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery'], function() {
|
layui.use(['form', 'jquery'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
|
|
||||||
// 修改数据 当点击更新之后,获取数据
|
// 修改数据 当点击更新之后,获取数据
|
||||||
form.on('submit(dept-update)', function(data) {
|
form.on('submit(dept-update)', function(data) {
|
||||||
@@ -111,17 +108,17 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.render()
|
parent.render();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
});
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>图片上传</title>
|
<title>图片上传</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<table id="tables" lay-filter="tables"></table>
|
<table id="tables" lay-filter="tables"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script type="text/html" id="toolbar">
|
<script type="text/html" id="toolbar">
|
||||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="toolbar-add">
|
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="toolbar-add">
|
||||||
<i class="layui-icon layui-icon-add-1"></i>
|
<i class="layui-icon layui-icon-add-1"></i>
|
||||||
@@ -28,13 +29,12 @@
|
|||||||
<i class="layui-icon layui-icon-delete"></i>
|
<i class="layui-icon layui-icon-delete"></i>
|
||||||
</button>
|
</button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'element', 'form', 'upload'], function() {
|
layui.use(['table', 'form', 'jquery', 'element', 'form', 'upload'], function() {
|
||||||
let table = layui.table
|
let table = layui.table;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let upload = layui.upload
|
let upload = layui.upload;
|
||||||
|
|
||||||
const get_columns = () => [
|
const get_columns = () => [
|
||||||
[
|
[
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
unresize: true,
|
unresize: true,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
templet: (d) => {
|
templet: (d) => {
|
||||||
return `<img class="tool-photo" style="max-width: 100%;height: 100%;cursor: pointer;" lay-event="photo" src="${d.href}"></i>`
|
return `<img class="tool-photo" style="max-width: 100%;height: 100%;cursor: pointer;" lay-event="photo" src="${d.href}"></i>`;
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
]
|
];
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
parseData: parserTableData, /* 服务器返回的数据格式与 layui 不一致,需要进行转化*/
|
parseData: parserTableData, /* 服务器返回的数据格式与 layui 不一致,需要进行转化*/
|
||||||
@@ -107,35 +107,35 @@
|
|||||||
layEvent: 'refresh',
|
layEvent: 'refresh',
|
||||||
icon: 'layui-icon-refresh',
|
icon: 'layui-icon-refresh',
|
||||||
}, 'filter', 'print', 'exports'],
|
}, 'filter', 'print', 'exports'],
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('tool(tables)', function(obj) {
|
table.on('tool(tables)', function(obj) {
|
||||||
if (obj.event === 'tool-remove') {
|
if (obj.event === 'tool-remove') {
|
||||||
window.remove(obj)
|
window.remove(obj);
|
||||||
} else if (obj.event === 'photo') {
|
} else if (obj.event === 'photo') {
|
||||||
window.photo(obj)
|
window.photo(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('toolbar(tables)', function(obj) {
|
table.on('toolbar(tables)', function(obj) {
|
||||||
if (obj.event === 'toolbar-add') {
|
if (obj.event === 'toolbar-add') {
|
||||||
window.add()
|
window.add();
|
||||||
} else if (obj.event === 'refresh') {
|
} else if (obj.event === 'refresh') {
|
||||||
window.refresh()
|
window.refresh();
|
||||||
} else if (obj.event === 'toolbar-remove') {
|
} else if (obj.event === 'toolbar-remove') {
|
||||||
window.batchRemove(obj)
|
window.batchRemove(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
//弹出窗设置 自己设置弹出百分比
|
//弹出窗设置 自己设置弹出百分比
|
||||||
function screen(width, height) {
|
function screen(width, height) {
|
||||||
if (typeof width !== 'number' || width === 0) {
|
if (typeof width !== 'number' || width === 0) {
|
||||||
width = $(window).width() * 0.8
|
width = $(window).width() * 0.8;
|
||||||
}
|
}
|
||||||
if (typeof height !== 'number' || height === 0) {
|
if (typeof height !== 'number' || height === 0) {
|
||||||
height = $(window).height() - 20
|
height = $(window).height() - 20;
|
||||||
}
|
}
|
||||||
return [width + 'px', height + 'px']
|
return [width + 'px', height + 'px'];
|
||||||
}
|
}
|
||||||
|
|
||||||
window.add = function() {
|
window.add = function() {
|
||||||
@@ -146,110 +146,110 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: screen(),
|
area: screen(),
|
||||||
content: 'file/photo/add',
|
content: 'file/photo/add',
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.remove = function(obj) {
|
window.remove = function(obj) {
|
||||||
layer.confirm('确定要删除该图片', {
|
layer.confirm('确定要删除该图片', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
title: '提示',
|
title: '提示',
|
||||||
}, function(index) {
|
}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/file/photo/' + obj.data['id'],
|
url: '/api/v1/file/photo/' + obj.data['id'],
|
||||||
data: {id: obj.data['id']},
|
data: {id: obj.data['id']},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
layer.msg(res.message, {
|
layer.msg(res.message, {
|
||||||
icon: 1,
|
icon: 1,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
}, function() {
|
}, function() {
|
||||||
obj.del()
|
obj.del();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(res.message, {
|
layer.msg(res.message, {
|
||||||
icon: 2,
|
icon: 2,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.batchRemove = function(obj) {
|
window.batchRemove = function(obj) {
|
||||||
let data = table.checkStatus(obj.config.id).data
|
let data = table.checkStatus(obj.config.id).data;
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
layer.msg('未选中数据', {
|
layer.msg('未选中数据', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
var ids = []
|
var ids = [];
|
||||||
var hasCheck = table.checkStatus('tables')
|
var hasCheck = table.checkStatus('tables');
|
||||||
var hasCheckData = hasCheck.data
|
var hasCheckData = hasCheck.data;
|
||||||
if (hasCheckData.length > 0) {
|
if (hasCheckData.length > 0) {
|
||||||
$.each(hasCheckData, function(index, element) {
|
$.each(hasCheckData, function(index, element) {
|
||||||
ids.push(element.id)
|
ids.push(element.id);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
layer.confirm('确定要删除这些图片', {
|
layer.confirm('确定要删除这些图片', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
title: '提示',
|
title: '提示',
|
||||||
}, function(index) {
|
}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/file/photos',
|
url: '/api/v1/file/photos',
|
||||||
data: {ids: ids},
|
data: {ids: ids},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
layer.msg(res.message, {
|
layer.msg(res.message, {
|
||||||
icon: 1,
|
icon: 1,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
}, function() {
|
}, function() {
|
||||||
table.reload('tables')
|
table.reload('tables');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(res.message, {
|
layer.msg(res.message, {
|
||||||
icon: 2,
|
icon: 2,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.refresh = function() {
|
window.refresh = function() {
|
||||||
table.reload('tables')
|
table.reload('tables');
|
||||||
}
|
};
|
||||||
// 查看大图
|
// 查看大图
|
||||||
window.photo = function(obj) {
|
window.photo = function(obj) {
|
||||||
if (!obj.data.href || obj.data.href === '') {
|
if (!obj.data.href || obj.data.href === '') {
|
||||||
layer.msg('图片地址错误!')
|
layer.msg('图片地址错误!');
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
var auto_img = {}
|
var auto_img = {};
|
||||||
var img = new Image()
|
var img = new Image();
|
||||||
img.src = obj.data.href
|
img.src = obj.data.href;
|
||||||
img.onload = function() {
|
img.onload = function() {
|
||||||
var max_height = $(window).height() - 100
|
var max_height = $(window).height() - 100;
|
||||||
var max_width = $(window).width()
|
var max_width = $(window).width();
|
||||||
var rate1 = max_height / img.height
|
var rate1 = max_height / img.height;
|
||||||
var rate2 = max_width / img.width
|
var rate2 = max_width / img.width;
|
||||||
var rate3 = 1
|
var rate3 = 1;
|
||||||
var rate = Math.min(rate1, rate2, rate3)
|
var rate = Math.min(rate1, rate2, rate3);
|
||||||
auto_img.height = img.height * rate
|
auto_img.height = img.height * rate;
|
||||||
auto_img.width = img.width * rate
|
auto_img.width = img.width * rate;
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 1,
|
type: 1,
|
||||||
title: false,
|
title: false,
|
||||||
@@ -257,10 +257,11 @@
|
|||||||
skin: 'layui-layer-nobg', //没有背景色
|
skin: 'layui-layer-nobg', //没有背景色
|
||||||
shadeClose: true,
|
shadeClose: true,
|
||||||
content: `<img src="${obj.data['href']}" width="${auto_img.width}px" height="${auto_img.height}px">`,
|
content: `<img src="${obj.data['href']}" width="${auto_img.width}px" height="${auto_img.height}px">`,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>新增图片</title>
|
<title>新增图片</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<div class="layui-row layui-col-space15">
|
<div class="layui-row layui-col-space15">
|
||||||
<div class="layui-col-md12">
|
<div class="layui-col-md12">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
@@ -25,16 +25,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
{% block models_script %}
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['jquery', 'element', 'form', 'upload'], function() {
|
layui.use(['jquery', 'element', 'form', 'upload'], function() {
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery;
|
||||||
var element = layui.element
|
var element = layui.element;
|
||||||
var form = layui.form
|
var form = layui.form;
|
||||||
var upload = layui.upload
|
var upload = layui.upload;
|
||||||
//选完文件后不自动上传
|
//选完文件后不自动上传
|
||||||
upload.render({
|
upload.render({
|
||||||
elem: '#select-img'
|
elem: '#select-img'
|
||||||
@@ -46,14 +44,15 @@
|
|||||||
, done: function(res) {
|
, done: function(res) {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
layer.msg(res.message, {icon: 1, time: 500}, function() {
|
layer.msg(res.message, {icon: 1, time: 500}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
window.parent.location.reload()
|
window.parent.location.reload();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(res.message, { icon: 2 })
|
layer.msg(res.message, {icon: 2});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>日志</title>
|
<title>日志</title>
|
||||||
|
{% include 'admin/common/header.html' %}
|
||||||
<link rel="stylesheet" href="/static/admin/admin/css/other/console2.css"/>
|
<link rel="stylesheet" href="/static/admin/admin/css/other/console2.css"/>
|
||||||
{% endblock %}
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<div class="layui-tab layui-tab-card">
|
<div class="layui-tab layui-tab-card">
|
||||||
@@ -19,15 +19,16 @@
|
|||||||
<table style="margin-top: 10px;" id="log-login-table" lay-filter="log-login-table"></table>
|
<table style="margin-top: 10px;" id="log-login-table" lay-filter="log-login-table"></table>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
<table style="margin-top: 10px;" id="log-access-table" lay-filter="log-access-table"></table>
|
<table style="margin-top: 10px;" id="log-access-table"
|
||||||
|
lay-filter="log-access-table"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script type="text/html" id="log-createTime">
|
<script type="text/html" id="log-createTime">
|
||||||
{{ ' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
{{ ' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||||
</script>
|
</script>
|
||||||
@@ -38,13 +39,12 @@
|
|||||||
<span style="color: red">失败</span>
|
<span style="color: red">失败</span>
|
||||||
{{# } }}'|safe }}
|
{{# } }}'|safe }}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'element', 'util'], function() {
|
layui.use(['table', 'form', 'jquery', 'element', 'util'], function() {
|
||||||
let table = layui.table
|
let table = layui.table;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
|
|
||||||
let MODULE_PATH = '/logs/'
|
let MODULE_PATH = '/logs/';
|
||||||
|
|
||||||
const get_columns = () => [
|
const get_columns = () => [
|
||||||
[
|
[
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
{title: '描述', field: 'desc', align: 'center'},
|
{title: '描述', field: 'desc', align: 'center'},
|
||||||
{title: '访问状态', templet: '#log-status', align: 'center'},
|
{title: '访问状态', templet: '#log-status', align: 'center'},
|
||||||
],
|
],
|
||||||
]
|
];
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
parseData: parserTableData,
|
parseData: parserTableData,
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
cols: get_columns(),
|
cols: get_columns(),
|
||||||
skin: 'line',
|
skin: 'line',
|
||||||
toolbar: false,
|
toolbar: false,
|
||||||
})
|
});
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
parseData: parserTableData,
|
parseData: parserTableData,
|
||||||
@@ -78,7 +78,8 @@
|
|||||||
cols: get_columns(),
|
cols: get_columns(),
|
||||||
skin: 'line',
|
skin: 'line',
|
||||||
toolbar: false,
|
toolbar: false,
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>权限</title>
|
<title>权限</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
{% block body %}
|
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
@@ -31,9 +30,9 @@
|
|||||||
<table id="tables" lay-filter="tables"></table>
|
<table id="tables" lay-filter="tables"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script type="text/html" id="toolbar">
|
<script type="text/html" id="toolbar">
|
||||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||||
<i class="layui-icon layui-icon-add-1"></i>
|
<i class="layui-icon layui-icon-add-1"></i>
|
||||||
@@ -52,16 +51,15 @@
|
|||||||
class="layui-icon layui-icon-delete"></i>
|
class="layui-icon layui-icon-delete"></i>
|
||||||
</button>
|
</button>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'treetable', 'popup', 'dtree', 'iconPicker'], function() {
|
layui.use(['table', 'form', 'jquery', 'treetable', 'popup', 'dtree', 'iconPicker'], function() {
|
||||||
let table = layui.table
|
let table = layui.table;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let treetable = layui.treetable
|
let treetable = layui.treetable;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
let iconPicker = layui.iconPicker
|
let iconPicker = layui.iconPicker;
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
|
|
||||||
const get_columns = () => [
|
const get_columns = () => [
|
||||||
[
|
[
|
||||||
@@ -71,11 +69,11 @@
|
|||||||
{
|
{
|
||||||
field: 'powerType', title: '权限类型', templet: (d) => {
|
field: 'powerType', title: '权限类型', templet: (d) => {
|
||||||
if (d.powerType === 0) {
|
if (d.powerType === 0) {
|
||||||
return `<span>目录</span>`
|
return `<span>目录</span>`;
|
||||||
} else if (d.powerType === 1) {
|
} else if (d.powerType === 1) {
|
||||||
return `<span>菜单</span>`
|
return `<span>菜单</span>`;
|
||||||
} else if (d.powerType === 2) {
|
} else if (d.powerType === 2) {
|
||||||
return `<span>按钮</span>`
|
return `<span>按钮</span>`;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -83,13 +81,13 @@
|
|||||||
field: 'enable', title: '是否可用', templet: (d) => {
|
field: 'enable', title: '是否可用', templet: (d) => {
|
||||||
// TODO 修改禁用启动逻辑
|
// TODO 修改禁用启动逻辑
|
||||||
return `<input type="checkbox" name="enable" value="${d.powerId}" lay-skin="switch" lay-text="启用|禁用" lay-filter="tool-switch" ${d.enable ===
|
return `<input type="checkbox" name="enable" value="${d.powerId}" lay-skin="switch" lay-text="启用|禁用" lay-filter="tool-switch" ${d.enable ===
|
||||||
true ? 'checked=checked' : ''}>`
|
true ? 'checked=checked' : ''}>`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{field: 'sort', title: '排序'},
|
{field: 'sort', title: '排序'},
|
||||||
{title: '操作', templet: '#tool', width: 150, align: 'center'},
|
{title: '操作', templet: '#tool', width: 150, align: 'center'},
|
||||||
],
|
],
|
||||||
]
|
];
|
||||||
|
|
||||||
treetable.render({
|
treetable.render({
|
||||||
treeColIndex: 1,
|
treeColIndex: 1,
|
||||||
@@ -104,62 +102,62 @@
|
|||||||
url: '/api/v1/rights/rights',
|
url: '/api/v1/rights/rights',
|
||||||
page: false,
|
page: false,
|
||||||
cols: get_columns(),
|
cols: get_columns(),
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(power_query)', function(data) {
|
form.on('submit(power_query)', function(data) {
|
||||||
var keyword = data.field.powerName
|
var keyword = data.field.powerName;
|
||||||
var $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td')
|
var $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td');
|
||||||
if (!keyword) {
|
if (!keyword) {
|
||||||
$tds.css('background-color', 'transparent')
|
$tds.css('background-color', 'transparent');
|
||||||
layer.msg('请输入关键字', { icon: 5 })
|
layer.msg('请输入关键字', {icon: 5});
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
var searchCount = 0
|
var searchCount = 0;
|
||||||
$tds.each(function() {
|
$tds.each(function() {
|
||||||
$(this).css('background-color', 'transparent')
|
$(this).css('background-color', 'transparent');
|
||||||
if ($(this).text().indexOf(keyword) >= 0) {
|
if ($(this).text().indexOf(keyword) >= 0) {
|
||||||
$(this).css('background-color', 'rgba(250,230,160,0.5)')
|
$(this).css('background-color', 'rgba(250,230,160,0.5)');
|
||||||
if (searchCount === 0) {
|
if (searchCount === 0) {
|
||||||
$('body,html').stop(true)
|
$('body,html').stop(true);
|
||||||
$('body,html').animate({ scrollTop: $(this).offset().top - 150 }, 500)
|
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
|
||||||
}
|
}
|
||||||
searchCount++
|
searchCount++;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
if (searchCount === 0) {
|
if (searchCount === 0) {
|
||||||
layer.msg('没有匹配结果', { icon: 5 })
|
layer.msg('没有匹配结果', {icon: 5});
|
||||||
} else {
|
} else {
|
||||||
treetable.expandAll('#tables')
|
treetable.expandAll('#tables');
|
||||||
}
|
}
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('tool(tables)', function(obj) {
|
table.on('tool(tables)', function(obj) {
|
||||||
if (obj.event === 'tool-remove') {
|
if (obj.event === 'tool-remove') {
|
||||||
window.tool_remove(obj)
|
window.tool_remove(obj);
|
||||||
} else if (obj.event === 'tool-edit') {
|
} else if (obj.event === 'tool-edit') {
|
||||||
window.tool_edit(obj)
|
window.tool_edit(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('toolbar(tables)', function(obj) {
|
table.on('toolbar(tables)', function(obj) {
|
||||||
if (obj.event === 'toolbar-add') {
|
if (obj.event === 'toolbar-add') {
|
||||||
window.toolbar_add()
|
window.toolbar_add();
|
||||||
} else if (obj.event === 'refresh') {
|
} else if (obj.event === 'refresh') {
|
||||||
window.refresh()
|
window.refresh();
|
||||||
} else if (obj.event === 'toolbar-remove') {
|
} else if (obj.event === 'toolbar-remove') {
|
||||||
window.toolbar_remove(obj)
|
window.toolbar_remove(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('switch(tool-switch)', function(obj) {
|
form.on('switch(tool-switch)', function(obj) {
|
||||||
let operate
|
let operate;
|
||||||
if (obj.elem.checked) {
|
if (obj.elem.checked) {
|
||||||
operate = 1 /*启用*/
|
operate = 1; /*启用*/
|
||||||
} else {
|
} else {
|
||||||
operate = 0 /*禁用*/
|
operate = 0; /*禁用*/
|
||||||
}
|
}
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/rights/power/' + this.value + '/status',
|
url: '/api/v1/rights/power/' + this.value + '/status',
|
||||||
data: JSON.stringify({powerId: this.value, operate: operate}),
|
data: JSON.stringify({powerId: this.value, operate: operate}),
|
||||||
@@ -167,15 +165,15 @@
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'put',
|
type: 'put',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message)
|
popup.success(result.message);
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
window.toolbar_add = function() {
|
window.toolbar_add = function() {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -184,8 +182,8 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['450px', '500px'],
|
area: ['450px', '500px'],
|
||||||
content: '/rights/add',
|
content: '/rights/add',
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_edit = function(obj) {
|
window.tool_edit = function(obj) {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -194,73 +192,73 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['450px', '500px'],
|
area: ['450px', '500px'],
|
||||||
content: '/rights/power/' + obj.data['powerId'],
|
content: '/rights/power/' + obj.data['powerId'],
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
window.tool_remove = function(obj) {
|
window.tool_remove = function(obj) {
|
||||||
layer.confirm('确定要删除该权限', {icon: 3, title: '提示'}, function(index) {
|
layer.confirm('确定要删除该权限', {icon: 3, title: '提示'}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/rights/power/' + obj.data['powerId'],
|
url: '/api/v1/rights/power/' + obj.data['powerId'],
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
console.log(obj)
|
console.log(obj);
|
||||||
obj.del()
|
obj.del();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.toolbar_remove = function(obj) {
|
window.toolbar_remove = function(obj) {
|
||||||
let data = table.checkStatus(obj.config.id).data
|
let data = table.checkStatus(obj.config.id).data;
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
layer.msg('未选中数据', {
|
layer.msg('未选中数据', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
var ids = []
|
var ids = [];
|
||||||
var hasCheck = table.checkStatus('tables')
|
var hasCheck = table.checkStatus('tables');
|
||||||
var hasCheckData = hasCheck.data
|
var hasCheckData = hasCheck.data;
|
||||||
if (hasCheckData.length > 0) {
|
if (hasCheckData.length > 0) {
|
||||||
$.each(hasCheckData, function(index, element) {
|
$.each(hasCheckData, function(index, element) {
|
||||||
ids.push(element.id)
|
ids.push(element.id);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
layer.confirm('确定要删除选中权限', {
|
layer.confirm('确定要删除选中权限', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
title: '提示',
|
title: '提示',
|
||||||
}, function(index) {
|
}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/rights/rights',
|
url: '/api/v1/rights/rights',
|
||||||
data: {ids: ids},
|
data: {ids: ids},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.msg, function() {
|
popup.success(result.msg, function() {
|
||||||
console.log(obj)
|
console.log(obj);
|
||||||
obj.del()
|
obj.del();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.msg)
|
popup.failure(result.msg);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
iconPicker.render({
|
iconPicker.render({
|
||||||
// 选择器,推荐使用input
|
// 选择器,推荐使用input
|
||||||
@@ -275,9 +273,10 @@
|
|||||||
limit: 12,
|
limit: 12,
|
||||||
// 点击回调
|
// 点击回调
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
console.log(data)
|
console.log(data);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>权限</title>
|
<title>权限</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -84,16 +84,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function() {
|
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let iconPicker = layui.iconPicker
|
let iconPicker = layui.iconPicker;
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
|
|
||||||
dtree.renderSelect({
|
dtree.renderSelect({
|
||||||
elem: '#selectParent',
|
elem: '#selectParent',
|
||||||
@@ -104,31 +103,31 @@
|
|||||||
dataFormat: 'list',
|
dataFormat: 'list',
|
||||||
response: {treeId: 'powerId', parentId: 'parentId', title: 'powerName'}, //修改response中返回数据的定义
|
response: {treeId: 'powerId', parentId: 'parentId', title: 'powerName'}, //修改response中返回数据的定义
|
||||||
selectInitVal: '0',
|
selectInitVal: '0',
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('radio(powerType)', function() {
|
form.on('radio(powerType)', function() {
|
||||||
if (this.value == '0') {
|
if (this.value == '0') {
|
||||||
$('#powerUrlItem').hide()
|
$('#powerUrlItem').hide();
|
||||||
$('#powerCodeItem').hide()
|
$('#powerCodeItem').hide();
|
||||||
$('#openTypeItem').hide()
|
$('#openTypeItem').hide();
|
||||||
$('#powerUrl').val('')
|
$('#powerUrl').val('');
|
||||||
$('#powerCode').val('')
|
$('#powerCode').val('');
|
||||||
$('#openType').val('')
|
$('#openType').val('');
|
||||||
} else if (this.value == '1') {
|
} else if (this.value == '1') {
|
||||||
$('#powerUrlItem').show()
|
$('#powerUrlItem').show();
|
||||||
$('#powerCodeItem').show()
|
$('#powerCodeItem').show();
|
||||||
$('#openTypeItem').show()
|
$('#openTypeItem').show();
|
||||||
} else if (this.value == '2') {
|
} else if (this.value == '2') {
|
||||||
$('#powerUrlItem').hide()
|
$('#powerUrlItem').hide();
|
||||||
$('#openTypeItem').hide()
|
$('#openTypeItem').hide();
|
||||||
$('#powerCodeItem').show()
|
$('#powerCodeItem').show();
|
||||||
$('#powerUrl').val('')
|
$('#powerUrl').val('');
|
||||||
$('#openType').val('')
|
$('#openType').val('');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(power-save)', function(data) {
|
form.on('submit(power-save)', function(data) {
|
||||||
data.field.icon = 'layui-icon ' + data.field.icon
|
data.field.icon = 'layui-icon ' + data.field.icon;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/rights/power/0',
|
url: '/api/v1/rights/power/0',
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
@@ -138,16 +137,16 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.render()
|
parent.render();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
iconPicker.render({
|
iconPicker.render({
|
||||||
// 选择器,推荐使用input
|
// 选择器,推荐使用input
|
||||||
@@ -162,9 +161,11 @@
|
|||||||
limit: 12,
|
limit: 12,
|
||||||
// 点击回调
|
// 点击回调
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
console.log(data)
|
console.log(data);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>权限编辑</title>
|
<title>权限编辑</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -95,15 +96,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function() {
|
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let iconPicker = layui.iconPicker
|
let iconPicker = layui.iconPicker;
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
|
|
||||||
dtree.renderSelect({
|
dtree.renderSelect({
|
||||||
elem: '#selectParent',
|
elem: '#selectParent',
|
||||||
@@ -114,35 +114,35 @@
|
|||||||
dataFormat: 'list',
|
dataFormat: 'list',
|
||||||
response: {treeId: 'powerId', parentId: 'parentId', title: 'powerName'},
|
response: {treeId: 'powerId', parentId: 'parentId', title: 'powerName'},
|
||||||
selectInitVal: "{{ power.parent_id }}",
|
selectInitVal: "{{ power.parent_id }}",
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('radio(powerType)', function(data) {
|
form.on('radio(powerType)', function(data) {
|
||||||
if (this.value == '0') {
|
if (this.value == '0') {
|
||||||
{#目录#}
|
{#目录#}
|
||||||
$('#powerUrlItem').hide()
|
$('#powerUrlItem').hide();
|
||||||
$('#powerCodeItem').hide()
|
$('#powerCodeItem').hide();
|
||||||
$('#openTypeItem').hide()
|
$('#openTypeItem').hide();
|
||||||
$('#powerUrl').val('')
|
$('#powerUrl').val('');
|
||||||
$('#powerCode').val('')
|
$('#powerCode').val('');
|
||||||
$('#openType').val('')
|
$('#openType').val('');
|
||||||
} else if (this.value == '1') {
|
} else if (this.value == '1') {
|
||||||
{#菜单#}
|
{#菜单#}
|
||||||
$('#powerUrlItem').show()
|
$('#powerUrlItem').show();
|
||||||
$('#powerCodeItem').show()
|
$('#powerCodeItem').show();
|
||||||
$('#openTypeItem').show()
|
$('#openTypeItem').show();
|
||||||
} else if (this.value == '2') {
|
} else if (this.value == '2') {
|
||||||
{#按钮#}
|
{#按钮#}
|
||||||
$('#powerUrlItem').hide()
|
$('#powerUrlItem').hide();
|
||||||
$('#openTypeItem').hide()
|
$('#openTypeItem').hide();
|
||||||
$('#powerCodeItem').show()
|
$('#powerCodeItem').show();
|
||||||
$('#powerUrl').val('')
|
$('#powerUrl').val('');
|
||||||
$('#openType').val('')
|
$('#openType').val('');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(power-save)', function(data) {
|
form.on('submit(power-save)', function(data) {
|
||||||
data.field.icon = 'layui-icon ' + data.field.icon
|
data.field.icon = 'layui-icon ' + data.field.icon;
|
||||||
console.log(data.field)
|
console.log(data.field);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/rights/power/' + data.field.powerId,
|
url: '/api/v1/rights/power/' + data.field.powerId,
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
@@ -152,16 +152,16 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.render()
|
parent.render();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
iconPicker.render({
|
iconPicker.render({
|
||||||
elem: '#edit_icon',
|
elem: '#edit_icon',
|
||||||
@@ -170,34 +170,35 @@
|
|||||||
page: true,
|
page: true,
|
||||||
limit: 12,
|
limit: 12,
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
console.log(data)
|
console.log(data);
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
iconPicker.checkIcon('icon', "{{ icon }}")
|
iconPicker.checkIcon('icon', "{{ icon }}");
|
||||||
|
|
||||||
window.init = function(type) {
|
window.init = function(type) {
|
||||||
if (type == '0') {
|
if (type == '0') {
|
||||||
$('#powerUrlItem').hide()
|
$('#powerUrlItem').hide();
|
||||||
$('#powerCodeItem').hide()
|
$('#powerCodeItem').hide();
|
||||||
$('#openTypeItem').hide()
|
$('#openTypeItem').hide();
|
||||||
$('#powerUrl').val('')
|
$('#powerUrl').val('');
|
||||||
$('#powerCode').val('')
|
$('#powerCode').val('');
|
||||||
$('#openType').val('')
|
$('#openType').val('');
|
||||||
} else if (type == '1') {
|
} else if (type == '1') {
|
||||||
$('#powerUrlItem').show()
|
$('#powerUrlItem').show();
|
||||||
$('#powerCodeItem').show()
|
$('#powerCodeItem').show();
|
||||||
$('#openTypeItem').show()
|
$('#openTypeItem').show();
|
||||||
} else if (type == '2') {
|
} else if (type == '2') {
|
||||||
$('#powerUrlItem').hide()
|
$('#powerUrlItem').hide();
|
||||||
$('#openTypeItem').hide()
|
$('#openTypeItem').hide();
|
||||||
$('#powerCodeItem').show()
|
$('#powerCodeItem').show();
|
||||||
$('#powerUrl').val('')
|
$('#powerUrl').val('');
|
||||||
$('#openType').val('')
|
$('#openType').val('');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
window.init("{{ power.type }}")
|
window.init("{{ power.type }}");
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>角色管理</title>
|
<title>角色管理</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
@@ -34,9 +35,9 @@
|
|||||||
<table id="tables" lay-filter="tables"></table>
|
<table id="tables" lay-filter="tables"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script type="text/html" id="toolbar">
|
<script type="text/html" id="toolbar">
|
||||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||||
<i class="layui-icon layui-icon-add-1"></i>
|
<i class="layui-icon layui-icon-add-1"></i>
|
||||||
@@ -62,13 +63,12 @@
|
|||||||
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用"
|
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||||
lay-filter="tool-switch" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
|
lay-filter="tool-switch" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'form', 'jquery', 'popup', 'common'], function() {
|
layui.use(['table', 'form', 'jquery', 'popup', 'common'], function() {
|
||||||
let table = layui.table
|
let table = layui.table;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
|
|
||||||
const get_columns = () => [
|
const get_columns = () => [
|
||||||
[
|
[
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
{title: '排序', field: 'sort', align: 'center'},
|
{title: '排序', field: 'sort', align: 'center'},
|
||||||
{title: '操作', toolbar: '#tool', align: 'center', width: 195},
|
{title: '操作', toolbar: '#tool', align: 'center', width: 195},
|
||||||
],
|
],
|
||||||
]
|
];
|
||||||
|
|
||||||
table.render({
|
table.render({
|
||||||
parseData: parserTableData,
|
parseData: parserTableData,
|
||||||
@@ -95,41 +95,41 @@
|
|||||||
layEvent: 'refresh',
|
layEvent: 'refresh',
|
||||||
icon: 'layui-icon-refresh',
|
icon: 'layui-icon-refresh',
|
||||||
}, 'filter', 'print', 'exports'],
|
}, 'filter', 'print', 'exports'],
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('tool(tables)', function(obj) {
|
table.on('tool(tables)', function(obj) {
|
||||||
if (obj.event === 'tool-remove') {
|
if (obj.event === 'tool-remove') {
|
||||||
window.tool_remove(obj)
|
window.tool_remove(obj);
|
||||||
} else if (obj.event === 'tool-edit') {
|
} else if (obj.event === 'tool-edit') {
|
||||||
window.tool_edit(obj)
|
window.tool_edit(obj);
|
||||||
} else if (obj.event === 'tool-power') {
|
} else if (obj.event === 'tool-power') {
|
||||||
window.tool_power(obj)
|
window.tool_power(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('toolbar(tables)', function(obj) {
|
table.on('toolbar(tables)', function(obj) {
|
||||||
if (obj.event === 'toolbar-add') {
|
if (obj.event === 'toolbar-add') {
|
||||||
window.toolbar_add()
|
window.toolbar_add();
|
||||||
} else if (obj.event === 'refresh') {
|
} else if (obj.event === 'refresh') {
|
||||||
window.refresh()
|
window.refresh();
|
||||||
} else if (obj.event === 'toolbar-remove') {
|
} else if (obj.event === 'toolbar-remove') {
|
||||||
window.toolbar_remove(obj)
|
window.toolbar_remove(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(role-query)', function(data) {
|
form.on('submit(role-query)', function(data) {
|
||||||
table.reload('tables', { where: data.field })
|
table.reload('tables', {where: data.field});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('switch(tool-switch)', function(obj) {
|
form.on('switch(tool-switch)', function(obj) {
|
||||||
let operate
|
let operate;
|
||||||
if (obj.elem.checked) {
|
if (obj.elem.checked) {
|
||||||
operate = 1
|
operate = 1;
|
||||||
} else {
|
} else {
|
||||||
operate = 0
|
operate = 0;
|
||||||
}
|
}
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/roles/role/' + this.value + '/status',
|
url: '/api/v1/roles/role/' + this.value + '/status',
|
||||||
data: JSON.stringify({roleId: this.value, operate: operate}),
|
data: JSON.stringify({roleId: this.value, operate: operate}),
|
||||||
@@ -137,15 +137,15 @@
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'put',
|
type: 'put',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, { icon: 1, time: 1000 })
|
layer.msg(result.message, {icon: 1, time: 1000});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
window.toolbar_add = function() {
|
window.toolbar_add = function() {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -154,8 +154,8 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['500px', '500px'],
|
area: ['500px', '500px'],
|
||||||
content: '/admin/role/add',
|
content: '/admin/role/add',
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_power = function(obj) {
|
window.tool_power = function(obj) {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -164,8 +164,8 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['320px', '400px'],
|
area: ['320px', '400px'],
|
||||||
content: '/admin/role/power/' + obj.data['id'],
|
content: '/admin/role/power/' + obj.data['id'],
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_edit = function(obj) {
|
window.tool_edit = function(obj) {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -174,55 +174,55 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['500px', '500px'],
|
area: ['500px', '500px'],
|
||||||
content: '/admin/role/edit/' + obj.data['id'],
|
content: '/admin/role/edit/' + obj.data['id'],
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_remove = function(obj) {
|
window.tool_remove = function(obj) {
|
||||||
layer.confirm('确定要删除该角色', {icon: 3, title: '提示'}, function(index) {
|
layer.confirm('确定要删除该角色', {icon: 3, title: '提示'}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/roles/role_power/' + obj.data['id'],
|
url: '/api/v1/roles/role_power/' + obj.data['id'],
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
obj.del()
|
obj.del();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.toolbar_remove = function(obj) {
|
window.toolbar_remove = function(obj) {
|
||||||
let data = table.checkStatus(obj.config.id).data
|
let data = table.checkStatus(obj.config.id).data;
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
layer.msg('未选中数据', {
|
layer.msg('未选中数据', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
var ids = []
|
var ids = [];
|
||||||
var hasCheck = table.checkStatus('tables')
|
var hasCheck = table.checkStatus('tables');
|
||||||
var hasCheckData = hasCheck.data
|
var hasCheckData = hasCheck.data;
|
||||||
if (hasCheckData.length > 0) {
|
if (hasCheckData.length > 0) {
|
||||||
$.each(hasCheckData, function(index, element) {
|
$.each(hasCheckData, function(index, element) {
|
||||||
ids.push(element.id)
|
ids.push(element.id);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
console.log(ids)
|
console.log(ids);
|
||||||
layer.confirm('确定要删除选中角色', {
|
layer.confirm('确定要删除选中角色', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
title: '提示',
|
title: '提示',
|
||||||
}, function(index) {
|
}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
||||||
url: '/api/v1/roles/role',
|
url: '/api/v1/roles/role',
|
||||||
@@ -230,23 +230,25 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
table.reload('tables')
|
table.reload('tables');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.refresh = function() {
|
window.refresh = function() {
|
||||||
table.reload('tables')
|
table.reload('tables');
|
||||||
}
|
};
|
||||||
|
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
{% block title %}
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
<title>角色新增</title>
|
<title>角色新增</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -57,14 +59,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery'], function() {
|
layui.use(['form', 'jquery'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
|
|
||||||
form.on('submit(role-save)', function(data) {
|
form.on('submit(role-save)', function(data) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -76,16 +77,18 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.layui.table.reload('tables')
|
parent.layui.table.reload('tables');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
{% block title %}
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
<title>角色编辑</title>
|
<title>角色编辑</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -70,14 +71,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
{% block models_script %}
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
layui.use(['form', 'jquery'], function() {
|
layui.use(['form', 'jquery'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
|
|
||||||
form.on('submit(role-update)', function(data) {
|
form.on('submit(role-update)', function(data) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -89,16 +88,17 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.layui.table.reload('tables')
|
parent.layui.table.reload('tables');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
{% block title %}
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
<title>角色授权</title>
|
<title>角色授权</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -26,15 +28,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['dtree', 'form', 'jquery'], function() {
|
layui.use(['dtree', 'form', 'jquery'], function() {
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
|
|
||||||
dtree.render({
|
dtree.render({
|
||||||
elem: '#role-power',
|
elem: '#role-power',
|
||||||
@@ -46,18 +47,18 @@
|
|||||||
initLevel: '1',
|
initLevel: '1',
|
||||||
checkbarType: 'self',
|
checkbarType: 'self',
|
||||||
response: {treeId: 'powerId', parentId: 'parentId', title: 'powerName'},
|
response: {treeId: 'powerId', parentId: 'parentId', title: 'powerName'},
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(power-save)', function(data) {
|
form.on('submit(power-save)', function(data) {
|
||||||
let param = dtree.getCheckbarNodesParam('role-power')
|
let param = dtree.getCheckbarNodesParam('role-power');
|
||||||
let ids = ''
|
let ids = '';
|
||||||
for (let i = 0; i < param.length; i++) {
|
for (let i = 0; i < param.length; i++) {
|
||||||
let id = param[i].nodeId
|
let id = param[i].nodeId;
|
||||||
ids += id + ','
|
ids += id + ',';
|
||||||
}
|
}
|
||||||
ids = ids.substr(0, ids.length - 1)
|
ids = ids.substr(0, ids.length - 1);
|
||||||
data.field.roleId = {{role_id}};
|
data.field.roleId = {{role_id}};
|
||||||
data.field.powerIds = ids
|
data.field.powerIds = ids;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/roles/role_power/' + data.field.roleId,
|
url: '/api/v1/roles/role_power/' + data.field.roleId,
|
||||||
@@ -67,16 +68,17 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>个人中心</title>
|
<title>个人中心</title>
|
||||||
<style>
|
<style>
|
||||||
.layui-form-item {
|
.layui-form-item {
|
||||||
@@ -8,10 +8,10 @@
|
|||||||
margin-bottom: 17px !important;
|
margin-bottom: 17px !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
<div class="layui-row layui-col-space10">
|
<div class="layui-row layui-col-space10">
|
||||||
{# 左侧栏 #}
|
{# 左侧栏 #}
|
||||||
<div class="layui-col-md3">
|
<div class="layui-col-md3">
|
||||||
@@ -184,7 +184,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form id="edit_password_view" class="layui-form" action="" style="display: none">
|
<form id="edit_password_view" class="layui-form" action="" style="display: none">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -235,15 +234,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['element', 'jquery', 'layer', 'form', 'popup'], function() {
|
layui.use(['element', 'jquery', 'layer', 'form', 'popup'], function() {
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let layer = layui.layer
|
let layer = layui.layer;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
|
|
||||||
// 修改密码页面
|
// 修改密码页面
|
||||||
$('.edit-password').click(function() {
|
$('.edit-password').click(function() {
|
||||||
@@ -253,9 +251,9 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['550px', '280px'],
|
area: ['550px', '280px'],
|
||||||
content: $('#edit_password_view'),
|
content: $('#edit_password_view'),
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
// 修改头像
|
// 修改头像
|
||||||
$('#avatar').click(function() {
|
$('#avatar').click(function() {
|
||||||
@@ -267,10 +265,10 @@
|
|||||||
content: '/users/avatar',
|
content: '/users/avatar',
|
||||||
btn: ['确定', '取消'],
|
btn: ['确定', '取消'],
|
||||||
yes: function(index, layero) {
|
yes: function(index, layero) {
|
||||||
window['layui-layer-iframe' + index].submitForm()
|
window['layui-layer-iframe' + index].submitForm();
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
// 表单提交更改个人信息数据
|
// 表单提交更改个人信息数据
|
||||||
form.on('submit(user-update)', function(data) {
|
form.on('submit(user-update)', function(data) {
|
||||||
@@ -282,14 +280,14 @@
|
|||||||
type: 'put',
|
type: 'put',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg('修改成功', { icon: 1, time: 1000 })
|
layer.msg('修改成功', {icon: 1, time: 1000});
|
||||||
} else {
|
} else {
|
||||||
layer.msg('修改失败', { icon: 2, time: 1000 })
|
layer.msg('修改失败', {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
// 修改密码提交
|
// 修改密码提交
|
||||||
form.on('submit(edit-password)', function(data) {
|
form.on('submit(edit-password)', function(data) {
|
||||||
@@ -303,15 +301,16 @@
|
|||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
// TODO 关闭修改密码成之后的窗口
|
// TODO 关闭修改密码成之后的窗口
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>头像上传</title>
|
<title>头像上传</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<div class="layui-row layui-col-space15">
|
<div class="layui-row layui-col-space15">
|
||||||
<div class="layui-col-xs9">
|
<div class="layui-col-xs9">
|
||||||
<div style="height:325px;background-color: rgb(247, 247, 247);">
|
<div style="height:325px;background-color: rgb(247, 247, 247);">
|
||||||
@@ -34,38 +34,37 @@
|
|||||||
<input type="text" hidden value="{{ current_user.id }}" id="user_id">
|
<input type="text" hidden value="{{ current_user.id }}" id="user_id">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block models_script %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['jquery', 'layer', 'cropper', 'popup'], function() {
|
layui.use(['jquery', 'layer', 'cropper', 'popup'], function() {
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let layer = layui.layer
|
let layer = layui.layer;
|
||||||
let cropper = layui.cropper
|
let cropper = layui.cropper;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
|
|
||||||
let options = {
|
let options = {
|
||||||
aspectRatio: 1 / 1, // 裁剪框比例
|
aspectRatio: 1 / 1, // 裁剪框比例
|
||||||
preview: '#previewImage', // 预览div
|
preview: '#previewImage', // 预览div
|
||||||
viewmode: 1,
|
viewmode: 1,
|
||||||
}
|
};
|
||||||
|
|
||||||
$('#sourceImage').attr('src', parent.layui.$('#avatar').attr('src'))
|
$('#sourceImage').attr('src', parent.layui.$('#avatar').attr('src'));
|
||||||
$('#sourceImage').cropper(options)
|
$('#sourceImage').cropper(options);
|
||||||
|
|
||||||
window.submitForm = function() {
|
window.submitForm = function() {
|
||||||
$('#sourceImage').crossOrigin = 'anonymous'//解决跨域图片问题
|
$('#sourceImage').crossOrigin = 'anonymous';//解决跨域图片问题
|
||||||
$('#sourceImage').cropper('getCroppedCanvas', {
|
$('#sourceImage').cropper('getCroppedCanvas', {
|
||||||
width: 280,
|
width: 280,
|
||||||
height: 140,
|
height: 140,
|
||||||
}).toBlob(function(blob) {
|
}).toBlob(function(blob) {
|
||||||
let timeStamp = Date.parse(new Date())
|
let timeStamp = Date.parse(new Date());
|
||||||
let fileName = timeStamp + '.jpg'
|
let fileName = timeStamp + '.jpg';
|
||||||
let formData = new FormData()
|
let formData = new FormData();
|
||||||
formData.append('file', blob, fileName)
|
formData.append('file', blob, fileName);
|
||||||
formData.append('fileName', fileName)
|
formData.append('fileName', fileName);
|
||||||
formData.append('fileToken', timeStamp)
|
formData.append('fileToken', timeStamp);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: 'post',
|
method: 'post',
|
||||||
url: '/api/v1/file/photos', //用于文件上传的服务器端请求地址
|
url: '/api/v1/file/photos', //用于文件上传的服务器端请求地址
|
||||||
@@ -84,44 +83,45 @@
|
|||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// 关闭当前弹层
|
// 关闭当前弹层
|
||||||
parent.layui.$('#avatar').attr('src', result.data.src)
|
parent.layui.$('#avatar').attr('src', result.data.src);
|
||||||
top.layui.$('#avatar').attr('src', result.data.src)
|
top.layui.$('#avatar').attr('src', result.data.src);
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))
|
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||||
} else {
|
} else {
|
||||||
popup.failure('上传失败')
|
popup.failure('上传失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure('上传失败')
|
popup.failure('上传失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
$('.pear-btn').on('click', function() {
|
$('.pear-btn').on('click', function() {
|
||||||
let event = $(this).attr('cropper-event')
|
let event = $(this).attr('cropper-event');
|
||||||
if (event === 'rotate') {
|
if (event === 'rotate') {
|
||||||
let option = $(this).attr('data-option')
|
let option = $(this).attr('data-option');
|
||||||
$('#sourceImage').cropper('rotate', option)
|
$('#sourceImage').cropper('rotate', option);
|
||||||
} else if (event === 'reset') {
|
} else if (event === 'reset') {
|
||||||
$('#sourceImage').cropper('reset')
|
$('#sourceImage').cropper('reset');
|
||||||
}
|
}
|
||||||
$('#uploadPicture').change(function() {
|
$('#uploadPicture').change(function() {
|
||||||
let r = new FileReader()
|
let r = new FileReader();
|
||||||
let f = this.files[0]
|
let f = this.files[0];
|
||||||
let uploadFileSize = f.size / 1024
|
let uploadFileSize = f.size / 1024;
|
||||||
if (uploadFileSize > 5120) {
|
if (uploadFileSize > 5120) {
|
||||||
parent.layer.msg('上传文件不得超过5m', { icon: 5 })
|
parent.layer.msg('上传文件不得超过5m', {icon: 5});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
r.readAsDataURL(f)
|
r.readAsDataURL(f);
|
||||||
r.onload = function(e) {
|
r.onload = function(e) {
|
||||||
$('#sourceImage').cropper('destroy').attr('src', this.result).cropper(options)
|
$('#sourceImage').cropper('destroy').attr('src', this.result).cropper(options);
|
||||||
}
|
};
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
|
<html lang="zh-CN">
|
||||||
{% block title %}
|
<head>
|
||||||
<title>用户管理</title>
|
<title>用户管理</title>
|
||||||
|
{% include 'admin/common/header.html' %}
|
||||||
<link rel="stylesheet" href="/static/admin/admin/css/other/user.css"/>
|
<link rel="stylesheet" href="/static/admin/admin/css/other/user.css"/>
|
||||||
{% endblock %}
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
|
|
||||||
|
|
||||||
{% block body %}
|
|
||||||
{# 查询表单 #}
|
{# 查询表单 #}
|
||||||
<div class="layui-card">
|
<div class="layui-card">
|
||||||
<div class="layui-card-body">
|
<div class="layui-card-body">
|
||||||
@@ -51,9 +52,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
{# 表格操作 #}
|
{# 表格操作 #}
|
||||||
<script type="text/html" id="toolbar">
|
<script type="text/html" id="toolbar">
|
||||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||||
@@ -92,15 +93,14 @@
|
|||||||
<script type="text/html" id="user-updateTime">
|
<script type="text/html" id="user-updateTime">
|
||||||
{{ ' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
{{ ' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['table', 'dtree', 'form', 'jquery', 'popup', 'common'], function() {
|
layui.use(['table', 'dtree', 'form', 'jquery', 'popup', 'common'], function() {
|
||||||
let table = layui.table
|
let table = layui.table;
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
let common = layui.common
|
let common = layui.common;
|
||||||
|
|
||||||
// 表格数据
|
// 表格数据
|
||||||
const get_columns = () => [
|
const get_columns = () => [
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
{title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center'},
|
{title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center'},
|
||||||
{title: '操作', toolbar: '#tool', align: 'center', width: 130},
|
{title: '操作', toolbar: '#tool', align: 'center', width: 130},
|
||||||
],
|
],
|
||||||
]
|
];
|
||||||
|
|
||||||
// 渲染表格数据
|
// 渲染表格数据
|
||||||
table.render({
|
table.render({
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
toolbar: '#toolbar', /*工具栏*/
|
toolbar: '#toolbar', /*工具栏*/
|
||||||
text: {none: '暂无人员信息'},
|
text: {none: '暂无人员信息'},
|
||||||
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'], /*默认工具栏*/
|
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'], /*默认工具栏*/
|
||||||
})
|
});
|
||||||
|
|
||||||
// 公司部门树状图菜单
|
// 公司部门树状图菜单
|
||||||
dtree.render({
|
dtree.render({
|
||||||
@@ -140,70 +140,70 @@
|
|||||||
skin: 'laySimple',
|
skin: 'laySimple',
|
||||||
icon: '-1',
|
icon: '-1',
|
||||||
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
||||||
})
|
});
|
||||||
|
|
||||||
// 菜单栏渲染
|
// 菜单栏渲染
|
||||||
dtree.on('node(\'dept-tree\')', function(obj) {
|
dtree.on('node(\'dept-tree\')', function(obj) {
|
||||||
let field = form.val('user-query-form') /*用户账号查询*/
|
let field = form.val('user-query-form'); /*用户账号查询*/
|
||||||
field.deptId = obj.param.nodeId
|
field.deptId = obj.param.nodeId;
|
||||||
window.refresh(field)
|
window.refresh(field);
|
||||||
})
|
});
|
||||||
|
|
||||||
//
|
//
|
||||||
$('.user-group').click(function() {
|
$('.user-group').click(function() {
|
||||||
let group = $(this).attr('user-group')
|
let group = $(this).attr('user-group');
|
||||||
let field = form.val('user-query-form')
|
let field = form.val('user-query-form');
|
||||||
if (group === '-1') {
|
if (group === '-1') {
|
||||||
field.deptId = group
|
field.deptId = group;
|
||||||
$(this).removeClass('button-default')
|
$(this).removeClass('button-default');
|
||||||
$(this).prev().removeClass('button-primary')
|
$(this).prev().removeClass('button-primary');
|
||||||
$(this).prev().addClass('button-default')
|
$(this).prev().addClass('button-default');
|
||||||
$(this).addClass('button-primary')
|
$(this).addClass('button-primary');
|
||||||
} else {
|
} else {
|
||||||
field.deptId = group
|
field.deptId = group;
|
||||||
$(this).removeClass('button-default')
|
$(this).removeClass('button-default');
|
||||||
$(this).next().removeClass('button-primary')
|
$(this).next().removeClass('button-primary');
|
||||||
$(this).next().addClass('button-default')
|
$(this).next().addClass('button-default');
|
||||||
$(this).addClass('button-primary')
|
$(this).addClass('button-primary');
|
||||||
}
|
}
|
||||||
window.refresh(field)
|
window.refresh(field);
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('tool(tables)', function(obj) {
|
table.on('tool(tables)', function(obj) {
|
||||||
if (obj.event === 'tool-remove') {
|
if (obj.event === 'tool-remove') {
|
||||||
window.tool_remove(obj)
|
window.tool_remove(obj);
|
||||||
} else if (obj.event === 'tool-edit') {
|
} else if (obj.event === 'tool-edit') {
|
||||||
window.tool_edit(obj)
|
window.tool_edit(obj);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
table.on('toolbar(tables)', function(obj) {
|
table.on('toolbar(tables)', function(obj) {
|
||||||
if (obj.event === 'toolbar-add') {
|
if (obj.event === 'toolbar-add') {
|
||||||
window.toolbar_add()
|
window.toolbar_add();
|
||||||
} else if (obj.event === 'refresh') {
|
} else if (obj.event === 'refresh') {
|
||||||
window.refresh()
|
window.refresh();
|
||||||
} else if (obj.event === 'toolbar-remove') {
|
} else if (obj.event === 'toolbar-remove') {
|
||||||
window.toolbar_remove(obj)
|
window.toolbar_remove(obj);
|
||||||
} else if (obj.event === 'toolbar-collasped') {
|
} else if (obj.event === 'toolbar-collasped') {
|
||||||
$('.user-left').toggleClass('user-collasped')
|
$('.user-left').toggleClass('user-collasped');
|
||||||
$('.user-main').toggleClass('user-collasped')
|
$('.user-main').toggleClass('user-collasped');
|
||||||
table.resize()
|
table.resize();
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(user-query)', function(data) {
|
form.on('submit(user-query)', function(data) {
|
||||||
window.refresh(data.field)
|
window.refresh(data.field);
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('switch(tool-switch)', function(obj) {
|
form.on('switch(tool-switch)', function(obj) {
|
||||||
let operate
|
let operate;
|
||||||
if (obj.elem.checked) {
|
if (obj.elem.checked) {
|
||||||
operate = 1
|
operate = 1;
|
||||||
} else {
|
} else {
|
||||||
operate = 0
|
operate = 0;
|
||||||
}
|
}
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/users/user/' + this.value + '/status',
|
url: '/api/v1/users/user/' + this.value + '/status',
|
||||||
data: JSON.stringify({operate: operate, userId: this.value}),
|
data: JSON.stringify({operate: operate, userId: this.value}),
|
||||||
@@ -211,15 +211,15 @@
|
|||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'put',
|
type: 'put',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message)
|
popup.success(result.message);
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
window.toolbar_add = function() {
|
window.toolbar_add = function() {
|
||||||
layer.open({
|
layer.open({
|
||||||
@@ -228,32 +228,32 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['550px', '550px'],
|
area: ['550px', '550px'],
|
||||||
content: '/users/add',
|
content: '/users/add',
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
window.toolbar_remove = function(obj) {
|
window.toolbar_remove = function(obj) {
|
||||||
let data = table.checkStatus(obj.config.id).data
|
let data = table.checkStatus(obj.config.id).data;
|
||||||
if (data.length === 0) {
|
if (data.length === 0) {
|
||||||
layer.msg('未选中数据', {
|
layer.msg('未选中数据', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
time: 1000,
|
time: 1000,
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
}
|
}
|
||||||
var ids = []
|
var ids = [];
|
||||||
var hasCheck = table.checkStatus('tables')
|
var hasCheck = table.checkStatus('tables');
|
||||||
var hasCheckData = hasCheck.data
|
var hasCheckData = hasCheck.data;
|
||||||
if (hasCheckData.length > 0) {
|
if (hasCheckData.length > 0) {
|
||||||
$.each(hasCheckData, function(index, element) {
|
$.each(hasCheckData, function(index, element) {
|
||||||
ids.push(element.id)
|
ids.push(element.id);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
{#console.log(ids);#}
|
{#console.log(ids);#}
|
||||||
layer.confirm('确定要删除选中角色', {
|
layer.confirm('确定要删除选中角色', {
|
||||||
icon: 3,
|
icon: 3,
|
||||||
title: '提示',
|
title: '提示',
|
||||||
}, function(index) {
|
}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
||||||
url: '/api/v1/users/user',
|
url: '/api/v1/users/user',
|
||||||
@@ -261,44 +261,44 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
table.reload('role-table')
|
table.reload('role-table');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
window.refresh = function(param) {
|
window.refresh = function(param) {
|
||||||
table.reload('tables', { where: param })
|
table.reload('tables', {where: param});
|
||||||
}
|
};
|
||||||
|
|
||||||
window.tool_remove = function(obj) {
|
window.tool_remove = function(obj) {
|
||||||
layer.confirm('确定要删除该用户', {icon: 3, title: '提示'}, function(index) {
|
layer.confirm('确定要删除该用户', {icon: 3, title: '提示'}, function(index) {
|
||||||
layer.close(index)
|
layer.close(index);
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/users/user/' + obj.data['id'],
|
url: '/api/v1/users/user/' + obj.data['id'],
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
type: 'delete',
|
type: 'delete',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
obj.del()
|
obj.del();
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message)
|
popup.failure(result.message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
window.tool_edit = function(obj) {
|
window.tool_edit = function(obj) {
|
||||||
layer.open({
|
layer.open({
|
||||||
type: 2,
|
type: 2,
|
||||||
@@ -306,9 +306,10 @@
|
|||||||
shade: 0.1,
|
shade: 0.1,
|
||||||
area: ['550px', '500px'],
|
area: ['550px', '500px'],
|
||||||
content: '/users/' + obj.data['id'],
|
content: '/users/' + obj.data['id'],
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
{% block title %}
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
<title>用户管理</title>
|
<title>用户管理</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
{% block body %}
|
<body class="pear-container">
|
||||||
<form class="layui-form">
|
<form class="layui-form">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -59,21 +60,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
layui.use(['form', 'jquery'], function() {
|
layui.use(['form', 'jquery'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
form.on('submit(user-save)', function(data) {
|
form.on('submit(user-save)', function(data) {
|
||||||
let roleIds = ''
|
let roleIds = '';
|
||||||
$('input[type=checkbox]:checked').each(function() {
|
$('input[type=checkbox]:checked').each(function() {
|
||||||
roleIds += $(this).val() + ','
|
roleIds += $(this).val() + ',';
|
||||||
})
|
});
|
||||||
roleIds = roleIds.substr(0, roleIds.length - 1)
|
roleIds = roleIds.substr(0, roleIds.length - 1);
|
||||||
data.field.roleIds = roleIds
|
data.field.roleIds = roleIds;
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/users/user',
|
url: '/api/v1/users/user',
|
||||||
@@ -84,16 +85,17 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
|
||||||
parent.layui.table.reload('tables')
|
parent.layui.table.reload('tables');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
{% extends 'admin/base.html' %}
|
<!doctype html>
|
||||||
{% block title %}
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
<title>用户编辑</title>
|
<title>用户编辑</title>
|
||||||
{% endblock %}
|
{% include 'admin/common/header.html' %}
|
||||||
|
</head>
|
||||||
|
<body class="pear-container">
|
||||||
{% block body %}
|
|
||||||
<form class="layui-form" action="">
|
<form class="layui-form" action="">
|
||||||
<div class="mainBox">
|
<div class="mainBox">
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
@@ -68,14 +68,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block models_script %}
|
|
||||||
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery', 'dtree'], function() {
|
layui.use(['form', 'jquery', 'dtree'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let dtree = layui.dtree
|
let dtree = layui.dtree;
|
||||||
|
|
||||||
dtree.renderSelect({
|
dtree.renderSelect({
|
||||||
elem: '#selectParent',
|
elem: '#selectParent',
|
||||||
@@ -86,15 +86,15 @@
|
|||||||
dataFormat: 'list',
|
dataFormat: 'list',
|
||||||
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
||||||
selectInitVal: "{{ user.dept_id }}",
|
selectInitVal: "{{ user.dept_id }}",
|
||||||
})
|
});
|
||||||
|
|
||||||
form.on('submit(user-update)', function(data) {
|
form.on('submit(user-update)', function(data) {
|
||||||
let roleIds = ''
|
let roleIds = '';
|
||||||
$('input[type=checkbox]:checked').each(function() {
|
$('input[type=checkbox]:checked').each(function() {
|
||||||
roleIds += $(this).val() + ','
|
roleIds += $(this).val() + ',';
|
||||||
})
|
});
|
||||||
roleIds = roleIds.substr(0, roleIds.length - 1)
|
roleIds = roleIds.substr(0, roleIds.length - 1);
|
||||||
data.field.roleIds = roleIds
|
data.field.roleIds = roleIds;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/users/user/' + data.field.userId + '/role',
|
url: '/api/v1/users/user/' + data.field.userId + '/role',
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
@@ -104,16 +104,17 @@
|
|||||||
success: function(result) {
|
success: function(result) {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||||
parent.layer.close(parent.layer.getFrameIndex(window.name)) //关闭当前页
|
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
|
||||||
parent.layui.table.reload('tables')
|
parent.layui.table.reload('tables');
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
layer.msg(result.message, { icon: 2, time: 1000 })
|
layer.msg(result.message, {icon: 2, time: 1000});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
@@ -80,42 +80,42 @@
|
|||||||
{% include 'admin/common/footer.html' %}
|
{% include 'admin/common/footer.html' %}
|
||||||
<script>
|
<script>
|
||||||
layui.use(['admin', 'jquery', 'layer', 'popup'], function() {
|
layui.use(['admin', 'jquery', 'layer', 'popup'], function() {
|
||||||
let admin = layui.admin
|
let admin = layui.admin;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let layer = layui.layer
|
let layer = layui.layer;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
let MODULE_PATH = '/api/v1/rights/'
|
let MODULE_PATH = '/api/v1/rights/';
|
||||||
|
|
||||||
// 框架初始化时会读取 根目录下 pear.configs.yml 文件作为初始化配置
|
// 框架初始化时会读取 根目录下 pear.configs.yml 文件作为初始化配置
|
||||||
// 你可以通过 admin.setConfigPath 方法修改配置文件位置
|
// 你可以通过 admin.setConfigPath 方法修改配置文件位置
|
||||||
// 你可以通过 admin.setConfigType 方法修改配置文件类型
|
// 你可以通过 admin.setConfigType 方法修改配置文件类型
|
||||||
admin.setConfigType('json')
|
admin.setConfigType('json');
|
||||||
admin.setConfigPath(MODULE_PATH + 'configs')
|
admin.setConfigPath(MODULE_PATH + 'configs');
|
||||||
|
|
||||||
admin.render()
|
admin.render();
|
||||||
|
|
||||||
// 注销实现
|
// 注销实现
|
||||||
admin.logout(function() {
|
admin.logout(function() {
|
||||||
let loading = layer.load()
|
let loading = layer.load();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/passport/logout',
|
url: '/passport/logout',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loading)
|
layer.close(loading);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
location.href = '/admin'
|
location.href = '/admin';
|
||||||
})
|
});
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
// 初始化消息事件
|
// 初始化消息事件
|
||||||
admin.message()
|
admin.message();
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>pear-admin-flask</title>
|
<title>pear-admin-flask</title>
|
||||||
@@ -155,11 +155,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
layui.use(['layer', 'form', 'jquery'], function() {
|
layui.use(['layer', 'form', 'jquery'], function() {
|
||||||
var $ = layui.jquery
|
var $ = layui.jquery;
|
||||||
var layer = layui.layer
|
var layer = layui.layer;
|
||||||
var form = layui.form
|
var form = layui.form;
|
||||||
var jquery = layui.jquery
|
var jquery = layui.jquery;
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+28
-26
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>登录</title>
|
<title>登录</title>
|
||||||
@@ -37,20 +37,22 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% include 'admin/common/footer.html' %}
|
|
||||||
|
<script src="/static/admin/component/layui/layui.js"></script>
|
||||||
|
<script src="/static/admin/component/pear/pear.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['form', 'jquery', 'layer', 'button', 'popup'], function() {
|
layui.use(['form', 'jquery', 'layer', 'button', 'popup'], function() {
|
||||||
let form = layui.form
|
let form = layui.form;
|
||||||
let $ = layui.jquery
|
let $ = layui.jquery;
|
||||||
let layer = layui.layer
|
let layer = layui.layer;
|
||||||
let button = layui.button
|
let button = layui.button;
|
||||||
let popup = layui.popup
|
let popup = layui.popup;
|
||||||
let captchaPath = '/passport/getCaptcha'
|
let captchaPath = '/passport/getCaptcha';
|
||||||
|
|
||||||
form.on('submit(login)', function(data) {
|
form.on('submit(login)', function(data) {
|
||||||
// data 是表单的数据
|
// data 是表单的数据
|
||||||
let loader = layer.load() // 加载按钮
|
let loader = layer.load(); // 加载按钮
|
||||||
let btn = button.load({ elem: '.login' })
|
let btn = button.load({elem: '.login'});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/api/v1/passport/login',
|
url: '/api/v1/passport/login',
|
||||||
data: JSON.stringify(data.field),
|
data: JSON.stringify(data.field),
|
||||||
@@ -59,37 +61,37 @@
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
// 请求成功之后返回的数据
|
// 请求成功之后返回的数据
|
||||||
success: function(result) {
|
success: function(result) {
|
||||||
layer.close(loader) // 关闭加载按钮
|
layer.close(loader); // 关闭加载按钮
|
||||||
btn.stop(function() {
|
btn.stop(function() {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
popup.success(result.message, function() {
|
popup.success(result.message, function() {
|
||||||
location.href = '/admin'
|
location.href = '/admin';
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
popup.failure(result.message, function() {
|
popup.failure(result.message, function() {
|
||||||
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random()
|
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
|
|
||||||
// 点击按钮更新验证码
|
// 点击按钮更新验证码
|
||||||
$('#captchaImage').click(function() {
|
$('#captchaImage').click(function() {
|
||||||
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random()
|
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random();
|
||||||
})
|
});
|
||||||
|
|
||||||
// 定时器,定时更新验证码
|
// 定时器,定时更新验证码
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random()
|
document.getElementById('captchaImage').src = captchaPath + '?' + Math.random();
|
||||||
}, 30 * 1000)
|
}, 30 * 1000);
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
if (window !== top) {
|
if (window !== top) {
|
||||||
top.location.href = location.href
|
top.location.href = location.href;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<title>首页</title>
|
<title>首页</title>
|
||||||
{% include 'admin/common/header.html' %}
|
<meta charset="utf-8">
|
||||||
|
<meta name="renderer" content="webkit">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<link rel="stylesheet" href="/static/admin/component/pear/css/pear.css"/>
|
||||||
<link rel="stylesheet" href="/static/admin/admin/css/other/console1.css"/>
|
<link rel="stylesheet" href="/static/admin/admin/css/other/console1.css"/>
|
||||||
|
|
||||||
<!-- 主 题 更 换 -->
|
<!-- 主 题 更 换 -->
|
||||||
@@ -290,82 +294,85 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--</div>-->
|
<script src="/static/admin/component/layui/layui.js"></script>
|
||||||
{% include 'admin/common/footer.html' %}
|
<script src="/static/admin/component/pear/pear.js"></script>
|
||||||
<script>
|
<script>
|
||||||
layui.use(['layer', 'echarts', 'element', 'count'], function() {
|
layui.use(['layer', 'echarts', 'element', 'count'], function() {
|
||||||
var $ = layui.jquery,
|
var $ = layui.jquery,
|
||||||
layer = layui.layer,
|
layer = layui.layer,
|
||||||
element = layui.element,
|
element = layui.element,
|
||||||
count = layui.count,
|
count = layui.count,
|
||||||
echarts = layui.echarts
|
echarts = layui.echarts;
|
||||||
|
|
||||||
count.up('value1', {
|
count.up('value1', {
|
||||||
time: 4000,
|
time: 4000,
|
||||||
num: 440.34,
|
num: 440.34,
|
||||||
bit: 2,
|
bit: 2,
|
||||||
regulator: 50
|
regulator: 50,
|
||||||
})
|
});
|
||||||
|
|
||||||
count.up('value2', {
|
count.up('value2', {
|
||||||
time: 4000,
|
time: 4000,
|
||||||
num: 236.30,
|
num: 236.30,
|
||||||
bit: 2,
|
bit: 2,
|
||||||
regulator: 50
|
regulator: 50,
|
||||||
})
|
});
|
||||||
|
|
||||||
count.up('value3', {
|
count.up('value3', {
|
||||||
time: 4000,
|
time: 4000,
|
||||||
num: 634.43,
|
num: 634.43,
|
||||||
bit: 2,
|
bit: 2,
|
||||||
regulator: 50
|
regulator: 50,
|
||||||
})
|
});
|
||||||
|
|
||||||
count.up('value4', {
|
count.up('value4', {
|
||||||
time: 4000,
|
time: 4000,
|
||||||
bit: 2,
|
bit: 2,
|
||||||
num: 373.23,
|
num: 373.23,
|
||||||
regulator: 50
|
regulator: 50,
|
||||||
})
|
});
|
||||||
|
|
||||||
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden')
|
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
|
||||||
|
|
||||||
var option = {
|
var option = {
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'axis'
|
trigger: 'axis',
|
||||||
},
|
},
|
||||||
xAxis: [{
|
xAxis: [
|
||||||
|
{
|
||||||
type: 'category',
|
type: 'category',
|
||||||
data: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06'],
|
data: ['2019-01', '2019-02', '2019-03', '2019-04', '2019-05', '2019-06'],
|
||||||
axisLine: {
|
axisLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: '#999'
|
color: '#999',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}],
|
}],
|
||||||
yAxis: [{
|
yAxis: [
|
||||||
|
{
|
||||||
type: 'value',
|
type: 'value',
|
||||||
splitNumber: 4,
|
splitNumber: 4,
|
||||||
splitLine: {
|
splitLine: {
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
type: 'dashed',
|
type: 'dashed',
|
||||||
color: '#DDD'
|
color: '#DDD',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
axisLine: {
|
axisLine: {
|
||||||
show: false,
|
show: false,
|
||||||
lineStyle: {
|
lineStyle: {
|
||||||
color: '#333'
|
color: '#333',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
nameTextStyle: {
|
nameTextStyle: {
|
||||||
color: '#999'
|
color: '#999',
|
||||||
},
|
},
|
||||||
splitArea: {
|
splitArea: {
|
||||||
show: false
|
show: false,
|
||||||
}
|
},
|
||||||
}],
|
}],
|
||||||
series: [{
|
series: [
|
||||||
|
{
|
||||||
name: '课时',
|
name: '课时',
|
||||||
type: 'line',
|
type: 'line',
|
||||||
data: [23, 60, 20, 36, 23, 85],
|
data: [23, 60, 20, 36, 23, 85],
|
||||||
@@ -375,19 +382,20 @@
|
|||||||
color: {
|
color: {
|
||||||
type: 'linear',
|
type: 'linear',
|
||||||
|
|
||||||
colorStops: [{
|
colorStops: [
|
||||||
|
{
|
||||||
offset: 0,
|
offset: 0,
|
||||||
color: '#A9F387' // 0% 处的颜色
|
color: '#A9F387', // 0% 处的颜色
|
||||||
}, {
|
}, {
|
||||||
offset: 1,
|
offset: 1,
|
||||||
color: '#48D8BF' // 100% 处的颜色
|
color: '#48D8BF', // 100% 处的颜色
|
||||||
}],
|
}],
|
||||||
globalCoord: false // 缺省为 false
|
globalCoord: false, // 缺省为 false
|
||||||
},
|
},
|
||||||
shadowColor: 'rgba(72,216,191, 0.3)',
|
shadowColor: 'rgba(72,216,191, 0.3)',
|
||||||
shadowBlur: 10,
|
shadowBlur: 10,
|
||||||
shadowOffsetY: 20
|
shadowOffsetY: 20,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
normal: {
|
normal: {
|
||||||
@@ -395,19 +403,19 @@
|
|||||||
borderWidth: 10,
|
borderWidth: 10,
|
||||||
/*shadowColor: 'rgba(72,216,191, 0.3)',
|
/*shadowColor: 'rgba(72,216,191, 0.3)',
|
||||||
shadowBlur: 100,*/
|
shadowBlur: 100,*/
|
||||||
borderColor: '#A9F387'
|
borderColor: '#A9F387',
|
||||||
}
|
|
||||||
},
|
},
|
||||||
smooth: true
|
},
|
||||||
}]
|
smooth: true,
|
||||||
}
|
}],
|
||||||
echartsRecords.setOption(option)
|
};
|
||||||
|
echartsRecords.setOption(option);
|
||||||
|
|
||||||
window.onresize = function() {
|
window.onresize = function() {
|
||||||
echartsRecords.resize()
|
echartsRecords.resize();
|
||||||
}
|
};
|
||||||
|
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user