wip(semantic):调整模板文件内容
This commit is contained in:
@@ -179,8 +179,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'admin/common/footer.html' %}
|
||||
</body>
|
||||
|
||||
<form id="edit_password_view" class="layui-form" action="" style="display: none">
|
||||
<div class="mainBox">
|
||||
@@ -233,6 +231,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
|
||||
<script type="module">
|
||||
import { USER_API } from '/static/api/http.js'
|
||||
|
||||
@@ -311,4 +313,5 @@
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<input type="text" hidden value="{{ current_user.id }}" id="user_id">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
<script type="module">
|
||||
import { USER_API } from '/static/api/http.js'
|
||||
@@ -126,4 +126,6 @@
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -46,55 +46,53 @@
|
||||
<div class="user-main user-collasped">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<table id="user-table" lay-filter="user-table"></table>
|
||||
<table id="tables" lay-filter="tables"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
|
||||
{# 表格操作 #}
|
||||
<script type="text/html" id="user-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="pear-icon pear-icon-add"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
|
||||
<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="collasped">
|
||||
<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-bar">
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="pear-icon pear-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="pear-icon pear-icon-edit"></i>
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
|
||||
class="pear-icon pear-icon-ashbin"></i>
|
||||
<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-enable">
|
||||
<script type="text/html" id="tool-switch">
|
||||
<input type="checkbox" name="enable" value="{{ "{{ d.id }}" }}" lay-skin="switch" lay-text="启用|禁用"
|
||||
lay-filter="user-enable"
|
||||
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>
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
|
||||
<script type="module">
|
||||
import { USER_API, ROLE } from '/static/api/http.js'
|
||||
|
||||
@@ -113,22 +111,22 @@
|
||||
{ title: '姓名', field: 'realname', align: 'center', width: 110 },
|
||||
{ title: '账号', field: 'username', align: 'center' },
|
||||
{ title: '部门', field: 'dept', align: 'center' },
|
||||
{ title: '启用', field: 'enable', align: 'center', templet: '#user-enable', width: 120 },
|
||||
{ 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: '#user-bar', align: 'center', width: 130 },
|
||||
{ title: '操作', toolbar: '#tool', align: 'center', width: 130 },
|
||||
],
|
||||
]
|
||||
|
||||
// 渲染表格数据
|
||||
table.render({
|
||||
elem: '#user-table',
|
||||
elem: '#tables',
|
||||
url: USER_API.USERS(),
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
height: 'full-148',
|
||||
toolbar: '#user-toolbar', /*工具栏*/
|
||||
toolbar: '#toolbar', /*工具栏*/
|
||||
text: { none: '暂无人员信息' },
|
||||
defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'], /*默认工具栏*/
|
||||
})
|
||||
@@ -172,22 +170,22 @@
|
||||
window.refresh(field)
|
||||
})
|
||||
|
||||
table.on('tool(user-table)', function (obj) {
|
||||
if (obj.event === 'remove') {
|
||||
window.remove(obj)
|
||||
} else if (obj.event === 'edit') {
|
||||
window.edit(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)
|
||||
}
|
||||
})
|
||||
|
||||
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 === 'collasped') {
|
||||
} 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()
|
||||
@@ -199,7 +197,7 @@
|
||||
return false
|
||||
})
|
||||
|
||||
form.on('switch(user-enable)', function (obj) {
|
||||
form.on('switch(tool-switch)', function (obj) {
|
||||
let operate
|
||||
if (obj.elem.checked) {
|
||||
operate = 1
|
||||
@@ -224,7 +222,7 @@
|
||||
})
|
||||
})
|
||||
|
||||
window.add = function () {
|
||||
window.toolbar_add = function () {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '新增',
|
||||
@@ -233,40 +231,7 @@
|
||||
content: '/users/add',
|
||||
})
|
||||
}
|
||||
|
||||
window.edit = function (obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['550px', '500px'],
|
||||
content: '/users/' + obj.data['id'],
|
||||
})
|
||||
}
|
||||
|
||||
window.remove = function (obj) {
|
||||
layer.confirm('确定要删除该用户', { icon: 3, title: '提示' }, function (index) {
|
||||
layer.close(index)
|
||||
let loading = layer.load()
|
||||
$.ajax({
|
||||
url: USER_API.USER(obj.data['id']),
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function (result) {
|
||||
layer.close(loading)
|
||||
if (result.success) {
|
||||
popup.success(result.msg, function () {
|
||||
obj.del()
|
||||
})
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
window.batchRemove = function (obj) {
|
||||
window.toolbar_remove = function (obj) {
|
||||
let data = table.checkStatus(obj.config.id).data
|
||||
if (data.length === 0) {
|
||||
layer.msg('未选中数据', {
|
||||
@@ -276,7 +241,7 @@
|
||||
return false
|
||||
}
|
||||
var ids = []
|
||||
var hasCheck = table.checkStatus('user-table')
|
||||
var hasCheck = table.checkStatus('tables')
|
||||
var hasCheckData = hasCheck.data
|
||||
if (hasCheckData.length > 0) {
|
||||
$.each(hasCheckData, function (index, element) {
|
||||
@@ -309,10 +274,42 @@
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
window.refresh = function (param) {
|
||||
table.reload('user-table', { where: 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: USER_API.USER(obj.data['id']),
|
||||
dataType: 'json',
|
||||
type: 'delete',
|
||||
success: function (result) {
|
||||
layer.close(loading)
|
||||
if (result.success) {
|
||||
popup.success(result.msg, function () {
|
||||
obj.del()
|
||||
})
|
||||
} else {
|
||||
popup.failure(result.msg)
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
window.tool_edit = function (obj) {
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '修改',
|
||||
shade: 0.1,
|
||||
area: ['550px', '500px'],
|
||||
content: '/users/' + obj.data['id'],
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -12,21 +12,21 @@
|
||||
<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="请输入标题"
|
||||
<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="请输入标题"
|
||||
<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="请输入标题"
|
||||
<input type="text" name="password" lay-verify="title" autocomplete="off" placeholder="请输入密码"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,21 +14,21 @@
|
||||
<label class="layui-form-label">编号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" value="{{ user.id }}" name="userId" lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
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" value="{{ user.username }}" name="username" lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题" class="layui-input">
|
||||
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" value="{{ user.realname }}" name="realName" lay-verify="title"
|
||||
autocomplete="off" placeholder="请输入标题"
|
||||
autocomplete="off" placeholder="请输入姓名"
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
@@ -68,7 +68,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
{% include 'admin/common/footer.html' %}
|
||||
|
||||
<script type="module">
|
||||
import { USER_API } from '/static/api/http.js'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user