diff --git a/src/main/java/cn/stylefeng/guns/modular/resource/ResourceViewController.java b/src/main/java/cn/stylefeng/guns/modular/resource/ResourceViewController.java new file mode 100644 index 00000000..afe96694 --- /dev/null +++ b/src/main/java/cn/stylefeng/guns/modular/resource/ResourceViewController.java @@ -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"; + } + +} diff --git a/src/main/webapp/assets/modular/auth/resource/resource.js b/src/main/webapp/assets/modular/auth/resource/resource.js new file mode 100644 index 00000000..168b2c53 --- /dev/null +++ b/src/main/webapp/assets/modular/auth/resource/resource.js @@ -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); + } + }); + +}); diff --git a/src/main/webapp/pages/modular/auth/resource/resource.html b/src/main/webapp/pages/modular/auth/resource/resource.html new file mode 100644 index 00000000..ab579c2d --- /dev/null +++ b/src/main/webapp/pages/modular/auth/resource/resource.html @@ -0,0 +1,35 @@ +@layout("/layout/_container.html",{js:["/assets/modular/auth/resource/resource.js"]}){ + +