提交 aaab9cbe 编写于 作者: doc_wei's avatar doc_wei

系统菜单增删改查完成

上级 3295b209
......@@ -11,4 +11,14 @@ public interface SysEveMenuDao {
public void insertSysMenuMation(Map<String, Object> map) throws Exception;
public Map<String, Object> querySysMenuMationToEditById(Map<String, Object> map) throws Exception;
public List<Map<String, Object>> querySysMenuMationBySimpleLevel(Map<String, Object> map) throws Exception;
public void editSysMenuMationById(Map<String, Object> map) throws Exception;
public void deleteSysMenuChildMationById(Map<String, Object> map) throws Exception;
public void deleteSysMenuMationById(Map<String, Object> map) throws Exception;
}
......@@ -7,74 +7,16 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds;
public interface SysEveUserDao {
/**
*
* @Title: querySysUserList
* @Description: 获取管理员用户列表
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public List<Map<String, Object>> querySysUserList(Map<String, Object> map, PageBounds pageBounds) throws Exception;
/**
*
* @Title: querySysUserLockStateById
* @Description: 根据用户账号ID获取用户的当前锁定状态
* @param @param map
* @param @return
* @param @throws Exception 参数
* @return Map<String,Object> 返回类型
* @throws
*/
public Map<String, Object> querySysUserLockStateById(Map<String, Object> map) throws Exception;
/**
*
* @Title: editSysUserLockStateToLockById
* @Description: 锁定账号
* @param @param map
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void editSysUserLockStateToLockById(Map<String, Object> map) throws Exception;
/**
*
* @Title: editSysUserLockStateToUnLockById
* @Description: 解锁账号
* @param @param map
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void editSysUserLockStateToUnLockById(Map<String, Object> map) throws Exception;
/**
*
* @Title: querySysUserMationToEditById
* @Description: 编辑账号时获取账号信息
* @param @param map
* @param @return
* @param @throws Exception 参数
* @return Map<String,Object> 返回类型
* @throws
*/
public Map<String, Object> querySysUserMationToEditById(Map<String, Object> map) throws Exception;
/**
*
* @Title: editSysUserMationById
* @Description: 编辑账号
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
public void editSysUserMationById(Map<String, Object> map) throws Exception;
......
......@@ -9,4 +9,12 @@ public interface SysEveMenuService {
public void insertSysMenuMation(InputObject inputObject, OutputObject outputObject) throws Exception;
public void querySysMenuMationToEditById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void querySysMenuMationBySimpleLevel(InputObject inputObject, OutputObject outputObject) throws Exception;
public void editSysMenuMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void deleteSysMenuMationById(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -68,7 +68,6 @@ public class SysEveMenuServiceImpl implements SysEveMenuService{
}else{
String[] str = map.get("parentId").toString().split(",");
map.put("menuLevel", str.length);
map.put("parentId", str[str.length - 1]);
}
map.put("id", ToolUtil.getSurFaceId());
map.put("createTime", ToolUtil.getTimeAndToString());
......@@ -76,6 +75,91 @@ public class SysEveMenuServiceImpl implements SysEveMenuService{
sysEveMenuDao.insertSysMenuMation(map);
}
/**
*
* @Title: querySysMenuMationBySimpleLevel
* @Description: 查看同级菜单
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySysMenuMationBySimpleLevel(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Map<String, Object>> beans = sysEveMenuDao.querySysMenuMationBySimpleLevel(map);
if(!beans.isEmpty()){
outputObject.setBeans(beans);
outputObject.settotal(beans.size());
}
}
/**
*
* @Title: querySysMenuMationToEditById
* @Description: 编辑菜单时进行信息回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void querySysMenuMationToEditById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
Map<String, Object> bean = sysEveMenuDao.querySysMenuMationToEditById(map);
outputObject.setBean(bean);
outputObject.settotal(1);
}
/**
*
* @Title: editSysMenuMationById
* @Description: 编辑菜单信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void editSysMenuMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
if(Constants.SYS_MENU_TYPE_IS_IFRAME.equals(map.get("menuType").toString())){//iframe
map.put("openType", Constants.SYS_MENU_OPEN_TYPE_IS_IFRAME);//1:打开iframe
}else if(Constants.SYS_MENU_TYPE_IS_HTML.equals(map.get("menuType").toString())){//html
map.put("openType", Constants.SYS_MENU_OPEN_TYPE_IS_HTML);//2:打开html
}else{
outputObject.setreturnMessage("菜单类型错误。");
return;
}
if("0".equals(map.get("parentId").toString())){
map.put("menuLevel", 0);
}else{
String[] str = map.get("parentId").toString().split(",");
map.put("menuLevel", str.length);
}
sysEveMenuDao.editSysMenuMationById(map);
}
/**
*
* @Title: deleteSysMenuMationById
* @Description: 删除菜单信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void deleteSysMenuMationById(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
//删除子菜单
sysEveMenuDao.deleteSysMenuChildMationById(map);
//删除自身菜单
sysEveMenuDao.deleteSysMenuMationById(map);
}
}
......@@ -47,4 +47,68 @@ public class SysEveMenuController {
sysEveMenuService.insertSysMenuMation(inputObject, outputObject);
}
/**
*
* @Title: querySysMenuMationBySimpleLevel
* @Description: 查看同级菜单
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveMenuController/querySysMenuMationBySimpleLevel")
@ResponseBody
public void querySysMenuMationBySimpleLevel(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveMenuService.querySysMenuMationBySimpleLevel(inputObject, outputObject);
}
/**
*
* @Title: querySysMenuMationToEditById
* @Description: 编辑菜单时进行信息回显
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveMenuController/querySysMenuMationToEditById")
@ResponseBody
public void querySysMenuMationToEditById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveMenuService.querySysMenuMationToEditById(inputObject, outputObject);
}
/**
*
* @Title: editSysMenuMationById
* @Description: 编辑菜单信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveMenuController/editSysMenuMationById")
@ResponseBody
public void editSysMenuMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveMenuService.editSysMenuMationById(inputObject, outputObject);
}
/**
*
* @Title: deleteSysMenuMationById
* @Description: 删除菜单信息
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/SysEveMenuController/deleteSysMenuMationById")
@ResponseBody
public void deleteSysMenuMationById(InputObject inputObject, OutputObject outputObject) throws Exception{
sysEveMenuService.deleteSysMenuMationById(inputObject, outputObject);
}
}
......@@ -13,10 +13,13 @@
a.menu_sys_type menuSysType,
a.menu_parent_id parentId,
a.menu_url menuUrl,
CONVERT(a.create_time, char) createTime
CONVERT(a.create_time, char) createTime,
b.user_name userName,
IFNULL(GROUP_CONCAT(c.menu_name separator '->'), '创世菜单') menuParentName
FROM
sys_eve_menu a
LEFT JOIN sys_eve_user b ON a.creater = a.id
LEFT JOIN sys_eve_user b ON a.creater = b.id
LEFT JOIN sys_eve_menu c ON INSTR(CONCAT(',', a.menu_parent_id, ','), CONCAT(',', c.id, ','))
WHERE 1=1
<if test="menuName != '' and menuName != null">
AND a.menu_name LIKE '%${menuName}%'
......@@ -24,6 +27,7 @@
<if test="menuUrl != '' and menuUrl != null">
AND a.menu_url LIKE '%${menuUrl}%'
</if>
GROUP BY a.id
ORDER BY a.create_time DESC
</select>
......@@ -34,4 +38,87 @@
(#{id}, #{menuName}, #{titleName}, #{menuIcon}, #{menuUrl}, #{menuType}, #{menuSysType}, #{parentId}, #{menuLevel}, #{openType}, #{createId}, #{createTime})
</insert>
<select id="querySysMenuMationBySimpleLevel" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.menu_name menuName,
a.menu_level menuLevel
FROM
sys_eve_menu a
<if test="parentId != &quot;0&quot;">
,sys_eve_menu b
</if>
WHERE INSTR(CONCAT(',', a.menu_parent_id, ','), CONCAT(',', #{parentId}, ','))
<if test="parentId != &quot;0&quot;">
AND b.id = #{parentId}
AND (b.menu_level + 1) = a.menu_level
</if>
</select>
<select id="querySysMenuMationToEditById" parameterType="java.util.Map" resultType="java.util.Map">
SELECT
a.id,
a.menu_name menuName,
a.menu_icon menuIcon,
a.title_name titleName,
a.menu_level menuLevel,
a.menu_type menuType,
a.menu_sys_type menuSysType,
a.menu_parent_id parentId,
a.menu_url menuUrl
FROM
sys_eve_menu a
WHERE a.id = #{id}
</select>
<update id="editSysMenuMationById" parameterType="java.util.Map">
UPDATE sys_eve_menu
<set>
<if test="menuName != '' and menuName != null">
menu_name = #{menuName},
</if>
<if test="menuIcon != '' and menuIcon != null">
menu_icon = #{menuIcon},
</if>
<if test="titleName != '' and titleName != null">
title_name = #{titleName},
</if>
<if test="menuLevel != '' and menuLevel != null">
menu_level = #{menuLevel},
</if>
<if test="menuType != '' and menuType != null">
menu_type = #{menuType},
</if>
<if test="menuSysType != '' and menuSysType != null">
menu_sys_type = #{menuSysType},
</if>
<if test="parentId != '' and parentId != null">
menu_parent_id = #{parentId},
</if>
<if test="menuUrl != '' and menuUrl != null">
menu_url = #{menuUrl},
</if>
<if test="openType != '' and openType != null">
open_type = #{openType},
</if>
</set>
WHERE id = #{id}
</update>
<delete id="deleteSysMenuChildMationById" parameterType="java.util.Map">
DELETE
FROM
sys_eve_menu
WHERE
INSTR(CONCAT(',', menu_parent_id, ','), CONCAT(',', #{id}, ','))
</delete>
<delete id="deleteSysMenuMationById" parameterType="java.util.Map">
DELETE
FROM
sys_eve_menu
WHERE
id = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -38,5 +38,24 @@
<property id="menuSysType" name="menuSysType" ref="required,num" var="是否为系统菜单"/>
<property id="parentId" name="parentId" ref="required" var="菜单父ID"/>
</url>
<url id="sys008" path="/post/SysEveMenuController/querySysMenuMationToEditById" val="编辑菜单时进行信息回显">
<property id="rowId" name="id" ref="required" var="菜单ID" />
</url>
<url id="sys009" path="/post/SysEveMenuController/querySysMenuMationBySimpleLevel" val="查看同级菜单">
<property id="parentId" name="parentId" ref="required" var="父菜单ID" />
</url>
<url id="sys010" path="/post/SysEveMenuController/editSysMenuMationById" val="编辑菜单">
<property id="menuName" name="menuName" ref="required" var="菜单名称"/>
<property id="titleName" name="titleName" ref="required" var="标题名称" />
<property id="menuIcon" name="menuIcon" ref="required" var="菜单logo"/>
<property id="menuUrl" name="menuUrl" ref="required" var="菜单链接"/>
<property id="menuType" name="menuType" ref="required" var="菜单类型"/>
<property id="menuSysType" name="menuSysType" ref="required,num" var="是否为系统菜单"/>
<property id="parentId" name="parentId" ref="required" var="菜单父ID"/>
<property id="rowId" name="id" ref="required" var="菜单ID" />
</url>
<url id="sys011" path="/post/SysEveMenuController/deleteSysMenuMationById" val="删除菜单信息">
<property id="rowId" name="id" ref="required" var="菜单ID" />
</url>
</controller>
\ No newline at end of file
......@@ -6,6 +6,7 @@ layui.config({
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$;
var parentId = "0";
form.render();
//菜单级别变化事件
......@@ -14,7 +15,10 @@ layui.config({
if(val == '1'){//创世菜单
$("#parentIdBox").addClass("layui-hide");
}else if(val == '2'){
parentId = "0";
$("#lockParentSel").html("");
$("#parentIdBox").removeClass("layui-hide");
loadChildMenu();
}else{
top.winui.window.msg('状态值错误', {icon: 2,time: 2000});
}
......@@ -26,6 +30,23 @@ layui.config({
$(data.elem).val(data.elem.checked);
});
form.on('select(selectParent)', function(data){
if(data.value != parentId){
if(isNull(data.value) || data.value == '请选择'){
layui.$(data.elem).parent('dd').nextAll().remove();
if(layui.$(data.elem).parent('dd').prev().children('select[class=menuParent]').length > 0){
parentId = layui.$(data.elem).parent('dd').prev().children('select[class=menuParent]')[0].value;
}else{
parentId = "0";
}
}else{
layui.$(data.elem).parent('dd').nextAll().remove();
parentId = data.value;
loadChildMenu();
}
}
});
form.on('submit(formAddMenu)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
......@@ -41,17 +62,23 @@ layui.config({
if(data.field.menuLevel == '1'){//创世菜单
params.parentId = '0';
}else if(data.field.menuLevel == '2'){//子菜单
if(isNull($("#parentIdOne").val())){//父菜单为空
var $menu = layui.$('.menuParent');
var str = "";
for(var i = 0; i < $menu.length; i++){
if(!isNull($menu[i].value) && $menu[i].value != '请选择'){
str += $menu[i].value + ",";
}
}
if(isNull(str)){//父菜单为空
top.winui.window.msg("请至少选择一级父菜单", {icon: 2,time: 2000});
return false;
}else{
params.parentId = "";
params.parentId = str;
}
}else{
top.winui.window.msg('状态值错误', {icon: 2,time: 2000});
}
if($("#menuSysType").val()){
if($("#menuSysType").val() == 'true'){
params.menuSysType = '1';
}else{
params.menuSysType = '2';
......@@ -68,6 +95,32 @@ layui.config({
return false;
});
//加载同级菜单
function loadChildMenu(){
AjaxPostUtil.request({url:reqBasePath + "sys009", params:{parentId: parentId}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd><select class="menuParent" lay-filter="selectParent" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].menuName + '---------' + getMenuLevelName(json.rows[i].menuLevel) + '</option>';
}
str += '</select></dd>';
$("#lockParentSel").append(str);
form.render('select');
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
//获取菜单级别
function getMenuLevelName(level){
if(level == '0'){
return "创世菜单";
}else{
return level + "级子菜单";
}
}
//初始化加载隐藏创世菜单
$("#parentIdBox").addClass("layui-hide");
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui'], function (exports) {
winui.renderColor();
layui.use(['form'], function (form) {
var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
var $ = layui.$;
var parentId = "0";
//初始化数据
showGrid({
id: "showForm",
url: reqBasePath + "sys008",
params: {rowId:parent.rowId},
pagination: false,
template: getFileContent('tpl/sysevemenu/sysevemenueditTemplate.tpl'),
ajaxSendLoadBefore: function(hdb){
//是否为系统菜单
hdb.registerHelper("compare2", function(v1, options){
if(v1 == '1'){
return 'checked';
}else if(v1 == '2'){
return '';
}else{
return '';
}
});
hdb.registerHelper("compare3", function(v1, options){
if(v1 == '1'){
return 'true';
}else if(v1 == '2'){
return 'false';
}else{
return 'false';
}
});
},
ajaxSendAfter:function(json){
//菜单级别
if(json.bean.menuLevel == '0'){
$("#parentIdBox").addClass("layui-hide");
$("input:radio[name=menuLevel][value=1]").attr("checked", true);
}else{
$("input:radio[name=menuLevel][value=2]").attr("checked", true);
//初始化父菜单
loadChildMenuAll(json.bean.parentId.split(','));
}
//菜单类型
$("input:radio[name=menuType][value=" + json.bean.menuType + "]").attr("checked", true);
form.render();
//菜单级别变化事件
form.on('radio(menuLevel)', function (data) {
var val = data.value;
if(val == '1'){//创世菜单
$("#parentIdBox").addClass("layui-hide");
}else if(val == '2'){
parentId = "0";
$("#lockParentSel").html("");
$("#parentIdBox").removeClass("layui-hide");
loadChildMenu();
}else{
top.winui.window.msg('状态值错误', {icon: 2,time: 2000});
}
});
//系统菜单同步
form.on('switch(isNecessary)', function (data) {
//同步开关值
$(data.elem).val(data.elem.checked);
});
//父菜单变化事件
form.on('select(selectParent)', function(data){
if(data.value != parentId){
if(isNull(data.value) || data.value == '请选择'){
layui.$(data.elem).parent('dd').nextAll().remove();
if(layui.$(data.elem).parent('dd').prev().children('select[class=menuParent]').length > 0){
parentId = layui.$(data.elem).parent('dd').prev().children('select[class=menuParent]')[0].value;
}else{
parentId = "0";
}
}else{
layui.$(data.elem).parent('dd').nextAll().remove();
parentId = data.value;
loadChildMenu();
}
}
});
form.on('submit(formEditMenu)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
var params = {
menuName: $("#menuName").val(),
titleName: $("#menuTitle").val(),
menuIcon: $("#menuIcon").val(),
menuUrl: $("#menuUrl").val(),
menuType: data.field.menuType,
rowId: parent.rowId
};
if(data.field.menuLevel == '1'){//创世菜单
params.parentId = '0';
}else if(data.field.menuLevel == '2'){//子菜单
var $menu = layui.$('.menuParent');
var str = "";
for(var i = 0; i < $menu.length; i++){
if(!isNull($menu[i].value) && $menu[i].value != '请选择'){
str += $menu[i].value + ",";
}
}
if(isNull(str)){//父菜单为空
top.winui.window.msg("请至少选择一级父菜单", {icon: 2,time: 2000});
return false;
}else{
params.parentId = str;
}
}else{
top.winui.window.msg('状态值错误', {icon: 2,time: 2000});
}
if($("#menuSysType").val() == 'true'){
params.menuSysType = '1';
}else{
params.menuSysType = '2';
}
AjaxPostUtil.request({url:reqBasePath + "sys010", params:params, type:'json', callback:function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
return false;
});
}
});
//初始化当前子菜单的父菜单
function loadChildMenuAll(pid){
if(pid.length > 0){
if(!isNull(pid[0])){
AjaxPostUtil.request({url:reqBasePath + "sys009", params:{parentId: parentId}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd><select class="menuParent" lay-filter="selectParent" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
if(json.rows[i].id != parent.rowId){
if(json.rows[i].id != pid[0]){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].menuName + '---------' + getMenuLevelName(json.rows[i].menuLevel) + '</option>';
}else{
str += '<option value="' + json.rows[i].id + '" selected>' + json.rows[i].menuName + '---------' + getMenuLevelName(json.rows[i].menuLevel) + '</option>';
}
}
}
str += '</select></dd>';
$("#lockParentSel").append(str);
form.render('select');
parentId = pid[0];
pid.splice(0, 1);
loadChildMenuAll(pid);
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}else{
pid.splice(0, 1);
loadChildMenuAll(pid);
}
}else{
loadChildMenu()
}
}
//加载同级菜单
function loadChildMenu(){
AjaxPostUtil.request({url:reqBasePath + "sys009", params:{parentId: parentId}, type:'json', callback:function(json){
if(json.returnCode == 0){
var str = '<dd><select class="menuParent" lay-filter="selectParent" lay-search=""><option value="">请选择</option>';
for(var i = 0; i < json.rows.length; i++){
if(json.rows[i].id != parent.rowId){
str += '<option value="' + json.rows[i].id + '">' + json.rows[i].menuName + '---------' + getMenuLevelName(json.rows[i].menuLevel) + '</option>';
}
}
str += '</select></dd>';
$("#lockParentSel").append(str);
form.render('select');
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
}
//获取菜单级别
function getMenuLevelName(level){
if(level == '0'){
return "创世菜单";
}else{
return level + "级子菜单";
}
}
//取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
});
\ No newline at end of file
......@@ -26,15 +26,16 @@ layui.config({
{ field: 'menuName', title: '菜单名称', width: 120 },
{ field: 'menuIcon', title: '图标码', width: 120 },
{ field: 'titleName', title: '标题名称', width: 120 },
{ field: 'menuLevel', title: '菜单级别', width: 120, templet: function(d){
{ field: 'menuLevel', title: '菜单级别', width: 180, templet: function(d){
if(d.parentId == '0'){
return "创世菜单";
}else{
return "子菜单-->" + d.menuLevel + "级子菜单";
}
}},
{ field: 'menuParentName', title: '父菜单', width: 100 },
{ field: 'menuType', title: '菜单类型', width: 100 },
{ field: 'menuUrl', title: '菜单链接', width: 100 },
{ field: 'menuUrl', title: '菜单链接', width: 160 },
{ field: 'menuSysType', title: '系统菜单', width: 100, templet: function(d){
if(d.menuSysType == 2){
return '';
......@@ -45,6 +46,7 @@ layui.config({
}
}},
{ field: 'createTime', title: '创建时间', width: 180 },
{ field: 'userName', title: '创建人', width: 150 },
{ title: '操作', fixed: 'right', align: 'center', width: 120, toolbar: '#tableBar'}
]]
});
......@@ -53,7 +55,7 @@ layui.config({
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值
if (layEvent === 'del') { //删除
del(data);
del(data, obj);
}else if (layEvent === 'edit') { //编辑
edit(data);
}
......@@ -70,17 +72,29 @@ layui.config({
});
//删除
function del(data){
function del(data, obj){
var msg = obj ? '确认删除菜单【' + obj.data.menuName + '】吗?' : '确认删除选中数据吗?';
layer.confirm(msg, { icon: 3, title: '删除系统菜单' }, function (index) {
layer.close(index);
//向服务端发送删除指令
AjaxPostUtil.request({url:reqBasePath + "sys011", params:{rowId: data.id}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("删除成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
//编辑
function edit(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/syseveuser/syseveuseredit.html",
url: "../../tpl/sysevemenu/sysevemenuedit.html",
title: "编辑用户",
pageId: "syseveuseredit",
pageId: "sysevemenuedit",
callBack: function(refreshCode){
if (refreshCode == '0') {
top.winui.window.msg("操作成功", {icon: 1,time: 2000});
......
......@@ -15,7 +15,7 @@ layui.config({
pagination: false,
template: getFileContent('tpl/syseveuser/syseveusereditTemplate.tpl'),
ajaxSendLoadBefore: function(hdb){
hdb.registerHelper("compare1", function(v1,options){
hdb.registerHelper("compare1", function(v1, options){
if(isNull(v1)){
return path + "assets/img/uploadPic.png";
}else{
......
......@@ -19,7 +19,7 @@
<div class="layui-form-item">
<label class="layui-form-label">窗口标题</label>
<div class="layui-input-block">
<input type="text" id="menuTitle" name="menuTitle" win-verify="required" placeholder="请输入菜单名称" class="layui-input" />
<input type="text" id="menuTitle" name="menuTitle" win-verify="required" placeholder="请输入窗口标题" class="layui-input" />
</div>
</div>
<div class="layui-form-item">
......@@ -43,21 +43,7 @@
</div>
<div class="layui-form-item" id="parentIdBox">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select id="parentIdOne" name="parentIdOne" >
<option value="0">请选择上级菜单</option>
<option value="1">&#x4E2A;&#x6027;&#x5316;</option>
<option value="3">&#x6253;&#x8D4F;&#x4F5C;&#x8005;</option>
<option value="4">&#x57FA;&#x672C;&#x8BF4;&#x660E;</option>
<option value="23">&#x7CFB;&#x7EDF;&#x8BBE;&#x7F6E;</option>
<option value="27">Font Awesome&#x56FE;&#x6807;&#x5C55;&#x793A;</option>
<option value="43">Font Awesome&#x7B2C;&#x4E09;&#x65B9;LOGO</option>
<option value="53">&#x81EA;&#x5B9A;&#x4E49;&#x56FE;&#x7247;&#x83DC;&#x5355;</option>
<option value="60">&#x7CFB;&#x7EDF;&#x65E5;&#x5FD7;</option>
<option value="62">&#x70B9;&#x8D5E;</option>
<option value="63">123</option>
<option value="66">&#x4F5C;&#x8005;&#x535A;&#x5BA2;</option>
</select>
<div class="layui-input-block" id="lockParentSel">
</div>
</div>
<div class="layui-form-item">
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
</head>
<body>
<div style="width:600px;margin:0 auto;padding-top:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/sysevemenu/'}).use('sysevemenuedit');
</script>
</body>
</html>
\ No newline at end of file
{{#bean}}
<div class="layui-form-item">
<label class="layui-form-label">菜单名称</label>
<div class="layui-input-block">
<input type="text" id="menuName" name="menuName" win-verify="required" placeholder="请输入菜单名称" class="layui-input" value="{{menuName}}" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">窗口标题</label>
<div class="layui-input-block">
<input type="text" id="menuTitle" name="menuTitle" win-verify="required" placeholder="请输入窗口标题" class="layui-input" value="{{titleName}}" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单图标</label>
<div class="layui-input-block">
<input type="text" id="menuIcon" name="menuIcon" win-verify="required" placeholder="请输入图标src或者class" class="layui-input" value="{{menuIcon}}" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单地址</label>
<div class="layui-input-block">
<input type="text" id="menuUrl" name="menuUrl" win-verify="required" placeholder="请输入菜单地址" class="layui-input" value="{{menuUrl}}" />
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单级别</label>
<div class="layui-input-block winui-radio">
<input type="radio" name="menuLevel" value="1" title="创世菜单" lay-filter="menuLevel"/>
<input type="radio" name="menuLevel" value="2" title="子菜单" lay-filter="menuLevel"/>
</div>
</div>
<div class="layui-form-item" id="parentIdBox">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block" id="lockParentSel">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">菜单类型</label>
<div class="layui-input-block winui-radio">
<input type="radio" name="menuType" value="html" title="HTML" lay-filter="menuType"/>
<input type="radio" name="menuType" value="iframe" title="Iframe" lay-filter="menuType"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">系统菜单</label>
<div class="layui-input-block winui-switch">
<input id="menuSysType" name="menuSysType" lay-filter="isNecessary" type="checkbox" lay-skin="switch" lay-text="是|否" {{#compare2 menuSysType}}{{/compare2}} value="{{#compare3 menuSysType}}{{/compare3}}" />
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" lay-submit lay-filter="formEditMenu">确定</button>
<button class="winui-btn" id="cancle">取消</button>
</div>
</div>
{{/bean}}
\ No newline at end of file
......@@ -33,7 +33,7 @@
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
<button id="addBean" class="winui-toolbtn"><i class="fa fa-plus" aria-hidden="true"></i>新增菜单</button>
<button id="deleteBeans" class="winui-toolbtn"><i class="fa fa-trash" aria-hidden="true"></i>删除选中</button>
<!-- <button id="deleteBeans" class="winui-toolbtn"><i class="fa fa-trash" aria-hidden="true"></i>删除选中</button> -->
</div>
</div>
<div style="margin:auto 10px;">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册