更新资源管理界面

pull/65/head
fengshuonan 4 years ago
parent f6556c0637
commit a82021ab9b

@ -0,0 +1,41 @@
package cn.stylefeng.guns.modular.resource;
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
/**
*
*
* @author fengshuonan
* @date 2021/1/8 21:59
*/
@Controller
@Slf4j
@ApiResource(name = "资源管理界面")
public class ResourceViewController {
/**
*
*
* @author fengshuonan
* @date 2021/1/8 21:59
*/
@GetResource(name = "资源管理首页", path = "/view/resource")
public String resourceIndex() {
return "/modular/auth/resource/resource.html";
}
/**
*
*
* @author fengshuonan
* @date 2021/1/8 22:23
*/
@GetResource(name = "资源管理详情", path = "/view/resource/detail")
public String resourceDetail() {
return "/modular/auth/resource/resource_detail.html";
}
}

@ -0,0 +1,108 @@
layui.use(['table', 'HttpRequest', 'func'], function () {
var $ = layui.$;
var table = layui.table;
var func = layui.func;
/**
* 资源管理配置
*/
var Resource = {
tableId: "resourceTable",
condition: {
appCode: "",
resourceName: ""
}
};
/**
* 初始化表格的列
*/
Resource.initColumn = function () {
return [[
{type: 'checkbox'},
{field: 'resourceId', hide: true, title: '资源id'},
{field: 'resourceName', align: "center", sort: true, title: '资源名称'},
{field: 'resourceCode', align: "center", sort: true, title: '资源编码'},
{field: 'modularName', align: "center", sort: true, title: '模块名称'},
{
field: 'viewFlag', align: "center", sort: true, title: '是否是视图', templet: function (data) {
if (data.viewFlag === 'Y') {
return '是';
} else {
return '否';
}
}
},
{field: 'url', align: "center", sort: true, title: '请求url'},
{field: 'httpMethod', align: "center", sort: true, title: 'http方法'},
{
field: 'requiredLoginFlag', align: "center", sort: true, title: '需要登录', templet: function (data) {
if (data.requiredLoginFlag === 'Y') {
return '是';
} else {
return '否';
}
}
},
{
field: 'requiredPermissionFlag', align: "center", sort: true, title: '需要权限验证', templet: function (data) {
if (data.requiredPermissionFlag === 'Y') {
return '是';
} else {
return '否';
}
}
},
{align: 'center', toolbar: '#tableBar', title: '操作'}
]];
};
/**
* 点击查询按钮
*/
Resource.search = function () {
var queryData = {};
queryData['resourceName'] = $("#resourceName").val();
queryData['url'] = $("#url").val();
table.reload(Resource.tableId, {
where: queryData, page: {curr: 1}
});
};
/**
* 资源详情对话框
*
* @param data 点击按钮时候的行数据
*/
Resource.openDetailDlg = function (data) {
func.open({
height: 500,
title: '资源详情',
content: Feng.ctxPath + '/view/resource/detail?resourceId=' + data.resourceId,
tableId: Resource.tableId
});
};
// 渲染表格
var tableResult = table.render({
elem: '#' + Resource.tableId,
url: Feng.ctxPath + '/resource/pageList',
page: true,
height: "full-98",
cellMinWidth: 100,
request: {pageName: 'pageNo', limitName: 'pageSize'},
parseData: Feng.parseData,
cols: Resource.initColumn()
});
// 工具条点击事件
table.on('tool(' + Resource.tableId + ')', function (obj) {
var data = obj.data;
var layEvent = obj.event;
if (layEvent === 'detail') {
Resource.openDetailDlg(data);
}
});
});

@ -0,0 +1,35 @@
@layout("/layout/_container.html",{js:["/assets/modular/auth/resource/resource.js"]}){
<div class="layui-body-header">
<span class="layui-body-header-title">资源管理</span>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form toolbar">
<div class="layui-form-item">
<div class="layui-inline">
<input id="resourceName" class="layui-input" type="text" placeholder="资源名称"/>
</div>
<div class="layui-inline">
<input id="url" class="layui-input" type="text" placeholder="资源url"/>
</div>
<div class="layui-inline">
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
</div>
</div>
</div>
<table class="layui-table" id="resourceTable" lay-filter="resourceTable"></table>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
</script>
@}

@ -0,0 +1,35 @@
@layout("/layout/_container.html",{js:["/assets/modular/auth/resource/resource.js"]}){
<div class="layui-body-header">
<span class="layui-body-header-title">资源管理</span>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form toolbar">
<div class="layui-form-item">
<div class="layui-inline">
<input id="resourceName" class="layui-input" type="text" placeholder="资源名称"/>
</div>
<div class="layui-inline">
<input id="url" class="layui-input" type="text" placeholder="资源url"/>
</div>
<div class="layui-inline">
<button id="btnSearch" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
</div>
</div>
</div>
<table class="layui-table" id="resourceTable" lay-filter="resourceTable"></table>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
</script>
@}
Loading…
Cancel
Save