【JSON2WEB】11 基于 Amis 角色功能权限设置页面

【JSON2WEB】01 WEB管理信息系统架构设计

【JSON2WEB】02 JSON2WEB初步UI设计

【JSON2WEB】03 go的模板包html/template的使用

【JSON2WEB】04 amis低代码前端框架介绍

【JSON2WEB】05 前端开发三件套 HTML CSS JavaScript 速成

【JSON2WEB】06 JSON2WEB前端框架搭建

【JSON2WEB】07 Amis可视化设计器CRUD增删改查

【JSON2WEB】08 Amis的事件和校验

【JSON2WEB】09 Amis-editor的代码移植到json2web

【JSON2WEB】10 基于 Amis 做个登录页面login.html


1 角色功能权限设置设计

页面分2栏,左边角色,右边为角色功能权限。角色授权保存在数据库表中。

1.1 页面布局

角色功能
角色列表功能列表

1.2 角色表

-- Create table
create table S_ROLE
(p_id       VARCHAR2(17) not null,s_name     VARCHAR2(52),s_note     VARCHAR2(52),time_stamp TIMESTAMP(6) default CURRENT_TIMESTAMP
)

1.3 功能表

-- Create table
create table S_MENU
(p_id    VARCHAR2(4) not null,s_name  VARCHAR2(63),s_ename VARCHAR2(63),s_winp  VARCHAR2(63),s_note  VARCHAR2(63),s_parm  VARCHAR2(63)
)

1.4 角色功能权限关系表

-- Create table
create table S_ROLE_MENU
(pf_role    VARCHAR2(17) not null,pf_menu    VARCHAR2(17) not null,time_stamp TIMESTAMP(6) default CURRENT_TIMESTAMP
)

1.5 角色功能视图

用于功能列表显示与操作。

create or replace view 
role_menu_v -- 角色功能视图
as
select m.p_id as m_id,m.s_name ,s.pf_role,r.p_id as r_id,decode(length(s.pf_role),4,1,0) as b_ynfrom s_menu m
cross join s_role r --先做一个角色与功能的笛卡尔交叉,再连接角色功能表
left join s_role_menu s on s.pf_menu = m.p_id and s.pf_role = r.p_id
order by r.p_id,m.p_id;

授权的功能b_yn = 1
在这里插入图片描述

2 页面布局与设计

布局容器用分栏,角色及功能权限用2个增删改查crud。
在这里插入图片描述

2.1 角色crud增加行点击事件

行点击时刷新角色功能的数据。
在这里插入图片描述

 "onEvent": {"rowClick": {"weight": 0,"actions": [{"componentId": "u:1f6f2d0609fc","ignoreError": false,"actionType": "reload","dataMergeMode": "override","data": {"where": "r_id='$event.data.item.P_ID'"}}]}}

Data为我的后台查询条件,就是url上query条件。

2.2 勾选事件

勾选列定义2个值变化事件,勾选插入数据,去勾删除数据。
在这里插入图片描述

插入数据事件

勾选时执行。
在这里插入图片描述

 "actions": [{"ignoreError": false,"outputVar": "responseResult","actionType": "ajax","options": {},"api": {"url": "http://127.0.0.1:5217/rest/s_role_menu/","method": "post","requestAdaptor": "","adaptor": "","messages": {},"sendOn": "","data": {"pf_role": "${R_ID}","pf_menu": "${M_ID}"}},"expression": "${event.data.value === 1}","stopPropagation": "${event.data.value===0}"},

删除数据事件

去勾时执行。
在这里插入图片描述

{"ignoreError": false,"outputVar": "responseResult","actionType": "ajax","options": {},"api": {"url": "http://127.0.0.1:5217/rest/s_role_menu/?where=pf_role='${R_ID}' and pf_menu='${M_ID}'","method": "delete","requestAdaptor": "","adaptor": "","messages": {}},"expression": "${event.data.value===0}","stopPropagation": "${event.data.value===1}"}

2.2 角色功能crud设置

接口初始化是不拉取数据。
在这里插入图片描述

2.3 页面全部代码

{"type": "page","title": "角色功能权限设置","body": [{"type": "grid","columns": [{"body": [{"id": "u:091b9d57f777","type": "crud","mode": "table","syncLocation": false,"primaryField": "P_ID","api": {"url": "http://127.0.0.1:5217/rest/s_role","method": "get"},"headerToolbar": [{"type": "button","id": "u:16551379d280","label": "新增","actionType": "drawer","level": "primary","editorSetting": {"behavior": "create"},"drawer": {"title": "新增","body": [{"type": "form","api": {"method": "post","url": "http://127.0.0.1:5217/rest/s_role","requestAdaptor": "","adaptor": "","messages": {}},"body": [{"type": "input-text","name": "p_id","label": "P_ID","id": "u:4d1b8b17dd50","required": true},{"type": "input-text","name": "s_name","label": "角色名称","id": "u:8cc7cb12757f","required": true},{"type": "input-text","name": "s_note","label": "备注","id": "u:2b9c33a07acf"}],"id": "u:f58f36c84f4c","actions": [{"type": "submit","label": "提交","primary": true}],"feat": "Insert","dsType": "api"}],"id": "u:747ffedb9a7c","actions": [{"type": "button","actionType": "cancel","label": "取消","id": "u:ceb03306d65f"},{"type": "button","actionType": "confirm","label": "确定","primary": true,"id": "u:3d9c4d86cfb2"}]},"icon": "fa fa-plus"},{"type": "export-excel","id": "u:5d48d559aa25"},{"type": "bulk-actions"}],"columns": [{"type": "text","name": "P_ID","id": "u:bbe6028ae0c5","label": "角色ID","searchable": true,"visible": true,"placeholder": "-"},{"type": "text","name": "S_NAME","id": "u:12be864daeab","placeholder": "-","label": "名称","searchable": true,"toggled": true,"fixed": "","className": ""},{"type": "datetime","name": "TIME_STAMP","id": "u:6bace394776e","label": "更新时间","format": "YYYY-MM-DD HH:mm:ss"},{"type": "text","name": "S_NOTE","id": "u:db13008a4821","label": "备注"},{"type": "operation","label": "操作","buttons": [{"label": "编辑","type": "button","actionType": "drawer","level": "link","editorSetting": {"behavior": "update"},"id": "u:2d2b520123cf","drawer": {"title": "编辑","body": [{"type": "form","api": {"method": "put","url": "http://127.0.0.1:5217/rest/s_role/?where=p_id='${P_ID}'","requestAdaptor": "","adaptor": "","messages": {}},"body": [{"name": "P_ID","label": "P_ID","type": "input-text","id": "u:2593d30c1ccb","required": true},{"label": "角色名称","name": "S_NAME","type": "input-text","id": "u:36fb4cfb08d6","showCounter": false,"required": true},{"label": "备注","name": "S_NOTE","type": "input-text","id": "u:d154d931e0a3"}],"id": "u:987f23c51645","actions": [{"type": "submit","label": "提交","primary": true}],"feat": "Insert","dsType": "api"}],"id": "u:7c6e61a902ce","actions": [{"type": "button","actionType": "cancel","label": "取消","id": "u:780ad561efc1"},{"type": "button","actionType": "confirm","label": "确定","primary": true,"id": "u:45527a149fd6"}]}},{"label": "查看","type": "button","actionType": "drawer","level": "link","editorSetting": {"behavior": "view"},"id": "u:e2047bc65d6b","drawer": {"title": "查看详情","body": [{"type": "form","api": "xxx/update","body": [{"name": "P_ID","label": "P_ID","type": "static","id": "u:08156f086042","quickEdit": false,"popOver": false,"copyable": false},{"label": "角色名称","name": "S_NAME","type": "static","id": "u:487232bc451c","quickEdit": false,"popOver": false,"copyable": false},{"label": "更新时间","name": "TIME_STAMP","type": "static-datetime","id": "u:aba51eac1e1c","quickEdit": false,"popOver": false,"copyable": false,"format": "YYYY-MM-DD HH:mm:ss"},{"label": "备注","name": "S_NOTE","type": "static","id": "u:60c73035a649","quickEdit": false,"popOver": false,"copyable": false}],"id": "u:929916bb02e0","actions": [{"type": "submit","label": "提交","primary": true}],"feat": "Insert"}],"id": "u:34c165044747","actions": [{"type": "button","actionType": "cancel","label": "取消","id": "u:62278f468936"},{"type": "button","actionType": "confirm","label": "确定","primary": true,"id": "u:38c71e71e647"}]}},{"type": "button","label": "删除","actionType": "ajax","level": "link","className": "text-danger","confirmText": "确定要删除?","api": {"method": "delete","url": "http://127.0.0.1:5217/rest/s_role/?where=p_id='${P_ID}'"},"editorSetting": {"behavior": "delete"},"id": "u:c08fb59a9328","onEvent": {"click": {"weight": 0,"actions": []}}}],"id": "u:ea0dc035e0ec"}],"loadDataOnce": true,"showHeader": true,"bulkActions": [],"itemActions": [],"perPageAvailable": [10],"messages": {},"autoGenerateFilter": {"columnsNum": 2,"showBtnToolbar": true},"matchFunc": "","title": "","showFooter": true,"visible": true,"dsType": "api","editorSetting": {"mock": {"enable": true,"maxDisplayRows": 5}},"onEvent": {"rowClick": {"weight": 0,"actions": [{"componentId": "u:1f6f2d0609fc","ignoreError": false,"actionType": "reload","dataMergeMode": "override","data": {"where": "r_id='$event.data.item.P_ID'"}}]}}}],"id": "u:18b68e993a8d","themeCss": {"baseControlClassName": {"border:default": {"top-border-style": "var(--borders-style-2)","left-border-style": "var(--borders-style-2)","right-border-style": "var(--borders-style-2)","bottom-border-style": "var(--borders-style-2)","right-border-width": "var(--borders-width-3)","top-border-width": "var(--borders-width-3)","left-border-width": "var(--borders-width-3)","bottom-border-width": "var(--borders-width-3)"},"padding-and-margin:default": {"marginTop": "var(--sizes-size-5)","marginRight": "var(--sizes-size-5)","marginBottom": "var(--sizes-size-5)","marginLeft": "var(--sizes-size-5)","paddingTop": "var(--sizes-size-5)","paddingRight": "var(--sizes-size-5)","paddingBottom": "var(--sizes-size-5)","paddingLeft": "var(--sizes-size-5)"}}},"md": 6},{"id": "u:d0513919f0fb","md": 6,"body": [{"id": "u:1f6f2d0609fc","type": "crud","mode": "table2","dsType": "api","syncLocation": true,"primaryField": "pf_role,pf_menu","loadType": "pagination","api": {"url": "http://127.0.0.1:5217/rest/role_menu_v/","method": "get","requestAdaptor": "","adaptor": "","messages": {}},"headerToolbar": [{"type": "flex","direction": "row","justify": "flex-start","alignItems": "stretch","style": {"position": "static"},"items": [{"type": "container","align": "left","behavior": ["Insert","BulkEdit","BulkDelete"],"body": [],"wrapperBody": false,"style": {"flexGrow": 1,"flex": "1 1 auto","position": "static","display": "flex","flexBasis": "auto","flexDirection": "row","flexWrap": "nowrap","alignItems": "stretch","justifyContent": "flex-start"},"id": "u:bef09c369eab"},{"type": "container","align": "right","behavior": ["FuzzyQuery"],"body": [],"wrapperBody": false,"style": {"flexGrow": 1,"flex": "1 1 auto","position": "static","display": "flex","flexBasis": "auto","flexDirection": "row","flexWrap": "nowrap","alignItems": "stretch","justifyContent": "flex-end"},"id": "u:b86c79951137"}],"id": "u:2259c57591f9"}],"footerToolbar": [{"type": "flex","direction": "row","justify": "flex-start","alignItems": "stretch","style": {"position": "static"},"items": [{"type": "container","align": "left","body": [],"wrapperBody": false,"style": {"flexGrow": 1,"flex": "1 1 auto","position": "static","display": "flex","flexBasis": "auto","flexDirection": "row","flexWrap": "nowrap","alignItems": "stretch","justifyContent": "flex-start"},"id": "u:950df6025af1"},{"type": "container","align": "right","body": [{"type": "pagination","behavior": "Pagination","layout": ["total","perPage","pager"],"perPage": 999,"perPageAvailable": [10,20,50,100],"align": "right","id": "u:cf75f0430847","size": ""}],"wrapperBody": false,"style": {"flexGrow": 1,"flex": "1 1 auto","position": "static","display": "flex","flexBasis": "auto","flexDirection": "row","flexWrap": "nowrap","alignItems": "stretch","justifyContent": "flex-end"},"id": "u:cbf1a9ad79d2"}],"id": "u:3052aef717a9"}],"columns": [{"type": "checkbox","title": "勾选授权","name": "B_YN","id": "u:26ec6ff796a9","placeholder": "-","align": "center","trueValue": 1,"falseValue": 0,"onEvent": {"change": {"weight": 0,"actions": [{"ignoreError": false,"outputVar": "responseResult","actionType": "ajax","options": {},"api": {"url": "http://127.0.0.1:5217/rest/s_role_menu/","method": "post","requestAdaptor": "","adaptor": "","messages": {},"sendOn": "","data": {"pf_role": "${R_ID}","pf_menu": "${M_ID}"}},"expression": "${event.data.value === 1}","stopPropagation": "${event.data.value===0}"},{"ignoreError": false,"outputVar": "responseResult","actionType": "ajax","options": {},"api": {"url": "http://127.0.0.1:5217/rest/s_role_menu/?where=pf_role='${R_ID}' and pf_menu='${M_ID}'","method": "delete","requestAdaptor": "","adaptor": "","messages": {}},"expression": "${event.data.value===0}","stopPropagation": "${event.data.value===1}"}]}}},{"type": "tpl","title": "功能ID","name": "M_ID","id": "u:8884f7cfc750"},{"type": "tpl","title": "功能名称","name": "S_NAME","id": "u:cea732fa69f4"},{"type": "tpl","title": "授权","name": "PF_ROLE","id": "u:86372060e12d"},{"type": "tpl","title": "角色ID","name": "R_ID","id": "u:b29521a345f6"}],"editorSetting": {"mock": {"enable": true,"maxDisplayRows": 5}},"placeholder": "暂无数据","loadDataOnce": true,"perPage": 999,"showHeader": true,"lineHeight": "","keepItemSelectionOnPageChange": false,"onEvent": {},"matchFunc": "","messages": {},"initFetch": false,"showBadge": false}]}],"id": "u:35740fa147ea","align": "left","themeCss": {"baseControlClassName": {"border:default": {"top-border-style": "var(--borders-style-2)","left-border-style": "var(--borders-style-2)","right-border-style": "var(--borders-style-2)","bottom-border-style": "var(--borders-style-2)","top-border-width": "var(--borders-width-1)","left-border-width": "var(--borders-width-1)","right-border-width": "var(--borders-width-1)","bottom-border-width": "var(--borders-width-1)"}}},"gap": "base","valign": "top"}],"id": "u:6cd046ec534c","asideResizor": false,"pullRefresh": {"disabled": true},"regions": ["body","header"],"onEvent": {}
}

3 实操演练

Step 1 页面加载

在这里插入图片描述
功能列表不拉取数据。

Step 2 点击角色行

在这里插入图片描述

Step 3 勾选授权

在这里插入图片描述

Step 4 去勾收权

在这里插入图片描述


本文完

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/289157.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

油缸位置传感器871D-DW2NP524-N4

概述 油缸位置传感器是一种使用电感原理来检测物体接近的开关装置。它通过感应物体的电磁场来判断物体的位置,并将信号转化为电信号输出。当物体靠近或远离电感式接近开关时,物体的电磁场会改变,从而使接近开关产生不同的信号输出。电感式接…

Chrome 插件 tabs API 解析

Chrome.tabs API 解析 使用 chrome.tabs API 与浏览器的标签页系统进行交互,可以使用此 API 在浏览器中创建、修改和重新排列标签页 Tabs API 不仅提供操作和管理标签页的功能,还可以检测标签页的语言、截取屏幕截图,以及与标签页的内容脚本…

MySQL面试汇总(一)

MySQL 如何定位慢查询 如何优化慢查询 索引及其底层实现 索引是一个数据结构,可以帮助MySQL高效获取数据。 聚簇索引和非聚簇索引 覆盖索引 索引创建原则 联合索引

6. 学习方法和Java概述

文章目录 1)学习方法2)Java是什么? 1)学习方法 作为一个0基础入门的同学,在刚开始学习的时候,我们不要追求知识点的深度,而是要追求知识点的广度。简单来说,学一个知识点不要想的太…

TCP和UDP分别是什么?TCP和UDP的区别

在计算机网络通信中,TCP(Transmission Control Protocol)和UDP(User Datagram Protocol)是两种重要的传输层协议,它们在数据传输过程中发挥着关键作用。本文将深入探讨TCP和UDP的定义、特点以及它们之间的区…

【Qt】QDialog对话框

目录 一、概念 二、对话框的分类 2.1 模态对话框 2.2 非模态对话框 2.3 混合属性对话框 三、消息对话框QMessageBox 四、颜色对话框QColorDialog 五、文件对话框QFileDialog 六、字体对话框QFontDialog 七、输入对话框QInputDialog 一、概念 对话框是GUI程序中不可或…

MrDoc寻思文档 个人wiki搭建

通过Docker快速搭建个人wiki,开源wiki系统用于知识沉淀,教学管理,技术学习 部署步骤 ## 拉取 MrDoc 代码 ### 开源版: git clone https://gitee.com/zmister/MrDoc.git### 专业版: git clone https://{用户名}:{密码…

「媒体宣传」如何针对不同行业制定媒体邀约方案

传媒如春雨,润物细无声,大家好,我是51媒体网胡老师。 针对不同行业制定媒体邀约方案时,需要考虑行业特点、目标受众、媒体偏好以及市场趋势等因素。 一、懂行业 先弄清楚你的行业是啥样,有啥特别之处。 了解行业的热…

PPT没保存怎么恢复?3个方法(更新版)!

“我刚做完一个PPT,正准备保存的时候电脑没电自动关机了,打开电脑后才发现我的PPT没保存。这可怎么办?还有机会恢复吗?” 在日常办公和学习中,PowerPoint是制作演示文稿的重要工具。我们会在各种场景下使用它。但有时候…

鸿蒙OS开发实例:【工具类封装-页面路由】

import common from ohos.app.ability.common; import router from ohos.router 封装app内的页面之间跳转、app与app之间的跳转工具类 【使用要求】 DevEco Studio 3.1.1 Release api 9 【使用示例】 import MyRouterUtil from ../common/utils/MyRouterUtil MyRouterUtil…

【jmeter+ant+jenkins】之搭建 接口自动化测试平台

平台搭建 (1). 录制jmeter脚本 (2). 将jmeter的安装目录下的G:\jmeter\apache-jmeter-5.1.1\extras中,将 ”ant-jmeter-1.1.1.jar”文件放到 ant的lib目录下 (3). 配置jmeter的xml配置文件,并放在ant目录的bin目录下,使用ant编译验证jmeter的…

[linux初阶][vim-gcc-gdb] OneCharter: vim编辑器

一.vim编辑器基础 目录 一.vim编辑器基础 ①.vim的语法 ②vim的三种模式 ③三种模式的基本切换 ④各个模式下的一些操作 二.配置vim环境 ①手动配置(不推荐) ②自动配置(推荐) vim是vi的升级版,包含了更加丰富的功能. ①.vim的语法 vim [文件名] ②vim的三种模式 命令…

QT 二维坐标系显示坐标点及点与点的连线-通过定时器自动添加随机数据点

QT 二维坐标系显示坐标点及点与点的连线-通过定时器自动添加随机数据点 功能介绍头文件C文件运行过程 功能介绍 上面的代码实现了一个简单的 Qt 应用程序,其功能包括: 创建一个 MainWindow 类,继承自 QMainWindow,作为应用程序的…

深度好文:解决Ubuntu 18.04安装nvidia显卡驱动,导致内核不匹配:无需重装系统修复内核

深度好文:解决Ubuntu 18.04安装nvidia显卡驱动,导致内核不匹配:无需重装系统修复内核 目录 一、问题描述二、尝试修复三、安装Nvidia驱动和CUDA并配置cuDNN四、总结 一、问题描述 昨天打算更新一下Ubuntu 18.04的显卡驱动,以支持…

基于SpringCloud+Hadoop+Vue实现的企业级网盘系统实现

编程语言:Java、Mybatis、Spring、SpringBoot、SpringCloud、Node、Vue 开发环境:Windows 10 Mysql 开发工具:WebStorm、IDEA编译器、Git、Maven 应用部署服务器:SpringBoot内置Tomcat插件 Node服务器:Node v10.1…

jconsole jvisualvm

jconsole 打开方式 命令行输入 jconsole双击想要连接的应用 界面展示 jvisualvm 打开方式 命令行输入 jvisualvm双击想要连接的应用 可以安装插件,比如 Visual GC 直观看到 GC 过程

最新版puppeteer 在linux下的安装教程

最新版的 puppeteer 在安装的时候,Chromium不会自动下载,导致安装失败 这个时候需要跳过Chromium的安装,然后手动下载Chromium并安装。 1、先设置npm跳过Chromium下载 export PUPPETEER_SKIP_DOWNLOADtrue 2、安装puppeteer npm i pup…

1. Java概述

文章目录 1.Java语言概述1.1 Java介绍1.1.1 软件开发概述1.1.2 计算机语言1.1.3 Java 简史1.1.4 Java 技术体系平台1.1.5 Java在各领域的应用1.1.6 Java语言特点1.1.7 Java核心机制一-Java虚拟机1.1.8 Java核心机制二-垃圾回收1.1.9 Java开发工具 1.2 Java环境搭建1.2.1 JDK、J…

PhpStorm 2023 for Mac/Win:开启PHP集成开发新纪元,让编程更高效更智能

在数字时代的浪潮中,PHP作为一种广泛应用的服务器端脚本语言,其重要性不言而喻。而要在PHP的世界里游刃有余,一款强大的集成开发环境(IDE)是必不可少的。PhpStorm 2023,正是这样一款能够助您一臂之力的编程…

Swift 从获取所有 NSObject 对象聊起:ObjC、汇编语言以及底层方法调用链(三)

概览 承接上一篇博文: Swift 从获取所有 NSObject 对象聊起:ObjC、汇编语言以及底层方法调用链(二)我们在其中讨论了如何使用第三方强大通用的钩子库 SwiftHook 来协助我们完成 NSObject 构造器 init 的 SWIZZ 操作。我们还讨论了为什么用 print 打印对象信息时会发生崩溃…