'wip(semantic):调整模板文件'
This commit is contained in:
@@ -8,13 +8,13 @@ from applications.view import index_bp
|
||||
@index_bp.get('/dept')
|
||||
@authorize("admin:dept:main", log=True)
|
||||
def dept_index():
|
||||
return render_template('department/main.html')
|
||||
return render_template('admin/department/main.html')
|
||||
|
||||
|
||||
@index_bp.get('/dept/add')
|
||||
@authorize("admin:dept:add", log=True)
|
||||
def add():
|
||||
return render_template('department/add.html')
|
||||
return render_template('admin/department/add.html')
|
||||
|
||||
|
||||
@index_bp.get('/dept/edit')
|
||||
@@ -22,4 +22,4 @@ def add():
|
||||
def edit():
|
||||
dept_id = request.args.get("deptId", type=int)
|
||||
dept = CompanyDepartment.query.get(dept_id)
|
||||
return render_template('department/edit.html', dept=dept)
|
||||
return render_template('admin/department/edit.html', dept=dept)
|
||||
|
||||
@@ -8,4 +8,11 @@ from applications.common.utils.rights import authorize
|
||||
@index_bp.get('/file')
|
||||
@authorize("admin:file:main", log=True)
|
||||
def file_index():
|
||||
return render_template('file/photo.html')
|
||||
return render_template('admin/file/photo.html')
|
||||
|
||||
|
||||
# 图片管理
|
||||
@index_bp.get('/file/photo/add')
|
||||
@authorize("admin:file:main", log=True)
|
||||
def file_photo_add():
|
||||
return render_template('admin/file/photo_add.html')
|
||||
|
||||
@@ -13,7 +13,7 @@ logs_bp = Blueprint('logs', __name__, url_prefix='/logs')
|
||||
@logs_bp.get('/')
|
||||
@authorize("admin:log:main")
|
||||
def index():
|
||||
return render_template('logs_temp/main.html')
|
||||
return render_template('admin/logs_temp/main.html')
|
||||
|
||||
|
||||
@logs_bp.get('/login_log')
|
||||
@@ -40,4 +40,4 @@ def operate_log():
|
||||
desc(AdminLog.create_at)).paginate(
|
||||
page=page, per_page=limit, error_out=False)
|
||||
data = marshal(log_paginate.items, log_fields)
|
||||
return table_api(data=data, count=log_paginate.total)
|
||||
return table_api(data=data, count=log_paginate.total, code=0)
|
||||
|
||||
@@ -8,16 +8,22 @@ from applications.view import index_bp
|
||||
@index_bp.get('/rights/')
|
||||
@authorize("admin:power:main", log=True)
|
||||
def rights_index():
|
||||
return render_template('rights/main.html')
|
||||
return render_template('admin/rights/rights.html')
|
||||
|
||||
|
||||
@index_bp.get('/rights/power/<int:power_id>')
|
||||
@authorize("admin:power:edit", log=True)
|
||||
def get(power_id):
|
||||
def rights_edit(power_id):
|
||||
power = RightsPower.query.filter_by(id=power_id).first()
|
||||
icon = str(power.icon).split()
|
||||
if len(icon) == 2:
|
||||
icon = icon[1]
|
||||
else:
|
||||
icon = None
|
||||
return render_template('rights/edit.html', power=power, icon=icon)
|
||||
return render_template('admin/rights/rights_edit.html', power=power, icon=icon)
|
||||
|
||||
|
||||
@index_bp.get('/rights/add')
|
||||
@authorize("admin:power:main", log=True)
|
||||
def rights_add():
|
||||
return render_template('admin/rights/rights_add.html')
|
||||
|
||||
@@ -11,14 +11,14 @@ role_bp = Blueprint('role', __name__, url_prefix='/admin/role')
|
||||
@role_bp.get('/')
|
||||
@authorize("admin:role:main", log=True)
|
||||
def main():
|
||||
return render_template('roles/main.html')
|
||||
return render_template('admin/roles/roles.html')
|
||||
|
||||
|
||||
# 角色授权操作
|
||||
@role_bp.get('/power/<int:_id>')
|
||||
@authorize("admin:role:power", log=True)
|
||||
def power(_id):
|
||||
return render_template('roles/power.html', id=_id)
|
||||
return render_template('admin/roles/roles_power.html', id=_id)
|
||||
|
||||
|
||||
# 角色编辑
|
||||
@@ -26,4 +26,10 @@ def power(_id):
|
||||
@role_bp.get('/edit/<int:role_id>')
|
||||
def role_editor(role_id):
|
||||
role = RightsRole.query.filter_by(id=role_id).first()
|
||||
return render_template('roles/edit.html', role=role)
|
||||
return render_template('admin/roles/roles_edit.html', role=role)
|
||||
|
||||
|
||||
@authorize("admin:role:edit", log=True)
|
||||
@role_bp.get('/add')
|
||||
def role_add():
|
||||
return render_template('admin/roles/roles_add.html')
|
||||
|
||||
@@ -4,7 +4,6 @@ from sqlalchemy import desc
|
||||
|
||||
from applications.common.utils.rights import authorize
|
||||
from applications.models import AdminLog, RightsRole, CompanyUser
|
||||
|
||||
from . import index_bp
|
||||
|
||||
|
||||
@@ -12,7 +11,7 @@ from . import index_bp
|
||||
@index_bp.get('/users/')
|
||||
@authorize("admin:user:main", log=True)
|
||||
def users_main():
|
||||
return render_template('users/main.html')
|
||||
return render_template('admin/users/users.html')
|
||||
|
||||
|
||||
@index_bp.get('/users/center')
|
||||
@@ -20,7 +19,7 @@ def users_main():
|
||||
def users_center():
|
||||
user_logs = AdminLog.query.filter_by(url='/passport/login').filter_by(uid=current_user.id).order_by(
|
||||
desc(AdminLog.create_at)).limit(10)
|
||||
return render_template('users/profile.html', user_info=current_user, user_logs=user_logs)
|
||||
return render_template('admin/users/profile.html', user_info=current_user, user_logs=user_logs)
|
||||
|
||||
|
||||
@index_bp.get('/users/<user_id>')
|
||||
@@ -32,9 +31,15 @@ def users_user_id_view(user_id):
|
||||
checked_roles = []
|
||||
for r in user.role:
|
||||
checked_roles.append(r.id)
|
||||
return render_template('users/edit_users.html', user=user, roles=roles, checked_roles=checked_roles)
|
||||
return render_template('admin/users/users_edit.html', user=user, roles=roles, checked_roles=checked_roles)
|
||||
|
||||
|
||||
@index_bp.get('/users/avatar')
|
||||
def users_avatar_view():
|
||||
return render_template('users/avatar.html')
|
||||
return render_template('admin/users/profile_avatar.html')
|
||||
|
||||
|
||||
@index_bp.get('/users/add')
|
||||
def users_add_view():
|
||||
roles = RightsRole.query.all()
|
||||
return render_template('admin/users/users_add.html', roles=roles)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>部门管理</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
@@ -79,7 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { DEPARTMENT_API } from '/static/api/http.js'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>部门修改</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
@@ -91,7 +91,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { DEPARTMENT_API } from '/static/api/http.js'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>部门新增</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
{#pear 后台边框#}
|
||||
<body class="pear-container">
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
</body>
|
||||
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
|
||||
<script type="module">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>图片上传</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
@@ -12,28 +12,6 @@
|
||||
</div>
|
||||
</body>
|
||||
|
||||
{#添加文件内容#}
|
||||
<div id="add_view" class="layui-row layui-col-space15 " style="margin: 10px;display: none">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-tab-content">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>新增图片</legend>
|
||||
</fieldset>
|
||||
<form class="layui-form edit-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">
|
||||
新增图片
|
||||
</label>
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="logo-img">选择文件</button>
|
||||
<button type="button" class="layui-btn" id="logo-upload-button">开始上传</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
@@ -50,7 +28,7 @@
|
||||
class="layui-icon layui-icon-delete"></i></button>
|
||||
</script>
|
||||
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { FILE_API } from '/static/api/http.js'
|
||||
|
||||
@@ -63,7 +41,7 @@
|
||||
let cols = [
|
||||
[
|
||||
{
|
||||
type: 'checkbox'
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
field: 'id',
|
||||
@@ -71,13 +49,13 @@
|
||||
sort: true,
|
||||
align: 'center',
|
||||
unresize: true,
|
||||
width: 80
|
||||
width: 80,
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
title: '文件名称',
|
||||
unresize: true,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
field: 'href',
|
||||
@@ -86,36 +64,36 @@
|
||||
align: 'center',
|
||||
templet: (d) => {
|
||||
return `<img class="photo" style="max-width: 100%;height: 100%;cursor: pointer;" lay-event="photo" src="${d.href}"></i>`
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
{
|
||||
field: 'mime',
|
||||
title: 'mime类型',
|
||||
unresize: true,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
field: 'size',
|
||||
title: '文件大小',
|
||||
unresize: true,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
field: 'create_at',
|
||||
title: '创建时间',
|
||||
templet: (d) => `${layui.util.toDateString(d.create_at, 'yyyy-MM-dd HH:mm:ss')}`,
|
||||
unresize: true,
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
toolbar: '#tools',
|
||||
align: 'center',
|
||||
unresize: true,
|
||||
width: 200
|
||||
}
|
||||
]
|
||||
width: 200,
|
||||
},
|
||||
],
|
||||
]
|
||||
|
||||
table.render({
|
||||
@@ -125,10 +103,11 @@
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: '#toolbar',
|
||||
defaultToolbar: [{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports']
|
||||
defaultToolbar: [
|
||||
{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports'],
|
||||
})
|
||||
|
||||
table.on('tool(tables)', function (obj) {
|
||||
@@ -162,19 +141,19 @@
|
||||
|
||||
window.add = function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
type: 2,
|
||||
maxmin: true,
|
||||
title: '新增图片',
|
||||
shade: 0.1,
|
||||
area: screen(),
|
||||
content: $('#add_view')
|
||||
content: 'file/photo/add',
|
||||
})
|
||||
}
|
||||
|
||||
window.remove = function (obj) {
|
||||
layer.confirm('确定要删除该图片', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
title: '提示',
|
||||
}, function (index) {
|
||||
layer.close(index)
|
||||
let loading = layer.load()
|
||||
@@ -188,17 +167,17 @@
|
||||
if (res.success) {
|
||||
layer.msg(res.msg, {
|
||||
icon: 1,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
}, function () {
|
||||
obj.del()
|
||||
})
|
||||
} else {
|
||||
layer.msg(res.msg, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -208,7 +187,7 @@
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
})
|
||||
return false
|
||||
}
|
||||
@@ -222,7 +201,7 @@
|
||||
}
|
||||
layer.confirm('确定要删除这些图片', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
title: '提示',
|
||||
}, function (index) {
|
||||
layer.close(index)
|
||||
let loading = layer.load()
|
||||
@@ -236,17 +215,17 @@
|
||||
if (res.success) {
|
||||
layer.msg(res.msg, {
|
||||
icon: 1,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
}, function () {
|
||||
table.reload('tables')
|
||||
})
|
||||
} else {
|
||||
layer.msg(res.msg, {
|
||||
icon: 2,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -278,31 +257,11 @@
|
||||
area: ['auto'],
|
||||
skin: 'layui-layer-nobg', //没有背景色
|
||||
shadeClose: true,
|
||||
content: `<img src="${obj.data['href']}" width="${auto_img.width}px" height="${auto_img.height}px">`
|
||||
content: `<img src="${obj.data['href']}" width="${auto_img.width}px" height="${auto_img.height}px">`,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/*上次文件部分*/
|
||||
// 选完文件后不自动上传
|
||||
upload.render({
|
||||
elem: '#logo-img'
|
||||
, url: FILE_API.PHOTOS()
|
||||
, auto: false
|
||||
, exts: 'jpg|png|gif|bmp|jpeg'
|
||||
, size: 1000
|
||||
, bindAction: '#logo-upload-button'
|
||||
, done: function (res) {
|
||||
if (res.success) {
|
||||
layer.msg(res.msg, { icon: 1, time: 500 }, function () {
|
||||
layer.close(layer.index)//关闭最新的layer
|
||||
location.reload()//当前页面刷新
|
||||
})
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 })
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{% include 'admin/common/header.html' %}
|
||||
<style>
|
||||
.pear-container {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-row layui-col-space15">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-tab-content">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend>新增图片</legend>
|
||||
</fieldset>
|
||||
<form class="layui-form edit-form">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">
|
||||
新增图片
|
||||
</label>
|
||||
<button type="button" class="layui-btn layui-btn-normal" id="select-img">选择文件</button>
|
||||
<button type="button" class="layui-btn" id="logo-upload-button">开始上传</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { FILE_API } from '/static/api/http.js'
|
||||
|
||||
layui.use(['jquery', 'element', 'form', 'upload'], function () {
|
||||
var $ = layui.jquery
|
||||
var element = layui.element
|
||||
var form = layui.form
|
||||
var upload = layui.upload
|
||||
//选完文件后不自动上传
|
||||
upload.render({
|
||||
elem: '#select-img'
|
||||
, url: FILE_API.PHOTOS()
|
||||
, auto: false
|
||||
, exts: 'jpg|png|gif|bmp|jpeg'
|
||||
, size: 1000
|
||||
, bindAction: '#logo-upload-button'
|
||||
, done: function (res) {
|
||||
if (res.success) {
|
||||
layer.msg(res.msg, { icon: 1, time: 500 }, function () {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name))//关闭当前页
|
||||
window.parent.location.reload()
|
||||
})
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2 })
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>日志</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
<link rel="stylesheet" href="/static/admin/admin/css/other/console2.css"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
@@ -38,7 +38,7 @@
|
||||
<span style="color: red">失败</span>
|
||||
{{# } }}'|safe }}
|
||||
</script>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script>
|
||||
layui.use(['table', 'form', 'jquery', 'element', 'util'], function () {
|
||||
let table = layui.table
|
||||
@@ -56,8 +56,8 @@
|
||||
{ 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' }
|
||||
]
|
||||
{ title: '访问状态', templet: '#log-status', align: 'center' },
|
||||
],
|
||||
]
|
||||
|
||||
table.render({
|
||||
@@ -66,7 +66,7 @@
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: false
|
||||
toolbar: false,
|
||||
})
|
||||
|
||||
table.render({
|
||||
@@ -75,7 +75,7 @@
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: false
|
||||
toolbar: false,
|
||||
})
|
||||
|
||||
form.on('submit(dict-type-query)', function (data) {
|
||||
@@ -105,7 +105,7 @@
|
||||
success: function (layero) {
|
||||
let iframeWin = window[layero.find('iframe')[0]['name']]
|
||||
iframeWin.show(obj.data)
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>权限</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
@@ -54,87 +54,7 @@
|
||||
</button>
|
||||
</script>
|
||||
|
||||
|
||||
<form id="add_view" class="layui-form" action="" style="display: none">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">父级</label>
|
||||
<div class="layui-input-block">
|
||||
<ul id="select_parent_dept" name="parentId" class="dtree" data-id="-1"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="powerName" lay-verify="title" autocomplete="off" placeholder="权限名称"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="powerCodeItem">
|
||||
<label class="layui-form-label">标识</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="powerCode" name="powerCode" 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" lay-filter="powerType" name="powerType" value="0" title="目录">
|
||||
<input type="radio" lay-filter="powerType" name="powerType" value="1" title="菜单" checked>
|
||||
<input type="radio" lay-filter="powerType" name="powerType" value="2" title="按钮">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="powerUrlItem">
|
||||
<label class="layui-form-label">路径</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="powerUrl" name="powerUrl" autocomplete="off" placeholder="菜单路径"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="openTypeItem">
|
||||
<label class="layui-form-label">打开</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="openType" id="openType">
|
||||
<option value=""></option>
|
||||
<option value="_iframe">框架</option>
|
||||
<option value="_blank">签页</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="add_icon" name="icon" lay-filter="icon" 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="sort" lay-verify="title" autocomplete="off" placeholder="排序"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</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="power-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>
|
||||
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { RIGHTS_API } from '/static/api/http.js'
|
||||
|
||||
@@ -174,18 +94,19 @@
|
||||
} 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="power_enable" ${d.enable === 1 ? 'checked=checked' : ''}>`
|
||||
}
|
||||
return `<input type="checkbox" name="enable" value="${d.powerId}" lay-skin="switch" lay-text="启用|禁用" lay-filter="power_enable" ${d.enable ===
|
||||
1 ? 'checked=checked' : ''}>`
|
||||
},
|
||||
},
|
||||
{ field: 'sort', title: '排序' },
|
||||
{ title: '操作', templet: '#power-bar', width: 150, align: 'center' }
|
||||
]
|
||||
]
|
||||
{ title: '操作', templet: '#power-bar', width: 150, align: 'center' },
|
||||
],
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -258,17 +179,24 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
window.add = function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: 'rights/add',
|
||||
})
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: $('#add_view')
|
||||
content: $('#add_view'),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -278,7 +206,7 @@
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['450px', '500px'],
|
||||
content: '/rights/power/' + obj.data['powerId']
|
||||
content: '/rights/power/' + obj.data['powerId'],
|
||||
})
|
||||
}
|
||||
window.remove = function (obj) {
|
||||
@@ -299,7 +227,7 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -309,7 +237,7 @@
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
})
|
||||
return false
|
||||
}
|
||||
@@ -323,7 +251,7 @@
|
||||
}
|
||||
layer.confirm('确定要删除选中权限', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
title: '提示',
|
||||
}, function (index) {
|
||||
layer.close(index)
|
||||
let loading = layer.load()
|
||||
@@ -342,66 +270,11 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
{#添加权限数据页面#}
|
||||
dtree.renderSelect({
|
||||
elem: '#select_parent_dept',
|
||||
url: RIGHTS_API.RIGHTS(),
|
||||
method: 'get',
|
||||
selectInputName: { nodeId: 'parentId', context: 'powerName' },
|
||||
skin: 'layui',
|
||||
dataFormat: 'list',
|
||||
response: { treeId: 'powerId', parentId: 'parentId', title: 'powerName' }, //修改response中返回数据的定义
|
||||
selectInitVal: '0'
|
||||
})
|
||||
|
||||
form.on('radio(powerType)', function () {
|
||||
if (this.value == '0') {
|
||||
$('#powerUrlItem').hide()
|
||||
$('#powerCodeItem').hide()
|
||||
$('#openTypeItem').hide()
|
||||
$('#powerUrl').val('')
|
||||
$('#powerCode').val('')
|
||||
$('#openType').val('')
|
||||
} else if (this.value == '1') {
|
||||
$('#powerUrlItem').show()
|
||||
$('#powerCodeItem').show()
|
||||
$('#openTypeItem').show()
|
||||
} else if (this.value == '2') {
|
||||
$('#powerUrlItem').hide()
|
||||
$('#openTypeItem').hide()
|
||||
$('#powerCodeItem').show()
|
||||
$('#powerUrl').val('')
|
||||
$('#openType').val('')
|
||||
}
|
||||
})
|
||||
|
||||
form.on('submit(power-save)', function (data) {
|
||||
data.field.icon = 'layui-icon ' + data.field.icon
|
||||
$.ajax({
|
||||
url: RIGHTS_API.POWER(0),
|
||||
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 () {
|
||||
layer.close(layer.index) // 关闭当前页
|
||||
location.reload()
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
}
|
||||
})
|
||||
return false
|
||||
})
|
||||
|
||||
iconPicker.render({
|
||||
// 选择器,推荐使用input
|
||||
elem: '#add_icon',
|
||||
@@ -416,7 +289,7 @@
|
||||
// 点击回调
|
||||
click: function (data) {
|
||||
console.log(data)
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,171 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>权限</title>
|
||||
{% include 'admin/common/header.html' %}</head>
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">父级</label>
|
||||
<div class="layui-input-block">
|
||||
<ul id="selectParent" name="parentId" class="dtree" data-id="-1"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="powerName" lay-verify="title" autocomplete="off" placeholder="权限名称"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="powerCodeItem">
|
||||
<label class="layui-form-label">标识</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="powerCode" name="powerCode" 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" lay-filter="powerType" name="powerType" value="0" title="目录">
|
||||
<input type="radio" lay-filter="powerType" name="powerType" value="1" title="菜单" checked>
|
||||
<input type="radio" lay-filter="powerType" name="powerType" value="2" title="按钮">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="powerUrlItem">
|
||||
<label class="layui-form-label">路径</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="powerUrl" name="powerUrl" autocomplete="off" placeholder="菜单路径"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" id="openTypeItem">
|
||||
<label class="layui-form-label">打开</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="openType" id="openType">
|
||||
<option value=""></option>
|
||||
<option value="_iframe">框架</option>
|
||||
<option value="_blank">签页</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id="icon" name="icon" lay-filter="icon" 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="sort" lay-verify="title" autocomplete="off" placeholder="排序"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</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="power-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>
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { RIGHTS_API } from 'static/api/http.js'
|
||||
|
||||
layui.use(['form', 'jquery', 'iconPicker', 'dtree'], function () {
|
||||
let form = layui.form
|
||||
let $ = layui.jquery
|
||||
let iconPicker = layui.iconPicker
|
||||
let dtree = layui.dtree
|
||||
|
||||
{#添加权限数据页面#}
|
||||
dtree.renderSelect({
|
||||
elem: '#select_parent_dept',
|
||||
url: RIGHTS_API.RIGHTS(),
|
||||
method: 'get',
|
||||
selectInputName: { nodeId: 'parentId', context: 'powerName' },
|
||||
skin: 'layui',
|
||||
dataFormat: 'list',
|
||||
response: { treeId: 'powerId', parentId: 'parentId', title: 'powerName' }, //修改response中返回数据的定义
|
||||
selectInitVal: '0',
|
||||
})
|
||||
|
||||
form.on('radio(powerType)', function () {
|
||||
if (this.value == '0') {
|
||||
$('#powerUrlItem').hide()
|
||||
$('#powerCodeItem').hide()
|
||||
$('#openTypeItem').hide()
|
||||
$('#powerUrl').val('')
|
||||
$('#powerCode').val('')
|
||||
$('#openType').val('')
|
||||
} else if (this.value == '1') {
|
||||
$('#powerUrlItem').show()
|
||||
$('#powerCodeItem').show()
|
||||
$('#openTypeItem').show()
|
||||
} else if (this.value == '2') {
|
||||
$('#powerUrlItem').hide()
|
||||
$('#openTypeItem').hide()
|
||||
$('#powerCodeItem').show()
|
||||
$('#powerUrl').val('')
|
||||
$('#openType').val('')
|
||||
}
|
||||
})
|
||||
|
||||
form.on('submit(power-save)', function (data) {
|
||||
data.field.icon = 'layui-icon ' + data.field.icon
|
||||
$.ajax({
|
||||
url: '/admin/power/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.render()
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
})
|
||||
|
||||
iconPicker.render({
|
||||
// 选择器,推荐使用input
|
||||
elem: '#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>
|
||||
<head>
|
||||
<title>权限编辑</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
|
||||
import { RIGHTS_API } from '/static/api/http.js'
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>角色管理</title>
|
||||
{% include 'common/header.html' %}</head>
|
||||
{% include 'admin/common/header.html' %}</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
@@ -34,6 +34,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<form id="add_view" class="layui-form" action="" style="display: none">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
@@ -86,6 +87,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/html" id="role-toolbar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
@@ -113,7 +115,7 @@
|
||||
<input type="checkbox" name="enable" value="{{ "{{d.id}}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="role-enable" {{ "{{# if(d.enable==1){ }} checked {{# } }}" }}>
|
||||
</script>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { ROLE_API } from '/static/api/http.js'
|
||||
|
||||
@@ -131,8 +133,8 @@
|
||||
{ title: '描述', field: 'details', align: 'center' },
|
||||
{ title: '是否可用', field: 'enable', align: 'center', templet: '#role-enable' },
|
||||
{ title: '排序', field: 'sort', align: 'center' },
|
||||
{ title: '操作', toolbar: '#role-bar', align: 'center', width: 195 }
|
||||
]
|
||||
{ title: '操作', toolbar: '#role-bar', align: 'center', width: 195 },
|
||||
],
|
||||
]
|
||||
|
||||
table.render({
|
||||
@@ -142,10 +144,11 @@
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: '#role-toolbar',
|
||||
defaultToolbar: [{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports']
|
||||
defaultToolbar: [
|
||||
{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
}, 'filter', 'print', 'exports'],
|
||||
})
|
||||
|
||||
table.on('tool(role-table)', function (obj) {
|
||||
@@ -194,18 +197,17 @@
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
let add_index
|
||||
window.add = function () {
|
||||
add_index = layer.open({
|
||||
type: 1,
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['500px', '500px'],
|
||||
content: $('#add_view')
|
||||
content: '/admin/role/add',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -215,7 +217,7 @@
|
||||
title: '授权',
|
||||
shade: 0.1,
|
||||
area: ['320px', '400px'],
|
||||
content: '/admin/role/power/' + obj.data['id']
|
||||
content: '/admin/role/power/' + obj.data['id'],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -225,7 +227,7 @@
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['500px', '500px'],
|
||||
content: '/admin/role/edit/' + obj.data['id']
|
||||
content: '/admin/role/edit/' + obj.data['id'],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -246,7 +248,7 @@
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -256,7 +258,7 @@
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
})
|
||||
return false
|
||||
}
|
||||
@@ -271,7 +273,7 @@
|
||||
console.log(ids)
|
||||
layer.confirm('确定要删除选中角色', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
title: '提示',
|
||||
}, function (index) {
|
||||
layer.close(index)
|
||||
let loading = layer.load()
|
||||
@@ -290,7 +292,7 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -299,28 +301,6 @@
|
||||
table.reload('role-table')
|
||||
}
|
||||
|
||||
{#添加数据逻辑#}
|
||||
form.on('submit(role-save)', function (data) {
|
||||
$.ajax({
|
||||
url: ROLE_API.ROLE(0),
|
||||
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 () {
|
||||
// TODO 关闭不了页面 flask-restful 拦截的错误信息没有提示
|
||||
layer.close(add_index) // 关闭当前页
|
||||
layui.table.reload('role-table')
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
}
|
||||
})
|
||||
return false
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</html>
|
||||
@@ -0,0 +1,92 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>角色新增</title>
|
||||
{% include 'admin/common/header.html' %}</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<div class="main-container">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="roleName" 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="roleCode" 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="enable" value="0" title="开启">
|
||||
<input type="radio" name="enable" value="1" title="关闭" checked>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">排序</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="sort" 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"></textarea>
|
||||
</div>
|
||||
</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="role-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>
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { ROLE_API } from '/static/api/http.js'
|
||||
|
||||
layui.use(['form', 'jquery'], function () {
|
||||
let form = layui.form
|
||||
let $ = layui.jquery
|
||||
|
||||
form.on('submit(role-save)', function (data) {
|
||||
$.ajax({
|
||||
url: ROLE_API.ROLE(0),
|
||||
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('role-table')
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>角色编辑</title>
|
||||
{% include 'common/header.html' %}</head>
|
||||
{% include 'admin/common/header.html' %}</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
@@ -70,7 +70,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
</body>
|
||||
<script type="module">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>角色授权</title>
|
||||
{% include 'common/header.html' %}</head>
|
||||
{% include 'admin/common/header.html' %}</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
<div class="mainBox">
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
|
||||
import { ROLE_API } from '/static/api/http.js'
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>个人中心</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
<style>
|
||||
.layui-form-item {
|
||||
margin-top: 17px !important;
|
||||
@@ -179,7 +179,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
</body>
|
||||
|
||||
<form id="edit_password_view" class="layui-form" action="" style="display: none">
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>头像上传</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
<div class="layui-row layui-col-space15">
|
||||
@@ -35,7 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { USER_API } from '/static/api/http.js'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>用户管理</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/user.css') }}"/>
|
||||
</head>
|
||||
<body class="pear-container">
|
||||
@@ -93,54 +93,7 @@
|
||||
{{ ' {{layui.util.toDateString(d.update_at, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
|
||||
{% include 'common/footer.html' %}
|
||||
|
||||
<form class="layui-form" style="display: none" id="add_user_view" lay-filter="add_form">
|
||||
<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" 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" 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" autocomplete="off" placeholder="请输入标题"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色</label>
|
||||
<div class="layui-input-block" id="add_role_ids">
|
||||
</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="add-user-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>
|
||||
{% include 'admin/common/footer.html' %}
|
||||
|
||||
<script type="module">
|
||||
import { USER_API, ROLE } from '/static/api/http.js'
|
||||
@@ -163,8 +116,8 @@
|
||||
{ title: '启用', field: 'enable', align: 'center', templet: '#user-enable', width: 120 },
|
||||
{ title: '注册时间', field: 'create_at', templet: '#user-createTime', align: 'center' },
|
||||
{ title: '更新时间', field: 'update_at', templet: '#user-updateTime', align: 'center' },
|
||||
{ title: '操作', toolbar: '#user-bar', align: 'center', width: 130 }
|
||||
]
|
||||
{ title: '操作', toolbar: '#user-bar', align: 'center', width: 130 },
|
||||
],
|
||||
]
|
||||
|
||||
// 渲染表格数据
|
||||
@@ -177,7 +130,7 @@
|
||||
height: 'full-148',
|
||||
toolbar: '#user-toolbar', /*工具栏*/
|
||||
text: { none: '暂无人员信息' },
|
||||
defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'] /*默认工具栏*/
|
||||
defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'], /*默认工具栏*/
|
||||
})
|
||||
|
||||
// 公司部门树状图菜单
|
||||
@@ -267,63 +220,17 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
form.on('submit(add-user-save)', function (data) {
|
||||
let roleIds = ''
|
||||
$('input[type=checkbox]:checked').each(function () {
|
||||
roleIds += $(this).val() + ','
|
||||
})
|
||||
roleIds = roleIds.substr(0, roleIds.length - 1)
|
||||
data.field.roleIds = roleIds
|
||||
|
||||
$.ajax({
|
||||
url: USER_API.USERS(),
|
||||
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 () {
|
||||
// TODO 无法关闭当前页
|
||||
layer.close(layer.index) //关闭当前页
|
||||
layui.table.reload('user-table')
|
||||
// 重置表单
|
||||
form.val('add_form', {
|
||||
'username': '' // "name": "value"
|
||||
, 'realName': ''
|
||||
, 'password': ''
|
||||
})
|
||||
})
|
||||
form.render()
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
}
|
||||
})
|
||||
return false
|
||||
})
|
||||
|
||||
window.add = function () {
|
||||
ROLE.get_roles().then(function (result) {
|
||||
let role = $('#add_role_ids')
|
||||
$('#add_role_ids input').remove()
|
||||
$('#add_role_ids div').remove()
|
||||
result['data'].forEach(function (item) {
|
||||
role.append(`<input value="${item.id}" title="${item.roleName}" type="checkbox" name="roleIds" lay-skin="primary">`)
|
||||
})
|
||||
form.render('checkbox')
|
||||
})
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
type: 2,
|
||||
title: '新增',
|
||||
shade: 0.1,
|
||||
area: ['550px', '550px'],
|
||||
content: $('#add_user_view')
|
||||
content: '/users/add',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -333,7 +240,7 @@
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['550px', '500px'],
|
||||
content: '/users/' + obj.data['id']
|
||||
content: '/users/' + obj.data['id'],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -354,7 +261,7 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -364,7 +271,7 @@
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
icon: 3,
|
||||
time: 1000
|
||||
time: 1000,
|
||||
})
|
||||
return false
|
||||
}
|
||||
@@ -379,7 +286,7 @@
|
||||
{#console.log(ids);#}
|
||||
layer.confirm('确定要删除选中角色', {
|
||||
icon: 3,
|
||||
title: '提示'
|
||||
title: '提示',
|
||||
}, function (index) {
|
||||
layer.close(index)
|
||||
let loading = layer.load()
|
||||
@@ -398,7 +305,7 @@
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>用户管理</title>
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form">
|
||||
<div class="mainBox">
|
||||
<div class="main-container">
|
||||
<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" 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="password" 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">
|
||||
|
||||
{% for role in roles %}
|
||||
<input
|
||||
value="{{ role.id }}" title="{{ role.name }}" type="checkbox"
|
||||
name="roleIds" lay-skin="primary">
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</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="user-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>
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { USER_API } from '/static/api/http.js'
|
||||
|
||||
layui.use(['form', 'jquery'], function () {
|
||||
let form = layui.form
|
||||
let $ = layui.jquery
|
||||
form.on('submit(user-save)', function (data) {
|
||||
let roleIds = ''
|
||||
$('input[type=checkbox]:checked').each(function () {
|
||||
roleIds += $(this).val() + ','
|
||||
})
|
||||
roleIds = roleIds.substr(0, roleIds.length - 1)
|
||||
data.field.roleIds = roleIds
|
||||
|
||||
$.ajax({
|
||||
url: USER_API.USERS(),
|
||||
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('user-table')
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.msg, { icon: 2, time: 1000 })
|
||||
}
|
||||
},
|
||||
})
|
||||
return false
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,7 +3,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>用户编辑</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
</head>
|
||||
<body>
|
||||
<form class="layui-form" action="">
|
||||
@@ -68,7 +68,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { USER_API } from '/static/api/http.js'
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<div class="loader"></div>
|
||||
</div>
|
||||
<!-- 依 赖 脚 本 -->
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script>
|
||||
layui.use(['admin', 'jquery', 'layer', 'popup'], function () {
|
||||
let admin = layui.admin
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script>
|
||||
layui.use(['form', 'jquery', 'layer', 'button', 'popup'], function () {
|
||||
let form = layui.form
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>首页</title>
|
||||
{% include 'common/header.html' %}
|
||||
{% include 'admin/common/header.html' %}
|
||||
<link rel="stylesheet" href="/static/admin/admin/css/other/console1.css"/>
|
||||
|
||||
<!-- 主 题 更 换 -->
|
||||
@@ -291,7 +291,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!--</div>-->
|
||||
{% include 'common/footer.html' %}
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script>
|
||||
layui.use(['layer', 'echarts', 'element', 'count'], function () {
|
||||
var $ = layui.jquery,
|
||||
|
||||
Reference in New Issue
Block a user