移除旧版本静态模板
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import typing as t
|
||||
|
||||
from flask import jsonify
|
||||
from flask.views import MethodView
|
||||
from flask_pydantic import validate
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from common.utils.http import success_api, fail_api
|
||||
from common.utils.http import success_api, fail_api, table_api
|
||||
from extensions import db
|
||||
from models import DepartmentModel, UserModel
|
||||
|
||||
@@ -39,26 +38,25 @@ class DepartmentsApi(MethodView):
|
||||
return dict(success=True, message='ok', dept=dept_data)
|
||||
|
||||
dept_data = DepartmentModel.query.order_by(DepartmentModel.sort).all()
|
||||
# TODO dtree 需要返回状态信息
|
||||
res = {
|
||||
"status": {"code": 200, "message": "默认"},
|
||||
"data": [
|
||||
{
|
||||
'deptId': item.id,
|
||||
'parentId': item.parent_id,
|
||||
'deptName': item.dept_name,
|
||||
'sort': item.sort,
|
||||
'leader': item.leader,
|
||||
'phone': item.phone,
|
||||
'email': item.email,
|
||||
'status': item.status,
|
||||
'comment': item.comment,
|
||||
'address': item.address,
|
||||
'create_at': item.create_at.strftime('%Y-%m-%d %H:%M:%S')
|
||||
} for item in dept_data
|
||||
]
|
||||
}
|
||||
return jsonify(res)
|
||||
return table_api(
|
||||
result={
|
||||
'items': [
|
||||
{
|
||||
'deptId': item.id,
|
||||
'parentId': item.parent_id,
|
||||
'deptName': item.dept_name,
|
||||
'sort': item.sort,
|
||||
'leader': item.leader,
|
||||
'phone': item.phone,
|
||||
'email': item.email,
|
||||
'status': item.status,
|
||||
'comment': item.comment,
|
||||
'address': item.address,
|
||||
'create_at': item.create_at.strftime('%Y-%m-%d %H:%M:%S')
|
||||
} for item in dept_data
|
||||
],
|
||||
'total': len(dept_data)}
|
||||
, code=0)
|
||||
|
||||
@validate()
|
||||
def post(self, body: DeptModel):
|
||||
|
||||
@@ -5,18 +5,11 @@ from common.utils.rights import permission_required, view_logging_required
|
||||
from applications.view import index_bp
|
||||
|
||||
|
||||
@index_bp.get('/dept')
|
||||
@view_logging_required
|
||||
@permission_required("admin:dept:main")
|
||||
def dept_index():
|
||||
return render_template('admin/department/dept.html')
|
||||
|
||||
|
||||
@index_bp.get('/dept/add')
|
||||
@view_logging_required
|
||||
@permission_required("admin:dept:add")
|
||||
def add():
|
||||
return render_template('admin/department/dept_add.html')
|
||||
return render_template('view/system/department_add.html')
|
||||
|
||||
|
||||
@index_bp.get('/dept/edit')
|
||||
@@ -25,4 +18,4 @@ def add():
|
||||
def edit():
|
||||
dept_id = request.args.get("deptId", type=int)
|
||||
dept = DepartmentModel.query.get(dept_id)
|
||||
return render_template('admin/department/dept_edit.html', dept=dept)
|
||||
return render_template('view/system/department_edit.html', dept=dept)
|
||||
|
||||
@@ -8,11 +8,11 @@ from common.utils.rights import view_logging_required, permission_required
|
||||
@view_logging_required
|
||||
@permission_required("admin:file:main")
|
||||
def file_index():
|
||||
return render_template('admin/file/photo.html')
|
||||
return render_template('view/system/photo.html')
|
||||
|
||||
|
||||
@index_bp.get('/file/photo/add')
|
||||
@view_logging_required
|
||||
@permission_required("admin:file:main")
|
||||
def file_photo_add():
|
||||
return render_template('admin/file/photo_add.html')
|
||||
return render_template('view/system/photo_add.html')
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from flask import Blueprint
|
||||
from flask import Blueprint, redirect, url_for
|
||||
from flask import send_file
|
||||
from flask import session, render_template
|
||||
from flask_login import current_user, logout_user, login_required
|
||||
|
||||
from common.gen_captcha import get_captcha_image
|
||||
|
||||
@@ -63,17 +64,16 @@ def get_captcha():
|
||||
|
||||
# 退出登录
|
||||
@index_bp.post('/logout')
|
||||
# @login_required
|
||||
@login_required
|
||||
def logout():
|
||||
# logout_user()
|
||||
# session.pop('permissions')
|
||||
logout_user()
|
||||
session.pop('permissions')
|
||||
print({"message": "注销成功", "success": True})
|
||||
return {"message": "注销成功", "success": True}
|
||||
|
||||
|
||||
@index_bp.get('/login')
|
||||
def login():
|
||||
# if current_user.is_authenticated:
|
||||
# return redirect(url_for('admin.index'))
|
||||
# TODO 分离视图操作 最终实现接口登录与视图登录两套逻辑
|
||||
if current_user.is_authenticated:
|
||||
return redirect(url_for('admin.index'))
|
||||
return render_template('login.html')
|
||||
|
||||
@@ -8,12 +8,6 @@ from models import LogModel
|
||||
logs_bp = Blueprint('logs', __name__, url_prefix='/logs')
|
||||
|
||||
|
||||
@logs_bp.get('/')
|
||||
@permission_required("admin:log:main")
|
||||
def index():
|
||||
return render_template('admin/logs_temp/main.html')
|
||||
|
||||
|
||||
@logs_bp.get('/login_log')
|
||||
@permission_required("admin:log:main")
|
||||
def login_log():
|
||||
|
||||
@@ -5,11 +5,11 @@ from models import RightModel
|
||||
from applications.view import index_bp
|
||||
|
||||
|
||||
@index_bp.get('/rights/')
|
||||
@view_logging_required
|
||||
@permission_required("admin:power:main")
|
||||
def rights_index():
|
||||
return render_template('admin/rights/rights.html')
|
||||
# @index_bp.get('/rights/')
|
||||
# @view_logging_required
|
||||
# @permission_required("admin:power:main")
|
||||
# def rights_index():
|
||||
# return render_template('admin/rights/rights.html')
|
||||
|
||||
|
||||
@index_bp.get('/rights/power/<int:power_id>')
|
||||
@@ -22,11 +22,11 @@ def rights_edit(power_id):
|
||||
icon = icon[1]
|
||||
else:
|
||||
icon = None
|
||||
return render_template('admin/rights/rights_edit.html', power=power, icon=icon)
|
||||
return render_template('view/system/power_edit.html', power=power, icon=icon)
|
||||
|
||||
|
||||
@index_bp.get('/rights/add')
|
||||
@view_logging_required
|
||||
@permission_required("admin:power:main")
|
||||
def rights_add():
|
||||
return render_template('admin/rights/rights_add.html')
|
||||
return render_template('view/system/power_add.html')
|
||||
|
||||
@@ -7,20 +7,12 @@ from models import RoleModel
|
||||
role_bp = Blueprint('role', __name__, url_prefix='/admin/role')
|
||||
|
||||
|
||||
# 角色而管理
|
||||
@role_bp.get('/')
|
||||
@view_logging_required
|
||||
@permission_required("admin:role:main")
|
||||
def main():
|
||||
return render_template('admin/roles/roles.html')
|
||||
|
||||
|
||||
# 角色授权操作
|
||||
@role_bp.get('/power/<int:role_id>')
|
||||
@view_logging_required
|
||||
@permission_required("admin:role:power")
|
||||
def power(role_id):
|
||||
return render_template('admin/roles/roles_power.html', role_id=role_id)
|
||||
return render_template('view/system/roles_power.html', role_id=role_id)
|
||||
|
||||
|
||||
# 角色编辑
|
||||
@@ -29,11 +21,11 @@ def power(role_id):
|
||||
@permission_required("admin:role:edit")
|
||||
def role_editor(role_id):
|
||||
role = RoleModel.query.filter_by(id=role_id).first()
|
||||
return render_template('admin/roles/roles_edit.html', role=role)
|
||||
return render_template('view/system/roles_edit.html', role=role)
|
||||
|
||||
|
||||
@role_bp.get('/add')
|
||||
@view_logging_required
|
||||
@permission_required("admin:role:edit")
|
||||
def role_add():
|
||||
return render_template('admin/roles/roles_add.html')
|
||||
return render_template('view/system/roles_add.html')
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
from flask import render_template
|
||||
from flask_login import login_required, current_user
|
||||
from sqlalchemy import desc
|
||||
|
||||
from common.utils.rights import permission_required, view_logging_required
|
||||
from models import LogModel, RoleModel, UserModel
|
||||
from models import RoleModel, UserModel
|
||||
from . import index_bp
|
||||
|
||||
|
||||
# 用户增加
|
||||
@index_bp.get('/users/')
|
||||
@view_logging_required
|
||||
@permission_required("admin:user:main")
|
||||
def users_main():
|
||||
return render_template('admin/users/users.html')
|
||||
|
||||
|
||||
@index_bp.get('/users/add')
|
||||
@view_logging_required
|
||||
@permission_required("admin:user:add")
|
||||
def users_add_view():
|
||||
roles = RoleModel.query.all()
|
||||
return render_template('admin/users/users_add.html', roles=roles)
|
||||
return render_template('view/system/user_add.html', roles=roles)
|
||||
|
||||
|
||||
@index_bp.get('/users/<user_id>')
|
||||
@@ -33,17 +23,4 @@ def users_user_id_view(user_id):
|
||||
checked_roles = []
|
||||
for r in user.role:
|
||||
checked_roles.append(r.id)
|
||||
return render_template('admin/users/users_edit.html', user=user, roles=roles, checked_roles=checked_roles)
|
||||
|
||||
|
||||
@index_bp.get('/users/center')
|
||||
@login_required
|
||||
def users_center():
|
||||
user_logs = LogModel.query.filter_by(url='/passport/login').filter_by(uid=current_user.id).order_by(
|
||||
desc(LogModel.create_at)).limit(10)
|
||||
return render_template('admin/users/profile.html', user_info=current_user, user_logs=user_logs)
|
||||
|
||||
|
||||
@index_bp.get('/users/avatar')
|
||||
def users_avatar_view():
|
||||
return render_template('admin/users/profile_avatar.html')
|
||||
return render_template('view/system/user_edit.html', user=user, roles=roles, checked_roles=checked_roles)
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<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"/>
|
||||
@@ -1,254 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>部门新增</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
<body class="pear-container">
|
||||
{#搜索框布局#}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">部门名称</label>
|
||||
<div class="layui-input-inline">
|
||||
{#部门信息搜索字段#}
|
||||
<input type="text" name="deptName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
{#查询按钮--需要触发layui事件#}
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="form_search">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
{#重置按钮#}
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
{#表格字段渲染#}
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{#表格工具栏,需要在表格中绑定,且需要自定义事件#}
|
||||
<script type="text/html" id="toolbar">
|
||||
{% if authorize("admin:dept:edit") %}
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if authorize("admin:dept:remove") %}
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
{% endif %}
|
||||
</script>
|
||||
{#操作字段,需要在表格中使用#}
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool_edit">
|
||||
<i class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool_remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
{#表格内的切换按钮#}
|
||||
<script type="text/html" id="dept-status">
|
||||
<input type="checkbox"
|
||||
name="status"
|
||||
value="{{ "{{ d.deptId }}" }}"
|
||||
lay-skin="switch"
|
||||
lay-text="启用|禁用"
|
||||
lay-filter="dept_enable"
|
||||
{{ "{{# if(d.status==1){ }} checked {{# } }}" }}>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'treetable', 'popup'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let treetable = layui.treetable;
|
||||
let popup = layui.popup;
|
||||
|
||||
let MODULE_PATH = '/dept/';
|
||||
const get_columns = () => [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{field: 'deptName', minWidth: 200, title: '部门名称'},
|
||||
{field: 'leader', title: '负责人'},
|
||||
{field: 'phone', title: '联系方式'},
|
||||
{field: 'email', title: '邮箱'},
|
||||
{field: 'address', title: '详细地址'},
|
||||
{field: 'status', title: '状态', templet: '#dept-status'},
|
||||
{field: 'sort', title: '排序', width: 100},
|
||||
{title: '操作', templet: '#tool', width: 120, align: 'center'},
|
||||
],
|
||||
];
|
||||
|
||||
{#定义表格渲染函数#}
|
||||
window.render = function() {
|
||||
/*树形表格渲染*/
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
treeIdName: 'deptId', /*表格的顶级字段*/
|
||||
treePidName: 'parentId', /*父级id选项*/
|
||||
skin: 'line',
|
||||
method: 'post', /**/
|
||||
treeDefaultClose: false,
|
||||
toolbar: '#toolbar', /*表格的工具栏*/
|
||||
elem: '#tables', /*表格挂载的对象*/
|
||||
url: '/api/v1/dept/department', /*数据来源接口*/
|
||||
page: false,
|
||||
cols: get_columns(),/*表格渲染的数据*/
|
||||
});
|
||||
};
|
||||
|
||||
/*查询表单按钮被点击的事件*/
|
||||
form.on('submit(form_search)', function(data) {
|
||||
let keyword = $.trim(data.field.deptName);
|
||||
/*获取所有的公司节点*/
|
||||
let $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td');
|
||||
if (!keyword) {
|
||||
$tds.css('background-color', 'transparent');
|
||||
layer.msg('请输入关键字', {icon: 5});
|
||||
return false;
|
||||
}
|
||||
/*本地查询并且标注高亮*/
|
||||
let searchCount = 0;
|
||||
$tds.each(function() {
|
||||
$(this).css('background-color', 'transparent');
|
||||
if ($(this).text().indexOf(keyword) >= 0) {
|
||||
$(this).css('background-color', 'rgba(250,230,160,0.5)');
|
||||
if (searchCount === 0) {
|
||||
$('body,html').stop(true);
|
||||
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
|
||||
}
|
||||
searchCount++;
|
||||
}
|
||||
});
|
||||
if (searchCount === 0) {
|
||||
layer.msg('没有匹配结果', {icon: 5});
|
||||
} else {
|
||||
treetable.expandAll('#tables');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
/*表格的操作栏*/
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool_remove') {
|
||||
/*移出事件*/
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool_edit') {
|
||||
/*编辑事件*/
|
||||
window.tool_edit(obj);
|
||||
}
|
||||
});
|
||||
|
||||
/*表格的工具栏*/
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
{#console.log(obj)#}
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
{#window.toolbar_remove(obj)#}
|
||||
layer.msg('禁止批量删除');
|
||||
return false;
|
||||
{#console.log(table.checkStatus(obj.config.id).data)#}
|
||||
}
|
||||
});
|
||||
|
||||
/*切换选择状态*/
|
||||
form.on('switch(dept_enable)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1;
|
||||
} else {
|
||||
operate = 0;
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/dept/department/' + this.value + '/status',
|
||||
data: JSON.stringify({deptId: this.value, operate: operate}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message);
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'], /*新增窗口的大小*/
|
||||
content: '/dept/add', /*新增窗口从那里来*/
|
||||
});
|
||||
};
|
||||
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId'], /*编辑修改窗口从那里来*/
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该部门', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/dept/department/' + obj.data['deptId'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>日志</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
<link rel="stylesheet" href="/static/admin/admin/css/other/console2.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-card">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">登录日志</li>
|
||||
<li>访问日志</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<table style="margin-top: 10px;" id="log-login-table" lay-filter="log-login-table"></table>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<table style="margin-top: 10px;" id="log-access-table"
|
||||
lay-filter="log-access-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="text/html" id="log-createTime">
|
||||
{{ ' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
<script type="text/html" id="log-status">
|
||||
{{ '{{#if (d.success == true) { }}
|
||||
<span style="color: green">成功</span>
|
||||
{{# }else if(d.success == false){ }}
|
||||
<span style="color: red">失败</span>
|
||||
{{# } }}'|safe }}
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'element', 'util'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
|
||||
let MODULE_PATH = '/logs/';
|
||||
|
||||
const get_columns = () => [
|
||||
[
|
||||
{title: 'ID', field: 'id', align: 'center'},
|
||||
{title: '请求方式', field: 'method', align: 'center'},
|
||||
{title: '接口', field: 'url', align: 'center'},
|
||||
{title: '浏览器', field: 'user_agent', align: 'center'},
|
||||
{title: '操作地址', field: 'ip', align: 'center'},
|
||||
{title: '访问时间', field: 'create_at', templet: '#log-createTime', align: 'center'},
|
||||
{title: '操作人ID', field: 'uid', align: 'center'},
|
||||
{title: '描述', field: 'desc', align: 'center'},
|
||||
{title: '访问状态', templet: '#log-status', align: 'center'},
|
||||
],
|
||||
];
|
||||
|
||||
table.render({
|
||||
parseData: parserTableData,
|
||||
elem: '#log-access-table',
|
||||
url: MODULE_PATH + 'access_log',
|
||||
page: true,
|
||||
cols: get_columns(),
|
||||
skin: 'line',
|
||||
toolbar: false,
|
||||
});
|
||||
|
||||
table.render({
|
||||
parseData: parserTableData,
|
||||
elem: '#log-login-table',
|
||||
url: MODULE_PATH + 'login_log',
|
||||
page: true,
|
||||
cols: get_columns(),
|
||||
skin: 'line',
|
||||
toolbar: false,
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,282 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>权限</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">权限名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="powerName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="power_query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool-edit"><i
|
||||
class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool-remove"><i
|
||||
class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'treetable', 'popup', 'dtree', 'iconPicker'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let treetable = layui.treetable;
|
||||
let popup = layui.popup;
|
||||
let iconPicker = layui.iconPicker;
|
||||
let dtree = layui.dtree;
|
||||
|
||||
const get_columns = () => [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{field: 'powerName', minWidth: 200, title: '权限名称'},
|
||||
{field: 'icon', title: '图标', templet: (d) => `<i class="layui-icon ${d.icon}"></i>`},
|
||||
{
|
||||
field: 'powerType', title: '权限类型', templet: (d) => {
|
||||
if (d.powerType === 0) {
|
||||
return `<span>目录</span>`;
|
||||
} else if (d.powerType === 1) {
|
||||
return `<span>菜单</span>`;
|
||||
} else if (d.powerType === 2) {
|
||||
return `<span>按钮</span>`;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'enable', title: '是否可用', templet: (d) => {
|
||||
// TODO 修改禁用启动逻辑
|
||||
return `<input type="checkbox" name="enable" value="${d.powerId}" lay-skin="switch" lay-text="启用|禁用" lay-filter="tool-switch" ${d.enable ===
|
||||
true ? 'checked=checked' : ''}>`;
|
||||
},
|
||||
},
|
||||
{field: 'sort', title: '排序'},
|
||||
{title: '操作', templet: '#tool', width: 150, align: 'center'},
|
||||
],
|
||||
];
|
||||
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
treeIdName: 'powerId',
|
||||
treePidName: 'parentId',
|
||||
skin: 'line',
|
||||
method: 'post',
|
||||
treeDefaultClose: true,
|
||||
toolbar: '#toolbar',
|
||||
elem: '#tables',
|
||||
url: '/api/v1/rights/rights',
|
||||
page: false,
|
||||
cols: get_columns(),
|
||||
});
|
||||
|
||||
form.on('submit(power_query)', function(data) {
|
||||
var keyword = data.field.powerName;
|
||||
var $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td');
|
||||
if (!keyword) {
|
||||
$tds.css('background-color', 'transparent');
|
||||
layer.msg('请输入关键字', {icon: 5});
|
||||
return;
|
||||
}
|
||||
var searchCount = 0;
|
||||
$tds.each(function() {
|
||||
$(this).css('background-color', 'transparent');
|
||||
if ($(this).text().indexOf(keyword) >= 0) {
|
||||
$(this).css('background-color', 'rgba(250,230,160,0.5)');
|
||||
if (searchCount === 0) {
|
||||
$('body,html').stop(true);
|
||||
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
|
||||
}
|
||||
searchCount++;
|
||||
}
|
||||
});
|
||||
if (searchCount === 0) {
|
||||
layer.msg('没有匹配结果', {icon: 5});
|
||||
} else {
|
||||
treetable.expandAll('#tables');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool-remove') {
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool-edit') {
|
||||
window.tool_edit(obj);
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
window.toolbar_remove(obj);
|
||||
}
|
||||
});
|
||||
|
||||
form.on('switch(tool-switch)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1; /*启用*/
|
||||
} else {
|
||||
operate = 0; /*禁用*/
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/power/' + this.value + '/status',
|
||||
data: JSON.stringify({powerId: this.value, operate: operate}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message);
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: '/rights/add',
|
||||
});
|
||||
};
|
||||
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: '/rights/power/' + obj.data['powerId'],
|
||||
});
|
||||
};
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该权限', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/power/' + obj.data['powerId'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
console.log(obj);
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.toolbar_remove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
var hasCheck = table.checkStatus('tables');
|
||||
var hasCheckData = hasCheck.data;
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function(index, element) {
|
||||
ids.push(element.id);
|
||||
});
|
||||
}
|
||||
layer.confirm('确定要删除选中权限', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/rights',
|
||||
data: {ids: ids},
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.msg, function() {
|
||||
console.log(obj);
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
iconPicker.render({
|
||||
// 选择器,推荐使用input
|
||||
elem: '#add_icon',
|
||||
// 数据类型:fontClass/unicode,推荐使用fontClass
|
||||
type: 'fontClass',
|
||||
// 是否开启搜索:true/false
|
||||
search: true,
|
||||
// 是否开启分页
|
||||
page: true,
|
||||
// 每页显示数量,默认12
|
||||
limit: 12,
|
||||
// 点击回调
|
||||
click: function(data) {
|
||||
console.log(data);
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,254 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>角色管理</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="roleName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<label class="layui-form-label">角色标识</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="roleCode" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="role-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool-edit"><i
|
||||
class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="tool-power"><i
|
||||
class="layui-icon layui-icon-vercode"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool-remove"><i
|
||||
class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/html" id="tool-switch">
|
||||
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="tool-switch" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'popup', 'common'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let popup = layui.popup;
|
||||
|
||||
const get_columns = () => [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{title: '角色名', field: 'roleName', align: 'center', width: 100},
|
||||
{title: 'Key值', field: 'roleCode', align: 'center'},
|
||||
{title: '描述', field: 'details', align: 'center'},
|
||||
{title: '是否可用', field: 'enable', align: 'center', templet: '#tool-switch'},
|
||||
{title: '排序', field: 'sort', align: 'center'},
|
||||
{title: '操作', toolbar: '#tool', align: 'center', width: 195},
|
||||
],
|
||||
];
|
||||
|
||||
table.render({
|
||||
parseData: parserTableData,
|
||||
elem: '#tables',
|
||||
url: '/api/v1/roles/role',
|
||||
page: true,
|
||||
cols: get_columns(),
|
||||
skin: 'line',
|
||||
toolbar: '#toolbar',
|
||||
defaultToolbar: [
|
||||
{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports'],
|
||||
});
|
||||
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool-remove') {
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool-edit') {
|
||||
window.tool_edit(obj);
|
||||
} else if (obj.event === 'tool-power') {
|
||||
window.tool_power(obj);
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
window.toolbar_remove(obj);
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(role-query)', function(data) {
|
||||
table.reload('tables', {where: data.field});
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('switch(tool-switch)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1;
|
||||
} else {
|
||||
operate = 0;
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/roles/role/' + this.value + '/status',
|
||||
data: JSON.stringify({roleId: this.value, operate: operate}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.message, {icon: 1, time: 1000});
|
||||
} else {
|
||||
layer.msg(result.message, {icon: 2, time: 1000});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['500px', '500px'],
|
||||
content: '/admin/role/add',
|
||||
});
|
||||
};
|
||||
|
||||
window.tool_power = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '授权',
|
||||
shade: 0.1,
|
||||
area: ['320px', '400px'],
|
||||
content: '/admin/role/power/' + obj.data['id'],
|
||||
});
|
||||
};
|
||||
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['500px', '500px'],
|
||||
content: '/admin/role/edit/' + obj.data['id'],
|
||||
});
|
||||
};
|
||||
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该角色', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/roles/role_power/' + obj.data['id'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.message, {icon: 2, time: 1000});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.toolbar_remove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
var hasCheck = table.checkStatus('tables');
|
||||
var hasCheckData = hasCheck.data;
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function(index, element) {
|
||||
ids.push(element.id);
|
||||
});
|
||||
}
|
||||
console.log(ids);
|
||||
layer.confirm('确定要删除选中角色', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
|
||||
url: '/api/v1/roles/role',
|
||||
data: {ids: ids},
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
table.reload('tables');
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.refresh = function() {
|
||||
table.reload('tables');
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,316 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>个人中心</title>
|
||||
<style>
|
||||
.layui-form-item {
|
||||
margin-top: 17px !important;
|
||||
margin-bottom: 17px !important;
|
||||
}
|
||||
</style>
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
|
||||
<div class="layui-row layui-col-space10">
|
||||
{# 左侧栏 #}
|
||||
<div class="layui-col-md3">
|
||||
{# 个人信息卡片 #}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 25px;">
|
||||
<div class="text-center layui-text">
|
||||
<div class="user-info-head" id="userInfoHead">
|
||||
<img id="avatar" src="{{ user_info.avatar }}" width="115px" height="115px" alt="">
|
||||
</div>
|
||||
<h2 style="padding-top: 20px;font-size: 20px;">{{ user_info.realname }}</h2>
|
||||
<p style="padding-top: 8px;margin-top: 10px;font-size: 13.5px;">China , 中国</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
|
||||
<span>{{ user_info.remark }}</span>
|
||||
</div>
|
||||
</div>
|
||||
{# 登录信息卡片 #}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
登录记录
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<ul class="list">
|
||||
{% for log in user_logs %}
|
||||
<li class="list-item">
|
||||
<span class="title">{{ log.url }}</span>
|
||||
<span class="footer">{{ log.create_time }}</span>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{# 右侧栏 #}
|
||||
<div class="layui-col-md9">
|
||||
{# 个人信息卡片 #}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">个人信息</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-brief">
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<form class="layui-form">
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<label class="layui-form-label">用户id</label>
|
||||
<div class="layui-input-block">
|
||||
<input value="{{ user_info.id }}" type="text" readonly name="user_id"
|
||||
id="user_id"
|
||||
lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input value="{{ user_info.username }}" type="text" readonly name="username"
|
||||
lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">姓名</label>
|
||||
<div class="layui-input-block">
|
||||
<input value="{{ user_info.realname }}" type="text" name="realName"
|
||||
lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">描述</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea placeholder="请输入描述" name="details"
|
||||
class="layui-textarea">{{ user_info.remark }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-submit
|
||||
lay-filter="user-update">修改资料
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-sm edit-password">更改密码</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{# 个人文章记录 #}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
我的文章
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="{{ url_for('static', filename='admin/admin/images/act.jpg') }}"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12
|
||||
转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="{{ url_for('static', filename='admin/admin/images/act.jpg') }}"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12
|
||||
转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="{{ url_for('static', filename='admin/admin/images/act.jpg') }}"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12
|
||||
转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="{{ url_for('static', filename='admin/admin/images/act.jpg') }}"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12
|
||||
转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="edit_password_view" class="layui-form" action="" style="display: none">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item" style="display: none">
|
||||
<label class="layui-form-label">用户id</label>
|
||||
<div class="layui-input-block">
|
||||
<input value="{{ user_info.id }}" type="text" readonly name="user_id"
|
||||
id="user_id"
|
||||
lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">旧密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="oldPassword" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">新密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="newPassword" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">确认密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="password" name="confirmPassword" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="button-container">
|
||||
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
|
||||
lay-filter="edit-password">
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
提交
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-sm">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script>
|
||||
layui.use(['element', 'jquery', 'layer', 'form', 'popup'], function() {
|
||||
let $ = layui.jquery;
|
||||
let layer = layui.layer;
|
||||
let form = layui.form;
|
||||
let popup = layui.popup;
|
||||
|
||||
// 修改密码页面
|
||||
$('.edit-password').click(function() {
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '修改密码',
|
||||
shade: 0.1,
|
||||
area: ['550px', '280px'],
|
||||
content: $('#edit_password_view'),
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 修改头像
|
||||
$('#avatar').click(function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '更换图片',
|
||||
shade: 0.1,
|
||||
area: ['900px', '500px'],
|
||||
content: '/users/avatar',
|
||||
btn: ['确定', '取消'],
|
||||
yes: function(index, layero) {
|
||||
window['layui-layer-iframe' + index].submitForm();
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
// 表单提交更改个人信息数据
|
||||
form.on('submit(user-update)', function(data) {
|
||||
$.ajax({
|
||||
url: '/api/v1/users/user/' + data.field.user_id + '/info',
|
||||
data: JSON.stringify(data.field),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
layer.msg('修改成功', {icon: 1, time: 1000});
|
||||
} else {
|
||||
layer.msg('修改失败', {icon: 2, time: 1000});
|
||||
}
|
||||
},
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
// 修改密码提交
|
||||
form.on('submit(edit-password)', function(data) {
|
||||
$.ajax({
|
||||
url: '/api/v1/users/user/' + data.field.user_id + '/password',
|
||||
data: JSON.stringify(data.field),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
// TODO 关闭修改密码成之后的窗口
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,127 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>头像上传</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-xs9">
|
||||
<div style="height:325px;background-color: rgb(247, 247, 247);">
|
||||
<img id="sourceImage" src="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-xs3" style="padding-left:0px;">
|
||||
<div id="previewImage"
|
||||
style="width:210px;height:210px;border: 1px solid rgb(200, 200, 200);border-radius: 50%;overflow:hidden;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline layui-btn-container" style="width: auto;vertical-align:top;">
|
||||
<button class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-left" cropper-event="rotate"
|
||||
data-option="-15" title="左旋15°"></button>
|
||||
<button class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-right" cropper-event="rotate"
|
||||
data-option="15" title="右旋15°"></button>
|
||||
<button class="pear-btn pear-btn-sm pear-btn-danger layui-icon layui-icon-refresh" cropper-event="reset"
|
||||
title="重置"></button>
|
||||
<label for="uploadPicture" class="pear-btn pear-btn-sm pear-btn-primary layui-icon layui-icon-upload"
|
||||
title="选择图片"></label>
|
||||
<input class="layui-upload-file" id="uploadPicture" type="file" value="选择图片">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">建议:图片的尺寸宽高比为1:1,大小在5m以内。</div>
|
||||
<input type="text" hidden value="{{ current_user.id }}" id="user_id">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script>
|
||||
layui.use(['jquery', 'layer', 'cropper', 'popup'], function() {
|
||||
let $ = layui.jquery;
|
||||
let layer = layui.layer;
|
||||
let cropper = layui.cropper;
|
||||
let popup = layui.popup;
|
||||
|
||||
let options = {
|
||||
aspectRatio: 1 / 1, // 裁剪框比例
|
||||
preview: '#previewImage', // 预览div
|
||||
viewmode: 1,
|
||||
};
|
||||
|
||||
$('#sourceImage').attr('src', parent.layui.$('#avatar').attr('src'));
|
||||
$('#sourceImage').cropper(options);
|
||||
|
||||
window.submitForm = function() {
|
||||
$('#sourceImage').crossOrigin = 'anonymous';//解决跨域图片问题
|
||||
$('#sourceImage').cropper('getCroppedCanvas', {
|
||||
width: 280,
|
||||
height: 140,
|
||||
}).toBlob(function(blob) {
|
||||
let timeStamp = Date.parse(new Date());
|
||||
let fileName = timeStamp + '.jpg';
|
||||
let formData = new FormData();
|
||||
formData.append('file', blob, fileName);
|
||||
formData.append('fileName', fileName);
|
||||
formData.append('fileToken', timeStamp);
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '/api/v1/file/photos', //用于文件上传的服务器端请求地址
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
// 修改 avatar 字段
|
||||
$.ajax({
|
||||
method: 'put',
|
||||
url: '/api/v1/users/user/' + $('#user_id').val() + '/avatar',
|
||||
data: JSON.stringify({avatar: result.data}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
success: function(res) {
|
||||
if (res.success) {
|
||||
// 关闭当前弹层
|
||||
parent.layui.$('#avatar').attr('src', result.data.src);
|
||||
top.layui.$('#avatar').attr('src', result.data.src);
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
} else {
|
||||
popup.failure('上传失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
} else {
|
||||
popup.failure('上传失败');
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$('.pear-btn').on('click', function() {
|
||||
let event = $(this).attr('cropper-event');
|
||||
if (event === 'rotate') {
|
||||
let option = $(this).attr('data-option');
|
||||
$('#sourceImage').cropper('rotate', option);
|
||||
} else if (event === 'reset') {
|
||||
$('#sourceImage').cropper('reset');
|
||||
}
|
||||
$('#uploadPicture').change(function() {
|
||||
let r = new FileReader();
|
||||
let f = this.files[0];
|
||||
let uploadFileSize = f.size / 1024;
|
||||
if (uploadFileSize > 5120) {
|
||||
parent.layer.msg('上传文件不得超过5m', {icon: 5});
|
||||
return false;
|
||||
}
|
||||
r.readAsDataURL(f);
|
||||
r.onload = function(e) {
|
||||
$('#sourceImage').cropper('destroy').attr('src', this.result).cropper(options);
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,315 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>用户管理</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
<link rel="stylesheet" href="/static/admin/admin/css/other/user.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
|
||||
|
||||
{# 查询表单 #}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="" lay-filter="user-query-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="username" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user-left user-collasped">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="button button-primary user-group" user-group=""> 全 部 用 户</div>
|
||||
<div class="button button-default user-group" user-group="-1"> 默 认 分 组</div>
|
||||
<div style="overflow: auto">
|
||||
<ul id="dept-tree" class="dept-tree" data-id="0"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{# 用户表格 #}
|
||||
<div class="user-main user-collasped">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{# 表格操作 #}
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="pear-icon pear-icon-add"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="pear-icon pear-icon-ashbin"></i>
|
||||
删除
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-collasped">
|
||||
<i class="pear-icon pear-icon-modular"></i>
|
||||
高级
|
||||
</button>
|
||||
</script>
|
||||
{# 用户修改操作 #}
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool-edit">
|
||||
<i class="pear-icon pear-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool-remove">
|
||||
<i class="pear-icon pear-icon-ashbin"></i>
|
||||
</button>
|
||||
</script>
|
||||
{# 启动与禁用 #}
|
||||
<script type="text/html" id="tool-switch">
|
||||
<input type="checkbox" name="enable" value="{{ "{{ d.id }}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="tool-switch"
|
||||
{{ "{{# if(d.enable==1){ }} checked {{# } }}" }} />
|
||||
</script>
|
||||
{# 用户注册时间 #}
|
||||
<script type="text/html" id="user-createTime">
|
||||
{{ ' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
{# 用户更新时间 #}
|
||||
<script type="text/html" id="user-updateTime">
|
||||
{{ ' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
<script>
|
||||
layui.use(['table', 'dtree', 'form', 'jquery', 'popup', 'common'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let dtree = layui.dtree;
|
||||
let popup = layui.popup;
|
||||
let common = layui.common;
|
||||
|
||||
// 表格数据
|
||||
const get_columns = () => [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{title: '姓名', field: 'realname', align: 'center', width: 110},
|
||||
{title: '账号', field: 'username', align: 'center'},
|
||||
{title: '部门', field: 'dept', align: 'center'},
|
||||
{title: '启用', field: 'enable', align: 'center', templet: '#tool-switch', width: 120},
|
||||
{title: '注册时间', field: 'create_at', templet: '#user-createTime', align: 'center'},
|
||||
{title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center'},
|
||||
{title: '操作', toolbar: '#tool', align: 'center', width: 130},
|
||||
],
|
||||
];
|
||||
|
||||
// 渲染表格数据
|
||||
table.render({
|
||||
parseData: parserTableData,
|
||||
elem: '#tables',
|
||||
url: '/api/v1/users/user',
|
||||
page: true,
|
||||
cols: get_columns(),
|
||||
skin: 'line',
|
||||
height: 'full-148',
|
||||
toolbar: '#toolbar', /*工具栏*/
|
||||
text: {none: '暂无人员信息'},
|
||||
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'], /*默认工具栏*/
|
||||
});
|
||||
|
||||
// 公司部门树状图菜单
|
||||
dtree.render({
|
||||
elem: '#dept-tree',
|
||||
method: 'get',
|
||||
url: '/api/v1/dept/department',
|
||||
dataFormat: 'list',
|
||||
line: true,
|
||||
skin: 'laySimple',
|
||||
icon: '-1',
|
||||
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
||||
});
|
||||
|
||||
// 菜单栏渲染
|
||||
dtree.on('node(\'dept-tree\')', function(obj) {
|
||||
let field = form.val('user-query-form'); /*用户账号查询*/
|
||||
field.deptId = obj.param.nodeId;
|
||||
window.refresh(field);
|
||||
});
|
||||
|
||||
//
|
||||
$('.user-group').click(function() {
|
||||
let group = $(this).attr('user-group');
|
||||
let field = form.val('user-query-form');
|
||||
if (group === '-1') {
|
||||
field.deptId = group;
|
||||
$(this).removeClass('button-default');
|
||||
$(this).prev().removeClass('button-primary');
|
||||
$(this).prev().addClass('button-default');
|
||||
$(this).addClass('button-primary');
|
||||
} else {
|
||||
field.deptId = group;
|
||||
$(this).removeClass('button-default');
|
||||
$(this).next().removeClass('button-primary');
|
||||
$(this).next().addClass('button-default');
|
||||
$(this).addClass('button-primary');
|
||||
}
|
||||
window.refresh(field);
|
||||
});
|
||||
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool-remove') {
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool-edit') {
|
||||
window.tool_edit(obj);
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
window.toolbar_remove(obj);
|
||||
} else if (obj.event === 'toolbar-collasped') {
|
||||
$('.user-left').toggleClass('user-collasped');
|
||||
$('.user-main').toggleClass('user-collasped');
|
||||
table.resize();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(user-query)', function(data) {
|
||||
window.refresh(data.field);
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('switch(tool-switch)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1;
|
||||
} else {
|
||||
operate = 0;
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/users/user/' + this.value + '/status',
|
||||
data: JSON.stringify({operate: operate, userId: this.value}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message);
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['550px', '550px'],
|
||||
content: '/users/add',
|
||||
});
|
||||
};
|
||||
window.toolbar_remove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
var hasCheck = table.checkStatus('tables');
|
||||
var hasCheckData = hasCheck.data;
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function(index, element) {
|
||||
ids.push(element.id);
|
||||
});
|
||||
}
|
||||
{#console.log(ids);#}
|
||||
layer.confirm('确定要删除选中角色', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
|
||||
url: '/api/v1/users/user',
|
||||
data: {ids: ids},
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
table.reload('role-table');
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
window.refresh = function(param) {
|
||||
table.reload('tables', {where: param});
|
||||
};
|
||||
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该用户', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/users/user/' + obj.data['id'],
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['550px', '500px'],
|
||||
content: '/users/' + obj.data['id'],
|
||||
});
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script src="/static/admin/component/layui/layui.js"></script>
|
||||
<script src="/static/admin/component/pear/pear.js"></script>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
/******************数据解析********************************/
|
||||
function parserTableData(data) {
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>部门管理</title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
{% include 'view/includes/links.html' %}
|
||||
<link rel="stylesheet" href="/static/admin/css/other/department.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
@@ -11,6 +11,12 @@
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">部门名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="deptName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">用户名</label>
|
||||
<div class="layui-input-inline">
|
||||
@@ -24,13 +30,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="form_search">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
@@ -79,8 +79,18 @@
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
|
||||
class="layui-icon layui-icon-delete"></i></button>
|
||||
</script>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
{#表格内的切换按钮#}
|
||||
<script type="text/html" id="dept-status">
|
||||
<input type="checkbox"
|
||||
name="status"
|
||||
value="{{ "{{ d.deptId }}" }}"
|
||||
lay-skin="switch"
|
||||
lay-text="启用|禁用"
|
||||
lay-filter="dept_enable"
|
||||
{{ "{{# if(d.status==1){ }} checked {{# } }}" }}>
|
||||
</script>
|
||||
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'dtree'], function() {
|
||||
let table = layui.table;
|
||||
@@ -88,39 +98,19 @@
|
||||
let $ = layui.jquery;
|
||||
let dtree = layui.dtree;
|
||||
|
||||
let MODULE_PATH = 'operate/';
|
||||
let MODULE_PATH = '/dept/';
|
||||
|
||||
let cols = [
|
||||
[
|
||||
{
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
field: 'name',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '人数',
|
||||
field: 'userCount',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '位置',
|
||||
field: 'location',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '负责人',
|
||||
field: 'leader',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
toolbar: '#organization-bar',
|
||||
align: 'center',
|
||||
width: 130,
|
||||
},
|
||||
{type: 'checkbox'},
|
||||
{field: 'deptName', minWidth: 200, title: '部门名称'},
|
||||
{field: 'leader', title: '负责人'},
|
||||
{field: 'phone', title: '联系方式'},
|
||||
{field: 'email', title: '邮箱'},
|
||||
{field: 'address', title: '详细地址'},
|
||||
{field: 'status', title: '状态', templet: '#dept-status'},
|
||||
{field: 'sort', title: '排序', width: 100},
|
||||
{title: '操作', toolbar: '#organization-bar', align: 'center', width: 130},
|
||||
],
|
||||
];
|
||||
|
||||
@@ -136,8 +126,9 @@
|
||||
});
|
||||
|
||||
table.render({
|
||||
parseData: parserTableData,
|
||||
elem: '#organization-table',
|
||||
url: '/static/admin/data/organization.json',
|
||||
url: '/api/v1/dept/department/',
|
||||
height: 'full-150',
|
||||
page: true,
|
||||
cols: cols,
|
||||
@@ -187,13 +178,39 @@
|
||||
return false;
|
||||
});
|
||||
|
||||
/*切换选择状态*/
|
||||
form.on('switch(dept_enable)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1;
|
||||
} else {
|
||||
operate = 0;
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/dept/department/' + this.value + '/status',
|
||||
data: JSON.stringify({deptId: this.value, operate: operate}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.message);
|
||||
} else {
|
||||
layer.msg(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['500px', '400px'],
|
||||
content: MODULE_PATH + 'add.html',
|
||||
content: '/dept/add',
|
||||
});
|
||||
};
|
||||
|
||||
@@ -203,35 +220,26 @@
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['500px', '400px'],
|
||||
content: MODULE_PATH + 'edit.html',
|
||||
content: MODULE_PATH + 'edit?deptId=' + obj.data['deptId'],
|
||||
});
|
||||
};
|
||||
|
||||
window.remove = function(obj) {
|
||||
layer.confirm('确定要删除该用户', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.confirm('确定要删除该部门', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH + 'remove/' + obj.data['organizationId'],
|
||||
url: '/api/v1/dept/department/' + obj.data['deptId'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {
|
||||
icon: 1,
|
||||
time: 1000,
|
||||
}, function() {
|
||||
popup.success(result.message, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000,
|
||||
});
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
+5
-9
@@ -1,13 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>部门管理</title>
|
||||
<title>部门新增</title>
|
||||
<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">
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
<body class="pear-container">
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
@@ -84,14 +79,15 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'dtree'], function() {
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let dtree = layui.dtree;
|
||||
|
||||
/*添加数据 渲染下拉选择组件*/
|
||||
// TODO dtree
|
||||
/*
|
||||
dtree.renderSelect({
|
||||
elem: '#selectParent',
|
||||
url: '/api/v1/dept/department/',
|
||||
@@ -102,7 +98,7 @@
|
||||
response: {treeId: 'deptId', parentId: 'parentId', title: 'deptName'},
|
||||
selectInitVal: '1',
|
||||
});
|
||||
|
||||
*/
|
||||
/*添加数据 表单组件,提交按钮之后触发的事件*/
|
||||
form.on('submit(dept-save)', function(data) {
|
||||
$.ajax({
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>部门修改</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<form class="layui-form" action="">
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery'], function() {
|
||||
let form = layui.form;
|
||||
@@ -94,7 +94,8 @@
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="dict-type-enable">
|
||||
<input type="checkbox" value="{{ '{{ d.id }}'|safe }}" lay-skin="switch" lay-text="启用|禁用" lay-filter="dict-type-enable"
|
||||
<input type="checkbox" value="{{ '{{ d.id }}'|safe }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="dict-type-enable"
|
||||
{{ "{{ d.enable== '0' ? 'checked' : '' }}"|safe }}>
|
||||
</script>
|
||||
|
||||
@@ -117,7 +118,8 @@
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="dict-data-enable">
|
||||
<input type="checkbox" value="{{ '{{ d.dataId }}' |safe}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="dict-data-enable"
|
||||
<input type="checkbox" value="{{ '{{ d.dataId }}' |safe }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="dict-data-enable"
|
||||
{{ "{{ d.enable== '0' ? 'checked' : '' }}"|safe }}>
|
||||
</script>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>行为日志</title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
@@ -40,33 +40,34 @@
|
||||
{{ '{{layui.util.toDateString(d.createTime, "yyyy-MM-dd HH:mm:ss")}}'|safe }}
|
||||
</script>
|
||||
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'element'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let element = layui.element;
|
||||
|
||||
let MODULE_PATH = '/system/logging/';
|
||||
let MODULE_PATH = '/logs/';
|
||||
|
||||
let cols = [
|
||||
[
|
||||
{title: '模块', field: 'title', align: 'center'},
|
||||
{title: '请求方式', field: 'requestMethod', align: 'center'},
|
||||
{title: '接口', field: 'method', align: 'center'},
|
||||
{title: '浏览器', field: 'browser', align: 'center'},
|
||||
{title: '操作地址', field: 'operateAddress', align: 'center'},
|
||||
{title: '操作系统', field: 'systemOs', align: 'center'},
|
||||
{title: '访问时间', field: 'createTime', templet: '#log-createTime', align: 'center'},
|
||||
{title: '操作人', field: 'operateName', align: 'center'},
|
||||
{title: 'ID', field: 'id', align: 'center'},
|
||||
{#{title: '模块', field: 'title', align: 'center'},#}
|
||||
{title: '请求方式', field: 'method', align: 'center'},
|
||||
{title: '接口', field: 'url', align: 'center'},
|
||||
{title: '浏览器', field: 'user_agent', align: 'center'},
|
||||
{title: '操作地址', field: 'ip', align: 'center'},
|
||||
{title: '描述', field: 'desc', align: 'center'},
|
||||
{title: '访问时间', field: 'create_at', templet: '#log-createTime', align: 'center'},
|
||||
{title: '操作人', field: 'uid', align: 'center'},
|
||||
{title: '访问状态', toolbar: '#log-bar', align: 'center', width: 150},
|
||||
],
|
||||
];
|
||||
|
||||
table.render({
|
||||
parseData: parserTableData,
|
||||
elem: '#log-operate-table',
|
||||
url: '/static/admin/data/operateLog.json',
|
||||
url: MODULE_PATH + 'access_log',
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
@@ -75,7 +76,7 @@
|
||||
|
||||
table.render({
|
||||
elem: '#log-login-table',
|
||||
url: '/static/admin/data/loginLog.json',
|
||||
url: MODULE_PATH + 'login_log',
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
|
||||
+104
-105
@@ -1,109 +1,108 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" value="854085467" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">姓名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="realName" lay-verify="title" autocomplete="off" placeholder="请输入标题"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="email" value="854085467@qq.com" lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="password" value="*******" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">电话</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" value="15555555555" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">性别</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="sex" value="0" title="男">
|
||||
<input type="radio" name="sex" value="1" title="女" checked>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="button-container">
|
||||
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
|
||||
lay-filter="form-save">
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
提交
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-sm">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script src="../../../component/layui/layui.js"></script>
|
||||
<script src="../../../component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery'], function() {
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="username" value="854085467" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">姓名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="realName" lay-verify="title" autocomplete="off" placeholder="请输入标题"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="email" value="854085467@qq.com" lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="password" value="*******" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">电话</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="phone" value="15555555555" lay-verify="title" autocomplete="off"
|
||||
placeholder="请输入标题" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">性别</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="sex" value="0" title="男">
|
||||
<input type="radio" name="sex" value="1" title="女" checked>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<div class="button-container">
|
||||
<button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
|
||||
lay-filter="form-save">
|
||||
<i class="layui-icon layui-icon-ok"></i>
|
||||
提交
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-sm">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['form', 'jquery'], function() {
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
|
||||
form.on('submit(form-save)', function(data) {
|
||||
$.ajax({
|
||||
url: '/system/user/save',
|
||||
data: JSON.stringify(data.field),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'post',
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {
|
||||
icon: 1,
|
||||
time: 1000
|
||||
}, function() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window
|
||||
.name)); //关闭当前页
|
||||
parent.layui.table.reload("form-table");
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
return false;
|
||||
});
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
form.on('submit(form-save)', function(data) {
|
||||
$.ajax({
|
||||
url: '/system/user/save',
|
||||
data: JSON.stringify(data.field),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'post',
|
||||
success: function(result) {
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {
|
||||
icon: 1,
|
||||
time: 1000,
|
||||
}, function() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
|
||||
parent.layui.table.reload('form-table');
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+202
-173
@@ -1,183 +1,212 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="../../component/pear/css/pear.css" />
|
||||
<link rel="stylesheet" href="../../admin/css/other/person.css" />
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
<link rel="stylesheet" href="/static/admin/css/other/person.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md3">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 25px;">
|
||||
<div class="text-center layui-text">
|
||||
<div class="user-info-head" id="userInfoHead">
|
||||
<img src="../../admin/images/avatar.jpg" id="userAvatar" width="115px" height="115px" alt="">
|
||||
</div>
|
||||
<h2 style="padding-top: 20px;font-size: 20px;">就眠仪式</h2>
|
||||
<p style="padding-top: 8px;margin-top: 10px;font-size: 13.5px;">China , 中国</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
|
||||
<span>今日事 ,今日毕</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md3">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body" style="padding: 25px;">
|
||||
<div class="text-center layui-text">
|
||||
<div class="user-info-head" id="userInfoHead">
|
||||
<img src="/static/admin/images/avatar.jpg" id="userAvatar" width="115px" height="115px" alt="">
|
||||
</div>
|
||||
<h2 style="padding-top: 20px;font-size: 20px;">就眠仪式</h2>
|
||||
<p style="padding-top: 8px;margin-top: 10px;font-size: 13.5px;">China , 中国</p>
|
||||
</div>
|
||||
</div>
|
||||
<div style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px;">
|
||||
<span>今日事 ,今日毕</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
归档
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<ul class="list">
|
||||
<li class="list-item"><span class="title">优化代码格式</span><span class="footer">2020-06-04 11:28</span></li>
|
||||
<li class="list-item"><span class="title">新增消息组件</span><span class="footer">2020-06-01 04:23</span></li>
|
||||
<li class="list-item"><span class="title">移动端兼容</span><span class="footer">2020-05-22 21:38</span></li>
|
||||
<li class="list-item"><span class="title">系统布局优化</span><span class="footer">2020-05-15 14:26</span></li>
|
||||
<li class="list-item"><span class="title">兼容多系统菜单模式</span><span class="footer">2020-05-13 16:32</span></li>
|
||||
<li class="list-item"><span class="title">兼容多标签页切换</span><span class="footer">2019-12-9 14:58</span></li>
|
||||
<li class="list-item"><span class="title">扩展下拉组件</span><span class="footer">2019-12-7 9:06</span></li>
|
||||
<li class="list-item"><span class="title">扩展卡片样式</span><span class="footer">2019-12-1 10:26</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
我的文章
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="../../admin/images/act.jpg" style="width: 100%;height: 100%;border-radius: 5px;" />
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发 4</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../component/layui/layui.js"></script>
|
||||
<script src="../../component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['jquery', 'element', 'layer', 'convert'], function () {
|
||||
var element = layui.element,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery,
|
||||
convert = layui.convert;
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
归档
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<ul class="list">
|
||||
<li class="list-item"><span class="title">优化代码格式</span><span class="footer">2020-06-04 11:28</span>
|
||||
</li>
|
||||
<li class="list-item"><span class="title">新增消息组件</span><span class="footer">2020-06-01 04:23</span>
|
||||
</li>
|
||||
<li class="list-item"><span class="title">移动端兼容</span><span class="footer">2020-05-22 21:38</span>
|
||||
</li>
|
||||
<li class="list-item"><span class="title">系统布局优化</span><span class="footer">2020-05-15 14:26</span>
|
||||
</li>
|
||||
<li class="list-item"><span class="title">兼容多系统菜单模式</span><span
|
||||
class="footer">2020-05-13 16:32</span></li>
|
||||
<li class="list-item"><span class="title">兼容多标签页切换</span><span class="footer">2019-12-9 14:58</span>
|
||||
</li>
|
||||
<li class="list-item"><span class="title">扩展下拉组件</span><span class="footer">2019-12-7 9:06</span>
|
||||
</li>
|
||||
<li class="list-item"><span class="title">扩展卡片样式</span><span class="footer">2019-12-1 10:26</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-col-md9">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
我的文章
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<div class="layui-tab-content">
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-row layui-col-space10" style="margin: 15px;">
|
||||
<div class="layui-col-md1">
|
||||
<img src="/static/admin/images/act.jpg"
|
||||
style="width: 100%;height: 100%;border-radius: 5px;"/>
|
||||
</div>
|
||||
<div class="layui-col-md11" style="height: 80px;">
|
||||
<div class="title">为什么程序员们愿意在GitHub上开源自己的成果给别人免费使用和学习?</div>
|
||||
<div class="content">
|
||||
“Git的精髓在于让所有人的贡献无缝合并。而GitHub的天才之处,在于理解了Git的精髓。”来一句我们程序员们接地气的话:分享是一种快乐~
|
||||
</div>
|
||||
<div class="comment">2020-06-12 评论 5 点赞 12 转发
|
||||
4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['jquery', 'element', 'layer', 'convert'], function() {
|
||||
var element = layui.element,
|
||||
layer = layui.layer,
|
||||
$ = layui.jquery,
|
||||
convert = layui.convert;
|
||||
|
||||
let MODULE_PATH = "operate/";
|
||||
|
||||
var image = new Image();
|
||||
image.src = "../../admin/images/avatar.jpg";
|
||||
image.onload = function() {
|
||||
$("#userAvatar").attr("src", convert.imageToBase64(image));
|
||||
}
|
||||
|
||||
window.callback = function (data) {
|
||||
layer.close(data.index);
|
||||
$("#userAvatar").attr("src", data.newAvatar);
|
||||
}
|
||||
let MODULE_PATH = 'operate/';
|
||||
|
||||
$("#userAvatar").click(function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '更换图片',
|
||||
shade: 0.1,
|
||||
area: ["900px", "500px"],
|
||||
content: MODULE_PATH + 'profile.html',
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index, layero) {
|
||||
window['layui-layer-iframe' + index].submitForm();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
var image = new Image();
|
||||
image.src = '/static/admin/images/avatar.jpg';
|
||||
image.onload = function() {
|
||||
$('#userAvatar').attr('src', convert.imageToBase64(image));
|
||||
};
|
||||
|
||||
window.callback = function(data) {
|
||||
layer.close(data.index);
|
||||
$('#userAvatar').attr('src', data.newAvatar);
|
||||
};
|
||||
|
||||
$('#userAvatar').click(function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '更换图片',
|
||||
shade: 0.1,
|
||||
area: ['900px', '500px'],
|
||||
content: MODULE_PATH + 'profile.html',
|
||||
btn: ['确定', '取消'],
|
||||
yes: function(index, layero) {
|
||||
window['layui-layer-iframe' + index].submitForm();
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>图片上传</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
|
||||
<body class="pear-container">
|
||||
@@ -13,7 +13,6 @@
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="toolbar-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
@@ -29,6 +28,7 @@
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'element', 'form', 'upload'], function() {
|
||||
let table = layui.table;
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>新增图片</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
@@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['jquery', 'element', 'form', 'upload'], function() {
|
||||
var $ = layui.jquery;
|
||||
+250
-209
@@ -1,242 +1,283 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>权限管理</title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
||||
<title>权限</title>
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">用户名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">性别</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">权限名称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="powerName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="power_query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="power-table" lay-filter="power-table"></table>
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="power-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-success pear-btn-md" lay-event="expandAll">
|
||||
<i class="layui-icon layui-icon-spread-left"></i>
|
||||
展开
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-success pear-btn-md" lay-event="foldAll">
|
||||
<i class="layui-icon layui-icon-shrink-right"></i>
|
||||
折叠
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool-edit"><i
|
||||
class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool-remove"><i
|
||||
class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="power-bar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="power-type">
|
||||
{{ " {{#if (d.powerType == '0') { }}
|
||||
<span>目录</span>
|
||||
{{# }else if(d.powerType == '1'){ }}
|
||||
<span>菜单</span>
|
||||
{{# }else if(d.powerType == '2'){ }}
|
||||
<span>按钮</span>
|
||||
{{# } }}"|safe }}
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="power-enable">
|
||||
<input type="checkbox" name="enable" value="{{ "{{d.id}}"|safe }}" lay-skin="switch" lay-text="启用|禁用" lay-filter="user-enable" {{ "{{ d.enable== true ? 'checked' : '' }}"|safe }} />
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="icon">
|
||||
<i class="layui-icon {{ "{{d.icon}}" |safe}}"></i>
|
||||
</script>
|
||||
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['table','form','jquery','treetable'],function () {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let treetable = layui.treetable;
|
||||
layui.use(['table', 'form', 'jquery', 'treetable', 'popup', 'dtree', 'iconPicker'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let treetable = layui.treetable;
|
||||
let popup = layui.popup;
|
||||
let iconPicker = layui.iconPicker;
|
||||
let dtree = layui.dtree;
|
||||
|
||||
let MODULE_PATH = "operate/";
|
||||
|
||||
window.render = function(){
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
treeIdName: 'powerId',
|
||||
treePidName: 'parentId',
|
||||
skin:'line',
|
||||
treeDefaultClose: true,
|
||||
toolbar:'#power-toolbar',
|
||||
elem: '#power-table',
|
||||
url: '/static/admin/data/power.json',
|
||||
page: false,
|
||||
cols: [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{field: 'powerName', minWidth: 200, title: '权限名称'},
|
||||
{field: 'icon', title: '图标',templet:'#icon'},
|
||||
{field: 'powerType', title: '权限类型',templet:'#power-type'},
|
||||
{field: 'enable', title: '是否可用',templet:'#power-enable'},
|
||||
{field: 'sort', title: '排序'},
|
||||
{title: '操作',templet: '#power-bar', width: 150, align: 'center'}
|
||||
]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
render();
|
||||
|
||||
table.on('tool(power-table)',function(obj){
|
||||
if (obj.event === 'remove') {
|
||||
window.remove(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
window.edit(obj);
|
||||
const get_columns = () => [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{field: 'powerName', minWidth: 200, title: '权限名称'},
|
||||
{field: 'icon', title: '图标', templet: (d) => `<i class="layui-icon ${d.icon}"></i>`},
|
||||
{
|
||||
field: 'powerType', title: '权限类型', templet: (d) => {
|
||||
if (d.powerType === 0) {
|
||||
return `<span>目录</span>`;
|
||||
} else if (d.powerType === 1) {
|
||||
return `<span>菜单</span>`;
|
||||
} else if (d.powerType === 2) {
|
||||
return `<span>按钮</span>`;
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'enable', title: '是否可用', templet: (d) => {
|
||||
// TODO 修改禁用启动逻辑
|
||||
return `<input type="checkbox" name="enable" value="${d.powerId}" lay-skin="switch" lay-text="启用|禁用" lay-filter="tool-switch" ${d.enable ===
|
||||
true ? 'checked=checked' : ''}>`;
|
||||
},
|
||||
},
|
||||
{field: 'sort', title: '排序'},
|
||||
{title: '操作', templet: '#tool', width: 150, align: 'center'},
|
||||
],
|
||||
];
|
||||
|
||||
treetable.render({
|
||||
treeColIndex: 1,
|
||||
treeSpid: 0,
|
||||
treeIdName: 'powerId',
|
||||
treePidName: 'parentId',
|
||||
skin: 'line',
|
||||
method: 'get',
|
||||
treeDefaultClose: true,
|
||||
toolbar: '#toolbar',
|
||||
elem: '#tables',
|
||||
url: '/api/v1/rights/rights',
|
||||
page: false,
|
||||
cols: get_columns(),
|
||||
});
|
||||
|
||||
table.on('toolbar(power-table)', function(obj){
|
||||
if(obj.event === 'add'){
|
||||
window.add();
|
||||
} else if(obj.event === 'refresh'){
|
||||
window.refresh();
|
||||
} else if(obj.event === 'batchRemove'){
|
||||
window.batchRemove(obj);
|
||||
} else if(obj.event === 'expandAll'){
|
||||
treetable.expandAll("#power-table");
|
||||
} else if(obj.event === 'foldAll'){
|
||||
treetable.foldAll("#power-table");
|
||||
}
|
||||
form.on('submit(power_query)', function(data) {
|
||||
var keyword = data.field.powerName;
|
||||
var $tds = $('#tables').next('.treeTable').find('.layui-table-body tbody tr td');
|
||||
if (!keyword) {
|
||||
$tds.css('background-color', 'transparent');
|
||||
layer.msg('请输入关键字', {icon: 5});
|
||||
return;
|
||||
}
|
||||
var searchCount = 0;
|
||||
$tds.each(function() {
|
||||
$(this).css('background-color', 'transparent');
|
||||
if ($(this).text().indexOf(keyword) >= 0) {
|
||||
$(this).css('background-color', 'rgba(250,230,160,0.5)');
|
||||
if (searchCount === 0) {
|
||||
$('body,html').stop(true);
|
||||
$('body,html').animate({scrollTop: $(this).offset().top - 150}, 500);
|
||||
}
|
||||
searchCount++;
|
||||
}
|
||||
});
|
||||
if (searchCount === 0) {
|
||||
layer.msg('没有匹配结果', {icon: 5});
|
||||
} else {
|
||||
treetable.expandAll('#tables');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool-remove') {
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool-edit') {
|
||||
window.tool_edit(obj);
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
window.toolbar_remove(obj);
|
||||
}
|
||||
});
|
||||
|
||||
form.on('switch(tool-switch)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1; /*启用*/
|
||||
} else {
|
||||
operate = 0; /*禁用*/
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/power/' + this.value + '/status',
|
||||
data: JSON.stringify({powerId: this.value, operate: operate}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message);
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: '/rights/add',
|
||||
});
|
||||
};
|
||||
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: '/rights/power/' + obj.data['powerId'],
|
||||
});
|
||||
};
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该权限', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/power/' + obj.data['powerId'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
console.log(obj);
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.add = function(){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: MODULE_PATH + 'add.html'
|
||||
});
|
||||
}
|
||||
window.toolbar_remove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
var ids = [];
|
||||
var hasCheck = table.checkStatus('tables');
|
||||
var hasCheckData = hasCheck.data;
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function(index, element) {
|
||||
ids.push(element.id);
|
||||
});
|
||||
}
|
||||
layer.confirm('确定要删除选中权限', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/rights',
|
||||
data: {ids: ids},
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.msg, function() {
|
||||
console.log(obj);
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.msg);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.edit = function(obj){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: MODULE_PATH + 'edit.html'
|
||||
});
|
||||
}
|
||||
window.remove = function(obj){
|
||||
layer.confirm('确定要删除该权限', {icon: 3, title:'提示'}, function(index){
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH+"remove/"+obj.data['powerId'],
|
||||
dataType:'json',
|
||||
type:'delete',
|
||||
success:function(result){
|
||||
layer.close(loading);
|
||||
if(result.success){
|
||||
layer.msg(result.msg,{icon:1,time:1000},function(){
|
||||
obj.del();
|
||||
});
|
||||
}else{
|
||||
layer.msg(result.msg,{icon:2,time:1000});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
window.batchRemove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg("未选中数据", {
|
||||
icon: 3,
|
||||
time: 1000
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let ids = "";
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
ids += data[i].powerId + ",";
|
||||
}
|
||||
ids = ids.substr(0, ids.length - 1);
|
||||
layer.confirm('确定要删除这些权限', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH + "batchRemove/" + ids,
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {
|
||||
icon: 1,
|
||||
time: 1000
|
||||
}, function() {
|
||||
table.reload('user-table');
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
})
|
||||
iconPicker.render({
|
||||
// 选择器,推荐使用input
|
||||
elem: '#add_icon',
|
||||
// 数据类型:fontClass/unicode,推荐使用fontClass
|
||||
type: 'fontClass',
|
||||
// 是否开启搜索:true/false
|
||||
search: true,
|
||||
// 是否开启分页
|
||||
page: true,
|
||||
// 每页显示数量,默认12
|
||||
limit: 12,
|
||||
// 点击回调
|
||||
click: function(data) {
|
||||
console.log(data);
|
||||
},
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>权限</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<form class="layui-form" action="">
|
||||
@@ -86,7 +86,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function() {
|
||||
let form = layui.form;
|
||||
@@ -129,7 +129,7 @@
|
||||
form.on('submit(power-save)', function(data) {
|
||||
data.field.icon = 'layui-icon ' + data.field.icon;
|
||||
$.ajax({
|
||||
url: '/api/v1/rights/power/0',
|
||||
url: '/api/v1/rights/power/',
|
||||
data: JSON.stringify(data.field),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>权限编辑</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function() {
|
||||
let form = layui.form;
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>头像上传</title>
|
||||
<link rel="stylesheet" href="../../../component/pear/css/pear.css" />
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
@@ -29,8 +29,8 @@
|
||||
<div class="layui-form-mid layui-word-aux">建议:图片的尺寸宽高比为1:1,大小在5m以内。</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="../../../component/layui/layui.js"></script>
|
||||
<script src="../../../component/pear/pear.js"></script>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['jquery','layer','cropper'], function () {
|
||||
let $ = layui.jquery;
|
||||
@@ -42,7 +42,7 @@
|
||||
preview: '#previewImage', // 预览div
|
||||
viewmode: 1
|
||||
};
|
||||
|
||||
|
||||
$("#sourceImage").attr("src", parent.layui.$("#userAvatar").attr("src"));
|
||||
$("#sourceImage").cropper(options);
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
formData.append('file', blob, fileName);
|
||||
formData.append('fileName', fileName);
|
||||
formData.append('fileToken', timeStamp);
|
||||
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.readAsDataURL(blob);
|
||||
reader.onload = function (e) {
|
||||
|
||||
+120
-97
@@ -1,222 +1,243 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>角色管理</title>
|
||||
<link href="/static/component/pear/css/pear.css" rel="stylesheet"/>
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">用户名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<label class="layui-form-label">角色名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="roleName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">性别</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="role-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
<label class="layui-form-label">角色标识</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="roleCode" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="role-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="role-table" lay-filter="role-table"></table>
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="role-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="role-bar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool-edit"><i
|
||||
class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="power"><i
|
||||
class="layui-icon layui-icon-vercode"></i></button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
|
||||
<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="tool-power"><i
|
||||
class="layui-icon layui-icon-vercode"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool-remove"><i
|
||||
class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="role-enable">
|
||||
<input type="checkbox" name="enable" value="{{ '{{ d.id }}'|safe }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="role-enable"
|
||||
{{ "{{ d.enable== true ? 'checked' : '' }}"|safe }} />
|
||||
<script type="text/html" id="tool-switch">
|
||||
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="tool-switch" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
|
||||
</script>
|
||||
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery'], function() {
|
||||
layui.use(['table', 'form', 'jquery', 'popup', 'common'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let popup = layui.popup;
|
||||
|
||||
let MODULE_PATH = 'operate/';
|
||||
|
||||
let cols = [
|
||||
const get_columns = () => [
|
||||
[
|
||||
{type: 'checkbox'},
|
||||
{title: '角色名', field: 'roleName', align: 'center', width: 100},
|
||||
{title: 'Key值', field: 'roleCode', align: 'center'},
|
||||
{title: '描述', field: 'details', align: 'center'},
|
||||
{title: '是否可用', field: 'enable', align: 'center', templet: '#role-enable'},
|
||||
{title: '操作', toolbar: '#role-bar', align: 'center', width: 195},
|
||||
{title: '是否可用', field: 'enable', align: 'center', templet: '#tool-switch'},
|
||||
{title: '排序', field: 'sort', align: 'center'},
|
||||
{title: '操作', toolbar: '#tool', align: 'center', width: 195},
|
||||
],
|
||||
];
|
||||
|
||||
table.render({
|
||||
elem: '#role-table',
|
||||
url: '/static/admin/data/role.json',
|
||||
parseData: parserTableData,
|
||||
elem: '#tables',
|
||||
url: '/api/v1/roles/role',
|
||||
page: true,
|
||||
cols: cols,
|
||||
cols: get_columns(),
|
||||
skin: 'line',
|
||||
toolbar: '#role-toolbar',
|
||||
toolbar: '#toolbar',
|
||||
defaultToolbar: [
|
||||
{
|
||||
title: '刷新',
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports'],
|
||||
});
|
||||
|
||||
table.on('tool(role-table)', function(obj) {
|
||||
if (obj.event === 'remove') {
|
||||
window.remove(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
window.edit(obj);
|
||||
} else if (obj.event === 'power') {
|
||||
window.power(obj);
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool-remove') {
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool-edit') {
|
||||
window.tool_edit(obj);
|
||||
} else if (obj.event === 'tool-power') {
|
||||
window.tool_power(obj);
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(role-table)', function(obj) {
|
||||
if (obj.event === 'add') {
|
||||
window.add();
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'batchRemove') {
|
||||
window.batchRemove(obj);
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
window.toolbar_remove(obj);
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(role-query)', function(data) {
|
||||
table.reload('role-table', {where: data.field});
|
||||
table.reload('tables', {where: data.field});
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('switch(role-enable)', function(obj) {
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
form.on('switch(tool-switch)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1;
|
||||
} else {
|
||||
operate = 0;
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/roles/role/' + this.value + '/status',
|
||||
data: JSON.stringify({roleId: this.value, operate: operate}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.message, {icon: 1, time: 1000});
|
||||
} else {
|
||||
layer.msg(result.message, {icon: 2, time: 1000});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.add = function() {
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['500px', '400px'],
|
||||
content: MODULE_PATH + 'add.html',
|
||||
area: ['500px', '500px'],
|
||||
content: '/admin/role/add',
|
||||
});
|
||||
};
|
||||
|
||||
window.power = function(obj) {
|
||||
window.tool_power = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '授权',
|
||||
shade: 0.1,
|
||||
area: ['320px', '400px'],
|
||||
content: MODULE_PATH + 'edit.html',
|
||||
content: '/admin/role/power/' + obj.data['id'],
|
||||
});
|
||||
};
|
||||
|
||||
window.edit = function(obj) {
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['500px', '400px'],
|
||||
content: MODULE_PATH + 'edit.html',
|
||||
area: ['500px', '500px'],
|
||||
content: '/admin/role/edit/' + obj.data['id'],
|
||||
});
|
||||
};
|
||||
|
||||
window.remove = function(obj) {
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该角色', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH + 'remove/' + obj.data['roleId'],
|
||||
url: '/api/v1/roles/role_power/' + obj.data['id'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {icon: 1, time: 1000}, function() {
|
||||
layer.msg(result.message, {icon: 1, time: 1000}, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {icon: 2, time: 1000});
|
||||
layer.msg(result.message, {icon: 2, time: 1000});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.batchRemove = function(obj) {
|
||||
window.toolbar_remove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {icon: 3, time: 1000});
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
let ids = '';
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
ids += data[i].roleId + ',';
|
||||
var ids = [];
|
||||
var hasCheck = table.checkStatus('tables');
|
||||
var hasCheckData = hasCheck.data;
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function(index, element) {
|
||||
ids.push(element.id);
|
||||
});
|
||||
}
|
||||
ids = ids.substr(0, ids.length - 1);
|
||||
layer.confirm('确定要删除这些用户', {icon: 3, title: '提示'}, function(index) {
|
||||
console.log(ids);
|
||||
layer.confirm('确定要删除选中角色', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH + 'batchRemove/' + ids,
|
||||
|
||||
url: '/api/v1/roles/role',
|
||||
data: {ids: ids},
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {icon: 1, time: 1000}, function() {
|
||||
table.reload('role-table');
|
||||
popup.success(result.message, function() {
|
||||
table.reload('tables');
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {icon: 2, time: 1000});
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -224,9 +245,11 @@
|
||||
};
|
||||
|
||||
window.refresh = function() {
|
||||
table.reload('role-table');
|
||||
table.reload('tables');
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>角色新增</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
|
||||
<body class="pear-container">
|
||||
@@ -61,7 +61,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery'], function() {
|
||||
let form = layui.form;
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>角色编辑</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<form class="layui-form" action="">
|
||||
@@ -72,7 +72,7 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script type="module">
|
||||
layui.use(['form', 'jquery'], function() {
|
||||
let form = layui.form;
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>角色授权</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
|
||||
<body class="pear-container">
|
||||
@@ -30,7 +30,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['dtree', 'form', 'jquery'], function() {
|
||||
let dtree = layui.dtree;
|
||||
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="../../component/pear/css/pear.css"/>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
<style>
|
||||
h1{
|
||||
margin-top: 200px;
|
||||
@@ -22,6 +22,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="../../component/layui/layui.js"></script>
|
||||
<script src="../../component/pear/pear.js"></script>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
</html>
|
||||
|
||||
+279
-274
@@ -1,300 +1,305 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">按钮</div>
|
||||
<div class="layui-card-body">
|
||||
<button class="pear-btn pear-btn-primary">Button</button>
|
||||
<button class="pear-btn pear-btn-primary">Button</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">输入框</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form" lay-filter="component-form-element">
|
||||
<div class="layui-card-header">复选框</div>
|
||||
<div class="layui-card-body layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="checkbox" name="" title="写作" checked>
|
||||
<input type="checkbox" name="" title="发呆">
|
||||
<input type="checkbox" name="" title="禁用" disabled>
|
||||
<input type="checkbox" name="" title="写作" lay-skin="primary" checked>
|
||||
<input type="checkbox" name="" title="发呆" lay-skin="primary">
|
||||
<input type="checkbox" name="" title="禁用" lay-skin="primary" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form" lay-filter="component-form-element">
|
||||
<div class="layui-card-header">开关</div>
|
||||
<div class="layui-card-body layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="checkbox" name="xxx" lay-skin="switch">
|
||||
<input type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked>
|
||||
<input type="checkbox" name="zzz" lay-skin="switch" lay-text="开启|关闭">
|
||||
<input type="checkbox" name="aaa" lay-skin="switch" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form" lay-filter="component-form-element">
|
||||
<div class="layui-card-header">单选框</div>
|
||||
<div class="layui-card-body layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="radio" name="sex" value="nan" title="男">
|
||||
<input type="radio" name="sex" value="nv" title="女" checked>
|
||||
<input type="radio" name="sex" value="" title="中性" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form">
|
||||
<div class="layui-card-header">下拉</div>
|
||||
<div class="layui-card-body">
|
||||
<select name="city" lay-verify="">
|
||||
<option value="">请选择一个城市</option>
|
||||
<option value="010">北京</option>
|
||||
<option value="021">上海</option>
|
||||
<option value="0571">杭州</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="user-table" lay-filter="user-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">按钮</div>
|
||||
<div class="layui-card-body">
|
||||
<button class="pear-btn pear-btn-primary">Button</button>
|
||||
<button class="pear-btn pear-btn-primary">Button</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">输入框</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form" lay-filter="component-form-element">
|
||||
<div class="layui-card-header">复选框</div>
|
||||
<div class="layui-card-body layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="checkbox" name="" title="写作" checked>
|
||||
<input type="checkbox" name="" title="发呆">
|
||||
<input type="checkbox" name="" title="禁用" disabled>
|
||||
<input type="checkbox" name="" title="写作" lay-skin="primary" checked>
|
||||
<input type="checkbox" name="" title="发呆" lay-skin="primary">
|
||||
<input type="checkbox" name="" title="禁用" lay-skin="primary" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form" lay-filter="component-form-element">
|
||||
<div class="layui-card-header">开关</div>
|
||||
<div class="layui-card-body layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="checkbox" name="xxx" lay-skin="switch">
|
||||
<input type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked>
|
||||
<input type="checkbox" name="zzz" lay-skin="switch" lay-text="开启|关闭">
|
||||
<input type="checkbox" name="aaa" lay-skin="switch" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form" lay-filter="component-form-element">
|
||||
<div class="layui-card-header">单选框</div>
|
||||
<div class="layui-card-body layui-row layui-col-space10">
|
||||
<div class="layui-col-md12">
|
||||
<input type="radio" name="sex" value="nan" title="男">
|
||||
<input type="radio" name="sex" value="nv" title="女" checked>
|
||||
<input type="radio" name="sex" value="" title="中性" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card layui-form">
|
||||
<div class="layui-card-header">下拉</div>
|
||||
<div class="layui-card-body">
|
||||
<select name="city" lay-verify="">
|
||||
<option value="">请选择一个城市</option>
|
||||
<option value="010">北京</option>
|
||||
<option value="021">上海</option>
|
||||
<option value="0571">杭州</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="user-table" lay-filter="user-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="user-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/html" id="user-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-bar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
|
||||
</script>
|
||||
<script type="text/html" id="user-bar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-enable">
|
||||
<input type="checkbox" name="enable" value="{{ '{{d.id}}' }}" lay-skin="switch" lay-text="启用|禁用" lay-filter="user-enable" checked = "{{ "{{ d.enable == 0 ? 'true' : 'false' }}" }}">
|
||||
</script>
|
||||
<script type="text/html" id="user-enable">
|
||||
<input type="checkbox" name="enable" value="{{ '{{d.id}}' }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="user-enable" checked="{{ "{{ d.enable == 0 ? 'true' : 'false' }}" }}">
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-sex">
|
||||
{{ "{{#if (d.sex == 1) { }}
|
||||
<script type="text/html" id="user-sex">
|
||||
{{ "{{#if (d.sex == 1) { }}
|
||||
<span>男</span>
|
||||
{{# }else if(d.sex == 2){ }}
|
||||
<span>女</span>
|
||||
{{# } }}" }}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-login">
|
||||
{{ "{{#if (d.login == 0) { }}
|
||||
<script type="text/html" id="user-login">
|
||||
{{ "{{#if (d.login == 0) { }}
|
||||
<span>在线</span>
|
||||
{{# }else if(d.sex == 1){ }}
|
||||
<span>离线</span>
|
||||
{{# } }}" }}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-createTime">
|
||||
{{ "{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd')}}" }}
|
||||
</script>
|
||||
<script type="text/html" id="user-createTime">
|
||||
{{ "{{layui.util.toDateString(d.createTime, 'yyyy-MM-dd')}}" }}
|
||||
</script>
|
||||
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">选项卡</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">网站设置</li>
|
||||
<li>用户管理</li>
|
||||
<li>权限分配</li>
|
||||
<li>商品管理</li>
|
||||
<li>订单管理</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 30px;">
|
||||
<div class="layui-tab-item layui-show"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">进度条</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-progress">
|
||||
<div class="layui-progress-bar" lay-percent="30%"></div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="layui-progress">
|
||||
<div class="layui-progress-bar" lay-percent="20%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">分页</div>
|
||||
<div class="layui-card-body">
|
||||
<div id="test1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">辅助元素</div>
|
||||
<div class="layui-card-body">
|
||||
<blockquote class="layui-elem-quote">快乐的时候不敢尽兴,频繁警戒自己保持清醒.</blockquote>
|
||||
<blockquote class="layui-elem-quote">路上没有灯火的时候,就点亮自己的头颅.</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"></div>
|
||||
<div class="layui-card-body">
|
||||
<ul class="layui-timeline">
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">8月18日</h3>
|
||||
<p>
|
||||
layui 2.0 的一切准备工作似乎都已到位。发布之弦,一触即发。
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">8月16日</h3>
|
||||
<p>杜甫的思想核心是儒家的仁政思想,他有“<em>致君尧舜上,再使风俗淳</em>”的宏伟抱负。个人最爱的名篇有:</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">8月15日</h3>
|
||||
<p>
|
||||
中国人民抗日战争胜利72周年
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">日期选择</div>
|
||||
<div class="layui-card-body">
|
||||
<input type="text" class="layui-input" id="test2">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'drawer'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let drawer = layui.drawer;
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">选项卡</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">网站设置</li>
|
||||
<li>用户管理</li>
|
||||
<li>权限分配</li>
|
||||
<li>商品管理</li>
|
||||
<li>订单管理</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 30px;">
|
||||
<div class="layui-tab-item layui-show"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
<div class="layui-tab-item"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">进度条</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-progress">
|
||||
<div class="layui-progress-bar" lay-percent="30%"></div>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="layui-progress">
|
||||
<div class="layui-progress-bar" lay-percent="20%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">分页</div>
|
||||
<div class="layui-card-body">
|
||||
<div id="test1"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">辅助元素</div>
|
||||
<div class="layui-card-body">
|
||||
<blockquote class="layui-elem-quote">快乐的时候不敢尽兴,频繁警戒自己保持清醒.</blockquote>
|
||||
<blockquote class="layui-elem-quote">路上没有灯火的时候,就点亮自己的头颅.</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header"></div>
|
||||
<div class="layui-card-body">
|
||||
<ul class="layui-timeline">
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">8月18日</h3>
|
||||
<p>
|
||||
layui 2.0 的一切准备工作似乎都已到位。发布之弦,一触即发。
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">8月16日</h3>
|
||||
<p>杜甫的思想核心是儒家的仁政思想,他有“<em>致君尧舜上,再使风俗淳</em>”的宏伟抱负。个人最爱的名篇有:</p>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h3 class="layui-timeline-title">8月15日</h3>
|
||||
<p>
|
||||
中国人民抗日战争胜利72周年
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">日期选择</div>
|
||||
<div class="layui-card-body">
|
||||
<input type="text" class="layui-input" id="test2">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'drawer'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let drawer = layui.drawer;
|
||||
|
||||
let MODULE_PATH = "/system/user/";
|
||||
let MODULE_PATH = '/system/user/';
|
||||
|
||||
let cols = [
|
||||
[{
|
||||
type: 'checkbox'
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
field: 'realName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
field: 'sex',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
templet: '#user-sex'
|
||||
},
|
||||
{
|
||||
title: '启用',
|
||||
field: 'enable',
|
||||
align: 'center',
|
||||
templet: '#user-enable'
|
||||
},
|
||||
{
|
||||
title: '登录',
|
||||
field: 'login',
|
||||
align: 'center',
|
||||
templet: '#user-login'
|
||||
},
|
||||
{
|
||||
title: '注册',
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
templet: '#user-createTime'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
toolbar: '#user-bar',
|
||||
align: 'center',
|
||||
width: 130
|
||||
}
|
||||
]
|
||||
]
|
||||
let cols = [
|
||||
[
|
||||
{
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
field: 'realName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
field: 'sex',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
templet: '#user-sex',
|
||||
},
|
||||
{
|
||||
title: '启用',
|
||||
field: 'enable',
|
||||
align: 'center',
|
||||
templet: '#user-enable',
|
||||
},
|
||||
{
|
||||
title: '登录',
|
||||
field: 'login',
|
||||
align: 'center',
|
||||
templet: '#user-login',
|
||||
},
|
||||
{
|
||||
title: '注册',
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
templet: '#user-createTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
toolbar: '#user-bar',
|
||||
align: 'center',
|
||||
width: 130,
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
table.render({
|
||||
elem: '#user-table',
|
||||
url: '/static/admin/data/table.json',
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: '#user-toolbar',
|
||||
defaultToolbar: [{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports']
|
||||
});
|
||||
table.render({
|
||||
elem: '#user-table',
|
||||
url: '/static/admin/data/table.json',
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: '#user-toolbar',
|
||||
defaultToolbar: [
|
||||
{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports'],
|
||||
});
|
||||
|
||||
form.on('switch(user-enable)', function(obj) {
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
});
|
||||
form.on('switch(user-enable)', function(obj) {
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
});
|
||||
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
layui.use('form', function() {
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.use('form', function() {
|
||||
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
layui.use('laypage', function() {
|
||||
var laypage = layui.laypage;
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.use('laypage', function() {
|
||||
var laypage = layui.laypage;
|
||||
|
||||
laypage.render({
|
||||
elem: 'test1' //注意,这里的 test1 是 ID,不用加 # 号
|
||||
,
|
||||
count: 50 //数据总数,从服务端得到
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.use('laydate', function() {
|
||||
var laydate = layui.laydate;
|
||||
laypage.render({
|
||||
elem: 'test1' //注意,这里的 test1 是 ID,不用加 # 号
|
||||
,
|
||||
count: 50, //数据总数,从服务端得到
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
layui.use('laydate', function() {
|
||||
var laydate = layui.laydate;
|
||||
|
||||
laydate.render({
|
||||
elem: '#test2' //指定元素
|
||||
});
|
||||
});
|
||||
</script>
|
||||
laydate.render({
|
||||
elem: '#test2', //指定元素
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
|
||||
+192
-214
@@ -1,304 +1,282 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>用户管理</title>
|
||||
<link rel="stylesheet" href="/static/component/pear/css/pear.css"/>
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
{# 查询表单 #}
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<form class="layui-form" action="">
|
||||
<form class="layui-form" action="" lay-filter="user-query-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">用户名</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<label class="layui-form-label">用户</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">性别</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">邮箱</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="realName" placeholder="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="username" placeholder="" class="layui-input">
|
||||
</div>
|
||||
<button class="pear-btn pear-btn-md pear-btn-primary" lay-submit lay-filter="user-query">
|
||||
<i class="layui-icon layui-icon-search"></i>
|
||||
查询
|
||||
</button>
|
||||
<button type="reset" class="pear-btn pear-btn-md">
|
||||
<i class="layui-icon layui-icon-refresh"></i>
|
||||
重置
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="user-table" lay-filter="user-table"></table>
|
||||
|
||||
{# 用户表格 #}
|
||||
<div class="user-main user-collasped">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="user-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
{# 表格操作 #}
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="toolbar-add">
|
||||
<i class="pear-icon pear-icon-add"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-remove">
|
||||
<i class="pear-icon pear-icon-ashbin"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-bar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i>
|
||||
<button class="pear-btn pear-btn-md" lay-event="toolbar-collasped">
|
||||
<i class="pear-icon pear-icon-modular"></i>
|
||||
高级
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-enable">
|
||||
<input type="checkbox" name="enable" value="{{ "{{ d.id }}"|safe }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="user-enable"
|
||||
{{ "{{ d.enable== true ? 'checked' : '' }}"|safe }} />
|
||||
{# 用户修改操作 #}
|
||||
<script type="text/html" id="tool">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="tool-edit">
|
||||
<i class="pear-icon pear-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="tool-remove">
|
||||
<i class="pear-icon pear-icon-ashbin"></i>
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-sex">
|
||||
{{ "{{#if (d.sex == 1) { }}
|
||||
<span>男</span>
|
||||
{{# }else if(d.sex == 2){ }}
|
||||
<span>女</span>
|
||||
{{# } }}" |safe }}
|
||||
{# 启动与禁用 #}
|
||||
<script type="text/html" id="tool-switch">
|
||||
<input type="checkbox" name="enable" value="{{ "{{ d.id }}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="tool-switch"
|
||||
{{ "{{# if(d.enable==1){ }} checked {{# } }}" }} />
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="user-login">
|
||||
{{ "{{#if (d.login == 0) { }}
|
||||
<span>在线</span>
|
||||
{{# }else if(d.sex == 1){ }}
|
||||
<span>离线</span>
|
||||
{{# } }}"|safe }}
|
||||
</script>
|
||||
|
||||
{# 用户注册时间 #}
|
||||
<script type="text/html" id="user-createTime">
|
||||
{{ "{{ layui.util.toDateString(d.createTime, 'yyyy-MM-dd') }}"|safe }}
|
||||
{{ ' {{layui.util.toDateString(d.create_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
{# 用户更新时间 #}
|
||||
<script type="text/html" id="user-updateTime">
|
||||
{{ ' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
|
||||
<script src="/static/component/layui/layui.js"></script>
|
||||
<script src="/static/component/pear/pear.js"></script>
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'common'], function() {
|
||||
layui.use(['table', 'dtree', 'form', 'jquery', 'popup', 'common'], function() {
|
||||
let table = layui.table;
|
||||
let form = layui.form;
|
||||
let $ = layui.jquery;
|
||||
let dtree = layui.dtree;
|
||||
let popup = layui.popup;
|
||||
let common = layui.common;
|
||||
|
||||
let MODULE_PATH = 'operate/';
|
||||
|
||||
let cols = [
|
||||
// 表格数据
|
||||
const get_columns = () => [
|
||||
[
|
||||
{
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
field: 'username',
|
||||
align: 'center',
|
||||
width: 100,
|
||||
},
|
||||
{
|
||||
title: '姓名',
|
||||
field: 'realName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '性别',
|
||||
field: 'sex',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
templet: '#user-sex',
|
||||
},
|
||||
{
|
||||
title: '电话',
|
||||
field: 'phone',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '启用',
|
||||
field: 'enable',
|
||||
align: 'center',
|
||||
templet: '#user-enable',
|
||||
},
|
||||
{
|
||||
title: '登录',
|
||||
field: 'login',
|
||||
align: 'center',
|
||||
templet: '#user-login',
|
||||
},
|
||||
{
|
||||
title: '注册',
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
templet: '#user-createTime',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
toolbar: '#user-bar',
|
||||
align: 'center',
|
||||
width: 130,
|
||||
},
|
||||
{type: 'checkbox'},
|
||||
{title: '姓名', field: 'realname', align: 'center', width: 110},
|
||||
{title: '账号', field: 'username', align: 'center'},
|
||||
{title: '部门', field: 'dept', align: 'center'},
|
||||
{title: '启用', field: 'enable', align: 'center', templet: '#tool-switch', width: 120},
|
||||
{title: '注册时间', field: 'create_at', templet: '#user-createTime', align: 'center'},
|
||||
{title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center'},
|
||||
{title: '操作', toolbar: '#tool', align: 'center', width: 130},
|
||||
],
|
||||
];
|
||||
|
||||
// 渲染表格数据
|
||||
table.render({
|
||||
elem: '#user-table',
|
||||
url: '/static/admin/data/user.json',
|
||||
parseData: parserTableData,
|
||||
elem: '#tables',
|
||||
url: '/api/v1/users/user',
|
||||
page: true,
|
||||
cols: cols,
|
||||
cols: get_columns(),
|
||||
skin: 'line',
|
||||
toolbar: '#user-toolbar',
|
||||
defaultToolbar: [
|
||||
{
|
||||
title: '刷新',
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports'],
|
||||
height: 'full-148',
|
||||
toolbar: '#toolbar', /*工具栏*/
|
||||
text: {none: '暂无人员信息'},
|
||||
defaultToolbar: [{layEvent: 'refresh', icon: 'layui-icon-refresh'}, 'filter', 'print', 'exports'], /*默认工具栏*/
|
||||
});
|
||||
|
||||
table.on('tool(user-table)', function(obj) {
|
||||
if (obj.event === 'remove') {
|
||||
window.remove(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
window.edit(obj);
|
||||
//
|
||||
$('.user-group').click(function() {
|
||||
let group = $(this).attr('user-group');
|
||||
let field = form.val('user-query-form');
|
||||
if (group === '-1') {
|
||||
field.deptId = group;
|
||||
$(this).removeClass('button-default');
|
||||
$(this).prev().removeClass('button-primary');
|
||||
$(this).prev().addClass('button-default');
|
||||
$(this).addClass('button-primary');
|
||||
} else {
|
||||
field.deptId = group;
|
||||
$(this).removeClass('button-default');
|
||||
$(this).next().removeClass('button-primary');
|
||||
$(this).next().addClass('button-default');
|
||||
$(this).addClass('button-primary');
|
||||
}
|
||||
window.refresh(field);
|
||||
});
|
||||
|
||||
table.on('tool(tables)', function(obj) {
|
||||
if (obj.event === 'tool-remove') {
|
||||
window.tool_remove(obj);
|
||||
} else if (obj.event === 'tool-edit') {
|
||||
window.tool_edit(obj);
|
||||
}
|
||||
});
|
||||
|
||||
table.on('toolbar(user-table)', function(obj) {
|
||||
if (obj.event === 'add') {
|
||||
window.add();
|
||||
table.on('toolbar(tables)', function(obj) {
|
||||
if (obj.event === 'toolbar-add') {
|
||||
window.toolbar_add();
|
||||
} else if (obj.event === 'refresh') {
|
||||
window.refresh();
|
||||
} else if (obj.event === 'batchRemove') {
|
||||
window.batchRemove(obj);
|
||||
} else if (obj.event === 'toolbar-remove') {
|
||||
window.toolbar_remove(obj);
|
||||
} else if (obj.event === 'toolbar-collasped') {
|
||||
$('.user-left').toggleClass('user-collasped');
|
||||
$('.user-main').toggleClass('user-collasped');
|
||||
table.resize();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(user-query)', function(data) {
|
||||
table.reload('user-table', {
|
||||
where: data.field,
|
||||
});
|
||||
window.refresh(data.field);
|
||||
return false;
|
||||
});
|
||||
|
||||
form.on('switch(user-enable)', function(obj) {
|
||||
layer.tips(this.value + ' ' + this.name + ':' + obj.elem.checked, obj.othis);
|
||||
form.on('switch(tool-switch)', function(obj) {
|
||||
let operate;
|
||||
if (obj.elem.checked) {
|
||||
operate = 1;
|
||||
} else {
|
||||
operate = 0;
|
||||
}
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/users/user/' + this.value + '/status',
|
||||
data: JSON.stringify({operate: operate, userId: this.value}),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'put',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message);
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
window.add = function() {
|
||||
window.toolbar_add = function() {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: [common.isModile() ? '100%' : '500px', common.isModile() ? '100%' : '400px'],
|
||||
content: MODULE_PATH + 'add.html',
|
||||
area: ['550px', '550px'],
|
||||
content: '/users/add',
|
||||
});
|
||||
};
|
||||
|
||||
window.edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['500px', '400px'],
|
||||
content: MODULE_PATH + 'edit.html',
|
||||
});
|
||||
};
|
||||
|
||||
window.remove = function(obj) {
|
||||
layer.confirm('确定要删除该用户', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH + 'remove/' + obj.data['userId'],
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {
|
||||
icon: 1,
|
||||
time: 1000,
|
||||
}, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000,
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.batchRemove = function(obj) {
|
||||
|
||||
var checkIds = common.checkField(obj, 'userId');
|
||||
|
||||
if (checkIds === '') {
|
||||
window.toolbar_remove = function(obj) {
|
||||
let data = table.checkStatus(obj.config.id).data;
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000,
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
layer.confirm('确定要删除这些用户', {
|
||||
var ids = [];
|
||||
var hasCheck = table.checkStatus('tables');
|
||||
var hasCheckData = hasCheck.data;
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function(index, element) {
|
||||
ids.push(element.id);
|
||||
});
|
||||
}
|
||||
{#console.log(ids);#}
|
||||
layer.confirm('确定要删除选中角色', {
|
||||
icon: 3,
|
||||
title: '提示',
|
||||
}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: MODULE_PATH + 'batchRemove/' + ids,
|
||||
|
||||
url: '/api/v1/users/user',
|
||||
data: {ids: ids},
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
layer.msg(result.msg, {
|
||||
icon: 1,
|
||||
time: 1000,
|
||||
}, function() {
|
||||
table.reload('user-table');
|
||||
popup.success(result.message, function() {
|
||||
table.reload('role-table');
|
||||
});
|
||||
} else {
|
||||
layer.msg(result.msg, {
|
||||
icon: 2,
|
||||
time: 1000,
|
||||
});
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
window.refresh = function(param) {
|
||||
table.reload('user-table');
|
||||
table.reload('tables', {where: param});
|
||||
};
|
||||
|
||||
window.tool_remove = function(obj) {
|
||||
layer.confirm('确定要删除该用户', {icon: 3, title: '提示'}, function(index) {
|
||||
layer.close(index);
|
||||
let loading = layer.load();
|
||||
$.ajax({
|
||||
url: '/api/v1/users/user/' + obj.data['id'],
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
type: 'delete',
|
||||
success: function(result) {
|
||||
layer.close(loading);
|
||||
if (result.success) {
|
||||
popup.success(result.message, function() {
|
||||
obj.del();
|
||||
});
|
||||
} else {
|
||||
popup.failure(result.message);
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
window.tool_edit = function(obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['550px', '500px'],
|
||||
content: '/users/' + obj.data['id'],
|
||||
});
|
||||
};
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>用户管理</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<form class="layui-form">
|
||||
@@ -62,7 +62,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
|
||||
layui.use(['form', 'jquery'], function() {
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<title>用户编辑</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
{% include 'view/includes/links.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<form class="layui-form" action="">
|
||||
@@ -70,7 +70,7 @@
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
{% include 'view/includes/scripts.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'dtree'], function() {
|
||||
let form = layui.form;
|
||||
Reference in New Issue
Block a user