--- /dev/null
+package com.supwisdom.dlpay.system.controller;
+
+import com.supwisdom.dlpay.api.domain.TPerson;
+import com.supwisdom.dlpay.framework.util.PageResult;
+import com.supwisdom.dlpay.framework.util.WebConstant;
+import com.supwisdom.dlpay.system.bean.PersonParamBean;
+import com.supwisdom.dlpay.system.service.UserDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+public class UserController {
+ @Autowired
+ private UserDataService userDataService;
+
+
+ @GetMapping("/user/index")
+ public String sysparaView() {
+ return "system/user/index";
+ }
+ @GetMapping("/user/list")
+ @PreAuthorize("hasPermission('/user/list','')")
+ @ResponseBody
+ public PageResult<TPerson> getDataList(@RequestParam("page") Integer pageNo,
+ @RequestParam("limit") Integer pageSize,
+ @RequestParam(value = "searchkey", required = false) String searchKey) {
+ try {
+ if (null == pageNo || pageNo < 1) pageNo = WebConstant.PAGENO_DEFAULT;
+ if (null == pageSize || pageSize < 1) pageSize = WebConstant.PAGESIZE_DEFAULT;
+ PersonParamBean searchBean = new PersonParamBean();
+ searchBean.setPageNo(pageNo);
+ searchBean.setName(searchKey);
+ searchBean.setPageSize(pageSize);
+ return userDataService.getPersonsByKey(searchBean);
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new PageResult<>(99, "系统查询错误");
+ }
+ }
+}
--- /dev/null
+<div class="layui-card">
+ <div class="layui-card-header">
+ <h2 class="header-title">用户管理</h2>
+ <span class="layui-breadcrumb pull-right">
+ <a href="#">用户中心</a>
+ <a><cite>用户管理</cite></a>
+ </span>
+ </div>
+ <div class="layui-card-body">
+ <div class="layui-form toolbar">
+ 搜索:
+ <input id="search-value" class="layui-input search-input" type="text" placeholder="输入用户名称"/> 
+ <button id="btn-search" class="layui-btn icon-btn" data-type="search"><i class="layui-icon"></i>搜索
+ </button>
+ <button id="btn-add" class="layui-btn icon-btn" data-type="add"><i class="layui-icon"></i>添加用户</button>
+ </div>
+ <table class="layui-table" id="usertable" lay-filter="roletable"></table>
+ </div>
+</div>
+<script>
+ layui.use(['form', 'table', 'layer', 'admin', 'element'], function () {
+ let form = layui.form;
+ let table = layui.table;
+ let admin = layui.admin;
+ form.render('select');
+ // 渲染表格
+ table.render({
+ elem: '#usertable',
+ url: '/user/list',
+ page: true,
+ cols: [
+ [
+ {field: 'name', title: '名称', width: 160,fixed: 'left', sort: true},
+ {
+ field: 'sex', title: '性别', sort: true, width: 80, align: 'center', templet: function (item) {
+ if (item.sex == 'male') {
+ return '男'
+ } else if (item.sex == 'female') {
+ return '女'
+ } else {
+ return ''
+ }
+ }
+ },
+ {field: 'status', align: 'center', title: '状态', fixed: 'right', templet: function (item) {
+ let html = '';
+ if(item.status==='normal'){
+ html ='正常';
+ }else if(item.status=='closed'){
+ html ='注销';
+ }
+ return html;
+ }},
+ {
+ field: 'idtype', align: 'center', title: '证件类型', fixed: 'right', templet: function (item) {
+ if (item.idtype == '1') {
+ return '身份证'
+ } else if (item.idtype == '2') {
+ return '护照'
+ } else if (item.idtype == '3') {
+ return '驾照'
+ } else if (item.idtype == '4') {
+ return '港澳通行证'
+ } else if (item.idtype == '5') {
+ return '学工号'
+ } else {
+ return '其他'
+ }
+ }
+ },
+ {field: 'idno', title: '证件号', width: 160,fixed: 'left', sort: true},
+ {field: 'country', title: '国籍', width: 160,fixed: 'left', sort: true},
+ {field: 'nation', title: '民族', width: 160,fixed: 'left', sort: true},
+ {field: 'email', title: '邮箱', width: 160,fixed: 'left', sort: true},
+ {field: 'mobile', title: '手机', width: 160,fixed: 'left', sort: true},
+ {field: 'tel', title: '电话', width: 160,fixed: 'left', sort: true},
+ {field: 'addr', title: '地址', width: 160,fixed: 'left', sort: true},
+ {field: 'zipcode', title: '邮编', width: 160,fixed: 'left', sort: true},
+ {field: 'lastsaved', title: '最后修改时间', width: 160,fixed: 'left', sort: true},
+ {
+ field: 'userid', align: 'center', title: '操作', fixed: 'right', templet: function (item) {
+ let html = ' <a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a> ';
+ if(item.editflag===1){
+ html +='<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>';
+ }
+ return html;
+ }
+ },
+ ]
+ ]
+ });
+ // 搜索按钮点击事件
+ $('#btn-search').click(function () {
+ let key = $('#search-value').val();
+ table.reload('roletable', {where: {searchkey: key}, page: {curr: 1}});
+ });
+ $('#btn-add').click(function () {
+ showModel();
+ });
+ let showModel = function (data) {
+ let title = data ? '编辑角色' : '添加角色';
+ admin.putTempData('t_func', data);
+ admin.popupCenter({
+ title: title,
+ path: '/role/loadadd',
+ finish: function () {
+ table.reload('roletable', {});
+ }
+ });
+ };
+ let showFuncModel = function (data) {
+ let title = '分配功能';
+ admin.putTempData('roleId', data.roleId);
+ admin.popupCenter({
+ title: title,
+ path: '/role/loadfunc'
+ });
+ };
+ // 工具条点击事件
+ table.on('tool(roletable)', function (obj) {
+ let data = obj.data;
+ let layEvent = obj.event;
+ console.log(data);
+ if (layEvent === 'edit') {
+ showModel(data);
+ } else if (layEvent === 'addfunc') {
+ showFuncModel(data);
+ } else if (layEvent === 'del') {
+ showDelete(data);
+ }
+ });
+ let showDelete = function (data) {
+ layer.confirm('用户分配的该角色都将被删除,确定删除吗?', function (i) {
+ layer.close(i);
+ layer.load(2);
+ let token = $("meta[name='_csrf_token']").attr("value");
+ admin.go('/role/del', {
+ roleid: data.roleId,
+ _csrf: token
+ }, function (data) {
+ console.log(data.code);
+ layer.closeAll('loading');
+ if (data.code == 200) {
+ layer.msg(data.msg, {icon: 1});
+ } else if (data.code == 401) {
+ layer.msg(data.msg, {icon: 2, time: 1500}, function () {
+ location.replace('/login');
+ }, 1000);
+ return;
+ } else {
+ layer.msg(data.msg, {icon: 2});
+ }
+ table.reload('roletable', {});
+ }, function (ret) {
+ console.log(ret);
+ layer.closeAll('loading');
+ layer.msg('请求失败了,请稍后再试', {icon: 2});
+ });
+ });
+ }
+ });
+</script>
\ No newline at end of file