fix(issues):修改bug
This commit is contained in:
+16
-23
@@ -34,26 +34,6 @@
|
||||
</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>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-sm" 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-danger pear-btn-sm" lay-event="remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
</script>
|
||||
<script type="text/html" id="file-uploadTime">
|
||||
{{ ' {{layui.util.toDateString(d.create_time, "yyyy-MM-dd HH:mm:ss")}' |safe }}}
|
||||
</script>
|
||||
|
||||
{% include 'common/footer.html' %}
|
||||
<script type="module">
|
||||
import { FILE_API } from '/static/api/http.js'
|
||||
@@ -108,13 +88,17 @@
|
||||
{
|
||||
field: 'create_time',
|
||||
title: '创建时间',
|
||||
templet: '#file-uploadTime',
|
||||
templet: (d) => `${layui.util.toDateString(d.create_time, 'yyyy-MM-dd HH:mm:ss')}`,
|
||||
unresize: true,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
toolbar: '#user-bar',
|
||||
toolbar: (d) => {
|
||||
return `<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
</button>`
|
||||
},
|
||||
align: 'center',
|
||||
unresize: true,
|
||||
width: 200
|
||||
@@ -128,7 +112,16 @@
|
||||
page: true,
|
||||
cols: cols,
|
||||
skin: 'line',
|
||||
toolbar: '#toolbar',
|
||||
toolbar: (d) => {
|
||||
return `<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
<button class="pear-btn pear-btn-sm" lay-event="batchRemove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>`
|
||||
},
|
||||
defaultToolbar: [{
|
||||
layEvent: 'refresh',
|
||||
icon: 'layui-icon-refresh',
|
||||
|
||||
+28
-44
@@ -35,49 +35,23 @@
|
||||
|
||||
|
||||
<script type="text/html" id="power-toolbar">
|
||||
{% if authorize("admin:power:add") %}
|
||||
<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
|
||||
<i class="layui-icon layui-icon-add-1"></i>
|
||||
新增
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if authorize("admin:role:remove") %}
|
||||
<button class="pear-btn pear-btn-md" lay-event="batchRemove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
{% endif %}
|
||||
<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-md" lay-event="batchRemove">
|
||||
<i class="layui-icon layui-icon-delete"></i>
|
||||
删除
|
||||
</button>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="power-bar">
|
||||
{% if authorize("admin:role:edit") %}
|
||||
<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i
|
||||
class="layui-icon layui-icon-edit"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
{% if authorize("admin:role:remove") %}
|
||||
<button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
|
||||
class="layui-icon layui-icon-delete"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
</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="icon">
|
||||
<i class="layui-icon {{ "{{d.icon}}" }}"></i>
|
||||
<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>
|
||||
|
||||
|
||||
@@ -190,12 +164,22 @@
|
||||
[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'powerName', minWidth: 200, title: '权限名称' },
|
||||
{ field: 'icon', title: '图标', templet: '#icon' },
|
||||
{ field: 'powerType', title: '权限类型', templet: '#power-type' },
|
||||
{ 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="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: '排序' },
|
||||
@@ -253,7 +237,7 @@
|
||||
}
|
||||
})
|
||||
|
||||
form.on('switch(power-enable)', function (obj) {
|
||||
form.on('switch(power_enable)', function (obj) {
|
||||
let operate
|
||||
if (obj.elem.checked) {
|
||||
operate = 1 /*启用*/
|
||||
|
||||
Reference in New Issue
Block a user