更新初始化文件

pull/1/head
759675757@qq.com 2019-10-18 10:38:36 +08:00
parent c2f32371ec
commit 373906b1ea
25 changed files with 465 additions and 320 deletions

View File

@ -1,10 +1,19 @@
package com.songpeng.sparchetype.system.controller.admin;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.songpeng.sparchetype.common.BaseController;
import com.songpeng.sparchetype.common.Result;
import com.songpeng.sparchetype.system.entity.SysMenu;
import com.songpeng.sparchetype.system.entity.SysRole;
import com.songpeng.sparchetype.system.service.ISysMenuService;
import com.songpeng.sparchetype.system.service.ISysRoleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
/**
* <p>
@ -18,4 +27,34 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/admin/sys/menu")
public class SysMenuController extends BaseController {
@Autowired
private ISysMenuService sysMenuService;
@GetMapping("/list-ui")
public String listUI(Model model) {
return "system/menu/list";
}
@PostMapping("/page")
@ResponseBody
public Result page(Page page) {
IPage result = sysMenuService.page(page);
return Result.success(result);
}
@GetMapping("/add-or-upd-ui")
public String addOrUpdUI(Model model, SysMenu record) {
if (StringUtils.isNotEmpty(record.getId())) {
SysMenu result = sysMenuService.getById(record.getId());
model.addAttribute("result", result);
}
return "system/menu/addOrUpd";
}
@PostMapping("/add-or-upd")
@ResponseBody
public Result add(SysMenu record) {
sysMenuService.saveOrUpdate(record);
return Result.success(record.getId());
}
}

View File

@ -1,15 +1,24 @@
package com.songpeng.sparchetype.system.controller.admin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.songpeng.sparchetype.common.BaseController;
import com.songpeng.sparchetype.common.Result;
import com.songpeng.sparchetype.system.entity.SysRole;
import com.songpeng.sparchetype.system.service.ISysRoleService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* <p>
*
*
* </p>
*
* @author SongPeng
@ -19,4 +28,34 @@ import com.songpeng.sparchetype.common.BaseController;
@RequestMapping("/admin/sys/role")
public class SysRoleController extends BaseController {
@Autowired
private ISysRoleService sysRoleService;
@GetMapping("/list-ui")
public String listUI(Model model) {
return "system/role/list";
}
@PostMapping("/page")
@ResponseBody
public Result page(Page page) {
IPage result = sysRoleService.page(page);
return Result.success(result);
}
@GetMapping("/add-or-upd-ui")
public String addOrUpdUI(Model model, SysRole record) {
if (StringUtils.isNotEmpty(record.getId())) {
SysRole result = sysRoleService.getById(record.getId());
model.addAttribute("result", result);
}
return "system/role/addOrUpd";
}
@PostMapping("/add-or-upd")
@ResponseBody
public Result add(SysRole record) {
sysRoleService.saveOrUpdate(record);
return Result.success(record.getId());
}
}

View File

@ -1,22 +0,0 @@
package com.songpeng.sparchetype.system.controller.admin;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.songpeng.sparchetype.common.BaseController;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
@Controller("adminSysRoleMenuController")
@RequestMapping("/admin/sys/role-menu")
public class SysRoleMenuController extends BaseController {
}

View File

@ -48,8 +48,8 @@ public class SysUserController extends BaseController {
@GetMapping("/add-or-upd-ui")
public String addOrUpdUI(Model model, SysUser record) {
if (StringUtils.isNotEmpty(record.getId())) {
SysUser user = sysUserService.getById(record.getId());
model.addAttribute("user", user);
SysUser result = sysUserService.getById(record.getId());
model.addAttribute("result", result);
}
return "system/user/addOrUpd";
}

View File

@ -1,21 +0,0 @@
package com.songpeng.sparchetype.system.controller.admin;
import com.songpeng.sparchetype.common.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
@Controller("adminSysUserRoleController")
@RequestMapping("/admin/sys/user-role")
public class SysUserRoleController extends BaseController {
}

View File

@ -1,34 +0,0 @@
package com.songpeng.sparchetype.system.entity;
import com.songpeng.sparchetype.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class SysRoleMenu extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String roleId;
/**
* id
*/
private String menuId;
}

View File

@ -1,34 +0,0 @@
package com.songpeng.sparchetype.system.entity;
import com.songpeng.sparchetype.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class SysUserRole extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String userId;
/**
* id
*/
private String roleId;
}

View File

@ -1,16 +0,0 @@
package com.songpeng.sparchetype.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.songpeng.sparchetype.system.entity.SysRoleMenu;
/**
* <p>
* Mapper
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {
}

View File

@ -15,12 +15,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface SysUserMapper extends BaseMapper<SysUser> {
/**
*
*
*
* @param username
* @return
* @throws Exception
*/
SysUserDto getUserAndRoleAndMenuByUsername(String username) throws Exception;
SysUserDto getUserAndRoleByUsername(String username) throws Exception;
}

View File

@ -1,16 +0,0 @@
package com.songpeng.sparchetype.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.songpeng.sparchetype.system.entity.SysUserRole;
/**
* <p>
* Mapper
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
public interface SysUserRoleMapper extends BaseMapper<SysUserRole> {
}

View File

@ -1,16 +0,0 @@
package com.songpeng.sparchetype.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.songpeng.sparchetype.system.entity.SysRoleMenu;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
public interface ISysRoleMenuService extends IService<SysRoleMenu> {
}

View File

@ -1,16 +0,0 @@
package com.songpeng.sparchetype.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.songpeng.sparchetype.system.entity.SysUserRole;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
public interface ISysUserRoleService extends IService<SysUserRole> {
}

View File

@ -1,20 +0,0 @@
package com.songpeng.sparchetype.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songpeng.sparchetype.system.entity.SysRoleMenu;
import com.songpeng.sparchetype.system.mapper.SysRoleMenuMapper;
import com.songpeng.sparchetype.system.service.ISysRoleMenuService;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
@Service
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements ISysRoleMenuService {
}

View File

@ -1,20 +0,0 @@
package com.songpeng.sparchetype.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.songpeng.sparchetype.system.entity.SysUserRole;
import com.songpeng.sparchetype.system.mapper.SysUserRoleMapper;
import com.songpeng.sparchetype.system.service.ISysUserRoleService;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author SongPeng
* @since 2019-10-16
*/
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {
}

View File

@ -31,6 +31,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
*/
@Override
public SysUserDto getUserAndRoleAndMenuByUsername(String username) throws Exception {
return sysUserMapper.getUserAndRoleAndMenuByUsername(username);
SysUserDto result = sysUserMapper.getUserAndRoleByUsername(username);
return result;
}
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.songpeng.sparchetype.system.mapper.SysRoleMenuMapper">
</mapper>

View File

@ -23,37 +23,22 @@
<result column="street_number" property="streetNumber"/>
<result column="descr" property="descr"/>
<result column="status" property="status"/>
<!-- <collection property="sysRoleDtos" ofType="com.songpeng.sparchetype.system.dto.SysRoleDto">-->
<!-- <id column="id" property="id"/>-->
<!-- <result column="name" property="name"/>-->
<!-- <result column="code" property="code"/>-->
<!-- <result column="descr" property="descr"/>-->
<!-- <result column="status" property="status"/>-->
<!-- <collection property="sysMenuDtos" ofType="com.songpeng.sparchetype.system.dto.SysMenuDto">-->
<!-- <id column="id" property="id"/>-->
<!-- <result column="name" property="name"/>-->
<!-- <result column="url" property="url"/>-->
<!-- <result column="parent_id" property="parentId"/>-->
<!-- <result column="grade" property="grade"/>-->
<!-- <result column="sort_num" property="sortNum"/>-->
<!-- <result column="type" property="type"/>-->
<!-- <result column="permission" property="permission"/>-->
<!-- <result column="icon" property="icon"/>-->
<!-- <result column="descr" property="descr"/>-->
<!-- </collection>-->
<!-- </collection>-->
<collection property="sysRoleDtos" ofType="com.songpeng.sparchetype.system.dto.SysRoleDto">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="descr" property="descr"/>
<result column="status" property="status"/>
</collection>
</resultMap>
<select id="getUserAndRoleAndMenuByUsername" parameterType="java.lang.String" resultMap="userRoleAndMenuResultMap">
<select id="getUserAndRoleByUsername" parameterType="java.lang.String" resultMap="userRoleAndMenuResultMap">
SELECT t.*,
sr.name, sr.code, sr.descr, sr.status,
sm.name, sm.url, sm.parent_id, sm.grade, sm.sort_num, sm.type, sm.permission, sm.icon, sm.descr
FROM sp_sys_user t, sp_sys_user_role sur, sp_sys_role sr, sp_sys_role_menu srm, sp_sys_menu sm
sr.name, sr.code, sr.descr, sr.status
FROM sp_sys_user t, sp_sys_user_role sur, sp_sys_role sr
WHERE
t.username = #{username}
AND t.id = sur.user_id
AND sur.user_id = sr.id
AND srm.role_id = sr.id
AND sm.id = srm.menu_id
AND sur.role_id = sr.id
</select>
</mapper>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.songpeng.sparchetype.system.mapper.SysUserRoleMapper">
</mapper>

View File

@ -175,14 +175,11 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
tabAdd: function(title, url, id) {
//判断当前id的元素是否存在于tab中
var li = $("#WeTabTip li[lay-id=" + id + "]").length;
//console.log(li);
if(li > 0) {
//tab已经存在直接切换到指定Tab项
//console.log(">0");
element.tabChange('wenav_tab', id); //切换到:用户管理
} else {
//该id不存在新增一个Tab项
//console.log("<0");
element.tabAdd('wenav_tab', {
title: title,
content: '<iframe tab-id="' + id + '" frameborder="0" src="' + url + '" scrolling="yes" class="weIframe"></iframe>',
@ -230,7 +227,6 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
var aid = $(this).attr("lay-id"); //获取右键时li的lay-id属性
var popupmenu = $(".rightMenu");
popupmenu.find("li").attr("data-id", aid);
//console.log("popopmenuId:" + popupmenu.find("li").attr("data-id"));
l = ($(document).width() - e.clientX) < popupmenu.width() ? (e.clientX - popupmenu.width()) : e.clientX;
t = ($(document).height() - e.clientY) < popupmenu.height() ? (e.clientY - popupmenu.height()) : e.clientY;
popupmenu.css({
@ -245,10 +241,8 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
var type = $(this).attr("data-type");
var layId = $(this).attr("data-id")
if(type == "current") {
//console.log("close this:" + layId);
tab.tabDelete(layId);
} else if(type == "all") {
//console.log("closeAll");
var tabtitle = $(".layui-tab-title li");
var ids = new Array();
$.each(tabtitle, function(i) {
@ -256,7 +250,6 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
})
tab.tabDeleteAll(ids);
} else if(type == "fresh") {
//console.log("fresh:" + layId);
tab.tabChange($(this).attr("data-id"));
var othis = $('.layui-tab-title').find('>li[lay-id="' + layId + '"]'),
index = othis.parent().children('li').index(othis),
@ -351,7 +344,6 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
//向iframe页的id=house的元素传值 // 参考 https://yq.aliyun.com/ziliao/133150
var body = layer.getChildFrame('body', index);
body.contents().find("#js-id").val(id);
console.log(id);
},
error: function(layero, index) {
alert("aaa");
@ -370,7 +362,6 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
* tab切换监听不能写字初始化加载$(function())方法内否则不执行
*/
element.on('tab(wenav_tab)', function(data) {
//console.log(this); //当前Tab标题所在的原始DOM元素
setStorageCurMenu();
});
/*
@ -378,7 +369,6 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
*/
element.on('tabDelete(wenav_tab)', function(data) {
var layId = $(this).parent('li').attr('lay-id');
//console.log(layId);
removeStorageMenu(layId);
});
/**
@ -421,7 +411,6 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
text = text.split('ဆ')[0];
var url = $('.layui-tab-content').find('.layui-show').find('.weIframe').attr('src');
var id = $('.layui-tab-title').find('.layui-this').attr('lay-id');
//console.log(text);
curMenu = {
title: text,
url: url,
@ -475,8 +464,7 @@ layui.define(['jquery', 'form', 'layer', 'element'], function(exports) {
$(which).attr('data-bit',i);
var frame = $('.weIframe[tab-id='+layId+']');
frame.attr('src', frame.attr('src'));
console.log("reload:"+$(which).attr('data-bit'));
}
}
}
/**
*@todo Frame内部的按钮点击打开其他frame的tab

View File

@ -83,7 +83,7 @@
"id": 15,
"name": "角色管理",
"icon": "",
"url": "/blog/article/listui"
"url": "/admin/sys/role/list-ui"
},
{
"id": 16,

View File

@ -10,16 +10,6 @@
<#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="weadmin-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">系统字典列表管理</a>
<a><cite>系统字典列表</cite></a>
</span>
<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px">&#xe669;</i>
</a>
</div>
<div class="weadmin-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 we-search" lay-filter="search-form-filter">

View File

@ -0,0 +1,121 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加用户</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<!-- 让IE8/9支持媒体查询从而兼容栅格 -->
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="weadmin-body">
<form class="layui-form">
<div class="layui-form-item">
<label for="js-name" class="layui-form-label">
<span class="we-red">*</span>角色名称
</label>
<div class="layui-input-inline">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${result.name}">
</div>
</div>
<div class="layui-form-item">
<label for="js-username" class="layui-form-label">
<span class="we-red">*</span>角色编码
</label>
<div class="layui-input-inline">
<input type="text" id="js-code" name="code" lay-verify="required" autocomplete="off" class="layui-input" value="${result.code}">
</div>
</div>
<div class="layui-form-item">
<label for="js-descr" class="layui-form-label">
描述
</label>
<div class="layui-input-inline">
<input type="text" id="js-descr" name="descr" lay-verify="" autocomplete="off" class="layui-input" value="${result.descr}">
</div>
</div>
<div class="layui-form-item">
<label for="js-status" class="layui-form-label"><span class="we-red">*</span>状态</label>
<div class="layui-input-block" id="js-status">
<input type="radio" name="status" value="0" title="正常" <#if result.status == "0" || !(result??)>checked</#if>>
<input type="radio" name="status" value="1" title="已删除" <#if result.status == "1">checked</#if>>
</div>
</div>
<div class="layui-form-item">
<input type="hidden" name="id" id="js-id" value="" />
<label for="js-add-btn" class="layui-form-label"></label>
<button id="js-add-btn" class="layui-btn" lay-filter="add" lay-submit="">确定</button>
</div>
</form>
</div>
</body>
<script>
layui.extend({
admin: '${request.contextPath}/js/admin'
});
layui.use(['form', 'jquery', 'util', 'admin', 'layer'], function() {
var form = layui.form,
$ = layui.jquery,
util = layui.util,
admin = layui.admin,
layer = layui.layer;
//失去焦点时判断值为空不验证,一旦填写必须验证
$('input[name="email"]').blur(function(){
//这里是失去焦点时的事件
if($('input[name="email"]').val()){
$('input[name="email"]').attr('lay-verify','email');
}else{
$('input[name="email"]').removeAttr('lay-verify');
}
});
//监听提交
form.on('submit(add)', function(data) {
$.ajax({
type: "POST",
//请求的媒体类型
//contentType: "application/json;charset=UTF-8",
url: "${request.contextPath}/admin/sys/user/add-or-upd",
//data: JSON.stringify(data),
data: data.field,
success: function(result) {
if (result.code === 0) {
//获取提交成功的时间
var time = new Date();
var timeNow = util.toDateString(time);
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);
//刷新父页面注意一定要在关闭当前iframe层之前执行刷新
parent.location.reload();
//关闭当前frame
parent.layer.close(index);
} else {
layer.alert(result.msg, {
icon: 2
})
}
},
error: function(e){
layer.alert(e, {
icon: 2
})
}
});
return false;
});
});
</script>
</html>

View File

@ -0,0 +1,217 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>系统角色列表</title>
<meta name="Description" content="基于layUI数据表格操作"/>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="weadmin-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 we-search" lay-filter="search-form-filter">
<div class="layui-input-inline">
<select name="cateid">
<option>请选择分类</option>
<option>文章</option>
<option>会员</option>
<option>权限</option>
</select>
</div>
<div class="layui-inline">
<input class="layui-input" placeholder="开始日" name="start" id="start">
</div>
<div class="layui-inline">
<input class="layui-input" placeholder="截止日" name="end" id="end">
</div>
<div class="layui-inline">
<input type="text" name="keyword" placeholder="请输入关键字" autocomplete="off" class="layui-input">
</div>
<button class="layui-btn" lay-submit lay-filter="search-form-btn-filter"><i class="layui-icon">&#xe615;</i></button>
</form>
</div>
<!--数据表格-->
<table class="layui-hide" id="record-table" lay-filter="table-filter"></table>
</div>
</body>
<script type="text/html" id="toolbar-top">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="getCheckData"><i class="layui-icon">&#xe640;</i>批量删除</button>
<button class="layui-btn layui-btn-sm" lay-event="recommend"><i class="layui-icon">&#xe6c6;</i>推荐</button>
<button class="layui-btn layui-btn-sm" lay-event="top"><i class="layui-icon">&#xe619;</i>置顶</button>
<button class="layui-btn layui-btn-sm" lay-event="review"><i class="layui-icon">&#xe6b2;</i>审核</button>
<button class="layui-btn layui-btn-sm" onclick="WeAdminShow('添加角色','${request.contextPath}/admin/sys/role/add-or-upd-ui',600,400)"><i class="layui-icon">&#xe61f;</i>添加</button>
</div>
</script>
<script type="text/html" id="recommendTpl">
<input type="checkbox" name="zzz" lay-skin="switch" lay-text="已推荐|未推荐" {{d.recommend}}>
</script>
<script type="text/html" id="topTpl">
<input type="checkbox" name="show" lay-skin="switch" lay-text="已置顶|未置顶" {{d.top}}>
</script>
<script type="text/html" id="reviewTpl">
<!-- 这里的 checked 的状态只是演示 -->
<input type="checkbox" name="lock" value="{{d.id}}" title="锁定" lay-filter="lockDemo" {{ d.id == 1 ? 'checked' : '' }}>
</script>
<script type="text/html" id="operateTpl">
<a title="编辑" onclick="WeAdminEdit('编辑','${request.contextPath}/admin/sys/role/add-or-upd-ui', '{{ d.id }}', 600, 400)" href="javascript:;">
<i class="layui-icon">&#xe642;</i>
</a>
<a title="查看" onclick="WeAdminShow('查看文章','./show.html',600,400)" href="javascript:;">
<i class="layui-icon">&#xe63c;</i>
</a>
<a title="删除" onclick="member_del(this,'要删除的id')" href="javascript:;">
<i class="layui-icon">&#xe640;</i>
</a>
</script>
<script type="text/javascript">
layui.extend({
admin: '${request.contextPath}/js/admin'
});
layui.use(['table', 'jquery','form', 'admin', 'laydate'], function() {
var table = layui.table,
$ = layui.jquery,
form = layui.form,
admin = layui.admin,
laydate = layui.laydate;
laydate.render({
elem: '#start'
});
laydate.render({
elem: '#end'
});
var tableIns = table.render({
elem: '#record-table',
cellMinWidth: 80,
toolbar: '#toolbar-top',
method: 'POST',
event: true,
page: true,
url: '${request.contextPath}/admin/sys/role/page',
request: {
pageName: 'current' //页码的参数名称默认page
,limitName: 'size' //每页数据量的参数名默认limit
},
parseData: function(res){ //res 即为原始返回的数据
return {
"code": res.code, //解析接口状态
"msg": res.msg, //解析提示文本
"count": res.data ? res.data.total : 0, //解析数据长度
"data": res.data ? res.data.records : [] //解析数据列表
};
},
cols: [
[{
type: 'checkbox'
}, {
field: 'name', title: '角色名称'
}, {
field: 'code', title: '角色编码'
}, {
field: 'descr', title: '角色描述'
}, {
field: 'status', title: '状态'
}, {
fixed: 'right', field: 'operate',title: '操作', toolbar: '#operateTpl', unresize: true, width: 90
}]
],
done: function(res, curr, count){
//如果是异步请求数据方式res即为你接口返回的信息。
//如果是直接赋值的方式res即为{data: [], count: 99} data为当前页数据、count为数据总长度
}
});
/*
* 数据表格中form表单元素是动态插入,所以需要更新渲染下
* http://www.layui.com/doc/modules/form.html#render
*/
$(function(){
form.render();
});
form.on('submit(search-form-btn-filter)', function(data){
tableIns.reload({
// 设定异步数据接口的额外参数,任意设
where: data.field,
page: {
curr: 1 //重新从第 1 页开始
}
});
// 阻止表单跳转。如果需要表单跳转,去掉这段即可。
return false;
});
//头工具栏事件
table.on('toolbar(table-filter)', function(obj){
var checkStatus = table.checkStatus(obj.config.id);
switch(obj.event){
case 'getCheckData':
var checkStatus = table.checkStatus('record-table'),
data = checkStatus.data;
if(data.length > 0) {
layer.confirm('确认要删除吗?' + JSON.stringify(data), function(index) {
layer.msg('删除成功', {
icon: 1
});
//找到所有被选中的,发异步进行删除
$(".layui-table-body .layui-form-checked").parents('tr').remove();
});
} else {
layer.msg("请先选择需要删除的文章!");
}
break;
case 'recommend':
var checkStatus = table.checkStatus('record-table'),
data = checkStatus.data;
if(data.length > 0) {
layer.msg("您点击了推荐操作");
for(var i = 0; i < data.length; i++) {
data[i].recommend = "checked";
form.render();
}
} else {
layer.msg("请先选择");
}
break;
case 'top':
layer.msg("您点击了置顶操作");
break;
case 'review':
layer.msg("您点击了审核操作");
break;
};
});
/*用户-删除*/
window.member_del = function(obj, id) {
layer.confirm('确认要删除吗?', function(index) {
//发异步删除数据
$(obj).parents("tr").remove();
layer.msg('已删除!', {
icon: 1,
time: 1000
});
});
}
});
function delAll(argument) {
var data = tableCheck.getData();
layer.confirm('确认要删除吗?' + data, function(index) {
//捉到所有被选中的,发异步进行删除
layer.msg('删除成功', {
icon: 1
});
$(".layui-form-checked").not('.header').parents('tr').remove();
});
}
</script>
</html>

View File

@ -22,7 +22,7 @@
<span class="we-red">*</span>姓名
</label>
<div class="layui-input-inline">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${user.name}">
<input type="text" id="js-name" name="name" lay-verify="required" autocomplete="off" class="layui-input" value="${result.name}">
</div>
</div>
@ -31,7 +31,7 @@
<span class="we-red">*</span>用户名
</label>
<div class="layui-input-inline">
<input type="text" id="js-username" name="username" lay-verify="required" autocomplete="off" class="layui-input" value="${user.username}">
<input type="text" id="js-username" name="username" lay-verify="required" autocomplete="off" class="layui-input" value="${result.username}">
</div>
</div>
@ -40,7 +40,7 @@
<span class="we-red">*</span>密码
</label>
<div class="layui-input-inline">
<input type="password" id="js-password" name="password" lay-verify="required" autocomplete="off" class="layui-input" value="${user.password}">
<input type="password" id="js-password" name="password" lay-verify="required" autocomplete="off" class="layui-input" value="${result.password}">
</div>
</div>
@ -49,7 +49,7 @@
<span class="we-red">*</span>确认密码
</label>
<div class="layui-input-inline">
<input type="password" id="js-repassword" name="repassword" lay-verify="required" autocomplete="off" class="layui-input" value="${user.password}">
<input type="password" id="js-repassword" name="repassword" lay-verify="required" autocomplete="off" class="layui-input" value="${result.password}">
</div>
</div>
@ -58,7 +58,7 @@
部门id
</label>
<div class="layui-input-inline">
<input type="text" id="js-dept-id" name="deptId" lay-verify="" autocomplete="off" class="layui-input" value="${user.deptId}">
<input type="text" id="js-dept-id" name="deptId" lay-verify="" autocomplete="off" class="layui-input" value="${result.deptId}">
</div>
</div>
@ -68,7 +68,7 @@
</label>
<!--校验规则动态添加,根据鼠标焦点进行-->
<div class="layui-input-inline">
<input type="text" id="js-email" name="email" lay-verify="" autocomplete="off" class="layui-input" value="${user.email}">
<input type="text" id="js-email" name="email" lay-verify="" autocomplete="off" class="layui-input" value="${result.email}">
</div>
</div>
@ -77,7 +77,7 @@
<span class="we-red">*</span>手机号
</label>
<div class="layui-input-inline">
<input type="text" id="js-mobile" name="mobile" lay-verify="required|number" autocomplete="off" class="layui-input" value="${user.mobile}">
<input type="text" id="js-mobile" name="mobile" lay-verify="required|number" autocomplete="off" class="layui-input" value="${result.mobile}">
</div>
</div>
@ -86,16 +86,16 @@
固定电话
</label>
<div class="layui-input-inline">
<input type="text" id="js-tel" name="tel" lay-verify="" autocomplete="off" class="layui-input" value="${user.tel}">
<input type="text" id="js-tel" name="tel" lay-verify="" autocomplete="off" class="layui-input" value="${result.tel}">
</div>
</div>
<div class="layui-form-item">
<label for="js-sex" class="layui-form-label"><span class="we-red">*</span>性别</label>
<div class="layui-input-block" id="js-sex">
<input type="radio" name="sex" value="0" title="女" checked>
<input type="radio" name="sex" value="1" title="男">
<input type="radio" name="sex" value="2" title="其他">
<input type="radio" name="sex" value="0" title="女" <#if result.sex == "0" || !(result??)>checked</#if>>
<input type="radio" name="sex" value="1" title="男" <#if result.sex == "1">checked</#if>>
<input type="radio" name="sex" value="2" title="其他" <#if result.sex == "2">checked</#if>>
</div>
</div>
@ -104,7 +104,7 @@
出生年月日
</label>
<div class="layui-input-inline">
<input type="text" id="js-birthday" name="birthday" lay-verify="" autocomplete="off" class="layui-input" value="${user.birthday}">
<input type="text" id="js-birthday" name="birthday" lay-verify="" autocomplete="off" class="layui-input" value="${result.birthday}">
</div>
</div>
@ -113,7 +113,7 @@
图片id
</label>
<div class="layui-input-inline">
<input type="text" id="js-pic-id" name="picId" lay-verify="" autocomplete="off" class="layui-input" value="${user.picId}">
<input type="text" id="js-pic-id" name="picId" lay-verify="" autocomplete="off" class="layui-input" value="${result.picId}">
</div>
</div>
@ -122,7 +122,7 @@
身份证
</label>
<div class="layui-input-inline">
<input type="text" id="js-id-card" name="idCard" lay-verify="" autocomplete="off" class="layui-input" value="${user.idCard}">
<input type="text" id="js-id-card" name="idCard" lay-verify="" autocomplete="off" class="layui-input" value="${result.idCard}">
</div>
</div>
@ -131,7 +131,7 @@
爱好
</label>
<div class="layui-input-inline">
<input type="text" id="js-hobby" name="hobby" lay-verify="" autocomplete="off" class="layui-input" value="${user.hobby}">
<input type="text" id="js-hobby" name="hobby" lay-verify="" autocomplete="off" class="layui-input" value="${result.hobby}">
</div>
</div>
@ -140,7 +140,7 @@
省份
</label>
<div class="layui-input-inline">
<input type="text" id="js-province" name="province" lay-verify="" autocomplete="off" class="layui-input" value="${user.province}">
<input type="text" id="js-province" name="province" lay-verify="" autocomplete="off" class="layui-input" value="${result.province}">
</div>
</div>
@ -149,7 +149,7 @@
城市
</label>
<div class="layui-input-inline">
<input type="text" id="js-city" name="city" lay-verify="" autocomplete="off" class="layui-input" value="${user.city}">
<input type="text" id="js-city" name="city" lay-verify="" autocomplete="off" class="layui-input" value="${result.city}">
</div>
</div>
@ -158,7 +158,7 @@
区县
</label>
<div class="layui-input-inline">
<input type="text" id="js-district" name="district" lay-verify="" autocomplete="off" class="layui-input" value="${user.district}">
<input type="text" id="js-district" name="district" lay-verify="" autocomplete="off" class="layui-input" value="${result.district}">
</div>
</div>
@ -167,7 +167,7 @@
街道
</label>
<div class="layui-input-inline">
<input type="text" id="js-street" name="street" lay-verify="" autocomplete="off" class="layui-input" value="${user.street}">
<input type="text" id="js-street" name="street" lay-verify="" autocomplete="off" class="layui-input" value="${result.street}">
</div>
</div>
@ -176,7 +176,7 @@
门牌号
</label>
<div class="layui-input-inline">
<input type="text" id="js-street-number" name="streetNumber" lay-verify="" autocomplete="off" class="layui-input" value="${user.streetNumber}">
<input type="text" id="js-street-number" name="streetNumber" lay-verify="" autocomplete="off" class="layui-input" value="${result.streetNumber}">
</div>
</div>
@ -185,15 +185,15 @@
描述
</label>
<div class="layui-input-inline">
<input type="text" id="js-descr" name="descr" lay-verify="" autocomplete="off" class="layui-input" value="${user.descr}">
<input type="text" id="js-descr" name="descr" lay-verify="" autocomplete="off" class="layui-input" value="${result.descr}">
</div>
</div>
<div class="layui-form-item">
<label for="js-status" class="layui-form-label"><span class="we-red">*</span>状态</label>
<div class="layui-input-block" id="js-status">
<input type="radio" name="status" value="0" title="正常" checked>
<input type="radio" name="status" value="1" title="已删除">
<input type="radio" name="status" value="0" title="正常" <#if result.status == "0" || !(result??)>checked</#if>>
<input type="radio" name="status" value="1" title="已删除" <#if result.status == "1">checked</#if>>
</div>
</div>

View File

@ -10,16 +10,6 @@
<#include "${request.contextPath}/common/common.ftl">
</head>
<body>
<div class="weadmin-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">系统用户列表管理</a>
<a><cite>系统用户列表</cite></a>
</span>
<a class="layui-btn layui-btn-sm" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
<i class="layui-icon" style="line-height:30px">&#xe669;</i>
</a>
</div>
<div class="weadmin-body">
<div class="layui-row">
<form class="layui-form layui-col-md12 we-search" lay-filter="search-form-filter">